Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
3126372c
"examples/vscode:/vscode.git/clone" did not exist on "c3a043eb23027bd3fa417b474d9f753bf9c75e72"
Commit
3126372c
authored
Jun 08, 2018
by
Davis King
Browse files
Added the translation jittering option to the python API.
parent
a9c940b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
tools/python/src/shape_predictor.cpp
tools/python/src/shape_predictor.cpp
+2
-0
tools/python/src/shape_predictor.h
tools/python/src/shape_predictor.h
+9
-0
No files found.
tools/python/src/shape_predictor.cpp
View file @
3126372c
...
...
@@ -189,6 +189,8 @@ void bind_shape_predictors(py::module &m)
cause overfitting. The value must be in the range (0, 1]."
)
.
def_readwrite
(
"oversampling_amount"
,
&
type
::
oversampling_amount
,
"The number of randomly selected initial starting points sampled for each training example"
)
.
def_readwrite
(
"oversampling_translation_jitter"
,
&
type
::
oversampling_translation_jitter
,
"The amount of translation jittering to apply to bounding boxes, a good value is in in the range [0 0.5]."
)
.
def_readwrite
(
"feature_pool_size"
,
&
type
::
feature_pool_size
,
"Number of pixels used to generate features for the random trees."
)
.
def_readwrite
(
"lambda_param"
,
&
type
::
lambda_param
,
...
...
tools/python/src/shape_predictor.h
View file @
3126372c
...
...
@@ -25,6 +25,7 @@ namespace dlib
num_trees_per_cascade_level
=
500
;
nu
=
0.1
;
oversampling_amount
=
20
;
oversampling_translation_jitter
=
0
;
feature_pool_size
=
400
;
lambda_param
=
0.1
;
num_test_splits
=
20
;
...
...
@@ -39,6 +40,7 @@ namespace dlib
unsigned
long
num_trees_per_cascade_level
;
double
nu
;
unsigned
long
oversampling_amount
;
double
oversampling_translation_jitter
;
unsigned
long
feature_pool_size
;
double
lambda_param
;
unsigned
long
num_test_splits
;
...
...
@@ -56,12 +58,14 @@ namespace dlib
{
try
{
serialize
(
"shape_predictor_training_options"
,
out
);
serialize
(
item
.
be_verbose
,
out
);
serialize
(
item
.
cascade_depth
,
out
);
serialize
(
item
.
tree_depth
,
out
);
serialize
(
item
.
num_trees_per_cascade_level
,
out
);
serialize
(
item
.
nu
,
out
);
serialize
(
item
.
oversampling_amount
,
out
);
serialize
(
item
.
oversampling_translation_jitter
,
out
);
serialize
(
item
.
feature_pool_size
,
out
);
serialize
(
item
.
lambda_param
,
out
);
serialize
(
item
.
num_test_splits
,
out
);
...
...
@@ -81,12 +85,14 @@ namespace dlib
{
try
{
check_serialized_version
(
"shape_predictor_training_options"
,
in
);
deserialize
(
item
.
be_verbose
,
in
);
deserialize
(
item
.
cascade_depth
,
in
);
deserialize
(
item
.
tree_depth
,
in
);
deserialize
(
item
.
num_trees_per_cascade_level
,
in
);
deserialize
(
item
.
nu
,
in
);
deserialize
(
item
.
oversampling_amount
,
in
);
deserialize
(
item
.
oversampling_translation_jitter
,
in
);
deserialize
(
item
.
feature_pool_size
,
in
);
deserialize
(
item
.
lambda_param
,
in
);
deserialize
(
item
.
num_test_splits
,
in
);
...
...
@@ -109,6 +115,7 @@ namespace dlib
<<
"num_trees_per_cascade_level="
<<
o
.
num_trees_per_cascade_level
<<
","
<<
"nu="
<<
o
.
nu
<<
","
<<
"oversampling_amount="
<<
o
.
oversampling_amount
<<
","
<<
"oversampling_translation_jitter="
<<
o
.
oversampling_translation_jitter
<<
","
<<
"feature_pool_size="
<<
o
.
feature_pool_size
<<
","
<<
"lambda_param="
<<
o
.
lambda_param
<<
","
<<
"num_test_splits="
<<
o
.
num_test_splits
<<
","
...
...
@@ -166,6 +173,7 @@ namespace dlib
trainer
.
set_nu
(
options
.
nu
);
trainer
.
set_random_seed
(
options
.
random_seed
);
trainer
.
set_oversampling_amount
(
options
.
oversampling_amount
);
trainer
.
set_oversampling_translation_jitter
(
options
.
oversampling_translation_jitter
);
trainer
.
set_feature_pool_size
(
options
.
feature_pool_size
);
trainer
.
set_feature_pool_region_padding
(
options
.
feature_pool_region_padding
);
trainer
.
set_lambda
(
options
.
lambda_param
);
...
...
@@ -180,6 +188,7 @@ namespace dlib
std
::
cout
<<
"Training with nu: "
<<
options
.
nu
<<
std
::
endl
;
std
::
cout
<<
"Training with random seed: "
<<
options
.
random_seed
<<
std
::
endl
;
std
::
cout
<<
"Training with oversampling amount: "
<<
options
.
oversampling_amount
<<
std
::
endl
;
std
::
cout
<<
"Training with oversampling translation jitter: "
<<
options
.
oversampling_translation_jitter
<<
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 "
<<
options
.
num_threads
<<
" threads."
<<
std
::
endl
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment