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
7fd3da34
Commit
7fd3da34
authored
Jan 02, 2012
by
Davis King
Browse files
Added some code to help detect and debug improperly coded feature extractors.
parent
0b2bfdde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
dlib/image_processing/scan_image_pyramid.h
dlib/image_processing/scan_image_pyramid.h
+28
-1
No files found.
dlib/image_processing/scan_image_pyramid.h
View file @
7fd3da34
...
@@ -148,6 +148,32 @@ namespace dlib
...
@@ -148,6 +148,32 @@ namespace dlib
return
(
r1
.
intersect
(
r2
).
area
())
/
(
double
)(
r1
+
r2
).
area
();
return
(
r1
.
intersect
(
r2
).
area
())
/
(
double
)(
r1
+
r2
).
area
();
}
}
void
test_coordinate_transforms
()
{
for
(
long
x
=
-
10
;
x
<=
10
;
x
+=
10
)
{
for
(
long
y
=
-
10
;
y
<=
10
;
y
+=
10
)
{
const
rectangle
rect
=
centered_rect
(
x
,
y
,
5
,
6
);
rectangle
a
;
a
=
feats_config
.
image_to_feat_space
(
rect
);
if
(
a
.
width
()
>
10000000
||
a
.
height
()
>
10000000
)
{
DLIB_CASSERT
(
false
,
"The image_to_feat_space() routine is outputting rectangles of an implausibly "
<<
"
\n
large size. This means there is probably a bug in your feature extractor."
);
}
a
=
feats_config
.
feat_to_image_space
(
rect
);
if
(
a
.
width
()
>
10000000
||
a
.
height
()
>
10000000
)
{
DLIB_CASSERT
(
false
,
"The feat_to_image_space() routine is outputting rectangles of an implausibly "
<<
"
\n
large size. This means there is probably a bug in your feature extractor."
);
}
}
}
}
feature_extractor_type
feats_config
;
// just here to hold configuration. use it to populate the feats elements.
feature_extractor_type
feats_config
;
// just here to hold configuration. use it to populate the feats elements.
typename
array
<
feature_extractor_type
>::
kernel_2a
feats
;
typename
array
<
feature_extractor_type
>::
kernel_2a
feats
;
std
::
vector
<
detection_template
>
det_templates
;
std
::
vector
<
detection_template
>
det_templates
;
...
@@ -318,7 +344,8 @@ namespace dlib
...
@@ -318,7 +344,8 @@ namespace dlib
const
feature_extractor_type
&
fe
const
feature_extractor_type
&
fe
)
)
{
{
return
feats_config
.
copy_configuration
(
fe
);
test_coordinate_transforms
();
feats_config
.
copy_configuration
(
fe
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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