-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Model:body-segmentation browser freezes for ~7-9 seconds in initial run #7026
Comments
The first detection is slow since the backend are caching the shader programs, the prediction after the first one should much faster and stable, for example after the model is loaded, you can run a warming up step, to feed the model prediction call with all zero tensor. tf.zeros([tensorShape]). |
Thank you Jiajia for redirecting the solution! @Exlord for your case, you could use tf.env().set('ENGINE_COMPILE_ONLY', true);
bodySegmenter.segmentPeople(video);
tf.backend().checkCompileCompletion();
tf.backend().getUniformLocations();
tf.env().set('ENGINE_COMPILE_ONLY', false); If it still does not work, I could help you tell a look at your codes. |
Tanks everyone , It worked like a charm. |
For WebGL backend, it's |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you. |
Closing as stale. Please @mention us if this needs more attention. |
Hi Again, This is my current code :
|
Could you provide the codes to reproduce the error? @Exlord |
Hi @Linchenn sorry for the late response, this project was put on hold for a while, now I am working on it again. If I don't use this code it works but with a huge initial loading time. |
Hi, I am not sure if this is a bug so am posting it here.
This line take ~7-9 seconds to run and freezes the browser when running for the first time, then it just takes ~100ms.
bodySegmenter.segmentPeople(video);
video
is aHTMLVideoElement
Running on chrome 107 with webgl backend.
The
tf
andbackend
and thesegmenter
has already loaded and is ready before running this.Any points or ideas ?
The text was updated successfully, but these errors were encountered: