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

Calculated Scales for ACF-Pyramid are wrong #62

Closed JN-Jones closed 6 years ago

JN-Jones commented 6 years ago

I noticed earlier that calculating the pyramid with the same parameters on the same image returns a different number of scales when using this library and when using the original matlab code. After some debugging I found that d0 and d1 are apparently the opposite of what they are in the original code:

My image is 500px in width and 375px in height, the original code is if(sz(1)<sz(2)), d0=sz(1); d1=sz(2); else d0=sz(2); d1=sz(1); end with sz = [375 500] which results in d0 = 375; d1 = 500 (or in general: d0 is the smaller dimension and d1 the larger).

However the code here is:

double d0 = sz.height, d1 = sz.width;
if (sz.height < sz.width)
{
    std::swap(d0, d1);
}

Which results in the d0/d1 swapping only happening when d0 is already the smaller value. In my case d0 = 500 and d1 = 375.

This resulted in 34 instead of 33 scales. Simply changing that if in a way that d0 is always the smaller value fixed the issue (either by changing the initialization or by using >=).

headupinclouds commented 6 years ago

Thanks again: https://github.com/elucideye/acf/pull/63

headupinclouds commented 6 years ago

merged