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;
|
return false;
|
||||||
cout << "POS count : consumed " << posCount << " : " << (int)posConsumed << endl;
|
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 );
|
int negCount = fillPassedSamples( posCount, proNumNeg, false, negConsumed );
|
||||||
if ( !negCount )
|
if ( !negCount )
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user