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
1ec5a945
"git@developer.sourcefind.cn:change/sglang.git" did not exist on "9d5fa68b903d295d2b39201d54905c6801f60f7f"
Commit
1ec5a945
authored
Feb 10, 2018
by
Davis King
Browse files
Added comments about how to run multiple detectors together efficiently.
parent
2d3dd3c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
python_examples/train_object_detector.py
python_examples/train_object_detector.py
+14
-0
No files found.
python_examples/train_object_detector.py
View file @
1ec5a945
...
...
@@ -131,6 +131,20 @@ for f in glob.glob(os.path.join(faces_folder, "*.jpg")):
# Next, suppose you have trained multiple detectors and you want to run them
# efficiently as a group. You can do this as follows:
detector1
=
dlib
.
fhog_object_detector
(
"detector.svm"
)
# In this example we load detector.svm again since it's the only one we have on
# hand. But in general it would be a different detector.
detector2
=
dlib
.
fhog_object_detector
(
"detector.svm"
)
# make a list of all the detectors you wan to run. Here we have 2, but you
# could have any number.
detectors
=
[
detector1
,
detector2
]
image
=
io
.
imread
(
faces_folder
+
'/2008_002506.jpg'
);
[
boxes
,
confidences
,
detector_idxs
]
=
dlib
.
fhog_object_detector
.
run_multiple
(
detectors
,
image
,
upsample_num_times
=
1
,
adjust_threshold
=
0.0
)
for
i
in
range
(
len
(
boxes
)):
print
(
"detector {} found box {} with confidence {}."
.
format
(
detector_idxs
[
i
],
boxes
[
i
],
confidences
[
i
]))
...
...
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