Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Train cascade classifier train error

Hello,

I am currently having problems training my own classifier.

I have created :

Negative.txt Positive.vec I can open and view my vec file just fine.

and start training with opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages 30 -w 55 -h 55 -featureType LBP

when i start the training it does the first stage just fine but when it gets to the second one i get

===== TRAINING 1-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 CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12-shared\opencv\apps\traincascade\imagestorage.cpp, line 157

can any one tell me shy i am getting this error

Train cascade classifier train error

Hello,

I am currently having problems training my own classifier.

I have created :

Negative.txt Positive.vec I can open and view my vec file just fine.

and start training with opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages 30 -w 55 -h 55 -featureType LBP

when i start the training it does the first stage just fine but when it gets to the second one i get

===== TRAINING 1-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 CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12-shared\opencv\apps\traincascade\imagestorage.cpp, line 157

can any one tell me shy why i am getting this error

Train cascade classifier train error

Hello,

I am currently having problems training my own classifier.

I have created :

Negative.txt Positive.vec I can open and view my vec file just fine.

and start training with opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages 30 -w 55 -h 55 -featureType LBP

when i start the training it does the first stage just fine but when it gets to the second one i get

===== TRAINING 1-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 CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12-shared\opencv\apps\traincascade\imagestorage.cpp, line 157

can any one tell me why i am getting this error

Edit: Output:

opencv_createsamples.exe -info Positive.info -num 1988 -w 55 -h 55 -vec Positive.vec -num 1988 Info file name: Positive.info Img file name: (NULL) Vec file name: Positive.vec BG file name: (NULL) Num: 1988 BG color: 0 BG threshold: 80 Invert: FALSE Max intensity deviation: 40 Max x angle: 1.1 Max y angle: 1.1 Max z angle: 0.5 Show samples: FALSE Width: 55 Height: 55 Create training samples from images collection... Positive.info(1988) : parse errorDone. Created 1987 samples

train>opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages 2 -w 55 -h 55 -featureType LBP PARAMETERS: cascadeDirName: data/ vecFileName: Positive.vec bgFileName: negative.txt numPos: 1987 numNeg: 3000 numStages: 2 precalcValBufSize[Mb] : 1024 precalcIdxBufSize[Mb] : 1024 acceptanceRatioBreakValue : -1 stageType: BOOST featureType: LBP sampleWidth: 55 sampleHeight: 55 boostType: GAB minHitRate: 0.995 maxFalseAlarmRate: 0.5 weightTrimRate: 0.95 maxDepth: 1 maxWeakCount: 100

===== TRAINING 0-stage ===== <begin pos="" count="" :="" consumed="" 1987="" :="" 1987="" neg="" count="" :="" acceptanceratio="" 3000="" :="" 1="" precalculation="" time:="" 9.501="" +----+---------+---------+="" |="" n="" |="" hr="" |="" fa="" |="" +----+---------+---------+="" |="" 1|="" 1|="" 1|="" +----+---------+---------+="" |="" 2|="" 0.996477|0.0776667|="" +----+---------+---------+="" end=""> Training until now has taken 0 days 0 hours 4 minutes 8 seconds.

===== TRAINING 1-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="" cvcascadeimagereader::posreader::get,="" file="" c:\builds\master_packslave-win32-vc12-shared\opencv\apps\traincascade\imagestorage.cpp,="" line="" 157<="" p="">

Train cascade classifier train error

Hello,

I am currently having problems training my own classifier.

I have created :

Negative.txt Positive.vec I can open and view my vec file just fine.

and start training with opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages 30 -w 55 -h 55 -featureType LBP

when i start the training it does the first stage just fine but when it gets to the second one i get

===== TRAINING 1-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 CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12-shared\opencv\apps\traincascade\imagestorage.cpp, C:\builds\master_PackSlave-win32-vc12-
shared\opencv\apps\traincascade\imagestorage.cpp,
line 157

can any one tell me why i am getting this error

Edit: Output:

opencv_createsamples.exe -info Positive.info -num 1988 -w 55 -h 55 -vec Positive.vec -num 1988
Info file name: Positive.info
Img file name: (NULL)
Vec file name: Positive.vec
BG file name: (NULL)
Num: 1988
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 55
Height: 55
Create training samples from images collection...
Positive.info(1988) : parse errorDone. Created 1987 samples

train>opencv_traincascade.exe samples

output 2

opencv_traincascade.exe -data "data/" -vec Positive.vec -bg negative.txt -numPos 1987 -numNeg 3000 -numStages -
numStages 2 -w 55 -h 55 -featureType LBP
PARAMETERS:
cascadeDirName: data/
vecFileName: Positive.vec
bgFileName: negative.txt
numPos: 1987
numNeg: 3000
numStages: 2
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: LBP
sampleWidth: 55
sampleHeight: 55
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100

100 ===== TRAINING 0-stage ===== <begin pos="" count="" :="" consumed="" 1987="" :="" 1987="" neg="" count="" :="" acceptanceratio="" 3000="" :="" 1="" precalculation="" time:="" 9.501="" +----+---------+---------+="" |="" n="" |="" hr="" |="" fa="" |="" +----+---------+---------+="" |="" 1|="" 1|="" 1|="" +----+---------+---------+="" |="" 2|="" 0.996477|0.0776667|="" +----+---------+---------+="" end=""> BEGIN POS count : consumed 1987 : 1987 NEG count : acceptanceRatio 3000 : 1 Precalculation time: 9.501 +----+---------+---------+ | N | HR | FA | +----+---------+---------+ | 1| 1| 1| +----+---------+---------+ | 2| 0.996477|0.0776667| +----+---------+---------+ END> Training until now has taken 0 days 0 hours 4 minutes 8 seconds.

seconds. ===== TRAINING 1-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="" cvcascadeimagereader::posreader::get,="" file="" c:\builds\master_packslave-win32-vc12-shared\opencv\apps\traincascade\imagestorage.cpp,="" line="" 157<="" p="">

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 CvCascadeImageReader::PosReader::get, file C:\builds\master_PackSlave-win32-vc12- shared\opencv\apps\traincascade\imagestorage.cpp, line 157