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
0fede57e
Commit
0fede57e
authored
Dec 16, 2020
by
Davis King
Browse files
Make the mmod loss not spam messages in the unit tests
parent
c5c761b5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
9 deletions
+24
-9
dlib/dnn/loss.h
dlib/dnn/loss.h
+18
-9
dlib/dnn/loss_abstract.h
dlib/dnn/loss_abstract.h
+5
-0
dlib/test/dnn.cpp
dlib/test/dnn.cpp
+1
-0
No files found.
dlib/dnn/loss.h
View file @
0fede57e
...
...
@@ -941,6 +941,9 @@ namespace dlib
test_box_overlap
overlaps_ignore
;
bool
use_bounding_box_regression
=
false
;
double
bbr_lambda
=
100
;
// This field is intentionally not serialized because I want people to really think hard
// about ignoring the warnings that this suppresses.
bool
be_quiet
=
false
;
use_image_pyramid
assume_image_pyramid
=
use_image_pyramid
::
yes
;
...
...
@@ -1431,11 +1434,14 @@ namespace dlib
const
size_t
idx
=
(
k
*
output_tensor
.
nr
()
+
p
.
y
())
*
output_tensor
.
nc
()
+
p
.
x
();
const
auto
i
=
idx_to_truth_rect
.
find
(
idx
);
if
(
i
!=
idx_to_truth_rect
.
end
())
{
if
(
!
options
.
be_quiet
)
{
// Ignore duplicate truth box in feature coordinates.
std
::
cout
<<
"Warning, ignoring object. We encountered a truth rectangle located at "
<<
x
.
rect
;
std
::
cout
<<
", and we are ignoring it because it maps to the exact same feature coordinates "
;
std
::
cout
<<
"as another truth rectangle located at "
<<
i
->
second
<<
"."
<<
std
::
endl
;
}
loss
-=
options
.
loss_per_missed_target
;
truth_idxs
.
push_back
(
-
1
);
...
...
@@ -1515,6 +1521,8 @@ namespace dlib
// added for it in the code above.
loss
-=
options
.
loss_per_missed_target
-
out_data
[
idx
];
g
[
idx
]
=
0
;
if
(
!
options
.
be_quiet
)
{
std
::
cout
<<
"Warning, ignoring object. We encountered a truth rectangle located at "
<<
(
*
truth
)[
i
].
rect
;
std
::
cout
<<
" that is suppressed by non-max-suppression "
;
std
::
cout
<<
"because it is overlapped by another truth rectangle located at "
<<
best_matching_truth_box
...
...
@@ -1524,6 +1532,7 @@ namespace dlib
}
}
}
}
hit_truth_table
.
assign
(
hit_truth_table
.
size
(),
false
);
final_dets
.
clear
();
...
...
dlib/dnn/loss_abstract.h
View file @
0fede57e
...
...
@@ -861,6 +861,11 @@ namespace dlib
// getting the bounding box shape correct.
double
bbr_lambda
=
100
;
// Tell the loss not to print warnings about impossible labels. You should think very hard
// before turning this off as it's very often telling you something is really wrong with
// your training data.
bool
be_quiet
=
false
;
mmod_options
(
const
std
::
vector
<
std
::
vector
<
mmod_rect
>>&
boxes
,
const
unsigned
long
target_size
,
...
...
dlib/test/dnn.cpp
View file @
0fede57e
...
...
@@ -4006,6 +4006,7 @@ namespace
const
std
::
vector
<
mmod_rect
>
labels
=
generate_labels
();
mmod_options
options
(
use_image_pyramid
::
no
,
{
labels
});
options
.
be_quiet
=
true
;
// Define a simple network.
using
net_type
=
loss_mmod
<
con
<
1
,
5
,
5
,
1
,
1
,
con
<
1
,
5
,
5
,
2
,
2
,
input
<
input_image_type
>>>>
;
...
...
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