3

I know this has been asked to death, but I have followed every link and solution to no avail. Im training a cascade with 10 original postive images and creating 200 samples from each one. I have 544 negatives. According to this: How to train cascade properly, it should work, but mine fails before starting first stage. I've tried increasing/reducing original samples and how many new samples are made but it doesnt make a difference.

PARAMETERS:
cascadeDirName: classifier
vecFileName: samples.vec
bgFileName: negatives.txt
numPos: 1800
numNeg: 544
numStages: 13
precalcValBufSize[Mb] : 2048
precalcIdxBufSize[Mb] : 2048
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 34
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: ALL

===== TRAINING 0-stage =====
<BEGIN
POS OpenCV Error: Bad argument (Can not get new positive sample. The most possible reason is insufficient count of samples in given vec-file. 

My confusion is compounded by the huge amount of conflict about this topic, for example this post http://abhishek4273.com/2014/03/16/traincascade-and-car-detection-using-opencv/ states that there should be more negative than positive, whereas the first link says the opposite.

Community
  • 1
  • 1
chris
  • 4,840
  • 5
  • 35
  • 66

1 Answers1

2

By your question I can understand two different situations:

  1. You have 2000 samples. If this is the case and numPos is 1800, you are using too much positive samples, and it may fail to fill every stage.

  2. You have put in the createsamples function 200. That would have as a result, 200 samples. So when the algorithm tries to read a new line from the .vec file it fails as there are only 200 and not 1800.

I suggest that when you perform the createsamples function, use after the cvShowVecSamples function, so that you know for sure how many samples you have.

I apologize for my english as it is not my first language, i hope that my answer will help to solve your problem.

Leire
  • 21
  • 3