mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-20 12:55:15 +08:00
Add bg_per_image param
This commit is contained in:
@@ -52,6 +52,7 @@ int main(int argc, char *argv[])
|
||||
"{help | | print this message}"
|
||||
"{pos_path | pos | path to training object samples}"
|
||||
"{bg_path | bg | path to background images}"
|
||||
"{bg_per_image | 5 | number of windows to sample per bg image}"
|
||||
"{feature_count | 10000 | number of features to generate}"
|
||||
"{weak_count | 100 | number of weak classifiers in cascade}"
|
||||
"{model_size | 40x40 | model size in pixels}"
|
||||
@@ -71,12 +72,10 @@ int main(int argc, char *argv[])
|
||||
string bg_path = parser.get<string>("bg_path");
|
||||
string model_filename = parser.get<string>("model_filename");
|
||||
|
||||
cerr << pos_path << endl;
|
||||
cerr << bg_path << endl;
|
||||
|
||||
ICFDetectorParams params;
|
||||
params.feature_count = parser.get<size_t>("feature_count");
|
||||
params.weak_count = parser.get<size_t>("weak_count");
|
||||
params.bg_per_image = parser.get<size_t>("bg_per_image");
|
||||
|
||||
string model_size = parser.get<string>("model_size");
|
||||
if( !read_model_size(model_size.c_str(), ¶ms.model_n_rows,
|
||||
|
@@ -159,9 +159,10 @@ struct CV_EXPORTS ICFDetectorParams
|
||||
int weak_count;
|
||||
int model_n_rows;
|
||||
int model_n_cols;
|
||||
int bg_per_image;
|
||||
|
||||
ICFDetectorParams(): feature_count(UINT_MAX), weak_count(100),
|
||||
model_n_rows(40), model_n_cols(40)
|
||||
model_n_rows(56), model_n_cols(56), bg_per_image(5)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@@ -97,11 +97,11 @@ void ICFDetector::train(const String& pos_path,
|
||||
{
|
||||
cout << setw(6) << (i + 1) << "/" << bg_filenames.size() << "\r";
|
||||
Mat img = imread(bg_filenames[i]);
|
||||
for( int j = 0; j < 50;
|
||||
++j, ++neg_count)
|
||||
for( int j = 0; j < params.bg_per_image; ++j, ++neg_count)
|
||||
{
|
||||
Rect r;
|
||||
r.x = rng.uniform(0, img.cols); r.width = rng.uniform(r.x + 1, img.cols);
|
||||
r.x = rng.uniform(0, img.cols);
|
||||
r.width = rng.uniform(r.x + 1, img.cols);
|
||||
r.y = rng.uniform(0, img.rows);
|
||||
r.height = rng.uniform(r.y + 1, img.rows);
|
||||
|
||||
|
Reference in New Issue
Block a user