Train Dataset to XML file for Cascade Classifier OpenCV
Find image for train :
- open web site http://image-net.org/ and search interest image.

2. Download url of chicken image.

3. after click download url . you see ->

3. copy top link to line 12 of resize.py . change value of neg_images_link.

4. run script resize.py python resize.py
How to train :
- down load https://github.com/spmallick/opencv-haar-classifier-training
- find your positive image and put in the
positive folder
- find your negative image and put in the
negative folder
- create name list of positive image and negative image by :
find ./positive_images -iname "*.jpg" > positives.txt
find ./negative_images -iname "*.jpg" > negatives.txt - create file samples .vec of positive image by use
createsamples.pl
perl bin/createsamples.pl positives.txt negatives.txt samples 1500\
"opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1\
-maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 80 -h 40" - run script merge file samples .vec by use
mergevec.py
python ./tools/mergevec.py -v samples/ -o samples.vec
- Start training
opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 -numNeg 600 -w 80 -h 40 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024