c++ - OpenCV 2.4.9 - Traincascade problems -
i use osx 10.11. i'm new opencv , i'm trying train simple (and surely weak) cascade classifier detect object. have read several answers, posts, guide, docs , tutorials cascade classifier have problems. referred guide:
that follow opencv doc. have 8 jpg interest object , 249 background images (i know it's poor dataset it's attempt).
when call opencv_createsamples noticed author of guide generate 1500 samples , it. means generate 1500 samples 8 positive images?
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"
note in sample folder have 7 img*.jpg.vec file. not 1500? after when 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 errors because missing "opencl" "appkit" "quartzcore" "qtkit" "cocoa". can retrieve these? i'm tried continue , generate samples.vec file.
find ./samples -name '*.vec' > samples.txt ./mergevec samples.txt samples.vec
finally train classifier 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 posts i've choosen -numpos smaller 1500 samples generated (but they?). when start training, 1 stuck in situation:
what learnt when tried follow same (and other) tutorial:
yes, createsamples turns single positive many. *.vec file contains many of them in 1 file. if display *.vec file using opencv_createsamples, can page through them arrow keys (i think).
you need mergevec program, combines *.vec files one, needed training. i'm using windows, have no idea how mac stuff.
the output of opencv_traincascade seems indicate found thousand images in samples.vec. if don't have mergevec, assume using prebuild samples.vec file.
what mean "stuck in situation"? no more output, no crash? sometimes, training takes hours.
Comments
Post a Comment