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
7109fadc
Unverified
Commit
7109fadc
authored
Dec 19, 2021
by
zhoujun
Committed by
GitHub
Dec 19, 2021
Browse files
Merge pull request #4971 from LDOUBLEV/sdmgr
fix win
parents
b8b5faaf
e6a29707
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
ppocr/data/imaug/label_ops.py
ppocr/data/imaug/label_ops.py
+1
-1
ppocr/metrics/rec_metric.py
ppocr/metrics/rec_metric.py
+3
-3
No files found.
ppocr/data/imaug/label_ops.py
View file @
7109fadc
...
@@ -291,7 +291,7 @@ class KieLabelEncode(object):
...
@@ -291,7 +291,7 @@ class KieLabelEncode(object):
def
__init__
(
self
,
character_dict_path
,
norm
=
10
,
directed
=
False
,
**
kwargs
):
def
__init__
(
self
,
character_dict_path
,
norm
=
10
,
directed
=
False
,
**
kwargs
):
super
(
KieLabelEncode
,
self
).
__init__
()
super
(
KieLabelEncode
,
self
).
__init__
()
self
.
dict
=
dict
({
''
:
0
})
self
.
dict
=
dict
({
''
:
0
})
with
open
(
character_dict_path
,
'r'
)
as
fr
:
with
open
(
character_dict_path
,
'r'
,
encoding
=
'utf-8'
)
as
fr
:
idx
=
1
idx
=
1
for
line
in
fr
:
for
line
in
fr
:
char
=
line
.
strip
()
char
=
line
.
strip
()
...
...
ppocr/metrics/rec_metric.py
View file @
7109fadc
...
@@ -48,7 +48,7 @@ class RecMetric(object):
...
@@ -48,7 +48,7 @@ class RecMetric(object):
self
.
norm_edit_dis
+=
norm_edit_dis
self
.
norm_edit_dis
+=
norm_edit_dis
return
{
return
{
'acc'
:
correct_num
/
all_num
,
'acc'
:
correct_num
/
all_num
,
'norm_edit_dis'
:
1
-
norm_edit_dis
/
all_num
'norm_edit_dis'
:
1
-
norm_edit_dis
/
(
all_num
+
1e-3
)
}
}
def
get_metric
(
self
):
def
get_metric
(
self
):
...
@@ -58,8 +58,8 @@ class RecMetric(object):
...
@@ -58,8 +58,8 @@ class RecMetric(object):
'norm_edit_dis': 0,
'norm_edit_dis': 0,
}
}
"""
"""
acc
=
1.0
*
self
.
correct_num
/
self
.
all_num
acc
=
1.0
*
self
.
correct_num
/
(
self
.
all_num
+
1e-3
)
norm_edit_dis
=
1
-
self
.
norm_edit_dis
/
self
.
all_num
norm_edit_dis
=
1
-
self
.
norm_edit_dis
/
(
self
.
all_num
+
1e-3
)
self
.
reset
()
self
.
reset
()
return
{
'acc'
:
acc
,
'norm_edit_dis'
:
norm_edit_dis
}
return
{
'acc'
:
acc
,
'norm_edit_dis'
:
norm_edit_dis
}
...
...
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