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
e9a8efdc
Unverified
Commit
e9a8efdc
authored
Oct 10, 2022
by
Double_V
Committed by
GitHub
Oct 10, 2022
Browse files
Merge pull request #7006 from ChenNima/release/2.5-kie-config-ignore-classed
[KIE] add configurable ignore classes for KIEMetric
parents
a7365a0b
6b173e63
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
configs/kie/kie_unet_sdmgr.yml
configs/kie/kie_unet_sdmgr.yml
+2
-0
ppocr/metrics/kie_metric.py
ppocr/metrics/kie_metric.py
+6
-2
No files found.
configs/kie/kie_unet_sdmgr.yml
View file @
e9a8efdc
...
@@ -54,6 +54,8 @@ PostProcess:
...
@@ -54,6 +54,8 @@ PostProcess:
Metric
:
Metric
:
name
:
KIEMetric
name
:
KIEMetric
main_indicator
:
hmean
main_indicator
:
hmean
# Classes that will be ignored while computing F1 score.
ignore_classes
:
[
0
,
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
,
20
,
22
,
24
,
25
]
Train
:
Train
:
dataset
:
dataset
:
...
...
ppocr/metrics/kie_metric.py
View file @
e9a8efdc
...
@@ -24,8 +24,12 @@ __all__ = ['KIEMetric']
...
@@ -24,8 +24,12 @@ __all__ = ['KIEMetric']
class
KIEMetric
(
object
):
class
KIEMetric
(
object
):
def
__init__
(
self
,
main_indicator
=
'hmean'
,
**
kwargs
):
def
__init__
(
self
,
main_indicator
=
'hmean'
,
ignore_classes
=
[
0
,
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
,
20
,
22
,
24
,
25
],
**
kwargs
):
self
.
main_indicator
=
main_indicator
self
.
main_indicator
=
main_indicator
self
.
ignore_classes
=
ignore_classes
self
.
reset
()
self
.
reset
()
self
.
node
=
[]
self
.
node
=
[]
self
.
gt
=
[]
self
.
gt
=
[]
...
@@ -40,7 +44,7 @@ class KIEMetric(object):
...
@@ -40,7 +44,7 @@ class KIEMetric(object):
# self.results.append(result)
# self.results.append(result)
def
compute_f1_score
(
self
,
preds
,
gts
):
def
compute_f1_score
(
self
,
preds
,
gts
):
ignores
=
[
0
,
2
,
4
,
6
,
8
,
10
,
12
,
14
,
16
,
18
,
20
,
22
,
24
,
25
]
ignores
=
self
.
ignore_classes
C
=
preds
.
shape
[
1
]
C
=
preds
.
shape
[
1
]
classes
=
np
.
array
(
sorted
(
set
(
range
(
C
))
-
set
(
ignores
)))
classes
=
np
.
array
(
sorted
(
set
(
range
(
C
))
-
set
(
ignores
)))
hist
=
np
.
bincount
(
hist
=
np
.
bincount
(
...
...
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