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
ModelZoo
SOLOv2-pytorch
Commits
f724f9ac
Commit
f724f9ac
authored
Jun 21, 2019
by
qiang chen
Committed by
Kai Chen
Jun 21, 2019
Browse files
fix potential bug in binary_cross_entropy (#846)
parent
32df98e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
mmdet/models/losses/cross_entropy_loss.py
mmdet/models/losses/cross_entropy_loss.py
+3
-4
No files found.
mmdet/models/losses/cross_entropy_loss.py
View file @
f724f9ac
...
...
@@ -29,14 +29,13 @@ def binary_cross_entropy(pred,
if
pred
.
dim
()
!=
label
.
dim
():
label
,
weight
=
_expand_binary_labels
(
label
,
weight
,
pred
.
size
(
-
1
))
# element-wise losses
#
weighted
element-wise losses
if
weight
is
not
None
:
weight
=
weight
.
float
()
loss
=
F
.
binary_cross_entropy_with_logits
(
pred
,
label
.
float
(),
weight
,
reduction
=
'none'
)
# apply weights and do the reduction
loss
=
weight_reduce_loss
(
loss
,
weight
=
weight
,
reduction
=
reduction
,
avg_factor
=
avg_factor
)
# do the reduction for the weighted loss
loss
=
weight_reduce_loss
(
loss
,
reduction
=
reduction
,
avg_factor
=
avg_factor
)
return
loss
...
...
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