I trained different types of mobilenet v2 models using Tensorflow object detection API, then converted them to tfjs and ran them in the web. It seems that the execution of these models only supports the executeAsync() method. I feel like being able to use the execute() method will speed up the inference time which now is ~100ms. However, when I try the execute() method, I get errors regarding some dynamic ops. Since I prefer speed over accuracy, is there anything that I can do in order to speed up the inference time? Alternatively, are there other recommended object detection models that will run in real-time on the web? Or anything else that I should try?
Asked
Active
Viewed 526 times
0
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 15 '21 at 10:48
1 Answers
0
why would execute
by faster than executeAsync
? there is minimal time wasted by overhead of async functions, you'd gain in order of 0.1-0.3ms at best
better question is which tfjs backend are you using?
cpu
is slowest, wasm
is fast to start, but overall still uses cpu and webgl
is slow to warmup (since it has to compile glsl functions and upload weights as shaders), but has overall fastest inference when gpu is available
do keep in mind that while mobilenetv2 is a lightweight model, it is quite old and performance is not the same as the latest lightweight sota models
for fast and lightweight object detection, my favorite is mobilenet v3 head combined with centernet

Vladimir Mandic
- 813
- 5
- 11
-
Thanks for answering. I am using webgl as a backend. Where can I find this mobilenet v3 - CenterNet model in order to train it? Thanks again! – user15840394 Sep 10 '21 at 17:11
-
-
Another quick question - what is roughly the inference time (using tfjs) for a frame with the centernet-mobilenet v3 (assuming a standard laptop)? – user15840394 Sep 13 '21 at 21:18
-
~10 FPS on average GPU like nVidia 1650. More with external optimizations to detect if frame has sufficiently changed or can be skipped. – Vladimir Mandic Sep 14 '21 at 22:48