(performance.cpp )
" -data <classifier_directory_name>\n" " -info <collection_file_name>\n" " [-maxSizeDiff <max_size_difference = %f>]\n" " [-maxPosDiff <max_position_difference = %f>]\n" " [-sf <scale_factor = %f>]\n" " [-ni <saveDetected = 0>]\n" " [-nos <number_of_stages = %d>]\n" " [-rs <roc_size = %d>]\n" " [-w <sample_width = %d>]\n" " [-h <sample_height = %d>]\n"
4、opencv_traincascade.exe参数说明
——traincascade.cpp
cout << "Usage: " << argv[0] << endl; cout << " -data <cascade_dir_name>" << endl; cout << " -vec <vec_file_name>" << endl; cout << " -bg <background_file_name>" << endl; cout << " [-numPos <number_of_positive_samples = " << numPos << ">]" << endl; //默认2000 cout << " [-numNeg <number_of_negative_samples = " << numNeg << ">]" << endl; //默认1000 cout << " [-numStages <number_of_stages = " << numStages << ">]" << endl; //默认20 cout << " [-precalcValBufSize <precalculated_vals_buffer_size_in_Mb = " << precalcValBufSize << ">]" << endl;//默认256 cout << " [-precalcIdxBufSize <precalculated_idxs_buffer_size_in_Mb = " << precalcIdxBufSize << ">]" << endl;//默认256 cout << " [-baseFormatSave]" << endl; //是否按照旧版存xml文件默认false // cout << " [-numThreads <max_number_of_threads = " << numThreads << ">]" << endl;//这个参数在3.0版本中才出现,默认numThreads = getNumThreads(); // cout << " [-acceptanceRatioBreakValue <value> = " << acceptanceRatioBreakValue << ">]" << endl;//这个参数在3.0版本中才出现,默认-1.0 cascadeParams.printDefaults(); stageParams.printDefaults(); for( int fi = 0; fi < fc; fi++ ) featureParams[fi]->printDefaults();其中cascadeParams.printDefaults();——cascadeclassifier.cpp 如下
cout << " [-stageType <"; //默认BOOST for( int i = 0; i < (int)(sizeof(stageTypes)/sizeof(stageTypes[0])); i++ ) { cout << (i ? " | " : "") << stageTypes[i]; if ( i == defaultStageType ) cout << "(default)"; } cout << ">]" << endl; cout << " [-featureType <{"; //默认HAAR for( int i = 0; i < (int)(sizeof(featureTypes)/sizeof(featureTypes[0])); i++ ) { cout << (i ? ", " : "") << featureTypes[i]; if ( i == defaultStageType ) cout << "(default)"; } cout << "}>]" << endl; cout << " [-w <sampleWidth = " << winSize.width << ">]" << endl; //默认24*24 cout << " [-h <sampleHeight = " << winSize.height << ">]" << endl;stageParams.printDefaults();——boost.cpp如下 cout << "--boostParams--" << endl; cout << " [-bt <{" << CC_DISCRETE_BOOST << ", " << CC_REAL_BOOST << ", " << CC_LOGIT_BOOST ", " << CC_GENTLE_BOOST << "(default)}>]" << endl; //默认CC_GENTLE_BOOST cout << " [-minHitRate <min_hit_rate> = " << minHitRate << ">]" << endl; //默认0.995 cout << " [-maxFalseAlarmRate <max_false_alarm_rate = " << maxFalseAlarm << ">]" << endl;//默认0.5 cout << " [-weightTrimRate <weight_trim_rate = " << weight_trim_rate << ">]" << endl; //默认0.95 cout << " [-maxDepth <max_depth_of_weak_tree = " << max_depth << ">]" << endl; //默认1 cout << " [-maxWeakCount <max_weak_tree_count = " << weak_count << ">]" << endl; //默认100featureParams[fi]->printDefaults();——haarfeatures.cpp 如下cout << " [-mode <" CC_MODE_BASIC << "(default)| " //默认CC_MODE_BASIC << CC_MODE_CORE <<" | " << CC_MODE_ALL << endl;
通用参数:
-data<cascade_dir_name>
目录名,如不存在训练程序会创建它,用于存放训练好的分类器
-vec<vec_file_name>
-bg<background_file_name>
背景描述文件,也就是包含负样本文件名的那个描述文件
-numPos<number_of_positive_samples>
每级分类器训练时所用的正样本数目
-numNeg<number_of_negative_samples>
每级分类器训练时所用的负样本数目,可以大于 -bg 指定的图片数目
-numStages<number_of_stages>
训练的分类器的级数。
-precalcValBufSize<precalculated_vals_buffer_size_in_Mb>
-precalcIdxBufSize<precalculated_idxs_buffer_size_in_Mb>
-baseFormatSave
这个参数仅在使用Haar特征时有效。如果指定这个参数,那么级联分类器将以老的格式存储
级联参数:
-stageType<BOOST(default)>
-featureType<{HAAR(default),LBP}>
-w<sampleWidth>
-h<sampleHeight>
训练样本的尺寸(单位为像素)。必须跟训练样本创建(使用 opencv_createsamples 程序创建)时的尺寸保持一致
Boosted分类器参数:
-bt<{DAB,RAB,LB,GAB(default)}>