Ask Your Question

Revision history [back]

Error in opencv_traincascade

Hi can you please help me, I'm getting an error while running the opencv_traincascade on Ubuntu 14.04 from the following script

#!/bin/sh
AS="/home/isat/HW_2"
opencv_traincascade -data $AS/trainCascade -vec $AS/full_vec.vec -bg $AS/negative_copy.txt -numStages 20 -nsplits 2 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000 -numNeg 9000 -w 20 -h 20 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024 -mem 14000

the error it gives is
POS count : consumed 1000 : 1000 Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

Which I realise is the issue of the bg description file not being interpreted properly. My directory structure is

HW_2
   negative_copy.txt
   /Negative
      neg_1.bmp
      neg_2.bmp

and my negative_copy.txt looks like

Negative/neg_1.bmp
Negative/neg_10.bmp
Negative/neg_100.bmp

since in the documentation it's written that the address must be relative to the directory of the description file. But I've tried everything from ./, to /Negative to absolute addresses and my terminal is running from / just to ensure that my relative and absolute paths are same as well. Kindly help me. I am at wit's end.