Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
41816dee
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看板
提交
41816dee
编写于
7月 23, 2021
作者:
L
LDOUBLEV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support multi inference model inference
上级
52f2152a
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
60 addition
and
34 deletion
+60
-34
tests/ocr_det_params.txt
tests/ocr_det_params.txt
+9
-6
tests/test.sh
tests/test.sh
+51
-28
未找到文件。
tests/ocr_det_params.txt
浏览文件 @
41816dee
...
...
@@ -31,17 +31,20 @@ norm_export:tools/export_model.py -c configs/det/det_mv3_db.yml -o
quant_export:deploy/slim/quantization/export_model.py -c configs/det/det_mv3_db.yml -o
fpgm_export:deploy/slim/prune/export_prune_model.py
distill_export:null
null
:null
null
:null
export1
:null
export2
:null
##
infer_model:./inference/ch_ppocr_mobile_v2.0_det_train/best_accuracy|./inference/ch_mobile_det_quant_dev_lr/
infer_export:tools/export_model.py -c configs/det/det_mv3_db.yml -o |null
infer_quant:False|True
inference:tools/infer/predict_det.py
--use_gpu:True
|False
--use_gpu:True
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:
True|Fals
e
--precision:fp32|
fp16|
int8
--det_model_dir:
./inference/ch_ppocr_mobile_v2.0_det_infer/
--use_tensorrt:
False|Tru
e
--precision:fp32|int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
--save_log_path:null
--benchmark:True
...
...
tests/test.sh
浏览文件 @
41816dee
...
...
@@ -118,28 +118,32 @@ export_value1=$(func_parser_value "${lines[33]}")
export_key2
=
$(
func_parser_key
"
${
lines
[34]
}
"
)
export_value2
=
$(
func_parser_value
"
${
lines
[34]
}
"
)
inference_py
=
$(
func_parser_value
"
${
lines
[36]
}
"
)
use_gpu_key
=
$(
func_parser_key
"
${
lines
[37]
}
"
)
use_gpu_list
=
$(
func_parser_value
"
${
lines
[37]
}
"
)
use_mkldnn_key
=
$(
func_parser_key
"
${
lines
[38]
}
"
)
use_mkldnn_list
=
$(
func_parser_value
"
${
lines
[38]
}
"
)
cpu_threads_key
=
$(
func_parser_key
"
${
lines
[39]
}
"
)
cpu_threads_list
=
$(
func_parser_value
"
${
lines
[39]
}
"
)
batch_size_key
=
$(
func_parser_key
"
${
lines
[40]
}
"
)
batch_size_list
=
$(
func_parser_value
"
${
lines
[40]
}
"
)
use_trt_key
=
$(
func_parser_key
"
${
lines
[41]
}
"
)
use_trt_list
=
$(
func_parser_value
"
${
lines
[41]
}
"
)
precision_key
=
$(
func_parser_key
"
${
lines
[42]
}
"
)
precision_list
=
$(
func_parser_value
"
${
lines
[42]
}
"
)
infer_model_key
=
$(
func_parser_key
"
${
lines
[43]
}
"
)
infer_model
=
$(
func_parser_value
"
${
lines
[43]
}
"
)
image_dir_key
=
$(
func_parser_key
"
${
lines
[44]
}
"
)
infer_img_dir
=
$(
func_parser_value
"
${
lines
[44]
}
"
)
save_log_key
=
$(
func_parser_key
"
${
lines
[45]
}
"
)
benchmark_key
=
$(
func_parser_key
"
${
lines
[46]
}
"
)
benchmark_value
=
$(
func_parser_value
"
${
lines
[46]
}
"
)
infer_key1
=
$(
func_parser_key
"
${
lines
[47]
}
"
)
infer_value1
=
$(
func_parser_value
"
${
lines
[47]
}
"
)
# parser inference model
infer_model_dir_list
=
$(
func_parser_value
"
${
lines
[36]
}
"
)
infer_export_list
=
$(
func_parser_value
"
${
lines
[37]
}
"
)
infer_is_quant
=
$(
func_parser_value
"
${
lines
[38]
}
"
)
# parser inference
inference_py
=
$(
func_parser_value
"
${
lines
[39]
}
"
)
use_gpu_key
=
$(
func_parser_key
"
${
lines
[40]
}
"
)
use_gpu_list
=
$(
func_parser_value
"
${
lines
[40]
}
"
)
use_mkldnn_key
=
$(
func_parser_key
"
${
lines
[41]
}
"
)
use_mkldnn_list
=
$(
func_parser_value
"
${
lines
[41]
}
"
)
cpu_threads_key
=
$(
func_parser_key
"
${
lines
[42]
}
"
)
cpu_threads_list
=
$(
func_parser_value
"
${
lines
[42]
}
"
)
batch_size_key
=
$(
func_parser_key
"
${
lines
[43]
}
"
)
batch_size_list
=
$(
func_parser_value
"
${
lines
[43]
}
"
)
use_trt_key
=
$(
func_parser_key
"
${
lines
[44]
}
"
)
use_trt_list
=
$(
func_parser_value
"
${
lines
[44]
}
"
)
precision_key
=
$(
func_parser_key
"
${
lines
[45]
}
"
)
precision_list
=
$(
func_parser_value
"
${
lines
[45]
}
"
)
infer_model_key
=
$(
func_parser_key
"
${
lines
[46]
}
"
)
image_dir_key
=
$(
func_parser_key
"
${
lines
[47]
}
"
)
infer_img_dir
=
$(
func_parser_value
"
${
lines
[47]
}
"
)
save_log_key
=
$(
func_parser_key
"
${
lines
[48]
}
"
)
benchmark_key
=
$(
func_parser_key
"
${
lines
[49]
}
"
)
benchmark_value
=
$(
func_parser_value
"
${
lines
[49]
}
"
)
infer_key1
=
$(
func_parser_key
"
${
lines
[50]
}
"
)
infer_value1
=
$(
func_parser_value
"
${
lines
[50]
}
"
)
LOG_PATH
=
"./tests/output"
mkdir
-p
${
LOG_PATH
}
...
...
@@ -179,10 +183,10 @@ function func_inference(){
elif
[
${
use_gpu
}
=
"True"
]
||
[
${
use_gpu
}
=
"gpu"
]
;
then
for
use_trt
in
${
use_trt_list
[*]
}
;
do
for
precision
in
${
precision_list
[*]
}
;
do
if
[
${
use_trt
}
=
"False"
]
&&
[
${
precision
}
!=
"fp32
"
]
;
then
if
[
[
${
precision
}
=
~
"fp16"
||
${
precision
}
=
~
"int8"
]]
&&
[
${
use_trt
}
=
"False
"
]
;
then
continue
fi
if
[[
${
use_trt
}
=
"False"
||
${
precision
}
!=
"int8"
]]
&&
[
${
_flag_quant
}
=
"True"
]
;
then
if
[[
${
use_trt
}
=
"False"
||
${
precision
}
=
~
"int8"
]]
&&
[
${
_flag_quant
}
=
"True"
]
;
then
continue
fi
for
batch_size
in
${
batch_size_list
[*]
}
;
do
...
...
@@ -200,7 +204,7 @@ function func_inference(){
done
done
else
echo
"
Currently does not support hardware other than CPU and GPU
"
echo
"
Does not support hardware other than CPU and GPU Currently!
"
fi
done
}
...
...
@@ -212,9 +216,28 @@ if [ ${MODE} = "infer" ]; then
else
env
=
"export CUDA_VISIBLE_DEVICES=
${
GPUID
}
"
fi
echo
$env
# set CUDA_VISIBLE_DEVICES
eval
$env
export
Count
=
0
IFS
=
"|"
infer_run_exports
=(
${
infer_export_list
}
)
infer_quant_flag
=(
${
infer_is_quant
}
)
for
infer_model
in
${
infer_model_dir_list
[*]
}
;
do
# run export
if
[
${
infer_run_exports
[Count]
}
!=
"null"
]
;
then
export_cmd
=
"
${
python
}
${
norm_export
}
${
export_weight
}
=
${
infer_model
}
${
save_infer_key
}
=
${
infer_model
}
"
eval
$export_cmd
status_export
=
$?
if
[
${
status_export
}
=
0
]
;
then
status_check
$status_export
"
${
export_cmd
}
"
"
${
status_log
}
"
fi
fi
#run inference
func_inference
"
${
python
}
"
"
${
inference_py
}
"
"
${
infer_model
}
"
"
${
LOG_PATH
}
"
"
${
infer_img_dir
}
"
"False"
is_quant
=
${
infer_quant_flag
[Count]
}
echo
"is_quant:
${
is_quant
}
"
func_inference
"
${
python
}
"
"
${
inference_py
}
"
"
${
infer_model
}
"
"
${
LOG_PATH
}
"
"
${
infer_img_dir
}
"
${
is_quant
}
Count
=
$((
$Count
+
1
))
done
else
IFS
=
"|"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录