Problems with traincascade - OpenCV 2.4.9

asked 2016-05-27 14:24:00 -0500

updated 2016-05-27 14:57:05 -0500

Hi, I use OSX 10.11. I'm new to opencv and I'm trying to train a simple (and surely weak) cascade classifier to detect an object. I have already read several answers, posts, guide, docs and tutorials about cascade classifier but I have some problems. I referred to this guide:


That follow opencv doc. Now I have 8 jpg with my interest object and 249 background images (I know that it's a poor dataset but it's only an attempt).

When I call opencv_createsamples I noticed the author of guide generate 1500 samples and also I do it. It means that generate 1500 samples from my 8 positive images?

perl bin/ 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"

Note that in sample folder I have only 7 img*.jpg.vec file. They would not be 1500? After when I call:

g++ `pkg-config --libs --cflags opencv` -I. -o mergevec mergevec.cpp cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp cvhaartraining.cpp -lopencv_core -lopencv_calib3d -lopencv_imgproc -lopencv_highgui -lopencv_objdetect

I have some errors because missing "OpenCL" "AppKit" "QuartzCore" "QTKit" "Cocoa". Where I can retrieve these? However I'm tried to continue and I generate samples.vec file.

find ./samples -name '*.vec' > samples.txt ./mergevec samples.txt samples.vec

Finally I train my classifier with this code:

opencv_traincascade -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 -numNeg 249 -featureType LBP -w 80 -h 40 -precalcValBufSize 2048 -precalcIdxBufSize 4096

After read some posts I've choosen -numPos smaller than 1500 samples previously generated (but where are they?). When I start the training, the one stuck in this situation: terminal

What's the problem? How can I solve previously issues? Thanks in advice

edit retag flag offensive close merge delete