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
60318cb3
"tests/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "d114d80fd2b5a1b7c5f3d2ec67b92a442d8f18f9"
Commit
60318cb3
authored
Dec 10, 2014
by
Patrick Snape
Browse files
Add example of testing detector using existing data
parent
cc3bb499
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
python_examples/train_object_detector.py
python_examples/train_object_detector.py
+7
-3
No files found.
python_examples/train_object_detector.py
View file @
60318cb3
...
...
@@ -66,11 +66,11 @@ dlib.train_simple_object_detector(faces_folder+"/training.xml", "detector.svm",
# Now that we have a face detector we can test it. The first statement tests
# it on the training data. It will print(the precision, recall, and then)
# average precision.
print
(
"
\n
training accuracy:
"
,
dlib
.
test_simple_object_detector
(
faces_folder
+
"/training.xml"
,
"detector.svm"
))
print
(
"
\n
training accuracy:
{}"
.
format
(
dlib
.
test_simple_object_detector
(
faces_folder
+
"/training.xml"
,
"detector.svm"
))
)
# However, to get an idea if it really worked without overfitting we need to
# run it on images it wasn't trained on. The next line does this. Happily, we
# see that the object detector works perfectly on the testing images.
print
(
"testing accuracy:
"
,
dlib
.
test_simple_object_detector
(
faces_folder
+
"/testing.xml"
,
"detector.svm"
))
print
(
"testing accuracy:
{}"
.
format
(
dlib
.
test_simple_object_detector
(
faces_folder
+
"/testing.xml"
,
"detector.svm"
))
)
...
...
@@ -128,4 +128,8 @@ detector2 = dlib.simple_object_detector("detector2.svm")
win_det
.
set_image
(
detector2
)
raw_input
(
"Hit enter to continue"
)
# Note that you don't have to use the XML based input to
# test_simple_object_detector(). If you have already loaded your training
# images and bounding boxes for the objects then you can call it as shown
# below.
print
(
"Training accuracy: {}"
.
format
(
dlib
.
test_simple_object_detector
(
images
,
boxes
,
"detector.svm"
)))
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