mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added num_threads to shape_predictor_training_options.
This commit is contained in:
parent
2a26521b0b
commit
aca8087371
@ -208,6 +208,8 @@ void bind_shape_predictors(py::module &m)
|
|||||||
e.g a padding of 0.5 would cause the algorithm to sample pixels from a box that was 2x2 pixels")
|
e.g a padding of 0.5 would cause the algorithm to sample pixels from a box that was 2x2 pixels")
|
||||||
.def_readwrite("random_seed", &type::random_seed,
|
.def_readwrite("random_seed", &type::random_seed,
|
||||||
"The random seed used by the internal random number generator")
|
"The random seed used by the internal random number generator")
|
||||||
|
.def_readwrite("num_threads", &type::num_threads,
|
||||||
|
"Use this many threads/CPU cores for training.")
|
||||||
.def("__str__", &::print_shape_predictor_training_options)
|
.def("__str__", &::print_shape_predictor_training_options)
|
||||||
.def(py::pickle(&getstate<type>, &setstate<type>));
|
.def(py::pickle(&getstate<type>, &setstate<type>));
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ namespace dlib
|
|||||||
num_test_splits = 20;
|
num_test_splits = 20;
|
||||||
feature_pool_region_padding = 0;
|
feature_pool_region_padding = 0;
|
||||||
random_seed = "";
|
random_seed = "";
|
||||||
|
num_threads = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool be_verbose;
|
bool be_verbose;
|
||||||
@ -43,6 +44,9 @@ namespace dlib
|
|||||||
unsigned long num_test_splits;
|
unsigned long num_test_splits;
|
||||||
double feature_pool_region_padding;
|
double feature_pool_region_padding;
|
||||||
std::string random_seed;
|
std::string random_seed;
|
||||||
|
|
||||||
|
// not serialized
|
||||||
|
unsigned long num_threads;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void serialize (
|
inline void serialize (
|
||||||
@ -110,6 +114,7 @@ namespace dlib
|
|||||||
<< "num_test_splits=" << o.num_test_splits << ","
|
<< "num_test_splits=" << o.num_test_splits << ","
|
||||||
<< "feature_pool_region_padding=" << o.feature_pool_region_padding << ","
|
<< "feature_pool_region_padding=" << o.feature_pool_region_padding << ","
|
||||||
<< "random_seed=" << o.random_seed
|
<< "random_seed=" << o.random_seed
|
||||||
|
<< "num_threads=" << o.num_threads
|
||||||
<< ")";
|
<< ")";
|
||||||
return sout.str();
|
return sout.str();
|
||||||
}
|
}
|
||||||
@ -165,6 +170,7 @@ namespace dlib
|
|||||||
trainer.set_feature_pool_region_padding(options.feature_pool_region_padding);
|
trainer.set_feature_pool_region_padding(options.feature_pool_region_padding);
|
||||||
trainer.set_lambda(options.lambda_param);
|
trainer.set_lambda(options.lambda_param);
|
||||||
trainer.set_num_test_splits(options.num_test_splits);
|
trainer.set_num_test_splits(options.num_test_splits);
|
||||||
|
trainer.set_num_threads(options.num_threads);
|
||||||
|
|
||||||
if (options.be_verbose)
|
if (options.be_verbose)
|
||||||
{
|
{
|
||||||
@ -176,6 +182,7 @@ namespace dlib
|
|||||||
std::cout << "Training with oversampling amount: " << options.oversampling_amount << std::endl;
|
std::cout << "Training with oversampling amount: " << options.oversampling_amount << std::endl;
|
||||||
std::cout << "Training with feature pool size: " << options.feature_pool_size << std::endl;
|
std::cout << "Training with feature pool size: " << options.feature_pool_size << std::endl;
|
||||||
std::cout << "Training with feature pool region padding: " << options.feature_pool_region_padding << std::endl;
|
std::cout << "Training with feature pool region padding: " << options.feature_pool_region_padding << std::endl;
|
||||||
|
std::cout << "Training with " << options.num_threads << " threads." << std::endl;
|
||||||
std::cout << "Training with lambda_param: " << options.lambda_param << std::endl;
|
std::cout << "Training with lambda_param: " << options.lambda_param << std::endl;
|
||||||
std::cout << "Training with " << options.num_test_splits << " split tests."<< std::endl;
|
std::cout << "Training with " << options.num_test_splits << " split tests."<< std::endl;
|
||||||
trainer.be_verbose();
|
trainer.be_verbose();
|
||||||
|
Loading…
Reference in New Issue
Block a user