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
e3af40d5
Commit
e3af40d5
authored
May 26, 2014
by
Davis King
Browse files
Updated example to use evaluate_detectors()
parent
4f275bd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
17 deletions
+5
-17
examples/fhog_object_detector_ex.cpp
examples/fhog_object_detector_ex.cpp
+5
-17
No files found.
examples/fhog_object_detector_ex.cpp
View file @
e3af40d5
...
@@ -225,25 +225,13 @@ int main(int argc, char** argv)
...
@@ -225,25 +225,13 @@ int main(int argc, char** argv)
// trainer.train() function. The trainer will simply disregard any detections that
// trainer.train() function. The trainer will simply disregard any detections that
// happen to hit these boxes.
// happen to hit these boxes.
//
//
// Another useful thing you can do is pack multiple HOG detectors into one
// Another useful thing you can do is evaluate multiple HOG detectors together. The
// object_detector. The main benefit of this is increased testing speed since it
// benefit of this is increased testing speed since it avoids recomputing the HOG
// avoids recomputing the HOG features for each run of the detector. This is how
// features for each run of the detector. You do this by storing your detectors
// the face detector that comes with dlib works (see get_frontal_face_detector()).
// into a std::vector and then invoking evaluate_detectors() like so:
// It contains 5 different detectors. One for front looking faces with no
// rotation, another for faces rotated to the left about 30 degrees, one for a
// right rotation of 30 degrees. Then two more detectors, one for faces looking to
// the left and another to the right. However, note that all HOG detectors packed
// into a single object_detector must have been trained with the same settings for
// the sliding window size and the scanner padding option (see the scan_fhog_pyramid
// documentation for a discussion of padding). This is because they all share the
// same scanner object inside the object_detector.
//
// To pack multiple detectors into a single object_detector you use code like this:
std
::
vector
<
object_detector
<
image_scanner_type
>
>
my_detectors
;
std
::
vector
<
object_detector
<
image_scanner_type
>
>
my_detectors
;
// Add your component detectors into my_detectors.
my_detectors
.
push_back
(
detector
);
my_detectors
.
push_back
(
detector
);
// Then just construct an object_detector from the set of detectors.
std
::
vector
<
rectangle
>
dets
=
evaluate_detectors
(
my_detectors
,
images_train
[
0
]);
object_detector
<
image_scanner_type
>
this_object_has_multiple_detectors
(
my_detectors
);
//
//
//
//
// Finally, you can add a nuclear norm regularizer to the SVM trainer. Doing has
// Finally, you can add a nuclear norm regularizer to the SVM trainer. Doing has
...
...
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