Merge 2.4 into master
PR #2968:cce2d99
8578f9c
Fixed bug which caused crash of GPU version of feature matcher in stitcher The bug caused crash of GPU version of feature matcher in stitcher when we use ORB features. PR #3236:5947519
Check sure that we're not already below required leaf false alarm rate before continuing to get negative samples. PR #3190 fix blobdetector PR #3562 (part):82bd82e
TBB updated to 4.3u2. Fix for aarch64 support. PR #3604 (part):091c7a3
OpenGL interop sample reworked not ot use cvconfig.h PR #3792:afdf319
Add -L for CUDA libs path to pkg-config Add all dirs from CUDA_LIBS_PATH as -L linker options to OPENCV_LINKER_LIBS. These will end up in opencv.pc. PR #3893:122b9f8
Turn ocv_convert_to_lib_name into a function PR #5490:ec5244a
fixed memory leak in findHomography tests PR #5491:0d5b739
delete video readers PR #5574 PR #5202
This commit is contained in:
@@ -206,7 +206,7 @@ bool CvCascadeClassifier::train( const string _cascadeDirName,
|
||||
cout << endl << "===== TRAINING " << i << "-stage =====" << endl;
|
||||
cout << "<BEGIN" << endl;
|
||||
|
||||
if ( !updateTrainingSet( tempLeafFARate ) )
|
||||
if ( !updateTrainingSet( requiredLeafFARate, tempLeafFARate ) )
|
||||
{
|
||||
cout << "Train dataset for temp stage can not be filled. "
|
||||
"Branch training terminated." << endl;
|
||||
@@ -297,17 +297,17 @@ int CvCascadeClassifier::predict( int sampleIdx )
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool CvCascadeClassifier::updateTrainingSet( double& acceptanceRatio)
|
||||
bool CvCascadeClassifier::updateTrainingSet( double minimumAcceptanceRatio, double& acceptanceRatio)
|
||||
{
|
||||
int64 posConsumed = 0, negConsumed = 0;
|
||||
imgReader.restart();
|
||||
int posCount = fillPassedSamples( 0, numPos, true, posConsumed );
|
||||
int posCount = fillPassedSamples( 0, numPos, true, 0, posConsumed );
|
||||
if( !posCount )
|
||||
return false;
|
||||
cout << "POS count : consumed " << posCount << " : " << (int)posConsumed << endl;
|
||||
|
||||
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, minimumAcceptanceRatio, negConsumed );
|
||||
if ( !negCount )
|
||||
return false;
|
||||
|
||||
@@ -317,7 +317,7 @@ bool CvCascadeClassifier::updateTrainingSet( double& acceptanceRatio)
|
||||
return true;
|
||||
}
|
||||
|
||||
int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositive, int64& consumed )
|
||||
int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositive, double minimumAcceptanceRatio, int64& consumed )
|
||||
{
|
||||
int getcount = 0;
|
||||
Mat img(cascadeParams.winSize, CV_8UC1);
|
||||
@@ -325,6 +325,9 @@ int CvCascadeClassifier::fillPassedSamples( int first, int count, bool isPositiv
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
if( consumed != 0 && ((double)getcount+1)/(double)(int64)consumed <= minimumAcceptanceRatio )
|
||||
return getcount;
|
||||
|
||||
bool isGetImg = isPositive ? imgReader.getPos( img ) :
|
||||
imgReader.getNeg( img );
|
||||
if( !isGetImg )
|
||||
|
Reference in New Issue
Block a user