Fixed small bug in opencv_traincascade application: overflow sometimes happened during calculation of the number of negative samples.
This commit is contained in:
parent
22bd127365
commit
484e56f31f
@ -268,7 +268,7 @@ bool CvCascadeClassifier::updateTrainingSet( double& acceptanceRatio)
|
||||
return false;
|
||||
cout << "POS count : consumed " << posCount << " : " << (int)posConsumed << endl;
|
||||
|
||||
int proNumNeg = cvRound( (float)(numNeg * posCount) / numPos ); // apply only a fraction of negative samples.
|
||||
int proNumNeg = cvRound( ( ((double)numNeg) * ((double)posCount) ) / numPos ); // apply only a fraction of negative samples. double is required since overflow is possible
|
||||
int negCount = fillPassedSamples( posCount, proNumNeg, false, negConsumed );
|
||||
if ( !negCount )
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user