Ask Your Question
0

Why does opencv_traincacade.exe crash

asked 2014-07-03 20:03:47 -0500

tcao gravatar image

Hi All,

I have a collection of 1947 positive images, and 2279 negative images stored in proper structure. I run the opencv_createsamples.exe successfully and it generated a file "positives.vec". When I then ran the opencv_traincascade.exe, it ran for a while, output some info (please see below) and then crashed without any useful information.

Please help!

Any help or pointer is highly appreciated.

Thanks,

Tuc


Computer spec:

  • Processor: Intel i7 CPU Q720 @1.60Hz
  • Installed Mem: 16.0 GB
  • System Type: 64-bit Operating System
  • OS: Windows 7 Professional Service Pack1

Command used to create samples:
opencv_createsamples.exe -info "C:\training\haar_training\positives.txt" -vec "C:\training\haar_training\positives.vec" -num 1947 -w 24 -h 24

Command used for cascade training:
opencv_traincascade.exe -data C:\training\haar_training\ -vec C:\training\haar_training\positives.vec -bg C:\training\haar_training\negatives.txt -minHitRate 0.95 -maxFalseAlarmRate 0.4 -numPos 1947 -numNeg 2279 -w 24 -h 24 -mode ALL

Console output after the cascade training command:
PARAMETERS:
cascadeDirName: C:\training\haar_training\
vecFileName: C:\training\haar_training\positives.vec
bgFileName: C:\training\haar_training\negatives.txt
numPos: 1947
numNeg: 2279
numStages: 20
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.95
maxFalseAlarmRate: 0.4
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: ALL

===== TRAINING 0-stage =====
BEGIN
POS count : consumed 1947 : 1947
NEG count : acceptanceRatio 2279 : 1
Precalculation time: 5.153

+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 1| 1|
+----+---------+---------+
| 3| 1| 1|
+----+---------+---------+
| 4| 1| 0.989908|
+----+---------+---------+
| 5| 1| 0.989908|
+----+---------+---------+
| 6| 1| 0.996051|
+----+---------+---------+
| 7| 1| 0.998245|
+----+---------+---------+

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-07-04 01:27:18 -0500

la lluvia gravatar image

updated 2014-07-04 01:29:03 -0500

Parameter -numPos is positive samples count that is used to train each stage in detector cascade. But some already used samples can be filtered by each previous stage (i.e. recognized as background), but no more than (1 - minHitRate) * numPos on each stage. So vec-file has to contain

= (numPos + (numStages-1) * (1 - minHitRate) * numPos) + S, where S is a count of samples from vec-file that can be recognized as background right away.

You have to calculate numPos for your training set, an example is given here: [http://stackoverflow.com/questions/10863560/haar-training-opencv-assertion-failed]

Hope it helps!

edit flag offensive delete link more

Comments

1
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2014-07-03 20:03:47 -0500

Seen: 693 times

Last updated: Jul 04 '14