justadudewhohacks / face-api.js

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

The face bounding box remains while there is no face anymore #276

Open vik-timmersion opened 5 years ago

vik-timmersion commented 5 years ago

I tried Browser Examples for web face detection. The face bounding box remains while there is no face anymore. image

It draws the previous detection.

justadudewhohacks commented 5 years ago

That's because the canvas is not cleared due to the early return statement in the main loop of the examples. You can simply clear the canvas by updating it's dimensions like: canvas.width = width