Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

traincascade - Train dataset for temp stage can not ...

Hello, I'm going nuts trying to get opencv_traincascade to work. It always stops with the error:

Train dataset for temp stage can not be filled. Branch training terminated

I'm using OpenCV 2.4.11 on a Windows 7 64-bit machine. I've used the distribution exe from the x64 VC12 directory. I've also recompiled from source code using Visual Studio 2012. I get the same results either way.

The command line I'm using is below. Test1 is my compiled version of traincascade.

test1 -data cscd -vec out/samples.vec -bg bgt.txt -numPos 5 -numNeg 1200 -numStages 10
  -featureType HAAR -minHitRate 0.999 -maxFalseAlarmRate 0.5 -w 24 -h 24
  -precalcValBufSize 2048 -precalcIdxBufSize 2048

The output I receive is:

PARAMETERS:
cascadeDirName: cscd
vecFileName: out/samples.vec
bgFileName: bgt.txt
numPos: 5
numNeg: 1200
numStages: 10
precalcValBufSize[Mb] : 2048
precalcIdxBufSize[Mb] : 2048
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC

Stages 0-2 are loaded

===== TRAINING 3-stage =====
<BEGIN
POS count : consumed   5 : 21
310: numNeg 1200, posCount 5, numPos 5, proNumNeg 1200, negConsumed 1024, negCount 0
Train dataset for temp stage can not be filled. Branch training terminated

Note that I added a printf statement that begins with "310:" corresponding to line 310 in the cascadeclassifier.cpp file. Line 310 falls within the following subroutine:

bool CvCascadeClassifier::updateTrainingSet( double minimumAcceptanceRatio, double& acceptanceRatio)

Can anyone see what I'm doing wrong?

Is there an example available – a zip file that contains positive images, negative images, the descriptor files, the command line to run, basically all the stuff just to verify that it works?

Thanks, Barry.

traincascade - Train dataset for temp stage can not ...

Hello, I'm going nuts trying to get opencv_traincascade to work. It always stops with the error:

Train dataset for temp stage can not be filled. Branch training terminated

I'm using OpenCV 2.4.11 on a Windows 7 64-bit machine. I've used the distribution exe from the x64 VC12 directory. I've also recompiled from source code using Visual Studio 2012. I get the same results either way.

The command line I'm using is below. Test1 is my compiled version of traincascade.

test1 -data cscd -vec out/samples.vec -bg bgt.txt -numPos 5 -numNeg 1200 -numStages 10
  -featureType HAAR -minHitRate 0.999 -maxFalseAlarmRate 0.5 -w 24 -h 24
  -precalcValBufSize 2048 -precalcIdxBufSize 2048

The output I receive is:

PARAMETERS:
cascadeDirName: cscd
vecFileName: out/samples.vec
bgFileName: bgt.txt
numPos: 5
numNeg: 1200
numStages: 10
precalcValBufSize[Mb] : 2048
precalcIdxBufSize[Mb] : 2048
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC

Stages 0-2 are loaded

===== TRAINING 3-stage =====
<BEGIN
POS count : consumed   5 : 21
310: numNeg 1200, posCount 5, numPos 5, proNumNeg 1200, negConsumed 1024, negCount 0
Train dataset for temp stage can not be filled. Branch training terminated

Note that I added a printf statement that begins with "310:" corresponding to line 310 in the cascadeclassifier.cpp file. Line 310 falls within the following subroutine:

bool CvCascadeClassifier::updateTrainingSet( double minimumAcceptanceRatio, double& acceptanceRatio)

Can anyone see what I'm doing wrong?

Is there an example available – a zip file that contains positive images, negative images, the descriptor files, the command line to run, basically all the stuff just to verify that it works?

Thanks, Barry.

-- UPDATE --

I found a great example at:

http://abhishek4273.com/2014/03/16/traincascade-and-car-detection-using-opencv/

TRAINCASCADE AND CAR DETECTION USING OPENCV by ABHISHEK KUMAR ANNAMRAJU

He works through a simple problem from start to finish providing the sample images, createsamples and traincascade command lines, and the info files.

He seems to be using Linux/UNIX. I use Windows 7. The "find" command is not available on Windows. I entered dir /B > cars.info from a command window and then and edited the output file to add the directory prefix and a 1 0 0 100 40 suffix to each line.

Everything worked and I got the output XML file.