OpenCV Object Tracker Performance (TBB vs. pthreads)
Hey Everyone,
I'm using OpenCV 3.3.0 on an Ubuntu 16.04 VM that I've allocated 8 "cpus" to. My application is tracking an object and interestingly, when I compile opencv with the TBB option set from CMake, the performance is significantly faster than pthreads. With TBB, the application requires 23 seconds to run, compared to 40.5 seconds when using pthreads. When I wrap the tracker->update function with time reads, it's nearly twice as slow when using pthreads. The only heavyweight operation in this application is the tracker updating, and I'm currently using the MIL tracker. Does anyone have any ideas? To me, this seems like a bug in OpenCV.
A lot depends on the data and chunk sizes, the operation performed, the type of threading, and the overhead to set up, coordinate and tear down the multiple threads.
I don't follow. Maybe I don't understand TBB well enough, but I don't see why the size of the data would affect the performance between TBB and pthreads. I also haven't found anything online about their being more overhead with pthreads than TBB, and I would be very surprised if this was the case since TBB is a higher level abstraction than pthreads. And as to the type of threading, that's the main point of my question. Can you explain further?
Can you share specific example code and image data illustrating your problem? Otherwise it's hard to speculate.