Ask Your Question

Question about calculation of positive and negative examples for training a LBP classifier and not getting stuck because of a wrong number of nPOS and nNEG.

asked 2013-03-22 07:59:23 -0600

This question is adressed to @Maria Dimashova in the first place, author of the traincascade algorithm (or of the original haar training algorithm in openCV). However, all other inputs are certainly welcome!

I found your suggesting of using the following equation to determine the numPos and numNeg elements for cascade training:

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

Assuming I have the following setup

  • 214 Positive images of cars to train a aerial detector
  • 10.000 Negative images of possible surroundings (to model the background)

I first use the create_samples utility in openCV to form a vector file with the positive images. This results in a vector of 214 images (all having a 28*56 resolution). The resulting vector file is stored as ouput.vec

I have a negative bg.txt file for defining negative images in negative folder.

I now want to determine the correct number of positives to assing to this traincascade using your suggested formula. This results in:

214 >= (numPose + (10-1) * (1 - 0.995) * numPose) + S.

I notice that the parameter S is described fairly vague. I would assume it would be 10.000 since that is the amount of bg files, but thats not possible, because it would result in a large negative result.

So could you specify more specific what this parameter S is? From the description you say, vector elements that can be determined as negatives right away. Does this mean that you have to include all the negatives into the createsamples algorithm to create a vector of 10.214 elements?

Guidance greatly appreciated!

edit retag flag offensive close merge delete


Guanta gravatar imageGuanta ( 2013-03-22 11:35:59 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-22 12:20:11 -0600

Thx to @Guanta for the solution, which i did not find yet. :)

It discusses all parts of the exact formula, explaining that the S parameter can only be estimated / guessed by the quality of the actual samples.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-03-22 07:59:23 -0600

Seen: 3,825 times

Last updated: Mar 22 '13