elucideye / acf

Aggregated Channel Feature object detection in C++ and OpenGL ES 2.0 based on https://github.com/pdollar/toolbox
BSD 3-Clause "New" or "Revised" License
49 stars 20 forks source link

orientation histograms are incorrect #42

Closed headupinclouds closed 6 years ago

headupinclouds commented 6 years ago

At some point a bug was introduced in the SSE code that causes the orientation histograms to be incorrect.

This line shouldn't be there: https://github.com/elucideye/acf/blob/bb61c100efaed44861e4284f716e516f4090b622/src/lib/acf/toolbox/gradientMex.cpp#L223

I will follow up with a fix and regression test shortly.

headupinclouds commented 6 years ago

After removing this line I did see both -0.0 values and NaN values in OS X testing. Both the -0.0 and NaN values would map to an out of range integer value during float -> int rounding in the lookup table.

For now I've replaced this with a simple clamp MAX_sse(MIN_sse(_Gx[y], upper), lower) so the pyramid look right and the errors are handled:

            if (O)
            {
                _Gx[y] = MUL(MUL(_Gx[y], _m), SET(acMult));
                _Gx[y] = XOR(_Gx[y], AND(_Gy[y], SET(-0.f)));
                _Gx[y] = MAX_sse(MIN_sse(_Gx[y], upper), lower); // prevent: NaN, -0.0
            }

PR #43 in the queue ...

headupinclouds commented 6 years ago

Merged