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
11113836
Commit
11113836
authored
Jan 21, 2012
by
Davis King
Browse files
Added a unit test for fine_hog_image.
parent
060f6c91
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
dlib/test/object_detector.cpp
dlib/test/object_detector.cpp
+43
-0
No files found.
dlib/test/object_detector.cpp
View file @
11113836
...
@@ -290,6 +290,48 @@ namespace
...
@@ -290,6 +290,48 @@ namespace
}
}
}
}
// ----------------------------------------------------------------------------------------
void
test_1_fine_hog
(
)
{
print_spinner
();
dlog
<<
LINFO
<<
"test_1_fine_hog()"
;
typedef
array
<
array2d
<
unsigned
char
>
>::
expand_1b
grayscale_image_array_type
;
grayscale_image_array_type
images
;
std
::
vector
<
std
::
vector
<
rectangle
>
>
object_locations
;
make_simple_test_data
(
images
,
object_locations
);
typedef
hashed_feature_image
<
fine_hog_image
<
3
,
3
,
2
,
4
,
hog_signed_gradient
>
>
feature_extractor_type
;
typedef
scan_image_pyramid
<
pyramid_down
,
feature_extractor_type
>
image_scanner_type
;
image_scanner_type
scanner
;
const
rectangle
object_box
=
compute_box_dimensions
(
1
,
35
*
35
);
scanner
.
add_detection_template
(
object_box
,
create_grid_detection_template
(
object_box
,
2
,
2
));
setup_hashed_features
(
scanner
,
images
,
9
);
structural_object_detection_trainer
<
image_scanner_type
>
trainer
(
scanner
);
trainer
.
set_num_threads
(
4
);
trainer
.
set_overlap_tester
(
test_box_overlap
(
0
,
0
));
object_detector
<
image_scanner_type
>
detector
=
trainer
.
train
(
images
,
object_locations
);
matrix
<
double
>
res
=
test_object_detection_function
(
detector
,
images
,
object_locations
);
dlog
<<
LINFO
<<
"Test detector (precision,recall): "
<<
res
;
DLIB_TEST
(
sum
(
res
)
==
2
);
{
ostringstream
sout
;
serialize
(
detector
,
sout
);
istringstream
sin
(
sout
.
str
());
object_detector
<
image_scanner_type
>
d2
;
deserialize
(
d2
,
sin
);
matrix
<
double
>
res
=
test_object_detection_function
(
detector
,
images
,
object_locations
);
dlog
<<
LINFO
<<
"Test detector (precision,recall): "
<<
res
;
DLIB_TEST
(
sum
(
res
)
==
2
);
validate_some_object_detector_stuff
(
images
,
detector
);
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
void
test_1_poly
(
void
test_1_poly
(
...
@@ -525,6 +567,7 @@ namespace
...
@@ -525,6 +567,7 @@ namespace
)
)
{
{
test_1
();
test_1
();
test_1_fine_hog
();
test_1_poly
();
test_1_poly
();
test_1_poly_nn
();
test_1_poly_nn
();
test_2
();
test_2
();
...
...
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