OpenCV Object Tracker Performance (TBB vs. pthreads)

asked 2017-10-16 13:11:25 -0600

furlongmt gravatar image

updated 2017-10-16 14:45:38 -0600

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.

edit retag flag offensive close merge delete

Comments

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.

opalmirror gravatar imageopalmirror ( 2017-10-16 14:50:12 -0600 )edit

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?

furlongmt gravatar imagefurlongmt ( 2017-10-16 14:55:13 -0600 )edit

Can you share specific example code and image data illustrating your problem? Otherwise it's hard to speculate.

opalmirror gravatar imageopalmirror ( 2017-10-16 15:14:03 -0600 )edit