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
afb7ec86
Commit
afb7ec86
authored
Jun 11, 2019
by
Ge Zheng
Committed by
Kai Chen
Jun 11, 2019
Browse files
Avoid log(0) in iou_loss, which will lead to Nan. (#733)
* Update losses.py * Update losses.py
parent
76d0af9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
mmdet/core/loss/losses.py
mmdet/core/loss/losses.py
+3
-3
No files found.
mmdet/core/loss/losses.py
View file @
afb7ec86
...
...
@@ -214,7 +214,7 @@ def weighted_iou_loss(pred,
loss
=
bounded_iou_loss
(
pred
[
inds
],
target
[
inds
],
beta
=
beta
,
eps
=
eps
,
reduction
=
'sum'
)
else
:
loss
=
iou_loss
(
pred
[
inds
],
target
[
inds
],
reduction
=
'sum'
)
loss
=
iou_loss
(
pred
[
inds
],
target
[
inds
],
eps
=
eps
,
reduction
=
'sum'
)
loss
=
loss
[
None
]
/
avg_factor
return
loss
...
...
@@ -248,8 +248,8 @@ def _expand_binary_labels(labels, label_weights, label_channels):
return
bin_labels
,
bin_label_weights
def
iou_loss
(
pred_bboxes
,
target_bboxes
,
reduction
=
'mean'
):
ious
=
bbox_overlaps
(
pred_bboxes
,
target_bboxes
,
is_aligned
=
True
)
def
iou_loss
(
pred_bboxes
,
target_bboxes
,
eps
=
1e-6
,
reduction
=
'mean'
):
ious
=
bbox_overlaps
(
pred_bboxes
,
target_bboxes
,
is_aligned
=
True
)
+
eps
loss
=
-
ious
.
log
()
reduction_enum
=
F
.
_Reduction
.
get_enum
(
reduction
)
...
...
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