ermig1979 / Simd

C++ image processing and machine learning library with using of SIMD: SSE, AVX, AVX-512, AMX for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
http://ermig1979.github.io/Simd
MIT License
2.04k stars 407 forks source link

FaceDetection #24

Closed sunjunlishi closed 6 years ago

sunjunlishi commented 6 years ago

1 hello author,I test your FaceDetection example 640*480 image,i use your xml,speed is 6-8ms; detection.Init(image.Size(), 1.16, cv::Size(60,60),cv::Size(450,450)); i use my xml ,speed is 1-2ms; your work is great,perfect. 2 But, I test my plate detect detection.Init(image.Size(), 1.16, cv::Size(60,60),cv::Size(450,450)); speed is 1-2ms and detection.Init(image.Size(), 1.16, cv::Size(80,20),cv::Size(520,130)); speed is 16-20ms so i think that Your algorithm is faster for squares, but rectangles don't support it very well

ermig1979 commented 6 years ago

Hello. Could you give me size of scan window of cascade that you use to.

sunjunlishi commented 6 years ago

my train isSize(64,16) ,is it? Scan window cv::Size(80,20) to cv::Size(520,130));

szad670401 commented 6 years ago

It is exactly that the square window is very fast such as 5050 。but i use it for some detection such as for pedestrian or license plate , which windows size is not square (e.g 6416 )is not so fast。

ermig1979 commented 6 years ago

If you use minimal size = cv::Size(60,60) and cascade window size = cv::Size(20,20) then the algorithm can reduce input image in 3 times (from 640x480 to 213x160) and process this small image. In second case the algorithm can reduce image only 1.25 times (relation between minimal size cv::Size(80,20) and cascade window size cv::Size(64,16)). So the algorithm need to process image of 512x384. The relation of areas (512x384)/(213x160) = 5.7. So it is not surprising that second case is slow.

P.S. OpenCV algorithm has the same behavior.

sunjunlishi commented 6 years ago

oh i see,the training size(20,20) and my training Size(64,16) is important. is it? it added the minimum scan size to determine the processing speed .thank you very much,and to trouble you

ermig1979 commented 6 years ago

The algorithm builds pyramid of scaled images with step which is setted by paramemter scaleFactor. Algorithm can skip the level, if window size is lesser or greater then minimal or maximal searched size (scaled to corresponding level). The main time is used to process low levels of the pyramid. So the parameter of minimal object size, cacade window size and scaleFactor have predominant influence to performance of the algorithm.

sunjunlishi commented 6 years ago

oh ,ye scaleFactor 1.2; I understand thoroughly that the road far away is far away . thanks very much.

sunjunlishi commented 6 years ago

Both rectangular and square, the speed is 2-3 times higher than the opencv ,your are great.