diff --git a/tools/python/src/object_detection.cpp b/tools/python/src/object_detection.cpp index ca2728bb0..9afe03ac5 100644 --- a/tools/python/src/object_detection.cpp +++ b/tools/python/src/object_detection.cpp @@ -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\ diff --git a/tools/python/src/simple_object_detector.h b/tools/python/src/simple_object_detector.h index 70f336456..3b8e1f3a6 100644 --- a/tools/python/src/simple_object_detector.h +++ b/tools/python/src/simple_object_detector.h @@ -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 > images; std::vector > boxes, ignore; @@ -140,10 +144,11 @@ namespace dlib structural_object_detection_trainer 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) diff --git a/tools/python/src/simple_object_detector_abstract.h b/tools/python/src/simple_object_detector_abstract.h index dd09ca47d..55f41b80d 100644 --- a/tools/python/src/simple_object_detector_abstract.h +++ b/tools/python/src/simple_object_detector_abstract.h @@ -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; }; // ----------------------------------------------------------------------------------------