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.01k stars 407 forks source link

InitLevels in SimdDetection seems inefficient #261

Closed TonyCongqianWang closed 7 months ago

TonyCongqianWang commented 7 months ago

Hello, I have noticed, that it is significantly slower to set minSize in Detection init, instead of resizing the image before calling detect on it. I think that shouldn't be the case. I have identified InitLevels as the possible culplrit. At the first level, one could directly resize the image to a size, that makes the level window size equal (or and eps smaller) than the specified minSize. Instead Resize is called multiple times with the giving scalefactor (default 1.1) until the window is large enough. When the minSize is significantly larger than the cascades window size, like 5 times in my case, there are many wasted resize operations so it seems. Am I missing something? Are there actually some optimizations that make the current algorithm faster than I thought or more accurate?

TonyCongqianWang commented 7 months ago

It seems I have made a mistake when benchmarking and I have noticed, that initlevels only resizes the image after finding the correct scaling, thus it is already optimized