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
2e002ac2
Commit
2e002ac2
authored
Mar 30, 2016
by
Evgeniy Fominov
Browse files
Python/Simple object detector trainer. Added upsample_limit option
parent
14d34ec9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
tools/python/src/object_detection.cpp
tools/python/src/object_detection.cpp
+9
-1
tools/python/src/simple_object_detector.h
tools/python/src/simple_object_detector.h
+3
-1
No files found.
tools/python/src/object_detection.cpp
View file @
2e002ac2
...
@@ -159,7 +159,15 @@ solver more accurate but might take longer to train.")
...
@@ -159,7 +159,15 @@ solver more accurate but might take longer to train.")
&
type
::
num_threads
,
&
type
::
num_threads
,
"train_simple_object_detector() will use this many threads of
\n
\
"train_simple_object_detector() will use this many threads of
\n
\
execution. Set this to the number of CPU cores on your machine to
\n
\
execution. Set this to the number of CPU cores on your machine to
\n
\
obtain the fastest training speed."
);
obtain the fastest training speed."
)
.
add_property
(
"upsample_limit"
,
&
type
::
upsample_limit
,
&
type
::
upsample_limit
,
"train_simple_object_detector() will upsample images if needed
\n
\
no more than upsample_limit times. Value 0 will forbid trainer to
\n
\
upsample any images. If trainer is unable to fit all boxes with
\n
\
required upsample_limit, exception will be thrown. Higher values
\n
\
of upsample_limit exponentially increases memory requiremens.
\n
\
Values higher than 2 (default) are not recommended."
);
}
}
{
{
typedef
simple_test_results
type
;
typedef
simple_test_results
type
;
...
...
tools/python/src/simple_object_detector.h
View file @
2e002ac2
...
@@ -33,6 +33,7 @@ namespace dlib
...
@@ -33,6 +33,7 @@ namespace dlib
detection_window_size
=
80
*
80
;
detection_window_size
=
80
*
80
;
C
=
1
;
C
=
1
;
epsilon
=
0.01
;
epsilon
=
0.01
;
upsample_limit
=
2
;
}
}
bool
be_verbose
;
bool
be_verbose
;
...
@@ -41,6 +42,7 @@ namespace dlib
...
@@ -41,6 +42,7 @@ namespace dlib
unsigned
long
detection_window_size
;
unsigned
long
detection_window_size
;
double
C
;
double
C
;
double
epsilon
;
double
epsilon
;
unsigned
long
upsample_limit
;
};
};
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -175,7 +177,7 @@ namespace dlib
...
@@ -175,7 +177,7 @@ namespace dlib
// upsample the images at most two times to help make the boxes obtainable.
// upsample the images at most two times to help make the boxes obtainable.
std
::
vector
<
std
::
vector
<
rectangle
>
>
temp
(
boxes
),
removed
;
std
::
vector
<
std
::
vector
<
rectangle
>
>
temp
(
boxes
),
removed
;
removed
=
remove_unobtainable_rectangles
(
trainer
,
images
,
temp
);
removed
=
remove_unobtainable_rectangles
(
trainer
,
images
,
temp
);
while
(
impl
::
contains_any_boxes
(
removed
)
&&
upsampling_amount
<
2
)
while
(
impl
::
contains_any_boxes
(
removed
)
&&
upsampling_amount
<
options
.
upsample_limit
)
{
{
++
upsampling_amount
;
++
upsampling_amount
;
if
(
options
.
be_verbose
)
if
(
options
.
be_verbose
)
...
...
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