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
77f6c9f2
Commit
77f6c9f2
authored
Nov 23, 2013
by
Davis King
Browse files
Made num_separable_filters() work with multi-filter object detectors.
parent
d02e6472
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
+20
-10
dlib/image_processing/scan_fhog_pyramid.h
dlib/image_processing/scan_fhog_pyramid.h
+13
-6
dlib/image_processing/scan_fhog_pyramid_abstract.h
dlib/image_processing/scan_fhog_pyramid_abstract.h
+7
-4
No files found.
dlib/image_processing/scan_fhog_pyramid.h
View file @
77f6c9f2
...
@@ -874,8 +874,8 @@ namespace dlib
...
@@ -874,8 +874,8 @@ namespace dlib
DLIB_ASSERT
(
weight_index
<
detector
.
num_detectors
(),
DLIB_ASSERT
(
weight_index
<
detector
.
num_detectors
(),
"
\t
matrix draw_fhog()"
"
\t
matrix draw_fhog()"
<<
"
\n\t
Invalid arguments were given to this function. "
<<
"
\n\t
Invalid arguments were given to this function. "
<<
"
\n\t
cell_draw_size: "
<<
cell_draw_size
<<
"
\n\t
weight_index: "
<<
weight_index
<<
"
\n\t
detector.num_detectors():
"
<<
detector
.
num_detectors
()
<<
"
\n\t
detector.num_detectors(): "
<<
detector
.
num_detectors
()
);
);
DLIB_ASSERT
(
cell_draw_size
>
0
&&
detector
.
get_w
(
weight_index
).
size
()
>=
detector
.
get_scanner
().
get_num_dimensions
(),
DLIB_ASSERT
(
cell_draw_size
>
0
&&
detector
.
get_w
(
weight_index
).
size
()
>=
detector
.
get_scanner
().
get_num_dimensions
(),
"
\t
matrix draw_fhog()"
"
\t
matrix draw_fhog()"
...
@@ -896,18 +896,25 @@ namespace dlib
...
@@ -896,18 +896,25 @@ namespace dlib
typename
Pyramid_type
typename
Pyramid_type
>
>
unsigned
long
num_separable_filters
(
unsigned
long
num_separable_filters
(
const
object_detector
<
scan_fhog_pyramid
<
Pyramid_type
>
>&
detector
const
object_detector
<
scan_fhog_pyramid
<
Pyramid_type
>
>&
detector
,
const
unsigned
long
weight_index
=
0
)
)
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
DLIB_ASSERT
(
detector
.
get_w
().
size
()
>=
detector
.
get_scanner
().
get_num_dimensions
()
,
DLIB_ASSERT
(
weight_index
<
detector
.
num_detectors
(),
"
\t
unsigned long num_separable_filters()"
<<
"
\n\t
Invalid arguments were given to this function. "
<<
"
\n\t
weight_index: "
<<
weight_index
<<
"
\n\t
detector.num_detectors(): "
<<
detector
.
num_detectors
()
);
DLIB_ASSERT
(
detector
.
get_w
(
weight_index
).
size
()
>=
detector
.
get_scanner
().
get_num_dimensions
()
,
"
\t
unsigned long num_separable_filters()"
"
\t
unsigned long num_separable_filters()"
<<
"
\n\t
Invalid arguments were given to this function. "
<<
"
\n\t
Invalid arguments were given to this function. "
<<
"
\n\t
detector.get_w().size():
"
<<
detector
.
get_w
().
size
()
<<
"
\n\t
detector.get_w(
weight_index
).size(): "
<<
detector
.
get_w
(
weight_index
).
size
()
<<
"
\n\t
detector.get_scanner().get_num_dimensions(): "
<<
detector
.
get_scanner
().
get_num_dimensions
()
<<
"
\n\t
detector.get_scanner().get_num_dimensions(): "
<<
detector
.
get_scanner
().
get_num_dimensions
()
);
);
typename
scan_fhog_pyramid
<
Pyramid_type
>::
fhog_filterbank
fb
=
detector
.
get_scanner
().
build_fhog_filterbank
(
detector
.
get_w
());
typename
scan_fhog_pyramid
<
Pyramid_type
>::
fhog_filterbank
fb
=
detector
.
get_scanner
().
build_fhog_filterbank
(
detector
.
get_w
(
weight_index
));
return
fb
.
num_separable_filters
();
return
fb
.
num_separable_filters
();
}
}
...
...
dlib/image_processing/scan_fhog_pyramid_abstract.h
View file @
77f6c9f2
...
@@ -24,7 +24,7 @@ namespace dlib
...
@@ -24,7 +24,7 @@ namespace dlib
requires
requires
- cell_draw_size > 0
- cell_draw_size > 0
- weight_index < detector.num_detectors()
- weight_index < detector.num_detectors()
- detector.get_w().size() >= detector.get_scanner().get_num_dimensions()
- detector.get_w(
weight_index
).size() >= detector.get_scanner().get_num_dimensions()
(i.e. the detector must have been populated with a HOG filter)
(i.e. the detector must have been populated with a HOG filter)
ensures
ensures
- Converts the HOG filters in the given detector (specifically, the filters in
- Converts the HOG filters in the given detector (specifically, the filters in
...
@@ -40,15 +40,18 @@ namespace dlib
...
@@ -40,15 +40,18 @@ namespace dlib
typename
Pyramid_type
typename
Pyramid_type
>
>
unsigned
long
num_separable_filters
(
unsigned
long
num_separable_filters
(
const
object_detector
<
scan_fhog_pyramid
<
Pyramid_type
>
>&
detector
const
object_detector
<
scan_fhog_pyramid
<
Pyramid_type
>
>&
detector
,
const
unsigned
long
weight_index
=
0
);
);
/*!
/*!
requires
requires
- detector.get_w().size() >= detector.get_scanner().get_num_dimensions()
- weight_index < detector.num_detectors()
- detector.get_w(weight_index).size() >= detector.get_scanner().get_num_dimensions()
(i.e. the detector must have been populated with a HOG filter)
(i.e. the detector must have been populated with a HOG filter)
ensures
ensures
- Returns the number of separable filters necessary to represent the HOG
- Returns the number of separable filters necessary to represent the HOG
filters in the given detector.
filters in the given detector's weight_index'th filter. This is the filter
defined by detector.get_w(weight_index).
!*/
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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