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
c4408812
Commit
c4408812
authored
Dec 09, 2018
by
Kai Chen
Browse files
bug fix for focal loss
parent
ddda131f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
mmdet/core/loss/losses.py
mmdet/core/loss/losses.py
+2
-1
No files found.
mmdet/core/loss/losses.py
View file @
c4408812
...
@@ -35,7 +35,8 @@ def sigmoid_focal_loss(pred,
...
@@ -35,7 +35,8 @@ def sigmoid_focal_loss(pred,
pt
=
(
1
-
pred_sigmoid
)
*
target
+
pred_sigmoid
*
(
1
-
target
)
pt
=
(
1
-
pred_sigmoid
)
*
target
+
pred_sigmoid
*
(
1
-
target
)
weight
=
(
alpha
*
target
+
(
1
-
alpha
)
*
(
1
-
target
))
*
weight
weight
=
(
alpha
*
target
+
(
1
-
alpha
)
*
(
1
-
target
))
*
weight
weight
=
weight
*
pt
.
pow
(
gamma
)
weight
=
weight
*
pt
.
pow
(
gamma
)
loss
=
F
.
binary_cross_entropy_with_logits
(
pred
,
target
,
reduction
=
'none'
)
loss
=
F
.
binary_cross_entropy_with_logits
(
pred
,
target
,
reduction
=
'none'
)
*
weight
reduction_enum
=
F
.
_Reduction
.
get_enum
(
reduction
)
reduction_enum
=
F
.
_Reduction
.
get_enum
(
reduction
)
# none: 0, mean:1, sum: 2
# none: 0, mean:1, sum: 2
if
reduction_enum
==
0
:
if
reduction_enum
==
0
:
...
...
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