You need to sign in or sign up before continuing.
Commit 312157ab authored by Davis King's avatar Davis King

Added epsilon to the python object detection training API.

parent 4b6087f7
......@@ -261,6 +261,15 @@ this parameter experimentally."
this parameter experimentally.
!*/
)
.add_property("epsilon", &simple_object_detector_training_options::epsilon,
&simple_object_detector_training_options::epsilon,
"epsilon is the stopping epsilon. Smaller values make the trainer's \n\
solver more accurate but might take longer to train."
/*!
epsilon is the stopping epsilon. Smaller values make the trainer's
solver more accurate but might take longer to train.
!*/
)
.add_property("num_threads", &simple_object_detector_training_options::num_threads,
&simple_object_detector_training_options::num_threads,
"train_simple_object_detector() will use this many threads of \n\
......
......@@ -31,6 +31,7 @@ namespace dlib
num_threads = 4;
detection_window_size = 80*80;
C = 1;
epsilon = 0.01;
}
bool be_verbose;
......@@ -38,6 +39,7 @@ namespace dlib
unsigned long num_threads;
unsigned long detection_window_size;
double C;
double epsilon;
};
// ----------------------------------------------------------------------------------------
......@@ -124,6 +126,8 @@ namespace dlib
{
if (options.C <= 0)
throw error("Invalid C value given to train_simple_object_detector(), C must be > 0.");
if (options.epsilon <= 0)
throw error("Invalid epsilon value given to train_simple_object_detector(), epsilon must be > 0.");
dlib::array<array2d<rgb_pixel> > images;
std::vector<std::vector<rectangle> > boxes, ignore;
......@@ -140,10 +144,11 @@ namespace dlib
structural_object_detection_trainer<image_scanner_type> trainer(scanner);
trainer.set_num_threads(options.num_threads);
trainer.set_c(options.C);
trainer.set_epsilon(0.01);
trainer.set_epsilon(options.epsilon);
if (options.be_verbose)
{
std::cout << "Training with C: " << options.C << std::endl;
std::cout << "Training with epsilon: " << options.epsilon << std::endl;
std::cout << "Training using " << options.num_threads << " threads."<< std::endl;
std::cout << "Training with sliding window " << width << " pixels wide by " << height << " pixels tall." << std::endl;
if (options.add_left_right_image_flips)
......@@ -195,6 +200,7 @@ namespace dlib
{
std::cout << "Training complete, saved detector to file " << detector_output_filename << std::endl;
std::cout << "Trained with C: " << options.C << std::endl;
std::cout << "Training with epsilon: " << options.epsilon << std::endl;
std::cout << "Trained using " << options.num_threads << " threads."<< std::endl;
std::cout << "Trained with sliding window " << width << " pixels wide by " << height << " pixels tall." << std::endl;
if (upsample_amount != 0)
......
......@@ -37,6 +37,8 @@ namespace dlib
will encourage the trainer to fit the data better but might lead to
overfitting. Therefore, you must determine the proper setting of
this parameter experimentally.
- epsilon is the stopping epsilon. Smaller values make the trainer's
solver more accurate but might take longer to train.
!*/
fhog_training_options()
......@@ -46,6 +48,7 @@ namespace dlib
num_threads = 4;
detection_window_size = 80*80;
C = 1;
epsilon = 0.01;
}
bool be_verbose;
......@@ -53,6 +56,7 @@ namespace dlib
unsigned long num_threads;
unsigned long detection_window_size;
double C;
double epsilon;
};
// ----------------------------------------------------------------------------------------
......
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