justadudewhohacks / face-api.js

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js
MIT License
16.69k stars 3.71k forks source link

Tiny face detection not working in example or locally #594

Open craigspaeth opened 4 years ago

craigspaeth commented 4 years ago

I was struggling to get the tiny face detector model to work locally on the same images that are working in the live demo for face and landmark detection—it would always return an empty array for detections. So I followed the README to clone and run the examples locally and I noticed they aren't working there either.

Is it possible the live-hosted version is behind the latest version in this repository and the latest version introduced a breaking change to the tiny face detector model? I noticed the demo web app looks significantly different with new examples as well.

cap

craigspaeth commented 4 years ago

FWIW It looks like it was a change after 0.21.0 that broke this code...

await faceapi.nets.tinyFaceDetector.loadFromUri('/static')
const input = document.getElementById('myImg')
const detection = await faceapi.detectSingleFace(
  input,
  new faceapi.TinyFaceDetectorOptions()
)
console.log(detection) // undefined in version 0.22.0 and above 
teganscott commented 4 years ago

Thank you @craigspaeth for the bug hunt! I was having the same issue and checking out version 0.21 did the trick.

developer1-scm commented 4 years ago

Version 0.21 still undefined in ios 12.4 with ionic. Working Fine in Android.