Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
a2e932c0
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看板
提交
a2e932c0
编写于
10月 26, 2020
作者:
B
baiyfbupt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add cls model quant code
上级
309c2e9d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
8 addition
and
1 deletion
+8
-1
deploy/slim/quantization/export_model.py
deploy/slim/quantization/export_model.py
+3
-0
deploy/slim/quantization/quant.py
deploy/slim/quantization/quant.py
+4
-1
ppocr/modeling/architectures/cls_model.py
ppocr/modeling/architectures/cls_model.py
+1
-0
未找到文件。
deploy/slim/quantization/export_model.py
浏览文件 @
a2e932c0
...
@@ -51,6 +51,7 @@ from paddleslim.quant import quant_aware, convert
...
@@ -51,6 +51,7 @@ from paddleslim.quant import quant_aware, convert
from
paddle.fluid.layer_helper
import
LayerHelper
from
paddle.fluid.layer_helper
import
LayerHelper
from
eval_utils.eval_det_utils
import
eval_det_run
from
eval_utils.eval_det_utils
import
eval_det_run
from
eval_utils.eval_rec_utils
import
eval_rec_run
from
eval_utils.eval_rec_utils
import
eval_rec_run
from
eval_utils.eval_cls_utils
import
eval_cls_run
def
main
():
def
main
():
...
@@ -105,6 +106,8 @@ def main():
...
@@ -105,6 +106,8 @@ def main():
if
alg_type
==
'det'
:
if
alg_type
==
'det'
:
final_metrics
=
eval_det_run
(
exe
,
config
,
quant_info_dict
,
"eval"
)
final_metrics
=
eval_det_run
(
exe
,
config
,
quant_info_dict
,
"eval"
)
elif
alg_type
==
'cls'
:
final_metrics
=
eval_cls_run
(
exe
,
quant_info_dict
)
else
:
else
:
final_metrics
=
eval_rec_run
(
exe
,
config
,
quant_info_dict
,
"eval"
)
final_metrics
=
eval_rec_run
(
exe
,
config
,
quant_info_dict
,
"eval"
)
print
(
final_metrics
)
print
(
final_metrics
)
...
...
deploy/slim/quantization/quant.py
浏览文件 @
a2e932c0
...
@@ -178,9 +178,12 @@ def main():
...
@@ -178,9 +178,12 @@ def main():
if
train_alg_type
==
'det'
:
if
train_alg_type
==
'det'
:
program
.
train_eval_det_run
(
program
.
train_eval_det_run
(
config
,
exe
,
train_info_dict
,
eval_info_dict
,
is_slim
=
"quant"
)
config
,
exe
,
train_info_dict
,
eval_info_dict
,
is_slim
=
"quant"
)
el
se
:
el
if
train_alg_type
==
'rec'
:
program
.
train_eval_rec_run
(
program
.
train_eval_rec_run
(
config
,
exe
,
train_info_dict
,
eval_info_dict
,
is_slim
=
"quant"
)
config
,
exe
,
train_info_dict
,
eval_info_dict
,
is_slim
=
"quant"
)
else
:
program
.
train_eval_cls_run
(
config
,
exe
,
train_info_dict
,
eval_info_dict
,
is_slim
=
"quant"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
ppocr/modeling/architectures/cls_model.py
浏览文件 @
a2e932c0
...
@@ -65,6 +65,7 @@ class ClsModel(object):
...
@@ -65,6 +65,7 @@ class ClsModel(object):
labels
=
None
labels
=
None
loader
=
None
loader
=
None
image
=
fluid
.
data
(
name
=
'image'
,
shape
=
image_shape
,
dtype
=
'float32'
)
image
=
fluid
.
data
(
name
=
'image'
,
shape
=
image_shape
,
dtype
=
'float32'
)
image
.
stop_gradient
=
False
return
image
,
labels
,
loader
return
image
,
labels
,
loader
def
__call__
(
self
,
mode
):
def
__call__
(
self
,
mode
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录