When the person detector is operated with the combination of OpenCV + Python, The processing speed is much slower than expected from the clock speed I felt it with Raspberry Pi B +. Make a note of the reason.
hog=cv2.HOGDescriptor() hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) hogParams = {'winStride': (8, 8), 'padding': (32, 32), 'scale': 1.05} human, r = hog.detectMultiScale(im, **hogParams)
A method called detectMultiScale () is used by multiple threads on Intel's multi-core CPUs. That's why ARM's single-core Raspberry Pi B + doesn't work with multiple threads.
If you look at the description of hog.cpp in the actual module, you can see that the detection processing is performed in parallel for each image size as shown below.
void HOGDescriptor::detectMultiScale(
const Mat& img, vector
In fact, in Windows Task Manager, Performance Looking at the operating status of each core in At the time of detectMultiScale (), you can see that multiple cores are working. On the other hand, detect () does not do that.
This is the same for C ++ and Python.
Since it is implemented using Intel Threading Building Blocks (TBB) RaspberryPi2 quad core, unless you have another multithreaded implementation It seems that the benefits of quad core will not be enjoyed.
Postscript: cv::parallel_for_ Please refer to the added reference material on how to use. cv::parallel_for_ Seems to manage threads in another framework in environments where Intel TBB is not available. In TBB, it is said that the creation and termination of threads are not explicitly described.
Postscript: Parallel processing by OpenCV TBB It describes how to install TBB and changes during CMake of OpenCV.
Threading Building Blocks It is essential to CMake after getting.
OpenCV memorandum I built OpenCV 2.4.11 with Raspberry Pi 2 [Building OpenCV 2.4.10 on Raspberry Pi 2] (http://iwaki2009.blogspot.jp/2015/02/raspberry-pi-2-opencv-2410.html) According to the Raspberry Pi 2, you can install TBB from source. The latter article describes the settings for CMake.
** References ** "Parallelization and speeding up of processing by TBB" http://opencv.jp/opencv2-x-tips/opencv_performance_with_tbb
"Try using cv :: parallel_for_" https://github.com/atinfinity/lab/wiki/cv :: parallel_for_% E3% 82% 92% E4% BD% BF% E3% 81% A3% E3% 81% A6% E3% 81% BF% E3% 82% 8B
Recommended Posts