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
312157ab
Commit
312157ab
authored
Mar 09, 2014
by
Davis King
Browse files
Added epsilon to the python object detection training API.
parent
4b6087f7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
tools/python/src/object_detection.cpp
tools/python/src/object_detection.cpp
+9
-0
tools/python/src/simple_object_detector.h
tools/python/src/simple_object_detector.h
+7
-1
tools/python/src/simple_object_detector_abstract.h
tools/python/src/simple_object_detector_abstract.h
+4
-0
No files found.
tools/python/src/object_detection.cpp
View file @
312157ab
...
...
@@ -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
\
...
...
tools/python/src/simple_object_detector.h
View file @
312157ab
...
...
@@ -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
)
...
...
tools/python/src/simple_object_detector_abstract.h
View file @
312157ab
...
...
@@ -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
;
};
// ----------------------------------------------------------------------------------------
...
...
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