Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
b7656e68
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看板
提交
b7656e68
编写于
5月 26, 2022
作者:
A
andyjpaddle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add paddle2onnx for tipc
上级
138371fb
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
236 addition
and
54 deletion
+236
-54
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+17
-0
test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+17
-0
test_tipc/configs/ch_PP-OCRv2_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+17
-0
test_tipc/configs/ch_PP-OCRv3/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+17
-0
test_tipc/configs/ch_PP-OCRv3_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+6
-3
test_tipc/configs/ch_PP-OCRv3_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+7
-4
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+17
-0
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+6
-3
test_tipc/configs/ch_ppocr_mobile_v2.0_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+8
-5
test_tipc/configs/ch_ppocr_server_v2.0/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+17
-0
test_tipc/configs/ch_ppocr_server_v2.0_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+7
-4
test_tipc/configs/ch_ppocr_server_v2.0_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
..._linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
+8
-5
test_tipc/test_paddle2onnx.sh
test_tipc/test_paddle2onnx.sh
+92
-30
未找到文件。
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
0 → 100644
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:ch_PP-OCRv2
python:python3.7
2onnx: paddle2onnx
--det_model_dir:./inference/ch_PP-OCRv2_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--det_save_file:./inference/det_v2_onnx/model.onnx
--rec_model_dir:./inference/ch_PP-OCRv2_rec_infer/
--rec_save_file:./inference/rec_v2_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_system.py --rec_image_shape="3,32,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
0 → 100644
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:ch_PP-OCRv2_det
python:python3.7
2onnx: paddle2onnx
--det_model_dir:./inference/ch_PP-OCRv2_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--det_save_file:./inference/det_v2_onnx/model.onnx
--rec_model_dir:
--rec_save_file:
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_det.py
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_PP-OCRv2_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
0 → 100644
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:ch_PP-OCRv2_rec
python:python3.7
2onnx: paddle2onnx
--det_model_dir:
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--det_save_file:
--rec_model_dir:./inference/ch_PP-OCRv2_rec_infer/
--rec_save_file:./inference/rec_v2_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_rec.py --rec_image_shape="3,32,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/rec_inference/
\ No newline at end of file
test_tipc/configs/ch_PP-OCRv3/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
0 → 100644
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:ch_PP-OCRv3
python:python3.7
2onnx: paddle2onnx
--det_model_dir:./inference/ch_PP-OCRv3_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--det_save_file:./inference/det_v3_onnx/model.onnx
--rec_model_dir:./inference/ch_PP-OCRv3_rec_infer/
--rec_save_file:./inference/rec_v3_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_system.py --rec_image_shape="3,48,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_PP-OCRv3_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:
ocr_det_v3
model_name:
ch_PP-OCRv3_det
python:python3.7
2onnx: paddle2onnx
--model_dir:./inference/ch_PP-OCRv3_det_infer/
--
det_
model_dir:./inference/ch_PP-OCRv3_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--save_file:./inference/det_v3_onnx/model.onnx
--det_save_file:./inference/det_v3_onnx/model.onnx
--rec_model_dir:
--rec_save_file:
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_det.py
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_PP-OCRv3_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:
ocr_rec_v3
model_name:
ch_PP-OCRv3_rec
python:python3.7
2onnx: paddle2onnx
--
model_dir:./inference/ch_PP-OCRv3_rec_infer/
--
det_model_dir:
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--save_file:./inference/rec_v3_onnx/model.onnx
--det_save_file:
--rec_model_dir:./inference/ch_PP-OCRv3_rec_infer/
--rec_save_file:./inference/rec_v3_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_rec.py --rec_image_shape="3,48,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/rec_inference
\ No newline at end of file
--image_dir:./inference/rec_inference/
\ No newline at end of file
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
0 → 100644
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:ch_ppocr_mobile_v2.0
python:python3.7
2onnx: paddle2onnx
--det_model_dir:./inference/ch_ppocr_mobile_v2.0_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--det_save_file:./inference/det_mobile_onnx/model.onnx
--rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/
--rec_save_file:./inference/rec_mobile_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_system.py --rec_image_shape="3,32,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:
ocr_det_mobile
model_name:
ch_ppocr_mobile_v2.0_det
python:python3.7
2onnx: paddle2onnx
--model_dir:./inference/ch_ppocr_mobile_v2.0_det_infer/
--
det_
model_dir:./inference/ch_ppocr_mobile_v2.0_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--save_file:./inference/det_mobile_onnx/model.onnx
--det_save_file:./inference/det_mobile_onnx/model.onnx
--rec_model_dir:
--rec_save_file:
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_det.py
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_ppocr_mobile_v2.0_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:
ocr_rec_mobile
model_name:
ch_ppocr_mobile_v2.0_rec
python:python3.7
2onnx: paddle2onnx
--
model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/
--
det_model_dir:
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--save_file:./inference/rec_mobile_onnx/model.onnx
--det_save_file:
--rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/
--rec_save_file:./inference/rec_mobile_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_rec.py
inference:tools/infer/predict_rec.py
--rec_image_shape="3,32,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/rec_inference
\ No newline at end of file
--image_dir:./inference/rec_inference/
\ No newline at end of file
test_tipc/configs/ch_ppocr_server_v2.0/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
0 → 100644
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:ch_ppocr_server_v2.0
python:python3.7
2onnx: paddle2onnx
--det_model_dir:./inference/ch_ppocr_server_v2.0_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--det_save_file:./inference/det_server_onnx/model.onnx
--rec_model_dir:./inference/ch_ppocr_server_v2.0_rec_infer/
--rec_save_file:./inference/rec_server_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_system.py --rec_image_shape="3,32,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_ppocr_server_v2.0_det/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:
ocr_det_server
model_name:
ch_ppocr_server_v2.0_det
python:python3.7
2onnx: paddle2onnx
--model_dir:./inference/ch_ppocr_server_v2.0_det_infer/
--
det_
model_dir:./inference/ch_ppocr_server_v2.0_det_infer/
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--save_file:./inference/det_server_onnx/model.onnx
--det_save_file:./inference/det_server_onnx/model.onnx
--rec_model_dir:
--rec_save_file:
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_det.py
--use_gpu:True|False
--det_model_dir:
--image_dir:./inference/det_inference
\ No newline at end of file
--rec_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
\ No newline at end of file
test_tipc/configs/ch_ppocr_server_v2.0_rec/model_linux_gpu_normal_normal_paddle2onnx_python_linux_cpu.txt
浏览文件 @
b7656e68
===========================paddle2onnx_params===========================
model_name:
ocr_rec_server
model_name:
ch_ppocr_server_v2.0_rec
python:python3.7
2onnx: paddle2onnx
--
model_dir:./inference/ch_ppocr_server_v2.0_rec_infer/
--
det_model_dir:
--model_filename:inference.pdmodel
--params_filename:inference.pdiparams
--save_file:./inference/rec_server_onnx/model.onnx
--det_save_file:
--rec_model_dir:./inference/ch_ppocr_server_v2.0_rec_infer/
--rec_save_file:./inference/rec_server_onnx/model.onnx
--opset_version:10
--enable_onnx_checker:True
inference:tools/infer/predict_rec.py
inference:tools/infer/predict_rec.py
--rec_image_shape="3,32,320"
--use_gpu:True|False
--det_model_dir:
--rec_model_dir:
--image_dir:./inference/rec_inference
\ No newline at end of file
--image_dir:./inference/rec_inference/
\ No newline at end of file
test_tipc/test_paddle2onnx.sh
浏览文件 @
b7656e68
...
...
@@ -11,7 +11,7 @@ python=$(func_parser_value "${lines[2]}")
# parser params
dataline
=
$(
awk
'NR==1, NR==1
4
{print}'
$FILENAME
)
dataline
=
$(
awk
'NR==1, NR==1
7
{print}'
$FILENAME
)
IFS
=
$'
\n
'
lines
=(
${
dataline
}
)
...
...
@@ -19,27 +19,32 @@ lines=(${dataline})
model_name
=
$(
func_parser_value
"
${
lines
[1]
}
"
)
python
=
$(
func_parser_value
"
${
lines
[2]
}
"
)
padlle2onnx_cmd
=
$(
func_parser_value
"
${
lines
[3]
}
"
)
infer_model_dir_key
=
$(
func_parser_key
"
${
lines
[4]
}
"
)
infer_model_dir_value
=
$(
func_parser_value
"
${
lines
[4]
}
"
)
det_
infer_model_dir_key
=
$(
func_parser_key
"
${
lines
[4]
}
"
)
det_
infer_model_dir_value
=
$(
func_parser_value
"
${
lines
[4]
}
"
)
model_filename_key
=
$(
func_parser_key
"
${
lines
[5]
}
"
)
model_filename_value
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
params_filename_key
=
$(
func_parser_key
"
${
lines
[6]
}
"
)
params_filename_value
=
$(
func_parser_value
"
${
lines
[6]
}
"
)
save_file_key
=
$(
func_parser_key
"
${
lines
[7]
}
"
)
save_file_value
=
$(
func_parser_value
"
${
lines
[7]
}
"
)
opset_version_key
=
$(
func_parser_key
"
${
lines
[8]
}
"
)
opset_version_value
=
$(
func_parser_value
"
${
lines
[8]
}
"
)
enable_onnx_checker_key
=
$(
func_parser_key
"
${
lines
[9]
}
"
)
enable_onnx_checker_value
=
$(
func_parser_value
"
${
lines
[9]
}
"
)
det_save_file_key
=
$(
func_parser_key
"
${
lines
[7]
}
"
)
det_save_file_value
=
$(
func_parser_value
"
${
lines
[7]
}
"
)
rec_infer_model_dir_key
=
$(
func_parser_key
"
${
lines
[8]
}
"
)
rec_infer_model_dir_value
=
$(
func_parser_value
"
${
lines
[8]
}
"
)
rec_save_file_key
=
$(
func_parser_key
"
${
lines
[9]
}
"
)
rec_save_file_value
=
$(
func_parser_value
"
${
lines
[9]
}
"
)
opset_version_key
=
$(
func_parser_key
"
${
lines
[10]
}
"
)
opset_version_value
=
$(
func_parser_value
"
${
lines
[10]
}
"
)
enable_onnx_checker_key
=
$(
func_parser_key
"
${
lines
[11]
}
"
)
enable_onnx_checker_value
=
$(
func_parser_value
"
${
lines
[11]
}
"
)
# parser onnx inference
inference_py
=
$(
func_parser_value
"
${
lines
[10]
}
"
)
use_gpu_key
=
$(
func_parser_key
"
${
lines
[11]
}
"
)
use_gpu_list
=
$(
func_parser_value
"
${
lines
[11]
}
"
)
det_model_key
=
$(
func_parser_key
"
${
lines
[12]
}
"
)
image_dir_key
=
$(
func_parser_key
"
${
lines
[13]
}
"
)
image_dir_value
=
$(
func_parser_value
"
${
lines
[13]
}
"
)
inference_py
=
$(
func_parser_value
"
${
lines
[12]
}
"
)
use_gpu_key
=
$(
func_parser_key
"
${
lines
[13]
}
"
)
use_gpu_list
=
$(
func_parser_value
"
${
lines
[13]
}
"
)
det_model_key
=
$(
func_parser_key
"
${
lines
[14]
}
"
)
rec_model_key
=
$(
func_parser_key
"
${
lines
[15]
}
"
)
image_dir_key
=
$(
func_parser_key
"
${
lines
[16]
}
"
)
image_dir_value
=
$(
func_parser_value
"
${
lines
[16]
}
"
)
LOG_PATH
=
"./test_tipc/output/
paddle2onnx/
${
model_name
}
"
LOG_PATH
=
"./test_tipc/output/
${
model_name
}
/paddle2onnx
"
mkdir
-p
${
LOG_PATH
}
status_log
=
"
${
LOG_PATH
}
/results_paddle2onnx.log"
...
...
@@ -49,24 +54,72 @@ function func_paddle2onnx(){
_script
=
$1
# paddle2onnx
set_dirname
=
$(
func_set_params
"
${
infer_model_dir_key
}
"
"
${
infer_model_dir_value
}
"
)
set_model_filename
=
$(
func_set_params
"
${
model_filename_key
}
"
"
${
model_filename_value
}
"
)
set_params_filename
=
$(
func_set_params
"
${
params_filename_key
}
"
"
${
params_filename_value
}
"
)
set_save_model
=
$(
func_set_params
"
${
save_file_key
}
"
"
${
save_file_value
}
"
)
set_opset_version
=
$(
func_set_params
"
${
opset_version_key
}
"
"
${
opset_version_value
}
"
)
set_enable_onnx_checker
=
$(
func_set_params
"
${
enable_onnx_checker_key
}
"
"
${
enable_onnx_checker_value
}
"
)
trans_model_cmd
=
"
${
padlle2onnx_cmd
}
${
set_dirname
}
${
set_model_filename
}
${
set_params_filename
}
${
set_save_model
}
${
set_opset_version
}
${
set_enable_onnx_checker
}
"
eval
$trans_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
status_check
$last_status
"
${
trans_model_cmd
}
"
"
${
status_log
}
"
if
[
${
model_name
}
=
"ch_PP-OCRv2"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0"
]
;
then
# trans det
set_dirname
=
$(
func_set_params
"--model_dir"
"
${
det_infer_model_dir_value
}
"
)
set_model_filename
=
$(
func_set_params
"
${
model_filename_key
}
"
"
${
model_filename_value
}
"
)
set_params_filename
=
$(
func_set_params
"
${
params_filename_key
}
"
"
${
params_filename_value
}
"
)
set_save_model
=
$(
func_set_params
"--save_file"
"
${
det_save_file_value
}
"
)
set_opset_version
=
$(
func_set_params
"
${
opset_version_key
}
"
"
${
opset_version_value
}
"
)
set_enable_onnx_checker
=
$(
func_set_params
"
${
enable_onnx_checker_key
}
"
"
${
enable_onnx_checker_value
}
"
)
trans_model_cmd
=
"
${
padlle2onnx_cmd
}
${
set_dirname
}
${
set_model_filename
}
${
set_params_filename
}
${
set_save_model
}
${
set_opset_version
}
${
set_enable_onnx_checker
}
"
eval
$trans_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
status_check
$last_status
"
${
trans_model_cmd
}
"
"
${
status_log
}
"
# trans rec
set_dirname
=
$(
func_set_params
"--model_dir"
"
${
rec_infer_model_dir_value
}
"
)
set_model_filename
=
$(
func_set_params
"
${
model_filename_key
}
"
"
${
model_filename_value
}
"
)
set_params_filename
=
$(
func_set_params
"
${
params_filename_key
}
"
"
${
params_filename_value
}
"
)
set_save_model
=
$(
func_set_params
"--save_file"
"
${
rec_save_file_value
}
"
)
set_opset_version
=
$(
func_set_params
"
${
opset_version_key
}
"
"
${
opset_version_value
}
"
)
set_enable_onnx_checker
=
$(
func_set_params
"
${
enable_onnx_checker_key
}
"
"
${
enable_onnx_checker_value
}
"
)
trans_model_cmd
=
"
${
padlle2onnx_cmd
}
${
set_dirname
}
${
set_model_filename
}
${
set_params_filename
}
${
set_save_model
}
${
set_opset_version
}
${
set_enable_onnx_checker
}
"
eval
$trans_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
status_check
$last_status
"
${
trans_model_cmd
}
"
"
${
status_log
}
"
elif
[
${
model_name
}
=
"ch_PP-OCRv2_det"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3_det"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_det"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0_det"
]
;
then
# trans det
set_dirname
=
$(
func_set_params
"--model_dir"
"
${
det_infer_model_dir_value
}
"
)
set_model_filename
=
$(
func_set_params
"
${
model_filename_key
}
"
"
${
model_filename_value
}
"
)
set_params_filename
=
$(
func_set_params
"
${
params_filename_key
}
"
"
${
params_filename_value
}
"
)
set_save_model
=
$(
func_set_params
"--save_file"
"
${
det_save_file_value
}
"
)
set_opset_version
=
$(
func_set_params
"
${
opset_version_key
}
"
"
${
opset_version_value
}
"
)
set_enable_onnx_checker
=
$(
func_set_params
"
${
enable_onnx_checker_key
}
"
"
${
enable_onnx_checker_value
}
"
)
trans_model_cmd
=
"
${
padlle2onnx_cmd
}
${
set_dirname
}
${
set_model_filename
}
${
set_params_filename
}
${
set_save_model
}
${
set_opset_version
}
${
set_enable_onnx_checker
}
"
eval
$trans_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
status_check
$last_status
"
${
trans_model_cmd
}
"
"
${
status_log
}
"
elif
[
${
model_name
}
=
"ch_PP-OCRv2_rec"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3_rec"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_rec"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0_rec"
]
;
then
# trans rec
set_dirname
=
$(
func_set_params
"--model_dir"
"
${
rec_infer_model_dir_value
}
"
)
set_model_filename
=
$(
func_set_params
"
${
model_filename_key
}
"
"
${
model_filename_value
}
"
)
set_params_filename
=
$(
func_set_params
"
${
params_filename_key
}
"
"
${
params_filename_value
}
"
)
set_save_model
=
$(
func_set_params
"--save_file"
"
${
rec_save_file_value
}
"
)
set_opset_version
=
$(
func_set_params
"
${
opset_version_key
}
"
"
${
opset_version_value
}
"
)
set_enable_onnx_checker
=
$(
func_set_params
"
${
enable_onnx_checker_key
}
"
"
${
enable_onnx_checker_value
}
"
)
trans_model_cmd
=
"
${
padlle2onnx_cmd
}
${
set_dirname
}
${
set_model_filename
}
${
set_params_filename
}
${
set_save_model
}
${
set_opset_version
}
${
set_enable_onnx_checker
}
"
eval
$trans_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
status_check
$last_status
"
${
trans_model_cmd
}
"
"
${
status_log
}
"
fi
# python inference
for
use_gpu
in
${
use_gpu_list
[*]
}
;
do
if
[
${
use_gpu
}
=
"False"
]
||
[
${
use_gpu
}
=
"cpu"
]
;
then
_save_log_path
=
"
${
LOG_PATH
}
/paddle2onnx_infer_cpu.log"
set_gpu
=
$(
func_set_params
"
${
use_gpu_key
}
"
"
${
use_gpu
}
"
)
set_model_dir
=
$(
func_set_params
"
${
det_model_key
}
"
"
${
save_file_value
}
"
)
set_img_dir
=
$(
func_set_params
"
${
image_dir_key
}
"
"
${
image_dir_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
if
[
${
model_name
}
=
"ch_PP-OCRv2"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0"
]
;
then
set_det_model_dir
=
$(
func_set_params
"
${
det_model_key
}
"
"
${
det_save_file_value
}
"
)
set_rec_model_dir
=
$(
func_set_params
"
${
rec_model_key
}
"
"
${
rec_save_file_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_det_model_dir
}
${
set_rec_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
elif
[
${
model_name
}
=
"ch_PP-OCRv2_det"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3_det"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_det"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0_det"
]
;
then
set_det_model_dir
=
$(
func_set_params
"
${
det_model_key
}
"
"
${
det_save_file_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_det_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
elif
[
${
model_name
}
=
"ch_PP-OCRv2_rec"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3_rec"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_rec"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0_rec"
]
;
then
set_rec_model_dir
=
$(
func_set_params
"
${
rec_model_key
}
"
"
${
rec_save_file_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_rec_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
fi
eval
$infer_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
...
...
@@ -74,9 +127,18 @@ function func_paddle2onnx(){
elif
[
${
use_gpu
}
=
"True"
]
||
[
${
use_gpu
}
=
"gpu"
]
;
then
_save_log_path
=
"
${
LOG_PATH
}
/paddle2onnx_infer_gpu.log"
set_gpu
=
$(
func_set_params
"
${
use_gpu_key
}
"
"
${
use_gpu
}
"
)
set_model_dir
=
$(
func_set_params
"
${
det_model_key
}
"
"
${
save_file_value
}
"
)
set_img_dir
=
$(
func_set_params
"
${
image_dir_key
}
"
"
${
image_dir_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
if
[
${
model_name
}
=
"ch_PP-OCRv2"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0"
]
;
then
set_det_model_dir
=
$(
func_set_params
"
${
det_model_key
}
"
"
${
det_save_file_value
}
"
)
set_rec_model_dir
=
$(
func_set_params
"
${
rec_model_key
}
"
"
${
rec_save_file_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_det_model_dir
}
${
set_rec_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
elif
[
${
model_name
}
=
"ch_PP-OCRv2_det"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3_det"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_det"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0_det"
]
;
then
set_det_model_dir
=
$(
func_set_params
"
${
det_model_key
}
"
"
${
det_save_file_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_det_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
elif
[
${
model_name
}
=
"ch_PP-OCRv2_rec"
]
||
[
${
model_name
}
=
"ch_PP-OCRv3_rec"
]
||
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_rec"
]
||
[
${
model_name
}
=
"ch_ppocr_server_v2.0_rec"
]
;
then
set_rec_model_dir
=
$(
func_set_params
"
${
rec_model_key
}
"
"
${
rec_save_file_value
}
"
)
infer_model_cmd
=
"
${
python
}
${
inference_py
}
${
set_gpu
}
${
set_img_dir
}
${
set_rec_model_dir
}
--use_onnx=True >
${
_save_log_path
}
2>&1 "
fi
eval
$infer_model_cmd
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录