Skip to content

Issue with using detections within a loop for drawing detection results on canvas (flicker) #143

Answered by vladmandic
mantzaris asked this question in Q&A
Discussion options

You must be logged in to vote

you've provided no details on your system, browser and backend - and those heavily matter.

but in general, studder is expected since tfjs model execution is a blocking call.
what you can do is have dual loops:

  • first that stores results in a global object and calls itself with `setTimeout(xxx, 0)
  • second that simply draws whatever is available in the global object and runs with requestAnimationFrame

unfortunately, faceapi does not support running in web workers since it heavily relies on dom.
if you want, you can try out my far newer library (faceapi internal architecture is quite old) which does support webworkers
https://github.com/vladmandic/human

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mantzaris
Comment options

Answer selected by mantzaris
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants