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
92a3c410
Commit
92a3c410
authored
Jul 31, 2013
by
Davis King
Browse files
Fixed a bug in the object_detector testing code that caused the average
precision values to be slightly wrong.
parent
c0c1995d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
dlib/svm/cross_validate_object_detection_trainer.h
dlib/svm/cross_validate_object_detection_trainer.h
+11
-16
No files found.
dlib/svm/cross_validate_object_detection_trainer.h
View file @
92a3c410
...
@@ -50,32 +50,27 @@ namespace dlib
...
@@ -50,32 +50,27 @@ namespace dlib
std
::
vector
<
bool
>
used
(
boxes
.
size
(),
false
);
std
::
vector
<
bool
>
used
(
boxes
.
size
(),
false
);
for
(
unsigned
long
i
=
0
;
i
<
truth_boxes
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
truth_boxes
.
size
();
++
i
)
{
{
unsigned
long
best_idx
=
0
;
bool
found_match
=
false
;
double
best_overlap
=
0
;
// Find the first box that hits truth_boxes[i]
// Find the best box that hits truth_boxes[i]
for
(
unsigned
long
j
=
0
;
j
<
boxes
.
size
();
++
j
)
for
(
unsigned
long
j
=
0
;
j
<
boxes
.
size
();
++
j
)
{
{
if
(
used
[
j
])
if
(
used
[
j
])
continue
;
continue
;
const
double
overlap
=
truth_boxes
[
i
].
get_rect
().
intersect
(
boxes
[
j
].
second
).
area
()
/
(
double
)(
truth_boxes
[
i
].
get_rect
()
+
boxes
[
j
].
second
).
area
();
const
double
overlap
=
truth_boxes
[
i
].
get_rect
().
intersect
(
boxes
[
j
].
second
).
area
()
/
if
(
overlap
>
best_overlap
)
(
double
)(
truth_boxes
[
i
].
get_rect
()
+
boxes
[
j
].
second
).
area
();
if
(
overlap
>=
overlap_eps
)
{
{
best_overlap
=
overlap
;
used
[
j
]
=
true
;
best_idx
=
j
;
++
count
;
found_match
=
true
;
break
;
}
}
}
}
// if there was any box that hit truth_boxes[i]
if
(
!
found_match
)
if
(
best_overlap
>
overlap_eps
)
{
used
[
best_idx
]
=
true
;
++
count
;
}
else
{
++
missing_detections
;
++
missing_detections
;
}
}
}
for
(
unsigned
long
i
=
0
;
i
<
boxes
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
boxes
.
size
();
++
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