Forum

OpenCV YoloDetector Async

I’m wondering what would be the most performant way possible to call a Yolo Label Detection on a VideoStream. My video image only changes from time to time, so at the moment I’m having a threshold for changes in the red channel to detect if the video image has changed in any way. I use this to trigger the AsyncLoop running the YoloDetection, but don’t know if that is a good approach. Generally I do not have to call the YoloDetection all the time or every frame, but several times in a row if there is heavy movement in the video image or not at all if the video image is not changing. Do you guys have some ideas for improving the performance in this scenario? Or generally another approach to calculate the YoloDetection async without major framedrops in the main loop, when triggering the async loop (because that is what I’m experiencing at the moment).

Thanks for your help :)

Screenshot 2021-05-27 115450

Just a little addition:
What’s also really expensive at the moment is simply drawing the rectangles.
I’m also using Stride to render something inexpensive inside the same patch, could this be the cause of additional performance problems: Rendering a simple 3d scene with Stride and a debug window with OpenCv Renderer inside the same patch?

Screenshot 2021-05-27 123907

When it only needs to run once per trigger, maybe use AsyncTask instead. Try to prevent triggers to happen in short succession, by using a monoflop for example.

Also check out: VL.Yolo.GPU
The prerequisites are a bit of a pita but it performs much better.