Ask Your Question
2

DaimlerPeopleDetector with smaller images

asked 2014-04-29 02:49:52 -0500

tfjgeorge gravatar image

updated 2014-04-29 04:45:25 -0500

Hi,

Is it possible to get the HOG DaimlerPeopleDetector work with smaller images? I am just upscaling the image before passing it to detectMultiScale. The idea behind that is that the gradients look roughly the same even with some upscaling?

Edit: I can't make it work with sample images like the ones below, even with a hit threshold as low as 0.1...

example 1 example 2

Some code:

vector<float> detector;
detector = HOGDescriptor::getDaimlerPeopleDetector();
Size win_size(48, 96);

HOGDescriptor cpu_hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1,
        HOGDescriptor::L2Hys, 0.2, false, HOGDescriptor::DEFAULT_NLEVELS);

cpu_hog.setSVMDetector(detector);


Mat image_resized;
vector<Rect> found;
double hit_threshold = 0.1;
double scale = 1.01;
int gr_threshold = 8;
double factor = 120./image.size[0];
Size new_size(round(image.size[1]*factor), 120);

Size win_stride(8, 8);
resize(image, image_resized, new_size, 0.0, 0.0, INTER_LINEAR);
cpu_hog.detectMultiScale(image_resized, found, hit_threshold, win_stride,
                                          Size(0, 0), scale, gr_threshold);

if (found.size() > 0)
    cout << "found new person" << endl;

Thanks for any help

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-04-29 04:01:27 -0500

Basically the model size is the limiting factor of all model based detectors. Upscalig is indeed the way to go, however, larger upscales create artefacts that influence the feature creation process, which introduce a lot of false positive detections.

So you are correct, or is there another question that I just didn't see?

edit flag offensive delete link more

Comments

I can't make it work... I edited the question to add sample images

tfjgeorge gravatar imagetfjgeorge ( 2014-04-29 04:48:10 -0500 )edit
1

after upscaling I think you will need to smooth! The pixelation will ruin your descriptors, like I said before. I do it all the time upscaling x2 and then smoothing for the artefacts. Detector still runs fine then.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 04:57:16 -0500 )edit

I used a Gaussian Blur with kernel of size 3, 5, 7, but still no hit... Are you using another smoothing method ?

tfjgeorge gravatar imagetfjgeorge ( 2014-04-29 06:36:24 -0500 )edit
1

Nope ... it could be that you are just not having enough information anymore and that the smoothing really destroys the feature set. The Daimler model is already a very small model .... I think you are reaching the limitations.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-29 06:47:32 -0500 )edit
1

all right the problem came from some other implementation mistake, blurring the image did the trick, thanks!

tfjgeorge gravatar imagetfjgeorge ( 2014-04-29 11:00:38 -0500 )edit

You are welcome! Do keep in mind that creating huge upscalings won't benefit your system ;) keep them limited :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-30 04:55:19 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-04-29 02:49:52 -0500

Seen: 872 times

Last updated: Apr 29 '14