Added an option to traincascade program to select the maximum number of threads to use during training
This commit is contained in:
parent
da1ac35930
commit
16a82b1747
@ -13,6 +13,7 @@ int main( int argc, char* argv[] )
|
|||||||
int numPos = 2000;
|
int numPos = 2000;
|
||||||
int numNeg = 1000;
|
int numNeg = 1000;
|
||||||
int numStages = 20;
|
int numStages = 20;
|
||||||
|
int numThreads = getNumThreads();
|
||||||
int precalcValBufSize = 256,
|
int precalcValBufSize = 256,
|
||||||
precalcIdxBufSize = 256;
|
precalcIdxBufSize = 256;
|
||||||
bool baseFormatSave = false;
|
bool baseFormatSave = false;
|
||||||
@ -36,6 +37,7 @@ int main( int argc, char* argv[] )
|
|||||||
cout << " [-precalcValBufSize <precalculated_vals_buffer_size_in_Mb = " << precalcValBufSize << ">]" << endl;
|
cout << " [-precalcValBufSize <precalculated_vals_buffer_size_in_Mb = " << precalcValBufSize << ">]" << endl;
|
||||||
cout << " [-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb = " << precalcIdxBufSize << ">]" << endl;
|
cout << " [-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb = " << precalcIdxBufSize << ">]" << endl;
|
||||||
cout << " [-baseFormatSave]" << endl;
|
cout << " [-baseFormatSave]" << endl;
|
||||||
|
cout << " [-numThreads <max_number_of_threads = " << numThreads << ">]" << endl;
|
||||||
cascadeParams.printDefaults();
|
cascadeParams.printDefaults();
|
||||||
stageParams.printDefaults();
|
stageParams.printDefaults();
|
||||||
for( int fi = 0; fi < fc; fi++ )
|
for( int fi = 0; fi < fc; fi++ )
|
||||||
@ -82,6 +84,10 @@ int main( int argc, char* argv[] )
|
|||||||
{
|
{
|
||||||
baseFormatSave = true;
|
baseFormatSave = true;
|
||||||
}
|
}
|
||||||
|
else if( !strcmp( argv[i], "-numThreads" ) )
|
||||||
|
{
|
||||||
|
numThreads = atoi(argv[++i]);
|
||||||
|
}
|
||||||
else if ( cascadeParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
|
else if ( cascadeParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
|
||||||
else if ( stageParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
|
else if ( stageParams.scanAttr( argv[i], argv[i+1] ) ) { i++; }
|
||||||
else if ( !set )
|
else if ( !set )
|
||||||
@ -98,6 +104,7 @@ int main( int argc, char* argv[] )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setNumThreads( numThreads );
|
||||||
classifier.train( cascadeDirName,
|
classifier.train( cascadeDirName,
|
||||||
vecName,
|
vecName,
|
||||||
bgName,
|
bgName,
|
||||||
|
@ -200,6 +200,12 @@ Command line arguments of ``opencv_traincascade`` application grouped by purpose
|
|||||||
|
|
||||||
This argument is actual in case of Haar-like features. If it is specified, the cascade will be saved in the old format.
|
This argument is actual in case of Haar-like features. If it is specified, the cascade will be saved in the old format.
|
||||||
|
|
||||||
|
* ``-numThreads <max_number_of_threads>``
|
||||||
|
|
||||||
|
Maximum number of threads to use during training. Notice that
|
||||||
|
the actual number of used threads may be lower, depending on
|
||||||
|
your machine and compilation options.
|
||||||
|
|
||||||
#.
|
#.
|
||||||
|
|
||||||
Cascade parameters:
|
Cascade parameters:
|
||||||
|
Loading…
Reference in New Issue
Block a user