I am getting this error in production build in React Js and working fine when use npm start.
import * as faceapi from 'face-api.js'
export async function loadModels() {
const MODEL_URL = process.env.PUBLIC_URL + '/models'
await faceapi.loadTinyFaceDetectorModel(MODEL_URL)
await faceapi.loadFaceLandmarkTinyModel(MODEL_URL)
await faceapi.loadFaceRecognitionModel(MODEL_URL)
}
export async function getFullFaceDescription(blob, inputSize = 512) {
const scoreThreshold = 0.5
const OPTION = new faceapi.TinyFaceDetectorOptions({
inputSize,
scoreThreshold
})
const useTinyModel = true
const img = await faceapi.fetchImage(blob)
const fullDesc = await faceapi
.detectAllFaces(img, OPTION)
.withFaceLandmarks(useTinyModel)
.withFaceDescriptors()
}
Please help me on this.
I saw the same error in a situation where I wasn't even using the Yolo model, which was confusing.
In the end it was because I had made a coding error, and the models I did want to use weren't actually loaded. Perhaps there is something in the FaceApiJs code where it throws a wrong error for a missing model, and ends up outputting the last name in the list of nets.
Hi @swapanil ,
I am faced with same issue. We have same code block. Have you solve your problem?
Hey @swapanil ,
FYI, I solved my problem. I couldn't load models correctly. Can u check your models location? It should be under the public folder as follows; public/models
I made it sure my all models are loading correctly infact my TinyYolov2 json and shard file loading correctly but still it showing me same issue, I replace it with SsdMobilenetv1Options it is working for now. I think this should be a bug.
I added this and issue resolved
faceapi.nets.tinyFaceDetector.loadFromUri(this.MODEL_URL),
Most helpful comment
I saw the same error in a situation where I wasn't even using the Yolo model, which was confusing.
In the end it was because I had made a coding error, and the models I did want to use weren't actually loaded. Perhaps there is something in the FaceApiJs code where it throws a wrong error for a missing model, and ends up outputting the last name in the list of nets.