Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
527e26df
Commit
527e26df
authored
Jun 19, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added max runtime option to object detector trainer API in python.
parent
7d3fac55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
object_detection.cpp
tools/python/src/object_detection.cpp
+13
-1
simple_object_detector.h
tools/python/src/simple_object_detector.h
+6
-1
No files found.
tools/python/src/object_detection.cpp
View file @
527e26df
...
...
@@ -177,6 +177,8 @@ process take significantly longer, so be patient when using it."
process take significantly longer, so be patient when using it.
!*/
)
.
def_readwrite
(
"max_runtime_seconds"
,
&
type
::
max_runtime_seconds
,
"Don't let the solver run for longer than this many seconds."
)
.
def_readwrite
(
"C"
,
&
type
::
C
,
"C is the usual SVM C regularization parameter. So it is passed to
\n
\
structural_object_detection_trainer::set_c(). Larger values of C
\n
\
...
...
@@ -407,13 +409,23 @@ ensures \n\
bunch of other simple_object_detectors. It essentially packs them together
\n
\
so that when you run the detector it's like calling run_multiple(). Except
\n
\
in this case the non-max suppression is applied to them all as a group. So
\n
\
unlike run_multiple(), each detector competes in the non-max suppression."
unlike run_multiple(), each detector competes in the non-max suppression.
\n
\
\n
\
Also, the non-max suppression settings used for this whole thing are
\n
\
the settings used by detectors[0]. So if you have a preference,
\n
\
put the detector that uses the type of non-max suppression you like first
\n
\
in the list."
/*!
This version of the constructor builds a simple_object_detector from a
bunch of other simple_object_detectors. It essentially packs them together
so that when you run the detector it's like calling run_multiple(). Except
in this case the non-max suppression is applied to them all as a group. So
unlike run_multiple(), each detector competes in the non-max suppression.
Also, the non-max suppression settings used for this whole thing are
the settings used by detectors[0]. So if you have a preference,
put the detector that uses the type of non-max suppression you like first
in the list.
!*/
)
.
def
(
py
::
init
(
&
load_object_from_file
<
type
>
),
...
...
tools/python/src/simple_object_detector.h
View file @
527e26df
...
...
@@ -36,6 +36,7 @@ namespace dlib
epsilon
=
0
.
01
;
upsample_limit
=
2
;
nuclear_norm_regularization_strength
=
0
;
max_runtime_seconds
=
86400
*
365
*
100
;
// 100 years
}
bool
be_verbose
;
...
...
@@ -46,7 +47,7 @@ namespace dlib
double
epsilon
;
unsigned
long
upsample_limit
;
double
nuclear_norm_regularization_strength
;
double
max_runtime_seconds
;
};
inline
std
::
string
print_simple_object_detector_training_options
(
const
simple_object_detector_training_options
&
o
)
...
...
@@ -59,6 +60,7 @@ namespace dlib
<<
"detection_window_size="
<<
o
.
detection_window_size
<<
", "
<<
"C="
<<
o
.
C
<<
", "
<<
"epsilon="
<<
o
.
epsilon
<<
", "
<<
"max_runtime_seconds="
<<
o
.
max_runtime_seconds
<<
", "
<<
"upsample_limit="
<<
o
.
upsample_limit
<<
", "
<<
"nuclear_norm_regularization_strength="
<<
o
.
nuclear_norm_regularization_strength
<<
")"
;
...
...
@@ -162,6 +164,8 @@ namespace dlib
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."
);
if
(
options
.
max_runtime_seconds
<=
0
)
throw
error
(
"Invalid max_runtime_seconds value given to train_simple_object_detector(), max_runtime_seconds must be > 0."
);
if
(
options
.
nuclear_norm_regularization_strength
<
0
)
throw
error
(
"Invalid nuclear_norm_regularization_strength value given to train_simple_object_detector(), it must be must be >= 0."
);
...
...
@@ -184,6 +188,7 @@ namespace dlib
trainer
.
set_num_threads
(
options
.
num_threads
);
trainer
.
set_c
(
options
.
C
);
trainer
.
set_epsilon
(
options
.
epsilon
);
trainer
.
set_max_runtime
(
std
::
chrono
::
milliseconds
((
int64_t
)
std
::
round
(
options
.
max_runtime_seconds
*
1000
)));
if
(
options
.
be_verbose
)
{
std
::
cout
<<
"Training with C: "
<<
options
.
C
<<
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