Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
63d5f785
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
63d5f785
编写于
1月 19, 2022
作者:
Z
zhoujun
提交者:
GitHub
1月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5294 from WenmuZhou/fix_vqa
add eps
上级
05741178
60a1408d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
10 deletion
+13
-10
ppocr/metrics/cls_metric.py
ppocr/metrics/cls_metric.py
+3
-2
ppocr/metrics/rec_metric.py
ppocr/metrics/rec_metric.py
+5
-4
ppocr/metrics/table_metric.py
ppocr/metrics/table_metric.py
+5
-4
未找到文件。
ppocr/metrics/cls_metric.py
浏览文件 @
63d5f785
...
...
@@ -16,6 +16,7 @@
class
ClsMetric
(
object
):
def
__init__
(
self
,
main_indicator
=
'acc'
,
**
kwargs
):
self
.
main_indicator
=
main_indicator
self
.
eps
=
1e-5
self
.
reset
()
def
__call__
(
self
,
pred_label
,
*
args
,
**
kwargs
):
...
...
@@ -28,7 +29,7 @@ class ClsMetric(object):
all_num
+=
1
self
.
correct_num
+=
correct_num
self
.
all_num
+=
all_num
return
{
'acc'
:
correct_num
/
all_num
,
}
return
{
'acc'
:
correct_num
/
(
all_num
+
self
.
eps
)
,
}
def
get_metric
(
self
):
"""
...
...
@@ -36,7 +37,7 @@ class ClsMetric(object):
'acc': 0
}
"""
acc
=
self
.
correct_num
/
self
.
all_num
acc
=
self
.
correct_num
/
(
self
.
all_num
+
self
.
eps
)
self
.
reset
()
return
{
'acc'
:
acc
}
...
...
ppocr/metrics/rec_metric.py
浏览文件 @
63d5f785
...
...
@@ -20,6 +20,7 @@ class RecMetric(object):
def
__init__
(
self
,
main_indicator
=
'acc'
,
is_filter
=
False
,
**
kwargs
):
self
.
main_indicator
=
main_indicator
self
.
is_filter
=
is_filter
self
.
eps
=
1e-5
self
.
reset
()
def
_normalize_text
(
self
,
text
):
...
...
@@ -47,8 +48,8 @@ class RecMetric(object):
self
.
all_num
+=
all_num
self
.
norm_edit_dis
+=
norm_edit_dis
return
{
'acc'
:
correct_num
/
all_num
,
'norm_edit_dis'
:
1
-
norm_edit_dis
/
(
all_num
+
1e-3
)
'acc'
:
correct_num
/
(
all_num
+
self
.
eps
)
,
'norm_edit_dis'
:
1
-
norm_edit_dis
/
(
all_num
+
self
.
eps
)
}
def
get_metric
(
self
):
...
...
@@ -58,8 +59,8 @@ class RecMetric(object):
'norm_edit_dis': 0,
}
"""
acc
=
1.0
*
self
.
correct_num
/
(
self
.
all_num
+
1e-3
)
norm_edit_dis
=
1
-
self
.
norm_edit_dis
/
(
self
.
all_num
+
1e-3
)
acc
=
1.0
*
self
.
correct_num
/
(
self
.
all_num
+
self
.
eps
)
norm_edit_dis
=
1
-
self
.
norm_edit_dis
/
(
self
.
all_num
+
self
.
eps
)
self
.
reset
()
return
{
'acc'
:
acc
,
'norm_edit_dis'
:
norm_edit_dis
}
...
...
ppocr/metrics/table_metric.py
浏览文件 @
63d5f785
...
...
@@ -12,9 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
numpy
as
np
class
TableMetric
(
object
):
def
__init__
(
self
,
main_indicator
=
'acc'
,
**
kwargs
):
self
.
main_indicator
=
main_indicator
self
.
eps
=
1e-5
self
.
reset
()
def
__call__
(
self
,
pred
,
batch
,
*
args
,
**
kwargs
):
...
...
@@ -31,9 +34,7 @@ class TableMetric(object):
correct_num
+=
1
self
.
correct_num
+=
correct_num
self
.
all_num
+=
all_num
return
{
'acc'
:
correct_num
*
1.0
/
all_num
,
}
return
{
'acc'
:
correct_num
*
1.0
/
(
all_num
+
self
.
eps
),
}
def
get_metric
(
self
):
"""
...
...
@@ -41,7 +42,7 @@ class TableMetric(object):
'acc': 0,
}
"""
acc
=
1.0
*
self
.
correct_num
/
self
.
all_num
acc
=
1.0
*
self
.
correct_num
/
(
self
.
all_num
+
self
.
eps
)
self
.
reset
()
return
{
'acc'
:
acc
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录