Bad performance for browsers
See original GitHub issueI have found that performance is terribly slow for browsers. But that’s the case at least if you use windows. Tested right on the face-api site example : https://justadudewhohacks.github.io/face-api.js/face_recognition . I tested it on several different windows machines. It takes roughly 25 seconds to recognise faces. https://user-images.githubusercontent.com/30739218/101359816-b224bf00-3894-11eb-801a-31e1c3bbfe4a.gif
On linux it works quite alright, taking 3 seconds with the example above. However there is one caveat. It works alright on chrome at this moment. For firefox there is a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1678652 https://bugzilla.mozilla.org/show_bug.cgi?id=1679671
In short, for firefox v83, there was a fix applied to how failIfMajorPerformanceCaveat
property works. Now if a library uses failIfMajorPerformanceCaveat: true
then webgl context creation fails and the library falls back to CPU, which is rather slow.
However, that’s true for linux only for now. On windows it still uses webgl, and still rather slow (20-30 seconds) for any browser.
I am not sure if that’s the issue of face-api.js or tensorflow itself
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12
Top GitHub Comments
i’m not sure i understand as this example is not complete. is
analyzeVideo
async function? if yes, then you have race scenario that is reduced a bit by having a delay between frames.why not put a promise in
analyzeVideo
and then do something like:or easier to read with async/await
that way loop will run as fast as possible and there is no race.
face-api.js includes bundled tfjs-core.
If you don’t even look at the code, look at sizes - face-api on its own is ~200kb, remaining ~600kb is tfjs-core.