Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 1.26 KB

File metadata and controls

36 lines (30 loc) · 1.26 KB

Machine learning Steps

  1. List positive and negative image in text file

    • Linux
    find ./positive_images -iname "*.jpg" > positives.txt
    find ./negative_images -iname "*.jpg" > negatives.txt
    • Windows
    forfiles /s /m *.jpg /c "cmd /c echo @relpath" > positives.txt
    forfiles /s /m *.jpg /c "cmd /c echo @relpath" > negatives.txt

    ** Remove quotes in the files.**

     ** Replace .\ -> ./positive_images/ **  
    
  2. Create samples

perl ML/tools/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 50 -h 70"
  1. Create .vec files from samples
python ML/tools/mergevec.py -v samples/ -o samples.vec
  1. Train
opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 -numNeg 5 -w 50 -h 70 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024

More information here :