Ask Your Question
0

correct parameters for createsamples and traincascade

asked 2013-05-05 21:52:23 -0600

lee7ster gravatar image

updated 2013-05-05 22:51:42 -0600

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!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-05-07 03:38:22 -0600

Creating a vector file based on a single image, would work, however results during detection will be dramatically bad. It is better to gather tons of images from a baby, versus several backgrounds, to model the actual intra-class variation.

This is also the main reason of your false positives. These clinical generated images, are not good for detection purposes, unless you have a very simple object like a logo or a cube.

edit flag offensive delete link more

Comments

Thanks for your response -- I have also tried taking ~1000 positive images of the baby (samples of some images here : http://answers.opencv.org/question/12742/opencv_traincascade-giving-a-lot-of-false/) Is there any reason it would do the same thing even with gathering many images of both positives/negatives?

lee7ster gravatar imagelee7ster ( 2013-05-08 12:37:21 -0600 )edit
0

answered 2013-07-13 13:05:25 -0600

asd gravatar image

did you use the facedetection code as it was and slot in your xml file? did this work, can you do that?

edit flag offensive delete link more

Comments

2

Please open your own topic! Hijacking someone elses isn't the right way to go on this forum!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-07-14 13:13:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-05-05 21:52:23 -0600

Seen: 2,894 times

Last updated: Jul 13 '13