question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TinyYolov2 - load model before inference

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

3reactions
flatsiedatsiecommented, May 12, 2020

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.

1reaction
buraksekilicommented, Jul 12, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't Load Models for face-api.js despite infereing the models
I'm getting the error "SsdMobilenetv1 - load model before inference" I'm sending the Front End HTML File from the server. and on the...
Read more >
Uncaught (in promise) Error: TinyYolov2 - load model before ...
Uncaught (in promise) Error: TinyYolov2 - load model before inference. i have java script called script.js. Copy Code const video = document.
Read more >
Face Recognition using face-api.js / Jirapol Songvuti
Enter index of drawed face 1,2,3,... RuntimeError: FaceDetectionNet - load model before inference. fullFaceDescriptions2 = Error: FaceDetectionNet - load model ...
Read more >
[Solved] Faceapi-js cannot load models - CodeProject
The site you are trying to load the scripts from is not configured to allow your site to load the scripts.
Read more >
Can't Load Models For Faceapi.Js Despite Infereing The Models
Uncaught in promise Error: TinyYolov2 load model before inference.i have java script called script.js const video document. Tensors are multidimensional arrays ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found