Ask Your Question
0

Cascade Training Error OpenCV 3.0.0 - Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

asked 2016-09-30 11:26:23 -0600

akasa gravatar image

updated 2016-09-30 11:37:28 -0600

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

I checked same problem under it.

http://answers.opencv.org/question/91...

However, error still occurred in this system. Also, I use OpenCV 3.0.0 with Python 2.7.12 on Ubuntu16.04.

#!/bin/sh

ls pos | xargs -I {} echo -e pos/{} > pslist.txt

paste pslist.txt plus.txt > pslist2.txt

mv pslist2.txt pslist.txt

ls neg | xargs -I {} echo -e neg/{} > nglist.txt

paste nglist.txt neg.txt > nglist2.txt

mv nglist2.txt nglist.txt

opencv_createsamples -info pslist.txt -num 99 -vec image.vec -w 24 -h 24

opencv_traincascade -data cascade -vec image.vec -bg nglist.txt -numPos 90 -numNeg 501 -numStages 20 -w 24 -h 24 -featureType LBP

pslist.txt

   pos/Flower100001.jpg 1 0 0 24 24
   pos/Flower100002.jpg 1 0 0 24 24
   pos/Flower100003.jpg 1 0 0 24 24
   pos/Flower100004.jpg 1 0 0 24 24
   pos/Flower100005.jpg 1 0 0 24 24
                :

nglist.txt

   neg/Car100001.jpg    1 0 0 24 24
   neg/Car100002.jpg    1 0 0 24 24
   neg/Car100003.jpg    1 0 0 24 24
   neg/Car100004.jpg    1 0 0 24 24
   neg/Car100005.jpg    1 0 0 24 24
            :

result

Info file name: pslist.txt
Img file name: (NULL)
Vec file name: image.vec
BG  file name: (NULL)
Num: 99
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: 24
Height: 24
Create training samples from images collection...
Done. Created 99 samples
PARAMETERS:
cascadeDirName: cascade
vecFileName: image.vec
bgFileName: nglist.txt
numPos: 90
numNeg: 501
numStages: 20
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: LBP
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100

===== TRAINING 0-stage =====
<BEGIN
POS current samples: 1
POS current samples: 2
            :
POS count : consumed   90 : 90
Train dataset for temp stage can not be filled. Branch training terminated.
Cascade classifier can't be trained. Check the used training parameters.

So, anyone teach me how to solve it?

edit retag flag offensive close merge delete

Comments

1

There are tons of questions in this forum answering this. Use the search bar, and read

LorenaGdL gravatar imageLorenaGdL ( 2016-10-01 03:50:57 -0600 )edit

Thank you!

I already read them, to search "train dataset" and I understood cause which is nglist.txt isn't read. So, I tried it, for examle, I wrote absolute path in nglist.txt, but it isn't improved.

akasa gravatar imageakasa ( 2016-10-01 06:04:10 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2016-10-04 06:42:58 -0600

Some remarks

  1. I use OpenCV 3.0.0 why o why ... OpenCV has provided over 25 fixes for the cascade classifiers since then. Don't use old versions if you don't explicitly need too. Because it will result in you being on your own ...
  2. Skip the relative paths, go for absolute. You are saying that is not the issue but better be safe then sorry. Update your question correspondingly.
  3. Your code is failing at your negative images, so again, something must be wrong there... since your positives are read exactly fine. It seems that after the name, you have a tab indent instead of spaces. OpenCV expects it to be spaces in between values ... so please avoid anything else. Also make sure that there are no weird hidden commands at the end of each line (Windows/Linux conversion line endings and such)
edit flag offensive delete link more

Comments

Also, your negatives should NOT have locations at all... read the tutorial again, which has been updated recently!

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-04 06:44:08 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-09-30 11:26:23 -0600

Seen: 2,220 times

Last updated: Oct 04 '16