naisy / realtime_object_detection

Plug and Play Real-Time Object Detection App with Tensorflow and OpenCV. No Bugs No Worries. Enjoy!
MIT License
101 stars 36 forks source link

240ms Latency? Any suggestions? #65

Open scbean opened 5 years ago

scbean commented 5 years ago

I am hoping you have a suggestion to reduce the latency. I am getting around 240ms using a webcam or onboard camera with both the Xavier and TX2. Just displaying the webcam I get about 60ms.

It looks like the program is taking about 130ms so 134 (program)+60(V4L2 Driver?)+37(time per frame)=231 so definitely close. I am just hoping you have some suggestions to get that number lower.

img_20190220_003319

naisy commented 5 years ago

Hi @scbean,

Please set vis_worker: False in your config.yml file.

visualize: True
vis_worker: False

vis_worker is prepared for high-performance GPU like desktop GPU. When vis_worker: True, the rendering process is separated by multiprocessing, so interprocess communication of image data is performed. Interprocess communication will degrade performance.

In high-performance GPU, the visualization is a bottleneck. The detection speed greatly varies with visualize: True or False. (60 FPS or 200 FPS). Visualization is for people to check and 30 FPS is enough. vis_worker: True and max_vis_fps: 30 exists for this purpose.

vis_worker: False and max_vis_fps: 0 has better performance until visualization becomes a bottleneck.

You can also limit visualization by vis_worker: False andmax_vis_fps: 30. This is a limitation of visualization with singleprocessing. But this may not be very beneficial.

scbean commented 5 years ago

Unfortunately, they are already set to vis_worker: False visualizer: True

and if I change the max_vis_FPS to 30 (instead of 0) it gives me a L4V pixal format error. This is all on the tx2

naisy commented 5 years ago

Hi @scbean,

Can you check the following?

  1. Set realtime_object_detection's input to movie and visualization: False. And run your delay test program.
  2. Run glmark2(this is gpu stress test) and run your delay test program. about glmark2: https://www.pcsuggest.com/gpu-benchmarking-and-stress-testing-in-linux/

How about each delay?