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
f8f71535
Commit
f8f71535
authored
Sep 01, 2021
by
WenmuZhou
Browse files
use eps instald of 0.001
parent
a4b0241a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
ppocr/losses/det_pse_loss.py
ppocr/losses/det_pse_loss.py
+4
-4
No files found.
ppocr/losses/det_pse_loss.py
View file @
f8f71535
...
...
@@ -25,7 +25,7 @@ class PSELoss(nn.Layer):
ohem_ratio
=
3
,
kernel_sample_mask
=
'pred'
,
reduction
=
'sum'
,
**
kwargs
):
eps
=
1e-6
**
kwargs
):
"""Implement PSE Loss.
"""
super
(
PSELoss
,
self
).
__init__
()
...
...
@@ -34,6 +34,7 @@ class PSELoss(nn.Layer):
self
.
ohem_ratio
=
ohem_ratio
self
.
kernel_sample_mask
=
kernel_sample_mask
self
.
reduction
=
reduction
self
.
eps
=
eps
def
forward
(
self
,
outputs
,
labels
):
predicts
=
outputs
[
'maps'
]
...
...
@@ -92,8 +93,8 @@ class PSELoss(nn.Layer):
target
=
target
*
mask
a
=
paddle
.
sum
(
input
*
target
,
1
)
b
=
paddle
.
sum
(
input
*
input
,
1
)
+
0.001
c
=
paddle
.
sum
(
target
*
target
,
1
)
+
0.001
b
=
paddle
.
sum
(
input
*
input
,
1
)
+
self
.
eps
c
=
paddle
.
sum
(
target
*
target
,
1
)
+
self
.
eps
d
=
(
2
*
a
)
/
(
b
+
c
)
return
1
-
d
...
...
@@ -104,7 +105,6 @@ class PSELoss(nn.Layer):
.
astype
(
'float32'
)))
if
pos_num
==
0
:
# selected_mask = gt_text.copy() * 0 # may be not good
selected_mask
=
training_mask
selected_mask
=
selected_mask
.
reshape
(
[
1
,
selected_mask
.
shape
[
0
],
selected_mask
.
shape
[
1
]]).
astype
(
...
...
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