Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

correct parameters for createsamples and traincascade wegawrgawgawgawgbaw

I am currently using opencv_createsamples and opencv_traincascade to create an xml file and run it on the android platform (using opencv-facedetection sample)

I just wanted to make sure I was using the right image sizes and parameters etc;

1) For createsamples I have a positive image of a baby with a black background called "IMG1.png"

I have another file called bg.dat that holds paths like img2/file1.jpg, im2/file2.jpg, etc The background jpg's are all 352x288

IMG1.png is an image of size 2400 1500, about which 90% w/h is the baby and the rest is a black Background.

I then call the command; -img IMG1.png -num 1000 -bg bg.dat -vec samples.vec -maxxangle 0.6 -maxzangle 0.3 -maxidev 30 -bgcolor 0 -bgthresh 10 -w 26 -h 22

to create samples.vec

2) After that, using the same images as img2/file.jpg with the same file names as bg.dat called "negatives.dat" and run the command;

-data cascade -vec samples.vec -bg negatives.dat -numPos 900 -numNeg 900 -numStages 20 -featureType LBP -w 26 -h 22 -minHitRate 0.999 -maxfalsealarm 0.5 -precalcValBufSize 2048 -precalcIdxBufSize 2048

The background images are again 352.x288 in original size.

Does anyone know if this would cause any inconsistancies? (Such as jpg vs png, size compression etc). When I traverse the sample.vec the quality all seem very low since it is 26x22. I am getting a lot of false positives from my training which is why I wanted to confirm these formats/sizes all line up ... thanks!

correct parameters for createsamples and traincascade wegawrgawgawgawgbawtraincascade

I am currently using opencv_createsamples and opencv_traincascade to create an xml file and run it on the android platform (using opencv-facedetection sample)

I just wanted to make sure I was using the right image sizes and parameters etc;

1) For createsamples I have a positive image of a baby with a black background called "IMG1.png"

I have another file called bg.dat that holds paths like img2/file1.jpg, im2/file2.jpg, etc The background jpg's are all 352x288

IMG1.png is an image of size 2400 1500, about which 90% w/h is the baby and the rest is a black Background.

I then call the command; -img IMG1.png -num 1000 -bg bg.dat -vec samples.vec -maxxangle 0.6 -maxzangle 0.3 -maxidev 30 -bgcolor 0 -bgthresh 10 -w 26 -h 22

to create samples.vec

2) After that, using the same images as img2/file.jpg with the same file names as bg.dat called "negatives.dat" and run the command;

-data cascade -vec samples.vec -bg negatives.dat -numPos 900 -numNeg 900 -numStages 20 -featureType LBP -w 26 -h 22 -minHitRate 0.999 -maxfalsealarm 0.5 -precalcValBufSize 2048 -precalcIdxBufSize 2048

The background images are again 352.x288 in original size.

Does anyone know if this would cause any inconsistancies? (Such as jpg vs png, size compression etc). When I traverse the sample.vec the quality all seem very low since it is 26x22. I am getting a lot of false positives from my training which is why I wanted to confirm these formats/sizes all line up ... thanks!