Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV_traincascade giving a lot of false positives

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!

OpenCV_traincascade giving a lot of false positives

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; 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!