uscauv-legacy / old-uscauv-ros-pkg

ROS software used on robots made by the USC AUV Team.
4 stars 6 forks source link

Speed up OpenCV SVM Predict #17

Open canondetortugas opened 11 years ago

canondetortugas commented 11 years ago

The SVM predict function from OpenCV's ml module, which we use to classify color images, is very slow. With radial basis functions, in the simplest case where we only use two support vectors, the function takes around 500ms to classify a full 640x480 image. Since each pixel is computed independently, it would be trivial to parallelize this operation if we had a GPU. According to the OpenCV docs, the function is parallelized with the Intel TBB library. We should see if we are currently compiling with this option or figure out how to do so if we aren't. Also, since the shapes we are trying to detect are very primitive, we could get away with downsampling the images before we classify them. Even a scaling them by 1/2 would speed things up significantly.

canondetortugas commented 11 years ago

Also, maybe we should just not use the OpenCV SVM library. We could give libSVM a shot or just not use SVMs at all, since it seems like the SVM approach tends to simplify to segmenting off part of the hue spectrum.

canondetortugas commented 11 years ago

http://opencv.willowgarage.com/wiki/InstallGuide

We should try passing WITH_TBB=ON to CMake as per item 2 on this page.