opencv_traincascade can not trained [closed]

asked 2013-11-22 12:22:53 -0500

ioanna gravatar image

I run these command

opencv_traincascade -data data/cascade -vec samples1.vec -bg negative/infofile.txt -numPos 231 -numNeg 100 -w 25 -h 15

in Centos systems and it returns the follow

PARAMETERS:
cascadeDirName: data/cascade
vecFileName: samples1.vec
bgFileName: negative/infofile.txt
numPos: 231
numNeg: 100
numStages: 20
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 25
sampleHeight: 15
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC

===== TRAINING 0-stage =====
<BEGIN
POS count : consumed   231 : 231
Train dataset for temp stage can not be filled. Branch training terminated.
Cascade classifier can't be trained. Check the used training parameters.

Can anyone tell me what is the problem?:/

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-13 10:15:58.554892

Comments

Do you actually have enough negative images? It seems it cannot get enough negative samples in the first iteration.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-22 15:21:37 -0500 )edit

I read that negative images have to be less than possitive.

ioanna gravatar imageioanna ( 2013-11-22 16:07:33 -0500 )edit

Btw it returns the same problem when I use more images. I notices that when the vec file created there was a parse error. Is that a reason that it can train?

ioanna gravatar imageioanna ( 2013-11-22 16:12:12 -0500 )edit

I mean in your actual negative image set defined in bg.txt file... You have to be sure that it is possible to retrieve 100 unique negative samples. And about the parse error, that is probable because your -num parameter is not the same as your actual positive examples training set length.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-23 06:36:00 -0500 )edit

In bg.txt there are 1000 images.

About the parse error, the file has 231 rows and I can not understand why there is a parse error in line 232. I removed the 232 line and executed the command again and the error still exist:/

ioanna gravatar imageioanna ( 2013-11-23 06:59:48 -0500 )edit

Did you specify -num 231 at the createsample utility? Then your parse error should be gone. Can you give a view of your neg and pos txt file by using the edit button of your question?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-11-23 09:06:38 -0500 )edit