Ask Your Question

Revision history [back]

Multiple parameter multiple model training with cascade classifiers, error on system() call

My setup: Linux Ubuntu 14.04 64 bit with OpenCV 2.4 branch compiled and installed.

Goal: to train multiple cascade classifier models with different parameters by executing a single command, so that I can fire it up at the end of my day of work and evaluate the results the day after when heading back.

Approach:

  • Using the system() call in C++ I subsequently want to invoke a opencv_traincascade command
  • The following command works from every single location on my system when manually passed to a terminal interface

    opencv_traincascade -data /data/datasets/candy_model/working_model/cascade/0/ -vec /data/datasets/candy_model/working_model/output20150305.vec -bg /data/datasets/candy_model/working_model/negatives.txt -numPos 25 -numNeg 250 -numStages 20 -w 59 -h 23 -precalcValBufSize 2048 -precalcIdxBufSize 2048

  • If you want this to work decently, you need to apply a small fix to the traincascade algorithm described in this PR, to allow the use of absolute paths for reading your data.

  • Now running the same command in my C++ OpenCV based project, with the command system(buffer.str().c_str() ); and the buffer being filled with the exact same content as the manual command (being checked by 5 collegues at work to avoid typos) raises the problem that the training cannot be performed as seen below

    cascadeDirName: /data/datasets/candy_model/working_model/cascade/0/ vecFileName: /data/datasets/candy_model/working_model/output20150305.vec bgFileName: /data/datasets/candy_model/working_model/negatives.txt numPos: -9008 numNeg: 32767 numStages: 20 precalcValBufSize[Mb] : 2048 precalcIdxBufSize[Mb] : 2048 stageType: BOOST featureType: HAAR sampleWidth: 59 sampleHeight: 23 boostType: GAB minHitRate: 0.995 maxFalseAlarmRate: 0.5 weightTrimRate: 0.95 maxDepth: 1 maxWeakCount: 100 mode: BASIC

    ===== TRAINING 0-stage ===== <begin train="" dataset="" for="" temp="" stage="" can="" not="" be="" filled.="" branch="" training="" terminated.="" cascade="" classifier="" can't="" be="" trained.="" check="" the="" used="" training="" parameters.<="" p="">

Multiple parameter multiple model training with cascade classifiers, error on system() call

My setup: Linux Ubuntu 14.04 64 bit with OpenCV 2.4 branch compiled and installed.

Goal: to train multiple cascade classifier models with different parameters by executing a single command, so that I can fire it up at the end of my day of work and evaluate the results the day after when heading back.

Approach:

  • Using the system() call in C++ I subsequently want to invoke a opencv_traincascade command
  • The following command works from every single location on my system when manually passed to a terminal interface

code sample

opencv_traincascade -data /data/datasets/candy_model/working_model/cascade/0/ -vec /data/datasets/candy_model/working_model/output20150305.vec -bg /data/datasets/candy_model/working_model/negatives.txt -numPos 25 -numNeg 250 -numStages 20 -w 59 -h 23 -precalcValBufSize 2048 -precalcIdxBufSize 2048

2048
  • If you want this to work decently, you need to apply a small fix to the traincascade algorithm described in this PR, to allow the use of absolute paths for reading your data.

  • Now running the same command in my C++ OpenCV based project, with the command system(buffer.str().c_str() ); and the buffer being filled with the exact same content as the manual command (being checked by 5 collegues at work to avoid typos) raises the problem that the training cannot be performed as seen below

generated output

cascadeDirName: /data/datasets/candy_model/working_model/cascade/0/
vecFileName: /data/datasets/candy_model/working_model/output20150305.vec
bgFileName: /data/datasets/candy_model/working_model/negatives.txt
numPos: -9008
numNeg: 32767
numStages: 20
precalcValBufSize[Mb] : 2048
precalcIdxBufSize[Mb] : 2048
stageType: BOOST
featureType: HAAR
sampleWidth: 59
sampleHeight: 23
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC

BASIC ===== TRAINING 0-stage ===== <begin train="" dataset="" for="" temp="" stage="" can="" not="" be="" filled.="" branch="" training="" terminated.="" cascade="" classifier="" can't="" be="" trained.="" check="" the="" used="" training="" parameters.<="" p="">

<BEGIN Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

Multiple parameter multiple model training with cascade classifiers, error on system() call

My setup: Linux Ubuntu 14.04 64 bit with OpenCV 2.4 branch compiled and installed.

Goal: to train multiple cascade classifier models with different parameters by executing a single command, so that I can fire it up at the end of my day of work and evaluate the results the day after when heading back.

Approach:

  • Using the system() call in C++ I subsequently want to invoke a opencv_traincascade command
  • The following command works from every single location on my system when manually passed to a terminal interface

code sample

opencv_traincascade -data /data/datasets/candy_model/working_model/cascade/0/ -vec /data/datasets/candy_model/working_model/output20150305.vec -bg /data/datasets/candy_model/working_model/negatives.txt -numPos 25 -numNeg 250 -numStages 20 -w 59 -h 23 -precalcValBufSize 2048 -precalcIdxBufSize 2048
  • If you want this to work decently, you need to apply a small fix to the traincascade algorithm described in this PR, to allow the use of absolute paths for reading your data.
  • Now running the same command in my C++ OpenCV based project, with the command system(buffer.str().c_str() ); and the buffer being filled with the exact same content as the manual command (being checked by 5 collegues at work to avoid typos) raises the problem that the training cannot be performed as seen below

generated output

cascadeDirName: /data/datasets/candy_model/working_model/cascade/0/
vecFileName: /data/datasets/candy_model/working_model/output20150305.vec
bgFileName: /data/datasets/candy_model/working_model/negatives.txt
numPos: -9008
25
numNeg: 32767
250
numStages: 20
precalcValBufSize[Mb] : 2048
precalcIdxBufSize[Mb] : 2048
stageType: BOOST
featureType: HAAR
sampleWidth: 59
sampleHeight: 23
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC

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