Verify vector file and background file
hi
I was trying to train cascade using opencv_traincascade binary, I am using linux 3.7, Below is result of my command
PARAMETERS:
cascadeDirName: imgs/cascade/
vecFileName: imgs/vector.vec
bgFileName: negative.dat
numPos: 200
numNeg: 8
numStages: 10
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: LBP
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.9
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
===== TRAINING 0-stage =====
<BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.
) in get, file /home/abuild/rpmbuild/BUILD/OpenCV-2.4.3/apps/traincascade/imagestorage.cpp, line 159
terminate called after throwing an instance of 'cv::Exception'
what(): /home/abuild/rpmbuild/BUILD/OpenCV-2.4.3/apps/traincascade/imagestorage.cpp:159: error: (-5) Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file.
in function get
./cascade_taining.sh: line 38: 11514 Aborted opencv_traincascade -data imgs/cascade/ -numPos 200 -numNeg 8 -numStages 10 -featureType LBP -maxFalseAlarmRate 0.9 -w 24 -h 24 -vec imgs/vector.vec -bg negative.dat
I wanted to verify my vector file and background file, I dont know how to do it.
Thanks Anshul
You can open your "negative.dat" file in a text editor. As for verifying a vec file, Use the opencv_createsamples.exe by passing vec file, width and height as arguments and -show option. (For example, opencv_createsamples.exe -vec imgs/vector.vec -w 640 -h 480 -show). But why are you using such high resolution like 640x480? It will take ages to train.
Try following this for a start.
I read that link, and improved lot of things. but while verifying the vect file by show argument does not work for me, It shows me only first sample, not all sample. if i press esc at the windows no other window appear and program exit. if i press x at right upper corner of window than window close and create sample utilitiy get hang. if this is normal behaviour than i want to see all the sample created and stored in vct file. do you have any clue.
Theres a waitKey(0) between showing samples from a vec file. Hit the enter key to go ahead. Make sure you merge the vecs created for each image.
Got that ! Why dont you put ur both comment as answer, for me they were answer to my question. Thanks lot
Also, when training will start, 640x480 pixel positives will crash your system. The image pyramids are stored in memory (thats how it is implemented) together with all features calculated. This will give an exponential grow in RAM needed, slurp it all up and then create a gigantic swap. Suggested is to use at least a size of a factor 10 smaller (64x48) pixels.
Hey Steve, Look what happened to your asterisks. Edit it before you confuse others. :D
Steve and Prasanna
Sorry for too late reply, busy in collecting positive sample.
Actually i was trying with lot of images and there are some image of different dimension. I have 1200 positive samples and in those 1000 are of 1280x720(taken out from my own camera) and 100 are of random size(downloaded from internet google image) so what would be the right choice height and width ???
I don't Know What is wrong, but my cascade still does not detect object well.