Ask Your Question
0

traincascade - "Cascade classifier can't be trained. Check the used training parameters."

asked 2013-11-19 11:44:46 -0500

Zuku gravatar image

Hi, I'm trying to train simple cascade classifier. I've created vec file with createsamples utility. But when i try to train classifier with command:

C:\ocv_sample> ..\opencv\build\x64\vc10\bin\opencv_traincascade.exe -data data -vec positive\myvec.vec -bg negative\bg.txt -numPos 3 -numNeg 5 -numStages 2 -w 300 -h 50 -featureType LBP
I get an error:
PARAMETERS:
cascadeDirName: data
vecFileName: positive\myvec.vec
bgFileName: negative\bg.txt
numPos: 3
numNeg: 5
numStages: 2
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: LBP
sampleWidth: 300
sampleHeight: 50
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100

===== TRAINING 0-stage =====
BEGIN
POS count : consumed   3 : 3
NEG count : acceptanceRatio    5 : 1
Precalculation time: 2.05
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
END
Cascade classifier can't be trained. Check the used training parameters.
My directory structure looks like:
\data
\negative
   bg.txt
   \img
      1.jpg
      2.jpg
      3.jpg
      4.jpg
      5.jpg
\positive
   myvec.vec

bg.txt:

img/1.jpg
img/2.jpg
img/3.jpg
img/4.jpg
img/5.jpg

I use Win7. What am i doing wrong?

edit retag flag offensive close merge delete

Comments

Basically I am guessing you have not enough data after the first stage. You always need more positive data then actually supplied to the positive parameter. Frequently people use like 85% - 90% of their data. About 3 pos and 5 neg, that will never give any decent results... You will need at least 50 pos and 250 neg to get something to work.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-20 02:45:29 -0500 )edit

Also search this forum first using the search button at the start page! Give tags like traincascade and you will see tons of questions handling your problems...

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-20 03:17:11 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
-2

answered 2014-10-08 22:30:49 -0500

hao gravatar image

The numPos must be >= 10. Re-create your samples and train again. Good luck!

edit flag offensive delete link more

Comments

@hao, can you explain why you use this 10 positives threshold? Also how does this answer give any extra information to the topic starter besides the remarks already given.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-09 01:49:42 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-11-19 11:44:46 -0500

Seen: 2,787 times

Last updated: Oct 08 '14