Ask Your Question
0

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

asked 2015-03-05 04:30:38 -0600

updated 2015-03-05 04:33:51 -0600

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: 25
numNeg: 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.
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-03-05 06:35:49 -0600

updated 2015-03-05 06:36:05 -0600

Solved it, seems that system() has application specific rights. When executing the program from command line than it switches to rights specific to the user and everything runs simply fine.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-03-05 04:30:38 -0600

Seen: 230 times

Last updated: Mar 05 '15