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
a41e0cdb
Commit
a41e0cdb
authored
Oct 14, 2019
by
Juha Reunanen
Committed by
Davis E. King
Oct 14, 2019
Browse files
Primarily match to truth rects that haven't been hit already (#1897)
parent
1264521e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
dlib/dnn/loss.h
dlib/dnn/loss.h
+17
-10
No files found.
dlib/dnn/loss.h
View file @
a41e0cdb
...
@@ -1204,7 +1204,7 @@ namespace dlib
...
@@ -1204,7 +1204,7 @@ namespace dlib
const
auto
&
det_label
=
options
.
detector_windows
[
dets
[
i
].
tensor_channel
].
label
;
const
auto
&
det_label
=
options
.
detector_windows
[
dets
[
i
].
tensor_channel
].
label
;
const
std
::
pair
<
double
,
unsigned
int
>
hittruth
=
find_best_match
(
*
truth
,
dets
[
i
].
rect
,
det_label
);
const
std
::
pair
<
double
,
unsigned
int
>
hittruth
=
find_best_match
(
*
truth
,
hit_truth_table
,
dets
[
i
].
rect
,
det_label
);
final_dets
.
push_back
(
dets
[
i
].
rect
);
final_dets
.
push_back
(
dets
[
i
].
rect
);
...
@@ -1273,7 +1273,7 @@ namespace dlib
...
@@ -1273,7 +1273,7 @@ namespace dlib
const
auto
&
det_label
=
options
.
detector_windows
[
dets
[
i
].
tensor_channel
].
label
;
const
auto
&
det_label
=
options
.
detector_windows
[
dets
[
i
].
tensor_channel
].
label
;
const
std
::
pair
<
double
,
unsigned
int
>
hittruth
=
find_best_match
(
*
truth
,
dets
[
i
].
rect
,
det_label
);
const
std
::
pair
<
double
,
unsigned
int
>
hittruth
=
find_best_match
(
*
truth
,
hit_truth_table
,
dets
[
i
].
rect
,
det_label
);
const
double
truth_match
=
hittruth
.
first
;
const
double
truth_match
=
hittruth
.
first
;
if
(
truth_match
>
options
.
truth_match_iou_threshold
)
if
(
truth_match
>
options
.
truth_match_iou_threshold
)
...
@@ -1633,16 +1633,22 @@ namespace dlib
...
@@ -1633,16 +1633,22 @@ namespace dlib
std
::
pair
<
double
,
unsigned
int
>
find_best_match
(
std
::
pair
<
double
,
unsigned
int
>
find_best_match
(
const
std
::
vector
<
mmod_rect
>&
boxes
,
const
std
::
vector
<
mmod_rect
>&
boxes
,
const
std
::
vector
<
bool
>&
hit_truth_table
,
const
rectangle
&
rect
,
const
rectangle
&
rect
,
const
std
::
string
&
label
const
std
::
string
&
label
)
const
)
const
{
{
double
match
=
0
;
double
match
=
0
;
unsigned
int
best_idx
=
0
;
unsigned
int
best_idx
=
0
;
for
(
int
allow_duplicate_hit
=
0
;
allow_duplicate_hit
<=
1
&&
match
==
0
;
++
allow_duplicate_hit
)
{
for
(
unsigned
long
i
=
0
;
i
<
boxes
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
boxes
.
size
();
++
i
)
{
{
if
(
boxes
[
i
].
ignore
||
boxes
[
i
].
label
!=
label
)
if
(
boxes
[
i
].
ignore
||
boxes
[
i
].
label
!=
label
)
continue
;
continue
;
if
(
!
allow_duplicate_hit
&&
hit_truth_table
[
i
])
continue
;
const
double
new_match
=
box_intersection_over_union
(
rect
,
boxes
[
i
]);
const
double
new_match
=
box_intersection_over_union
(
rect
,
boxes
[
i
]);
if
(
new_match
>
match
)
if
(
new_match
>
match
)
...
@@ -1651,6 +1657,7 @@ namespace dlib
...
@@ -1651,6 +1657,7 @@ namespace dlib
best_idx
=
i
;
best_idx
=
i
;
}
}
}
}
}
return
std
::
make_pair
(
match
,
best_idx
);
return
std
::
make_pair
(
match
,
best_idx
);
}
}
...
...
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