fix a bug in updateTrainingSet

In case fillPassedSamples find zero passed negatives and leafFA is achieved, function updateTrainingSet will return false and print misleading information, this PR fix the case.
pull/5872/head
Teng Cao 9 years ago
parent 9c58741dba
commit 25b044e6c3
  1. 1
      apps/traincascade/cascadeclassifier.cpp

@ -309,6 +309,7 @@ bool CvCascadeClassifier::updateTrainingSet( double minimumAcceptanceRatio, doub
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, minimumAcceptanceRatio, negConsumed );
if ( !negCount )
if ( !(negConsumed > 0 && ((double)negCount+1)/(double)negConsumed <= minimumAcceptanceRatio) )
return false;
curNumSamples = posCount + negCount;

Loading…
Cancel
Save