Uncaught Reference Error: faceapi is not defined

Uncaught Reference Error: faceapi is not defined

我目前在 javascript 中遇到 faceapi 的一些问题,faceapi 是用于检测您的面部的代码,请帮我解决这个错误。

代码:

const video = document.getElementById('video')

Promise.all([
    faceapi.nets.tinyFaceDetector.loadFromUri('/models'),
    faceapi.nets.faceLandmark68Net.loadFromUri('/models'),
    faceapi.nets.faceRecognitionNet.loadFromUri('/models'),
    faceapi.nets.faceExpressionNet.loadFromUri('/models')
  ]).then(startVideo)

function startVideo() {
    navigator.getUserMedia(
        { video: {} },
        stream => video.srcObject = stream,
        err => console.error(err)
    )
}

startVideo()

在您的代码中定义 faceapi

var faceapi = "url or path to library"