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
e4917130
Commit
e4917130
authored
Jun 22, 2019
by
Cao Yuhang
Committed by
Kai Chen
Jun 22, 2019
Browse files
add reduction_override to BoundedIoULoss (#850)
parent
4a0d7add
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
mmdet/models/losses/iou_loss.py
mmdet/models/losses/iou_loss.py
+11
-2
No files found.
mmdet/models/losses/iou_loss.py
View file @
e4917130
...
...
@@ -111,16 +111,25 @@ class BoundedIoULoss(nn.Module):
self
.
reduction
=
reduction
self
.
loss_weight
=
loss_weight
def
forward
(
self
,
pred
,
target
,
weight
=
None
,
avg_factor
=
None
,
**
kwargs
):
def
forward
(
self
,
pred
,
target
,
weight
=
None
,
avg_factor
=
None
,
reduction_override
=
None
,
**
kwargs
):
if
weight
is
not
None
and
not
torch
.
any
(
weight
>
0
):
return
(
pred
*
weight
).
sum
()
# 0
assert
reduction_override
in
(
None
,
'none'
,
'mean'
,
'sum'
)
reduction
=
(
reduction_override
if
reduction_override
else
self
.
reduction
)
loss
=
self
.
loss_weight
*
bounded_iou_loss
(
pred
,
target
,
weight
,
beta
=
self
.
beta
,
eps
=
self
.
eps
,
reduction
=
self
.
reduction
,
reduction
=
reduction
,
avg_factor
=
avg_factor
,
**
kwargs
)
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