Ask Your Question
1

OpenCV_traincascade giving a lot of false positives

asked 2013-05-01 16:31:34 -0600

lee7ster gravatar image

updated 2013-05-01 16:32:03 -0600

I am currently trying to use openCV's haartraining and traincascade to recognize babies in a box (or even babies) in a maze. For some reason I am getting a lot of false positives in the negatives (pictures of the maze without babies/box).

I have tried the following;

1) 1000 + positives images, 500+ negative images and use it as a batch.

2) give 1 cropped image with black background (bgcolor 0, bgtresh > 0) for transparent background, then ask OpenCV haartraining to apply transformations, 500 positive, 500 negative. The command I used to create the transformations was; -img IMG01.jpg -num 500 -bg negatives.dat -vec samples.vec -maxxangle 0.6 -maxzangle 0.3 -maxidev 30 -bgcolor 0 -bgthresh 10 -w 26 -h 22

3) I cropped 500 images of just the baby at different angles from the positive samples, but I think this approach may be flawed. It was just an alternative I tried since documentation was just a bit ambiguous.

Given a sample vector file, which I looked at to make sure was good using command -vec samples.vec, I used the following command to compile the xml file, which took a few hours on average! ... -data cascade -vec samples.vec -bg negatives.dat -numPos 500 (or 1000 for manual positive pictures I took) -numNeg 533 -numStages 20 -featureType LBP -w 26 -h 22 -minHitRate 0.999 -maxfalsealarm 0.5 -precalcValBufSize 2048 -precalcIdxBufSize 2048

I make sure the files give out reasonable sizes and the training takes a few hours, so I think it is set up correctly but is learning incorrectly somhow!

all images pre-processing was 352x288

It is weird that both trainings, and various others, resulted in a lot of false positives. Discussion with my professor lead us to believe it was for some reason recognizing lines as positives (which would explain why it is giving false positives).

Here are some samples of my positives;



Here are some samples of my negatives;

Image Hosted by ImageShack.us
Image Hosted by ImageShack.us

Here is the one picture that I used to transform:

Image Hosted by ImageShack.us

I will continue to work towards getting the false positives to not recognize, but any help or suggestions from more experienced OpenCV users would be greatly appreciated! I am also just copy-pasting the xml into the android face-recognition sample and running it on my android phone if anything could possibly get broken on that end too!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-05-11 12:38:40 -0600

I will answer in this topic, but it holds for the one you referred me from also. Looking at what you are doing, is training a baby in a box as object, not a baby itself. Your object area should only contain the actual baby doll, and the box (empty) should be used as a negative.

edit flag offensive delete link more
-2

answered 2013-05-16 05:50:48 -0600

vinayverma gravatar image

updated 2013-05-16 05:53:33 -0600

I think detecting the box would be much simple (for both cases: empty/with-baby). Once you are able to detect the box, you can apply HaarTraining's sample cascade classifier of faces, to the detection Rect of the box. Additionally you can specify max size limit to the face detection to make it more accurate (for dolls/baby's face).

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-05-01 16:31:34 -0600

Seen: 2,536 times

Last updated: May 16 '13