8
$\begingroup$

I'm using a HOG descriptor, coupled with a SVM classifier, to recognise humans in pictures. I'm using the Python wrappers for OpenCV. I've used the excellent tutorial at pymagesearch, which explains what the algorithm does and furnishes hints on how to set the parameters of the detectMultiScale method.

Specifically, I do

# initialize the HOG descriptor
hog = cv2.HOGDescriptor()

# Set the support vector machine to be pre-trained for people detection
hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())

# Detect people in the image
(rects, weights) = hog.detectMultiScale(image,
                                        winStride=(4, 4),
                                        padding=(8, 8),
                                        scale=1.05)

The parameters are chosen according to a fine tuning on both accuracy and performance, following the explanations in the tutorial itself.

My problem is that this method, which seems like the currently best method to recognise humans in a picture according to literature (the original paper is dated 2005) seems to perform pretty poorly on my images. I have images containing clothes, both with a model and without it and I'm trying this approach to recognise those with the model. On a subset of 300 images which I manually scanned to tag them for containing the model or not, the method fails 30% of the times.

These are some images as examples.

Here it detected a missing human:

Here it did not get the full human:

Here it did not recognise it at all:

I understand that the detector works for upright humans. Should they also be full-figure? My images encompass half-figure, figures with no head or no feet.

Before this, I have tried a Haar-feature based cascade classifier to recognise the face in an image and the accuracy on the same set of image has been 90%, so I was trying to improve on this. Also, I'm interested in understanding why things are not working here.

$\endgroup$
5
$\begingroup$

You are using the training set that opencv is giving you which it doesn't correspond to the kind of images you are using. The data you are using comes from getDefaultPeopleDetector and the kind of images that the default detector uses are pictures of many people, not a female model from a fashion ecommerce.

If you want to distinguish between models and garments you can try to train your own classifier with HOG or other features.

Another path you can take is to detect if there is a face or not. You could use haar cascades for that.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Yes, I got this. In fact, haar cascades performs better. But I still wanted to know exactly why hog descriptors fail miserably on my images, is it because the human is not completely included in the picture? $\endgroup$ – martina Dec 25 '15 at 12:18
  • 1
    $\begingroup$ The reason is the one I gave you. The default classifier you are using takes images that are nothing like the ones you are using $\endgroup$ – hoaphumanoid Dec 25 '15 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.