Commit 5ff271ef authored by Vlad Shakhuro's avatar Vlad Shakhuro

Add bg_per_image param

parent 319b25ee
...@@ -52,6 +52,7 @@ int main(int argc, char *argv[]) ...@@ -52,6 +52,7 @@ int main(int argc, char *argv[])
"{help | | print this message}" "{help | | print this message}"
"{pos_path | pos | path to training object samples}" "{pos_path | pos | path to training object samples}"
"{bg_path | bg | path to background images}" "{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}" "{feature_count | 10000 | number of features to generate}"
"{weak_count | 100 | number of weak classifiers in cascade}" "{weak_count | 100 | number of weak classifiers in cascade}"
"{model_size | 40x40 | model size in pixels}" "{model_size | 40x40 | model size in pixels}"
...@@ -71,12 +72,10 @@ int main(int argc, char *argv[]) ...@@ -71,12 +72,10 @@ int main(int argc, char *argv[])
string bg_path = parser.get<string>("bg_path"); string bg_path = parser.get<string>("bg_path");
string model_filename = parser.get<string>("model_filename"); string model_filename = parser.get<string>("model_filename");
cerr << pos_path << endl;
cerr << bg_path << endl;
ICFDetectorParams params; ICFDetectorParams params;
params.feature_count = parser.get<size_t>("feature_count"); params.feature_count = parser.get<size_t>("feature_count");
params.weak_count = parser.get<size_t>("weak_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"); string model_size = parser.get<string>("model_size");
if( !read_model_size(model_size.c_str(), &params.model_n_rows, if( !read_model_size(model_size.c_str(), &params.model_n_rows,
......
...@@ -159,9 +159,10 @@ struct CV_EXPORTS ICFDetectorParams ...@@ -159,9 +159,10 @@ struct CV_EXPORTS ICFDetectorParams
int weak_count; int weak_count;
int model_n_rows; int model_n_rows;
int model_n_cols; int model_n_cols;
int bg_per_image;
ICFDetectorParams(): feature_count(UINT_MAX), weak_count(100), 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, ...@@ -97,11 +97,11 @@ void ICFDetector::train(const String& pos_path,
{ {
cout << setw(6) << (i + 1) << "/" << bg_filenames.size() << "\r"; cout << setw(6) << (i + 1) << "/" << bg_filenames.size() << "\r";
Mat img = imread(bg_filenames[i]); Mat img = imread(bg_filenames[i]);
for( int j = 0; j < 50; for( int j = 0; j < params.bg_per_image; ++j, ++neg_count)
++j, ++neg_count)
{ {
Rect r; 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.y = rng.uniform(0, img.rows);
r.height = rng.uniform(r.y + 1, img.rows); r.height = rng.uniform(r.y + 1, img.rows);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment