Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
22b57e6e
P
PaddleOCR
项目概览
PaddlePaddle
/
PaddleOCR
大约 1 年 前同步成功
通知
1528
Star
32962
Fork
6643
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
108
列表
看板
标记
里程碑
合并请求
7
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
108
Issue
108
列表
看板
标记
里程碑
合并请求
7
合并请求
7
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
22b57e6e
编写于
4月 07, 2022
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rec pact hang
上级
41ba8776
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
10 deletion
+36
-10
deploy/slim/quantization/export_model.py
deploy/slim/quantization/export_model.py
+1
-0
ppocr/modeling/heads/rec_ctc_head.py
ppocr/modeling/heads/rec_ctc_head.py
+2
-1
test_tipc/configs/ch_PP-OCRv2_rec_PACT/train_infer_python.txt
..._tipc/configs/ch_PP-OCRv2_rec_PACT/train_infer_python.txt
+4
-4
test_tipc/configs/det_mv3_east_v2.0/train_infer_python.txt
test_tipc/configs/det_mv3_east_v2.0/train_infer_python.txt
+2
-2
test_tipc/prepare.sh
test_tipc/prepare.sh
+8
-0
tools/infer/utility.py
tools/infer/utility.py
+19
-3
未找到文件。
deploy/slim/quantization/export_model.py
浏览文件 @
22b57e6e
...
@@ -127,6 +127,7 @@ def main():
...
@@ -127,6 +127,7 @@ def main():
arch_config
=
config
[
"Architecture"
]
arch_config
=
config
[
"Architecture"
]
if
arch_config
[
"algorithm"
]
in
[
"Distillation"
,
]:
# distillation model
if
arch_config
[
"algorithm"
]
in
[
"Distillation"
,
]:
# distillation model
for
idx
,
name
in
enumerate
(
model
.
model_name_list
):
for
idx
,
name
in
enumerate
(
model
.
model_name_list
):
model
.
model_list
[
idx
].
eval
()
sub_model_save_path
=
os
.
path
.
join
(
save_path
,
name
,
"inference"
)
sub_model_save_path
=
os
.
path
.
join
(
save_path
,
name
,
"inference"
)
export_single_model
(
quanter
,
model
.
model_list
[
idx
],
infer_shape
,
export_single_model
(
quanter
,
model
.
model_list
[
idx
],
infer_shape
,
sub_model_save_path
,
logger
)
sub_model_save_path
,
logger
)
...
...
ppocr/modeling/heads/rec_ctc_head.py
浏览文件 @
22b57e6e
...
@@ -80,8 +80,9 @@ class CTCHead(nn.Layer):
...
@@ -80,8 +80,9 @@ class CTCHead(nn.Layer):
result
=
(
x
,
predicts
)
result
=
(
x
,
predicts
)
else
:
else
:
result
=
predicts
result
=
predicts
print
(
"self.training: "
,
self
.
training
)
if
not
self
.
training
:
if
not
self
.
training
:
print
(
"self.training, "
,
self
.
training
)
predicts
=
F
.
softmax
(
predicts
,
axis
=
2
)
predicts
=
F
.
softmax
(
predicts
,
axis
=
2
)
result
=
predicts
result
=
predicts
...
...
test_tipc/configs/ch_PP-OCRv2_rec_PACT/train_infer_python.txt
浏览文件 @
22b57e6e
===========================train_params===========================
===========================train_params===========================
model_name:
PPOCRv2_ocr_rec_pact
model_name:
ch_PPOCRv2_rec_PACT
python:python3.7
python:python3.7
gpu_list:
0|0,1
gpu_list:
6
Global.use_gpu:True|True
Global.use_gpu:True|True
Global.auto_cast:fp32
Global.auto_cast:fp32
Global.epoch_num:lite_train_lite_infer=
3
|whole_train_whole_infer=300
Global.epoch_num:lite_train_lite_infer=
6
|whole_train_whole_infer=300
Global.save_model_dir:./output/
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=128
Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=128
Global.pretrained_model:
null
Global.pretrained_model:
pretrain_models/ch_PP-OCRv2_rec_train/best_accuracy
train_model_name:latest
train_model_name:latest
train_infer_img_dir:./inference/rec_inference
train_infer_img_dir:./inference/rec_inference
null:null
null:null
...
...
test_tipc/configs/det_mv3_east_v2.0/train_infer_python.txt
浏览文件 @
22b57e6e
===========================train_params===========================
===========================train_params===========================
model_name:det_mv3_east_v2.0
model_name:det_mv3_east_v2.0
python:python3.7
python:python3.7
gpu_list:0
gpu_list:0
|0,1
Global.use_gpu:True|True
Global.use_gpu:True|True
Global.auto_cast:fp32
Global.auto_cast:fp32
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=500
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=500
Global.save_model_dir:./output/
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_infer=4
Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_infer=4
Global.pretrained_model:
null
Global.pretrained_model:
./pretrain_models/det_mv3_east_v2.0_train/best_accuracy
train_model_name:latest
train_model_name:latest
train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/
train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/
null:null
null:null
...
...
test_tipc/prepare.sh
浏览文件 @
22b57e6e
...
@@ -64,6 +64,10 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
...
@@ -64,6 +64,10 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_ppocr_server_v2.0_det_train.tar
&&
cd
../
cd
./pretrain_models/
&&
tar
xf ch_ppocr_server_v2.0_det_train.tar
&&
cd
../
fi
fi
if
[
${
model_name
}
==
"ch_PPOCRv2_rec"
]
||
[
${
model_name
}
==
"ch_PPOCRv2_rec_PACT"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_rec_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_rec_train.tar
&&
cd
../
fi
if
[
${
model_name
}
==
"det_r18_db_v2_0"
]
;
then
if
[
${
model_name
}
==
"det_r18_db_v2_0"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/pretrained/ResNet18_vd_pretrained.pdparams
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/pretrained/ResNet18_vd_pretrained.pdparams
--no-check-certificate
fi
fi
...
@@ -91,6 +95,10 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
...
@@ -91,6 +95,10 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_ppocr_mobile_v2.0_rec_train.tar
&&
cd
../
cd
./pretrain_models/
&&
tar
xf ch_ppocr_mobile_v2.0_rec_train.tar
&&
cd
../
fi
fi
if
[
${
model_name
}
==
"det_mv3_east_v2.0"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_east_v2.0_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf det_mv3_east_v2.0_train.tar
&&
cd
../
fi
elif
[
${
MODE
}
=
"whole_train_whole_infer"
]
;
then
elif
[
${
MODE
}
=
"whole_train_whole_infer"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
--no-check-certificate
...
...
tools/infer/utility.py
浏览文件 @
22b57e6e
...
@@ -312,12 +312,28 @@ def create_predictor(args, mode, logger):
...
@@ -312,12 +312,28 @@ def create_predictor(args, mode, logger):
input_names
=
predictor
.
get_input_names
()
input_names
=
predictor
.
get_input_names
()
for
name
in
input_names
:
for
name
in
input_names
:
input_tensor
=
predictor
.
get_input_handle
(
name
)
input_tensor
=
predictor
.
get_input_handle
(
name
)
output_names
=
predictor
.
get_output_names
()
output_tensors
=
get_output_tensors
(
args
,
mode
,
predictor
)
output_tensors
=
[]
#output_names = predictor.get_output_names()
#output_tensors = []
#print("output names", output_names)
#for output_name in output_names:
# output_tensor = predictor.get_output_handle(output_name)
# output_tensors.append(output_tensor)
return
predictor
,
input_tensor
,
output_tensors
,
config
def
get_output_tensors
(
args
,
mode
,
predictor
):
output_names
=
predictor
.
get_output_names
()
output_tensors
=
[]
if
mode
==
"rec"
and
args
.
rec_algorithm
==
"CRNN"
:
output_name
=
'softmax_0.tmp_0'
if
output_name
in
output_names
:
return
[
predictor
.
get_output_handle
(
output_name
)]
else
:
for
output_name
in
output_names
:
for
output_name
in
output_names
:
output_tensor
=
predictor
.
get_output_handle
(
output_name
)
output_tensor
=
predictor
.
get_output_handle
(
output_name
)
output_tensors
.
append
(
output_tensor
)
output_tensors
.
append
(
output_tensor
)
return
predictor
,
input_tensor
,
output_tensors
,
config
return
output_tensors
def
get_infer_gpuid
():
def
get_infer_gpuid
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录