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
wangsen
paddle_dbnet
Commits
202a0b5b
Commit
202a0b5b
authored
Jul 06, 2021
by
LDOUBLEV
Browse files
add det distill combined
parent
e174e9ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
ppocr/losses/combined_loss.py
ppocr/losses/combined_loss.py
+7
-5
No files found.
ppocr/losses/combined_loss.py
View file @
202a0b5b
...
...
@@ -44,15 +44,17 @@ class CombinedLoss(nn.Layer):
def
forward
(
self
,
input
,
batch
,
**
kargs
):
loss_dict
=
{}
loss_all
=
0.
for
idx
,
loss_func
in
enumerate
(
self
.
loss_func
):
loss
=
loss_func
(
input
,
batch
,
**
kargs
)
if
isinstance
(
loss
,
paddle
.
Tensor
):
loss
=
{
"loss_{}_{}"
.
format
(
str
(
loss
),
idx
):
loss
}
weight
=
self
.
loss_weight
[
idx
]
loss
=
{
"{}_{}"
.
format
(
key
,
idx
):
loss
[
key
]
*
weight
for
key
in
loss
}
for
key
in
loss
:
if
key
==
"loss"
:
loss_all
+=
loss
[
key
]
*
weight
# else:
# loss[f"{key}_{idx}"] = loss[key]
loss_dict
.
update
(
loss
)
loss_dict
[
"loss"
]
=
paddle
.
add_n
(
list
(
loss_dict
.
values
()))
loss_dict
[
"loss"
]
=
loss_all
return
loss_dict
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