Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleOCR
提交
0d85119d
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0d85119d
编写于
11月 25, 2021
作者:
文幕地方
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dygraph' of
https://github.com/PaddlePaddle/PaddleOCR
into tipc
上级
010202ff
731a8406
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
949 addition
and
90 deletion
+949
-90
benchmark/run_benchmark_det.sh
benchmark/run_benchmark_det.sh
+19
-21
benchmark/run_det.sh
benchmark/run_det.sh
+6
-3
test_tipc/common_func.sh
test_tipc/common_func.sh
+1
-0
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+19
-0
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
...-OCRv2/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
+0
-0
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
...model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
+0
-0
test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
...v2_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
+0
-0
test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
...model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
+0
-0
test_tipc/configs/ch_PP-OCRv2_det/train_infer_python.txt
test_tipc/configs/ch_PP-OCRv2_det/train_infer_python.txt
+7
-7
test_tipc/configs/ch_PP-OCRv2_det_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+19
-0
test_tipc/configs/ch_PP-OCRv2_det_PACT/train_infer_python.txt
..._tipc/configs/ch_PP-OCRv2_det_PACT/train_infer_python.txt
+51
-0
test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml
.../configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml
+159
-0
test_tipc/configs/ch_PP-OCRv2_rec/train_infer_python.txt
test_tipc/configs/ch_PP-OCRv2_rec/train_infer_python.txt
+53
-0
test_tipc/configs/ch_PP-OCRv2_rec_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+19
-0
test_tipc/configs/ch_PP-OCRv2_rec_PACT/train_infer_python.txt
..._tipc/configs/ch_PP-OCRv2_rec_PACT/train_infer_python.txt
+53
-0
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+19
-0
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
...e_v2.0/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
+13
-0
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
...model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
+13
-0
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
....0_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
+5
-4
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
...model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
+13
-0
test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_infer_python.txt
...c/configs/ch_ppocr_mobile_v2.0_det/train_infer_python.txt
+1
-1
test_tipc/configs/ch_ppocr_mobile_v2.0_det_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+2
-0
test_tipc/configs/ch_ppocr_server_v2.0_det/train_infer_python.txt
...c/configs/ch_ppocr_server_v2.0_det/train_infer_python.txt
+3
-3
test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/det_r50_vd_sast_icdar2015.yml
...et_r50_vd_sast_icdar15_v2.0/det_r50_vd_sast_icdar2015.yml
+111
-0
test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/train_infer_python.txt
...nfigs/det_r50_vd_sast_icdar15_v2.0/train_infer_python.txt
+51
-0
test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/det_r50_vd_sast_totaltext.yml
..._r50_vd_sast_totaltext_v2.0/det_r50_vd_sast_totaltext.yml
+108
-0
test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/train_infer_python.txt
...igs/det_r50_vd_sast_totaltext_v2.0/train_infer_python.txt
+51
-0
test_tipc/configs/en_server_pgnetA/train_infer_python.txt
test_tipc/configs/en_server_pgnetA/train_infer_python.txt
+51
-0
test_tipc/docs/test_lite_arm_cpp.md
test_tipc/docs/test_lite_arm_cpp.md
+12
-8
test_tipc/prepare.sh
test_tipc/prepare.sh
+45
-9
test_tipc/prepare_lite_cpp.sh
test_tipc/prepare_lite_cpp.sh
+42
-28
test_tipc/test_train_inference_python.sh
test_tipc/test_train_inference_python.sh
+2
-2
tools/infer/utility.py
tools/infer/utility.py
+1
-4
未找到文件。
benchmark/run_benchmark_det.sh
浏览文件 @
0d85119d
...
@@ -5,28 +5,36 @@ set -xe
...
@@ -5,28 +5,36 @@ set -xe
function
_set_params
(){
function
_set_params
(){
run_mode
=
${
1
:-
"sp"
}
# 单卡sp|多卡mp
run_mode
=
${
1
:-
"sp"
}
# 单卡sp|多卡mp
batch_size
=
${
2
:-
"64"
}
batch_size
=
${
2
:-
"64"
}
fp_item
=
${
3
:-
"fp32"
}
# fp32|fp16
fp_item
=
${
3
:-
"fp32"
}
# fp32|fp16
max_
iter
=
${
4
:-
"10"
}
# 可选,如果需要修改代码提前中断
max_
epoch
=
${
4
:-
"10"
}
# 可选,如果需要修改代码提前中断
model_
name
=
${
5
:-
"model_name
"
}
model_
item
=
${
5
:-
"model_item
"
}
run_log_path
=
${
TRAIN_LOG_DIR
:-
$(
pwd
)
}
# TRAIN_LOG_DIR 后续QA设置该参数
run_log_path
=
${
TRAIN_LOG_DIR
:-
$(
pwd
)
}
# TRAIN_LOG_DIR 后续QA设置该参数
# 日志解析所需参数
base_batch_size
=
${
batch_size
}
mission_name
=
"OCR"
direction_id
=
"0"
ips_unit
=
"images/sec"
skip_steps
=
2
# 解析日志,有些模型前几个step耗时长,需要跳过 (必填)
keyword
=
"ips:"
# 解析日志,筛选出数据所在行的关键字 (必填)
index
=
"1"
model_name
=
${
model_item
}
_
${
run_mode
}
_bs
${
batch_size
}
_
${
fp_item
}
# model_item 用于yml文件名匹配,model_name 用于数据入库前端展示
# 以下不用修改
# 以下不用修改
device
=
${
CUDA_VISIBLE_DEVICES
//,/
}
device
=
${
CUDA_VISIBLE_DEVICES
//,/
}
arr
=(
${
device
}
)
arr
=(
${
device
}
)
num_gpu_devices
=
${#
arr
[*]
}
num_gpu_devices
=
${#
arr
[*]
}
log_file
=
${
run_log_path
}
/
${
model_
name
}
_
${
run_mode
}
_bs
${
batch_size
}
_
${
fp_item
}
_
${
num_gpu_devices
}
log_file
=
${
run_log_path
}
/
${
model_
item
}
_
${
run_mode
}
_bs
${
batch_size
}
_
${
fp_item
}
_
${
num_gpu_devices
}
}
}
function
_train
(){
function
_train
(){
echo
"Train on
${
num_gpu_devices
}
GPUs"
echo
"Train on
${
num_gpu_devices
}
GPUs"
echo
"current CUDA_VISIBLE_DEVICES=
$CUDA_VISIBLE_DEVICES
, gpus=
$num_gpu_devices
, batch_size=
$batch_size
"
echo
"current CUDA_VISIBLE_DEVICES=
$CUDA_VISIBLE_DEVICES
, gpus=
$num_gpu_devices
, batch_size=
$batch_size
"
train_cmd
=
"-c configs/det/
${
model_
name
}
.yml -o Train.loader.batch_size_per_card=
${
batch_size
}
Global.epoch_num=
${
max_iter
}
Global.eval_batch_step=[0,20000] Global.print_batch_step=2"
train_cmd
=
"-c configs/det/
${
model_
item
}
.yml -o Train.loader.batch_size_per_card=
${
batch_size
}
Global.epoch_num=
${
max_epoch
}
Global.eval_batch_step=[0,20000] Global.print_batch_step=2"
case
${
run_mode
}
in
case
${
run_mode
}
in
sp
)
sp
)
train_cmd
=
"python
3.7
tools/train.py "
${
train_cmd
}
""
train_cmd
=
"python tools/train.py "
${
train_cmd
}
""
;;
;;
mp
)
mp
)
train_cmd
=
"python
3.7
-m paddle.distributed.launch --log_dir=./mylog --gpus=
$CUDA_VISIBLE_DEVICES
tools/train.py
${
train_cmd
}
"
train_cmd
=
"python -m paddle.distributed.launch --log_dir=./mylog --gpus=
$CUDA_VISIBLE_DEVICES
tools/train.py
${
train_cmd
}
"
;;
;;
*
)
echo
"choose run_mode(sp or mp)"
;
exit
1
;
*
)
echo
"choose run_mode(sp or mp)"
;
exit
1
;
esac
esac
...
@@ -46,17 +54,7 @@ function _train(){
...
@@ -46,17 +54,7 @@ function _train(){
fi
fi
}
}
function
_analysis_log
(){
source
${
BENCHMARK_ROOT
}
/scripts/run_model.sh
# 在该脚本中会对符合benchmark规范的log使用analysis.py 脚本进行性能数据解析;该脚本在连调时可从benchmark repo中下载https://github.com/PaddlePaddle/benchmark/blob/master/scripts/run_model.sh;如果不联调只想要产出训练log可以注掉本行,提交时需打开
analysis_cmd
=
"python3.7 benchmark/analysis.py --filename
${
log_file
}
--mission_name
${
model_name
}
--run_mode
${
run_mode
}
--direction_id 0 --keyword 'ips:' --base_batch_size
${
batch_size
}
--skip_steps 1 --gpu_num
${
num_gpu_devices
}
--index 1 --model_mode=-1 --ips_unit=samples/sec"
eval
$analysis_cmd
}
function
_kill_process
(){
kill
-9
`
ps
-ef
|grep
'python3.7'
|awk
'{print $2}'
`
}
_set_params
$@
_set_params
$@
_train
#_train # 如果只想产出训练log,不解析,可取消注释
_analysis_log
_run
# 该函数在run_model.sh中,执行时会调用_train; 如果不联调只想要产出训练log可以注掉本行,提交时需打开
_kill_process
\ No newline at end of file
benchmark/run_det.sh
浏览文件 @
0d85119d
#!/bin/bash
# 提供可稳定复现性能的脚本,默认在标准docker环境内py37执行: paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7 paddle=2.1.2 py=37
# 提供可稳定复现性能的脚本,默认在标准docker环境内py37执行: paddlepaddle/paddle:latest-gpu-cuda10.1-cudnn7 paddle=2.1.2 py=37
# 执行目录: ./PaddleOCR
# 执行目录: ./PaddleOCR
# 1 安装该模型需要的依赖 (如需开启优化策略请注明)
# 1 安装该模型需要的依赖 (如需开启优化策略请注明)
python
3.7
-m
pip
install
-r
requirements.txt
python
-m
pip
install
-r
requirements.txt
# 2 拷贝该模型需要数据、预训练模型
# 2 拷贝该模型需要数据、预训练模型
wget
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar
&&
cd
train_data
&&
tar
xf icdar2015.tar
&&
cd
../
wget
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar
&&
cd
train_data
&&
tar
xf icdar2015.tar
&&
cd
../
wget
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet50_vd_pretrained.pdparams
wget
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet50_vd_pretrained.pdparams
...
@@ -17,11 +18,13 @@ for model_mode in ${model_mode_list[@]}; do
...
@@ -17,11 +18,13 @@ for model_mode in ${model_mode_list[@]}; do
for
bs_item
in
${
bs_list
[@]
}
;
do
for
bs_item
in
${
bs_list
[@]
}
;
do
echo
"index is speed, 1gpus, begin,
${
model_name
}
"
echo
"index is speed, 1gpus, begin,
${
model_name
}
"
run_mode
=
sp
run_mode
=
sp
CUDA_VISIBLE_DEVICES
=
0 bash benchmark/run_benchmark_det.sh
${
run_mode
}
${
bs_item
}
${
fp_item
}
2
${
model_mode
}
# (5min)
log_name
=
ocr_
${
model_mode
}
_
${
run_mode
}
_bs
${
bs_item
}
_
${
fp_item
}
CUDA_VISIBLE_DEVICES
=
0 bash benchmark/run_benchmark_det.sh
${
run_mode
}
${
bs_item
}
${
fp_item
}
1
${
model_mode
}
|
tee
${
log_path
}
/
${
log_name
}
_speed_1gpus 2>&1
# (5min)
sleep
60
sleep
60
echo
"index is speed, 8gpus, run_mode is multi_process, begin,
${
model_name
}
"
echo
"index is speed, 8gpus, run_mode is multi_process, begin,
${
model_name
}
"
run_mode
=
mp
run_mode
=
mp
CUDA_VISIBLE_DEVICES
=
0,1,2,3,4,5,6,7 bash benchmark/run_benchmark_det.sh
${
run_mode
}
${
bs_item
}
${
fp_item
}
2
${
model_mode
}
log_name
=
ocr_
${
model_mode
}
_
${
run_mode
}
_bs
${
bs_item
}
_
${
fp_item
}
CUDA_VISIBLE_DEVICES
=
0,1,2,3,4,5,6,7 bash benchmark/run_benchmark_det.sh
${
run_mode
}
${
bs_item
}
${
fp_item
}
2
${
model_mode
}
|
tee
${
log_path
}
/
${
log_name
}
_speed_8gpus8p 2>&1
sleep
60
sleep
60
done
done
done
done
...
...
test_tipc/common_func.sh
浏览文件 @
0d85119d
...
@@ -30,6 +30,7 @@ function func_set_params(){
...
@@ -30,6 +30,7 @@ function func_set_params(){
function
func_parser_params
(){
function
func_parser_params
(){
strs
=
$1
strs
=
$1
MODE
=
$2
IFS
=
":"
IFS
=
":"
array
=(
${
strs
}
)
array
=(
${
strs
}
)
key
=
${
array
[0]
}
key
=
${
array
[0]
}
...
...
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
0 → 100644
浏览文件 @
0d85119d
===========================ch_ppocr_mobile_v2.0===========================
model_name:ch_PP-OCRv2
python:python3.7
infer_model:./inference/ch_PP-OCRv2_det_infer/
infer_export:null
infer_quant:True
inference:tools/infer/predict_system.py
--use_gpu:False
--enable_mkldnn:False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False
--precision:int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
--rec_model_dir:./inference/ch_PP-OCRv2_rec_infer/
--benchmark:True
null:null
null:null
test_tipc/configs/
ppocr_system_mobile
/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
→
test_tipc/configs/
ch_PP-OCRv2
/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
浏览文件 @
0d85119d
文件已移动
test_tipc/configs/
ppocr_system_mobile
/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
→
test_tipc/configs/
ch_PP-OCRv2
/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
浏览文件 @
0d85119d
文件已移动
test_tipc/configs/
ppocr_det_mobile
/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
→
test_tipc/configs/
ch_PP-OCRv2_det
/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
浏览文件 @
0d85119d
文件已移动
test_tipc/configs/
ppocr_det_mobile
/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
→
test_tipc/configs/
ch_PP-OCRv2_det
/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
浏览文件 @
0d85119d
文件已移动
test_tipc/configs/ch_PP-OCRv2_det/train_infer_python.txt
浏览文件 @
0d85119d
===========================train_params===========================
===========================train_params===========================
model_name:
PPOCRv2_ocr
_det
model_name:
ch_PPOCRv2
_det
python:python3.7
python:python3.7
gpu_list:0|0,1
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_
infer=1|whole_train
_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_
infer=2|whole_train
_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:null
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
##
##
trainer:norm_train|pact_train
trainer:norm_train|pact_train
norm_train:tools/train.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR_det_cml.yml -o
norm_train:tools/train.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR
v2
_det_cml.yml -o
pact_train:deploy/slim/quantization/quant.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR_det_cml.yml -o
pact_train:deploy/slim/quantization/quant.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR
v2
_det_cml.yml -o
fpgm_train:null
fpgm_train:null
distill_train:null
distill_train:null
null:null
null:null
...
@@ -27,8 +27,8 @@ null:null
...
@@ -27,8 +27,8 @@ null:null
===========================infer_params===========================
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.save_inference_dir:./output/
Global.pretrained_model:
Global.pretrained_model:
norm_export:tools/export_model.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR_det_cml.yml -o
norm_export:tools/export_model.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR
v2
_det_cml.yml -o
quant_export:deploy/slim/quantization/export_model.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR_det_cml.yml -o
quant_export:deploy/slim/quantization/export_model.py -c configs/det/ch_PP-OCRv2/ch_PP-OCR
v2
_det_cml.yml -o
fpgm_export:
fpgm_export:
distill_export:null
distill_export:null
export1:null
export1:null
...
...
test_tipc/configs/ch_PP-OCRv2_det_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
0 → 100644
浏览文件 @
0d85119d
===========================kl_quant_params===========================
model_name:PPOCRv2_ocr_det_kl
python:python3.7
infer_model:./inference/ch_PP-OCRv2_det_infer/
infer_export:deploy/slim/quantization/quant_kl.py -c configs/det/ch_PP-OCRv2/ch_PP-OCRv2_det_cml.yml -o
infer_quant:True
inference:tools/infer/predict_det.py
--use_gpu:False
--enable_mkldnn:False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False
--precision:int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
--benchmark:True
null:null
null:null
test_tipc/configs/ch_PP-OCRv2_det_PACT/train_infer_python.txt
0 → 100644
浏览文件 @
0d85119d
===========================train_params===========================
model_name:PPOCRv2_ocr_det
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:fp32
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=500
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_infer=4
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/
null:null
##
trainer:pact_train
norm_train:null
pact_train:deploy/slim/quantization/quant.py -c configs/det/ch_PP-OCRv2/ch_PP-OCRv2_det_cml.yml -o
fpgm_train:null
distill_train:null
null:null
null:null
##
===========================eval_params===========================
eval:null
null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.pretrained_model:
norm_export:null
quant_export:deploy/slim/quantization/export_model.py -c configs/det/ch_PP-OCRv2/ch_PP-OCRv2_det_cml.yml -o
fpgm_export:
distill_export:null
export1:null
export2:null
inference_dir:Student
infer_model:./inference/ch_PP-OCRv2_det_infer/
infer_export:null
infer_quant:False
inference:tools/infer/predict_det.py
--use_gpu:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False|True
--precision:fp32|fp16|int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
--benchmark:True
null:null
test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml
0 → 100644
浏览文件 @
0d85119d
Global
:
debug
:
false
use_gpu
:
true
epoch_num
:
800
log_smooth_window
:
20
print_batch_step
:
10
save_model_dir
:
./output/rec_pp-OCRv2_distillation
save_epoch_step
:
3
eval_batch_step
:
[
0
,
2000
]
cal_metric_during_train
:
true
pretrained_model
:
checkpoints
:
save_inference_dir
:
use_visualdl
:
false
infer_img
:
doc/imgs_words/ch/word_1.jpg
character_dict_path
:
ppocr/utils/ppocr_keys_v1.txt
max_text_length
:
25
infer_mode
:
false
use_space_char
:
true
distributed
:
true
save_res_path
:
./output/rec/predicts_pp-OCRv2_distillation.txt
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
lr
:
name
:
Piecewise
decay_epochs
:
[
700
,
800
]
values
:
[
0.001
,
0.0001
]
warmup_epoch
:
5
regularizer
:
name
:
L2
factor
:
2.0e-05
Architecture
:
model_type
:
&model_type
"
rec"
name
:
DistillationModel
algorithm
:
Distillation
Models
:
Teacher
:
pretrained
:
freeze_params
:
false
return_all_feats
:
true
model_type
:
*model_type
algorithm
:
CRNN
Transform
:
Backbone
:
name
:
MobileNetV1Enhance
scale
:
0.5
Neck
:
name
:
SequenceEncoder
encoder_type
:
rnn
hidden_size
:
64
Head
:
name
:
CTCHead
mid_channels
:
96
fc_decay
:
0.00002
Student
:
pretrained
:
freeze_params
:
false
return_all_feats
:
true
model_type
:
*model_type
algorithm
:
CRNN
Transform
:
Backbone
:
name
:
MobileNetV1Enhance
scale
:
0.5
Neck
:
name
:
SequenceEncoder
encoder_type
:
rnn
hidden_size
:
64
Head
:
name
:
CTCHead
mid_channels
:
96
fc_decay
:
0.00002
Loss
:
name
:
CombinedLoss
loss_config_list
:
-
DistillationCTCLoss
:
weight
:
1.0
model_name_list
:
[
"
Student"
,
"
Teacher"
]
key
:
head_out
-
DistillationDMLLoss
:
weight
:
1.0
act
:
"
softmax"
use_log
:
true
model_name_pairs
:
-
[
"
Student"
,
"
Teacher"
]
key
:
head_out
-
DistillationDistanceLoss
:
weight
:
1.0
mode
:
"
l2"
model_name_pairs
:
-
[
"
Student"
,
"
Teacher"
]
key
:
backbone_out
PostProcess
:
name
:
DistillationCTCLabelDecode
model_name
:
[
"
Student"
,
"
Teacher"
]
key
:
head_out
Metric
:
name
:
DistillationMetric
base_metric_name
:
RecMetric
main_indicator
:
acc
key
:
"
Student"
Train
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./train_data/ic15_data/
label_file_list
:
-
./train_data/ic15_data/rec_gt_train.txt
transforms
:
-
DecodeImage
:
img_mode
:
BGR
channel_first
:
false
-
RecAug
:
-
CTCLabelEncode
:
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
KeepKeys
:
keep_keys
:
-
image
-
label
-
length
loader
:
shuffle
:
true
batch_size_per_card
:
128
drop_last
:
true
num_sections
:
1
num_workers
:
8
Eval
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./train_data/ic15_data
label_file_list
:
-
./train_data/ic15_data/rec_gt_test.txt
transforms
:
-
DecodeImage
:
img_mode
:
BGR
channel_first
:
false
-
CTCLabelEncode
:
-
RecResizeImg
:
image_shape
:
[
3
,
32
,
320
]
-
KeepKeys
:
keep_keys
:
-
image
-
label
-
length
loader
:
shuffle
:
false
drop_last
:
false
batch_size_per_card
:
128
num_workers
:
8
test_tipc/configs/ch_PP-OCRv2_rec/train_infer_python.txt
0 → 100644
浏览文件 @
0d85119d
===========================train_params===========================
model_name:PPOCRv2_ocr_rec
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:fp32
Global.epoch_num:lite_train_lite_infer=3|whole_train_whole_infer=300
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=128|whole_train_whole_infer=128
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./inference/rec_inference
null:null
##
trainer:norm_train
norm_train:tools/train.py -c test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml -o
pact_train:null
fpgm_train:null
distill_train:null
null:null
null:null
##
===========================eval_params===========================
eval:null
null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.pretrained_model:
norm_export:tools/export_model.py -c test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml -o
quant_export:
fpgm_export:
distill_export:null
export1:null
export2:null
inference_dir:Student
infer_model:./inference/ch_PP-OCRv2_rec_infer/
infer_export:null
infer_quant:False
inference:tools/infer/predict_rec.py
--use_gpu:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1|6
--use_tensorrt:False|True
--precision:fp32|fp16|int8
--rec_model_dir:
--image_dir:/inference/rec_inference
null:null
--benchmark:True
null:null
test_tipc/configs/ch_PP-OCRv2_rec_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
0 → 100644
浏览文件 @
0d85119d
===========================kl_quant_params===========================
model_name:PPOCRv2_ocr_rec_kl
python:python3.7
infer_model:./inference/ch_PP-OCRv2_rec_infer/
infer_export:deploy/slim/quantization/quant_kl.py -c test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml -o
infer_quant:True
inference:tools/infer/predict_rec.py
--use_gpu:False
--enable_mkldnn:False
--cpu_threads:1|6
--rec_batch_num:1|6
--use_tensorrt:False
--precision:int8
--rec_model_dir:
--image_dir:./inference/rec_inference
null:null
--benchmark:True
null:null
null:null
test_tipc/configs/ch_PP-OCRv2_rec_PACT/train_infer_python.txt
0 → 100644
浏览文件 @
0d85119d
===========================train_params===========================
model_name:PPOCRv2_ocr_rec_pact
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:fp32
Global.epoch_num:lite_train_lite_infer=3|whole_train_whole_infer=300
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=128|whole_train_whole_infer=128
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./inference/rec_inference
null:null
##
trainer:pact_train
norm_train:deploy/slim/quantization/quant.py -c test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml -o
pact_train:null
fpgm_train:null
distill_train:null
null:null
null:null
##
===========================eval_params===========================
eval:null
null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.pretrained_model:
norm_export:deploy/slim/quantization/export_model.py -c test_tipc/configs/ch_PP-OCRv2_rec/ch_PP-OCRv2_rec_distillation.yml -o
quant_export:
fpgm_export:
distill_export:null
export1:null
export2:null
inference_dir:Student
infer_model:./inference/ch_PP-OCRv2_rec_infer/
infer_export:null
infer_quant:True
inference:tools/infer/predict_rec.py
--use_gpu:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1|6
--use_tensorrt:False|True
--precision:fp32|fp16|int8
--rec_model_dir:
--image_dir:/inference/rec_inference
null:null
--benchmark:True
null:null
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
0 → 100644
浏览文件 @
0d85119d
===========================ch_ppocr_mobile_v2.0===========================
model_name:ch_ppocr_mobile_v2.0
python:python3.7
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/
infer_export:null
infer_quant:True
inference:tools/infer/predict_system.py
--use_gpu:False
--enable_mkldnn:False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False
--precision:int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
--rec_model_dir:./inference/ch_ppocr_mobile_v2.0_rec_infer/
--benchmark:True
null:null
null:null
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
0 → 100644
浏览文件 @
0d85119d
===========================lite_params===========================
inference:./ocr_db_crnn system
runtime_device:ARM_CPU
det_infer_model:ch_ppocr_mobile_v2.0_det_infer|ch_ppocr_db_mobile_v2.0_det_quant_infer
rec_infer_model:ch_ppocr_mobile_v2.0_rec_infer|ch_ppocr_mobile_v2.0_rec_slim_infer
cls_infer_model:ch_ppocr_mobile_v2.0_cls_infer|ch_ppocr_mobile_v2.0_cls_slim_infer
--cpu_threads:1|4
--det_batch_size:1
--rec_batch_size:1
--image_dir:./test_data/icdar2015_lite/text_localization/ch4_test_images/
--config_dir:./config.txt
--rec_dict_dir:./ppocr_keys_v1.txt
--benchmark:True
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
0 → 100644
浏览文件 @
0d85119d
===========================lite_params===========================
inference:./ocr_db_crnn system
runtime_device:ARM_GPU_OPENCL
det_infer_model:ch_ppocr_mobile_v2.0_det_infer|ch_ppocr_db_mobile_v2.0_det_quant_infer
rec_infer_model:ch_ppocr_mobile_v2.0_rec_infer|ch_ppocr_mobile_v2.0_rec_slim_infer
cls_infer_model:ch_ppocr_mobile_v2.0_cls_infer|ch_ppocr_mobile_v2.0_cls_slim_infer
--cpu_threads:1|4
--det_batch_size:1
--rec_batch_size:1
--image_dir:./test_data/icdar2015_lite/text_localization/ch4_test_images/
--config_dir:./config.txt
--rec_dict_dir:./ppocr_keys_v1.txt
--benchmark:True
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
浏览文件 @
0d85119d
===========================lite_params===========================
===========================lite_params===========================
inference:./ocr_db_crnn det
inference:./ocr_db_crnn det
infer_model:ch_PP-OCRv2_det_infer|ch_PP-OCRv2_det_slim_quant_infer
runtime_device:ARM_CPU
runtime_device:ARM_CPU
det_infer_model:ch_ppocr_mobile_v2.0_det_infer|ch_ppocr_db_mobile_v2.0_det_quant_infer
null:null
null:null
--cpu_threads:1|4
--cpu_threads:1|4
--det_batch_size:1
--det_batch_size:1
--rec_batch_size:1
null:null
--system_batch_size:1
--image_dir:./test_data/icdar2015_lite/text_localization/ch4_test_images/
--image_dir:./test_data/icdar2015_lite/text_localization/ch4_test_images/
--config_dir:./config.txt
--config_dir:./config.txt
--rec_dict_dir:./ppocr_keys_v1.txt
null:null
--benchmark:True
--benchmark:True
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
0 → 100644
浏览文件 @
0d85119d
===========================lite_params===========================
inference:./ocr_db_crnn det
runtime_device:ARM_GPU_OPENCL
det_infer_model:ch_ppocr_mobile_v2.0_det_infer|ch_ppocr_db_mobile_v2.0_det_quant_infer
null:null
null:null
--cpu_threads:1|4
--det_batch_size:1
null:null
--image_dir:./test_data/icdar2015_lite/text_localization/ch4_test_images/
--config_dir:./config.txt
null:null
--benchmark:True
test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_infer_python.txt
浏览文件 @
0d85119d
===========================train_params===========================
===========================train_params===========================
model_name:
ocr
_det
model_name:
ch_ppocr_mobile_v2.0
_det
python:python3.7
python:python3.7
gpu_list:0|0,1
gpu_list:0|0,1
Global.use_gpu:True|True
Global.use_gpu:True|True
...
...
test_tipc/configs/ch_ppocr_mobile_v2.0_det_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
浏览文件 @
0d85119d
===========================kl_quant_params===========================
===========================kl_quant_params===========================
model_name:PPOCRv2_ocr_det
python:python3.7
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer/
infer_export:deploy/slim/quantization/quant_kl.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o
infer_export:deploy/slim/quantization/quant_kl.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o
infer_quant:True
infer_quant:True
...
...
test_tipc/configs/ch_ppocr_server_v2.0_det/train_infer_python.txt
浏览文件 @
0d85119d
===========================train_params===========================
===========================train_params===========================
model_name:
ocr_server
_det
model_name:
ch_ppocr_server_v2.0
_det
python:python3.7
python:python3.7
gpu_list:0|0,1
gpu_list:0|0,1
Global.use_gpu:True|True
Global.use_gpu:True|True
Global.auto_cast:null
Global.auto_cast:null
Global.epoch_num:lite_train_
infer=2|whole_train
_infer=300
Global.epoch_num:lite_train_
lite_infer=2|whole_train_whole
_infer=300
Global.save_model_dir:./output/
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_
infer=2|whole_train
_infer=4
Train.loader.batch_size_per_card:lite_train_
lite_infer=2|whole_train_lite
_infer=4
Global.pretrained_model:null
Global.pretrained_model:null
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/
...
...
test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/det_r50_vd_sast_icdar2015.yml
0 → 100644
浏览文件 @
0d85119d
Global
:
use_gpu
:
true
epoch_num
:
5000
log_smooth_window
:
20
print_batch_step
:
2
save_model_dir
:
./output/sast_r50_vd_ic15/
save_epoch_step
:
1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
[
4000
,
5000
]
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/ResNet50_vd_ssld_pretrained
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
save_res_path
:
./output/sast_r50_vd_ic15/predicts_sast.txt
Architecture
:
model_type
:
det
algorithm
:
SAST
Transform
:
Backbone
:
name
:
ResNet_SAST
layers
:
50
Neck
:
name
:
SASTFPN
with_cab
:
True
Head
:
name
:
SASTHead
Loss
:
name
:
SASTLoss
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
lr
:
# name: Cosine
learning_rate
:
0.001
# warmup_epoch: 0
regularizer
:
name
:
'
L2'
factor
:
0
PostProcess
:
name
:
SASTPostProcess
score_thresh
:
0.5
sample_pts_num
:
2
nms_thresh
:
0.2
expand_scale
:
1.0
shrink_ratio_of_width
:
0.3
Metric
:
name
:
DetMetric
main_indicator
:
hmean
Train
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./train_data/icdar2015/text_localization/
label_file_list
:
-
./train_data/icdar2015/text_localization/train_icdar2015_label.txt
ratio_list
:
[
0.1
,
0.45
,
0.3
,
0.15
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
DetLabelEncode
:
# Class handling label
-
SASTProcessTrain
:
image_shape
:
[
512
,
512
]
min_crop_side_ratio
:
0.3
min_crop_size
:
24
min_text_size
:
4
max_text_size
:
512
-
KeepKeys
:
keep_keys
:
[
'
image'
,
'
score_map'
,
'
border_map'
,
'
training_mask'
,
'
tvo_map'
,
'
tco_map'
]
# dataloader will return list in this order
loader
:
shuffle
:
True
drop_last
:
False
batch_size_per_card
:
4
num_workers
:
4
Eval
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./train_data/icdar2015/text_localization/
label_file_list
:
-
./train_data/icdar2015/text_localization/test_icdar2015_label.txt
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
DetLabelEncode
:
# Class handling label
-
DetResizeForTest
:
resize_long
:
1536
-
NormalizeImage
:
scale
:
1./255.
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
hwc'
-
ToCHWImage
:
-
KeepKeys
:
keep_keys
:
[
'
image'
,
'
shape'
,
'
polys'
,
'
ignore_tags'
]
loader
:
shuffle
:
False
drop_last
:
False
batch_size_per_card
:
1
# must be 1
num_workers
:
2
test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/train_infer_python.txt
0 → 100644
浏览文件 @
0d85119d
===========================train_params===========================
model_name:det_r50_vd_sast_icdar15_v2.0
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:null
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=5000
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_infer=4
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/
null:null
##
trainer:norm_train
norm_train:tools/train.py -c test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/det_r50_vd_sast_icdar2015.yml -o Global.pretrained_model=./pretrain_models/ResNet50_vd_ssld_pretrained
pact_train:null
fpgm_train:null
distill_train:null
null:null
null:null
##
===========================eval_params===========================
eval:null
null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.pretrained_model:
norm_export:tools/export_model.py -c test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/det_r50_vd_sast_icdar2015.yml -o
quant_export:null
fpgm_export:null
distill_export:null
export1:null
export2:null
inference_dir:null
train_model:./inference/det_r50_vd_sast_icdar15_v2.0_train/best_accuracy
infer_export:tools/export_model.py -c test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/det_r50_vd_sast_icdar2015.yml -o
infer_quant:False
inference:tools/infer/predict_det.py
--use_gpu:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False|True
--precision:fp32|fp16|int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
--benchmark:True
null:null
test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/det_r50_vd_sast_totaltext.yml
0 → 100644
浏览文件 @
0d85119d
Global
:
use_gpu
:
true
epoch_num
:
5000
log_smooth_window
:
20
print_batch_step
:
2
save_model_dir
:
./output/sast_r50_vd_tt/
save_epoch_step
:
1000
# evaluation is run every 5000 iterations after the 4000th iteration
eval_batch_step
:
[
4000
,
5000
]
cal_metric_during_train
:
False
pretrained_model
:
./pretrain_models/ResNet50_vd_ssld_pretrained
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
save_res_path
:
./output/sast_r50_vd_tt/predicts_sast.txt
Architecture
:
model_type
:
det
algorithm
:
SAST
Transform
:
Backbone
:
name
:
ResNet_SAST
layers
:
50
Neck
:
name
:
SASTFPN
with_cab
:
True
Head
:
name
:
SASTHead
Loss
:
name
:
SASTLoss
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
lr
:
# name: Cosine
learning_rate
:
0.001
# warmup_epoch: 0
regularizer
:
name
:
'
L2'
factor
:
0
PostProcess
:
name
:
SASTPostProcess
score_thresh
:
0.5
sample_pts_num
:
6
nms_thresh
:
0.2
expand_scale
:
1.2
shrink_ratio_of_width
:
0.2
Metric
:
name
:
DetMetric
main_indicator
:
hmean
Train
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./train_data/total_text/train
label_file_list
:
[
./train_data/total_text/train/train.txt
]
ratio_list
:
[
1.0
]
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
DetLabelEncode
:
# Class handling label
-
SASTProcessTrain
:
image_shape
:
[
512
,
512
]
min_crop_side_ratio
:
0.3
min_crop_size
:
24
min_text_size
:
4
max_text_size
:
512
-
KeepKeys
:
keep_keys
:
[
'
image'
,
'
score_map'
,
'
border_map'
,
'
training_mask'
,
'
tvo_map'
,
'
tco_map'
]
# dataloader will return list in this order
loader
:
shuffle
:
True
drop_last
:
False
batch_size_per_card
:
4
num_workers
:
4
Eval
:
dataset
:
name
:
SimpleDataSet
data_dir
:
./train_data/
label_file_list
:
-
./train_data/total_text/test/test.txt
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
DetLabelEncode
:
# Class handling label
-
DetResizeForTest
:
resize_long
:
768
-
NormalizeImage
:
scale
:
1./255.
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
hwc'
-
ToCHWImage
:
-
KeepKeys
:
keep_keys
:
[
'
image'
,
'
shape'
,
'
polys'
,
'
ignore_tags'
]
loader
:
shuffle
:
False
drop_last
:
False
batch_size_per_card
:
1
# must be 1
num_workers
:
2
\ No newline at end of file
test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/train_infer_python.txt
0 → 100644
浏览文件 @
0d85119d
===========================train_params===========================
model_name:det_r50_vd_sast_totaltext_v2.0
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:null
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=5000
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_infer=4
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/
null:null
##
trainer:norm_train
norm_train:tools/train.py -c test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/det_r50_vd_sast_totaltext.yml -o Global.pretrained_model=./pretrain_models/ResNet50_vd_ssld_pretrained
pact_train:null
fpgm_train:null
distill_train:null
null:null
null:null
##
===========================eval_params===========================
eval:null
null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.pretrained_model:
norm_export:tools/export_model.py -c test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/det_r50_vd_sast_totaltext.yml -o
quant_export:null
fpgm_export:null
distill_export:null
export1:null
export2:null
inference_dir:null
train_model:./inference/det_r50_vd_sast_totaltext_v2.0/best_accuracy
infer_export:tools/export_model.py -c test_tipc/configs/det_r50_vd_sast_totaltext_v2.0/det_r50_vd_sast_totaltext.yml -o
infer_quant:False
inference:tools/infer/predict_det.py
--use_gpu:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False|True
--precision:fp32|fp16|int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
--benchmark:True
null:null
test_tipc/configs/en_server_pgnetA/train_infer_python.txt
0 → 100644
浏览文件 @
0d85119d
===========================train_params===========================
model_name:en_server_pgnetA
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:null
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=500
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=2|whole_train_whole_infer=14
Global.pretrained_model:null
train_model_name:latest
train_infer_img_dir:./train_data/total_text/test/rgb/
null:null
##
trainer:norm_train
norm_train:tools/train.py -c configs/e2e/e2e_r50_vd_pg.yml -o Global.pretrained_model=./pretrain_models/en_server_pgnetA/best_accuracy
pact_train:null
fpgm_train:null
distill_train:null
null:null
null:null
##
===========================eval_params===========================
eval:null
null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.pretrained_model:
norm_export:tools/export_model.py -c configs/e2e/e2e_r50_vd_pg.yml -o
quant_export:null
fpgm_export:null
distill_export:null
export1:null
export2:null
inference_dir:null
train_model:./inference/en_server_pgnetA/best_accuracy
infer_export:tools/export_model.py -c configs/e2e/e2e_r50_vd_pg.yml -o
infer_quant:False
inference:tools/infer/predict_e2e.py
--use_gpu:True|False
--enable_mkldnn:True|False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False|True
--precision:fp32|fp16|int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
--benchmark:True
null:null
test_tipc/docs/test_lite_arm_cpp.md
浏览文件 @
0d85119d
...
@@ -16,7 +16,7 @@ Lite\_arm\_cpp预测功能测试的主程序为`test_lite_arm_cpp.sh`,可以
...
@@ -16,7 +16,7 @@ Lite\_arm\_cpp预测功能测试的主程序为`test_lite_arm_cpp.sh`,可以
| 模型类型 | batch-size | threads | predictor数量 | 预测库来源 | 测试硬件 |
| 模型类型 | batch-size | threads | predictor数量 | 预测库来源 | 测试硬件 |
| :----: | :----: | :----: | :----: | :----: | :----: |
| :----: | :----: | :----: | :----: | :----: | :----: |
| 正常模型/量化模型 | 1 | 1/4 | 单/多 | 下载方式 | ARM
\_
CPU/ARM
\_
GPU_OPENCL |
| 正常模型/量化模型 | 1 | 1/4 | 单/多 | 下载方式
/编译方式
| ARM
\_
CPU/ARM
\_
GPU_OPENCL |
## 2. 测试流程
## 2. 测试流程
...
@@ -30,8 +30,11 @@ Lite\_arm\_cpp预测功能测试的主程序为`test_lite_arm_cpp.sh`,可以
...
@@ -30,8 +30,11 @@ Lite\_arm\_cpp预测功能测试的主程序为`test_lite_arm_cpp.sh`,可以
```
shell
```
shell
# 数据和模型准备
# 数据、模型、Paddle-Lite预测库准备
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
#预测库为下载方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt download
#预测库为编译方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt compile
# 手机端测试:
# 手机端测试:
bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
...
@@ -42,8 +45,11 @@ bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
...
@@ -42,8 +45,11 @@ bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt
```
shell
```
shell
# 数据和模型准备
# 数据、模型、Paddle-Lite预测库准备
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ppocr_det_mobile/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
#预测库下载方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt download
#预测库编译方式
bash test_tipc/prepare_lite_cpp.sh ./test_tipc/configs/ch_PP-OCRv2_det/model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt compile
# 手机端测试:
# 手机端测试:
bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.txt
...
@@ -53,9 +59,7 @@ bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.
...
@@ -53,9 +59,7 @@ bash test_lite_arm_cpp.sh model_linux_gpu_normal_normal_lite_cpp_arm_gpu_opencl.
**注意**
:
**注意**
:
1.
由于运行该项目需要bash等命令,传统的adb方式不能很好的安装。所以此处推荐通在手机上开启虚拟终端的方式连接电脑,连接方式可以参考
[
安卓手机termux连接电脑
](
./termux_for_android.md
)
。
由于运行该项目需要bash等命令,传统的adb方式不能很好的安装。所以此处推荐通在手机上开启虚拟终端的方式连接电脑,连接方式可以参考
[
安卓手机termux连接电脑
](
./termux_for_android.md
)
。
2.
如果测试文本检测和识别完整的pipeline,在执行
`prepare_lite_cpp.sh`
时,配置文件需替换为
`test_tipc/configs/ppocr_system_mobile/model_linux_gpu_normal_normal_lite_cpp_arm_cpu.txt`
。在手机端测试阶段,配置文件同样修改为该文件。
### 2.2 运行结果
### 2.2 运行结果
...
...
test_tipc/prepare.sh
浏览文件 @
0d85119d
...
@@ -25,7 +25,7 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
...
@@ -25,7 +25,7 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
# pretrain lite train data
# pretrain lite train data
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
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar
--no-check-certificate
if
[
${
model_name
}
==
"
PPOCRv2_ocr
_det"
]
;
then
if
[
${
model_name
}
==
"
ch_PPOCRv2
_det"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
fi
fi
...
@@ -41,6 +41,18 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
...
@@ -41,6 +41,18 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
ln
-s
./icdar2015_lite ./icdar2015
ln
-s
./icdar2015_lite ./icdar2015
cd
../
cd
../
cd
./inference
&&
tar
xf rec_inference.tar
&&
cd
../
cd
./inference
&&
tar
xf rec_inference.tar
&&
cd
../
if
[
${
model_name
}
==
"en_server_pgnetA"
]
;
then
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/total_text_lite.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/en_server_pgnetA.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf en_server_pgnetA.tar
&&
cd
../
cd
./train_data
&&
tar
xf total_text_lite.tar
&&
ln
-s
total_text
&&
cd
../
fi
if
[
${
model_name
}
==
"det_r50_vd_sast_icdar15_v2.0"
]
||
[
${
model_name
}
==
"det_r50_vd_sast_totaltext_v2.0"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet50_vd_ssld_pretrained.pdparams
--no-check-certificate
wget
-nc
-P
./train_data/ wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/total_text_lite.tar
--no-check-certificate
cd
./train_data
&&
tar
xf total_text_lite.tar
&&
ln
-s
total_text
&&
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
rm
-rf
./train_data/icdar2015
rm
-rf
./train_data/icdar2015
...
@@ -48,10 +60,21 @@ elif [ ${MODE} = "whole_train_whole_infer" ];then
...
@@ -48,10 +60,21 @@ elif [ ${MODE} = "whole_train_whole_infer" ];then
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar
--no-check-certificate
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar
--no-check-certificate
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar
--no-check-certificate
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar
--no-check-certificate
cd
./train_data/
&&
tar
xf icdar2015.tar
&&
tar
xf ic15_data.tar
&&
cd
../
cd
./train_data/
&&
tar
xf icdar2015.tar
&&
tar
xf ic15_data.tar
&&
cd
../
if
[
${
model_name
}
==
"
PPOCRv2_ocr
_det"
]
;
then
if
[
${
model_name
}
==
"
ch_PPOCRv2
_det"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
fi
fi
if
[
${
model_name
}
==
"en_server_pgnetA"
]
;
then
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dataset/total_text.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/en_server_pgnetA.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf en_server_pgnetA.tar
&&
cd
../
cd
./train_data
&&
tar
xf total_text.tar
&&
ln
-s
total_text
&&
cd
../
fi
if
[
${
model_name
}
==
"det_r50_vd_sast_totaltext_v2.0"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet50_vd_ssld_pretrained.pdparams
--no-check-certificate
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dataset/total_text.tar
--no-check-certificate
cd
./train_data
&&
tar
xf total_text.tar
&&
ln
-s
total_text
&&
cd
../
fi
elif
[
${
MODE
}
=
"lite_train_whole_infer"
]
;
then
elif
[
${
MODE
}
=
"lite_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
rm
-rf
./train_data/icdar2015
rm
-rf
./train_data/icdar2015
...
@@ -61,19 +84,20 @@ elif [ ${MODE} = "lite_train_whole_infer" ];then
...
@@ -61,19 +84,20 @@ elif [ ${MODE} = "lite_train_whole_infer" ];then
cd
./train_data/
&&
tar
xf icdar2015_infer.tar
&&
tar
xf ic15_data.tar
cd
./train_data/
&&
tar
xf icdar2015_infer.tar
&&
tar
xf ic15_data.tar
ln
-s
./icdar2015_infer ./icdar2015
ln
-s
./icdar2015_infer ./icdar2015
cd
../
cd
../
if
[
${
model_name
}
==
"
PPOCRv2_ocr
_det"
]
;
then
if
[
${
model_name
}
==
"
ch_PPOCRv2
_det"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar
--no-check-certificate
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
fi
fi
elif
[
${
MODE
}
=
"whole_infer"
]
;
then
elif
[
${
MODE
}
=
"whole_infer"
]
;
then
if
[
${
model_name
}
=
"ocr_det"
]
;
then
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
if
[
${
model_name
}
=
"ch_ppocr_mobile_v2.0_det"
]
;
then
eval_model_name
=
"ch_ppocr_mobile_v2.0_det_train"
eval_model_name
=
"ch_ppocr_mobile_v2.0_det_train"
rm
-rf
./train_data/icdar2015
rm
-rf
./train_data/icdar2015
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
--no-check-certificate
cd
./inference
&&
tar
xf
${
eval_model_name
}
.tar
&&
tar
xf ch_det_data_50.tar
&&
tar
xf ch_ppocr_mobile_v2.0_det_infer.tar
&&
cd
../
cd
./inference
&&
tar
xf
${
eval_model_name
}
.tar
&&
tar
xf ch_det_data_50.tar
&&
tar
xf ch_ppocr_mobile_v2.0_det_infer.tar
&&
cd
../
elif
[
${
model_name
}
=
"
ocr_server
_det"
]
;
then
elif
[
${
model_name
}
=
"
ch_ppocr_server_v2.0
_det"
]
;
then
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
cd
./inference
&&
tar
xf ch_ppocr_server_v2.0_det_train.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
cd
./inference
&&
tar
xf ch_ppocr_server_v2.0_det_train.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
...
@@ -100,21 +124,33 @@ elif [ ${MODE} = "whole_infer" ];then
...
@@ -100,21 +124,33 @@ elif [ ${MODE} = "whole_infer" ];then
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar
--no-check-certificate
cd
./inference
&&
tar
xf
${
eval_model_name
}
.tar
&&
tar
xf rec_inference.tar
&&
cd
../
cd
./inference
&&
tar
xf
${
eval_model_name
}
.tar
&&
tar
xf rec_inference.tar
&&
cd
../
fi
fi
elif
[
${
model_name
}
=
"ch_PPOCRv2_det"
]
;
then
elif
[
${
model_name
}
=
"PPOCRv2_ocr_det"
]
;
then
eval_model_name
=
"ch_PP-OCRv2_det_infer"
eval_model_name
=
"ch_PP-OCRv2_det_infer"
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_infer.tar
--no-check-certificate
cd
./inference
&&
tar
xf
${
eval_model_name
}
.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
cd
./inference
&&
tar
xf
${
eval_model_name
}
.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
fi
fi
elif
[
${
model_name
}
=
"ch_PPOCRv2_det"
]
;
then
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/e2e_server_pgnetA_infer.tar
--no-check-certificate
cd
./inference
&&
tar
xf e2e_server_pgnetA_infer.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
fi
if
[
${
model_name
}
==
"en_server_pgnetA"
]
;
then
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/en_server_pgnetA.tar
--no-check-certificate
cd
./inference
&&
tar
xf en_server_pgnetA.tar
&&
cd
../
fi
if
[
${
model_name
}
==
"det_r50_vd_sast_icdar15_v2.0"
]
;
then
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_sast_icdar15_v2.0_train.tar
--no-check-certificate
cd
./inference/
&&
tar
det_r50_vd_sast_icdar15_v2.0_train.tar
&&
cd
../
fi
if
[
${
MODE
}
=
"klquant_whole_infer"
]
;
then
if
[
${
MODE
}
=
"klquant_whole_infer"
]
;
then
if
[
${
model_name
}
=
"
ocr
_det"
]
;
then
if
[
${
model_name
}
=
"
ch_ppocr_mobile_v2.0
_det"
]
;
then
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
cd
./inference
&&
tar
xf ch_ppocr_mobile_v2.0_det_infer.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
cd
./inference
&&
tar
xf ch_ppocr_mobile_v2.0_det_infer.tar
&&
tar
xf ch_det_data_50.tar
&&
cd
../
fi
fi
if
[
${
model_name
}
=
"
PPOCRv2_ocr
_det"
]
;
then
if
[
${
model_name
}
=
"
ch_PPOCRv2
_det"
]
;
then
eval_model_name
=
"ch_PP-OCRv2_det_infer"
eval_model_name
=
"ch_PP-OCRv2_det_infer"
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_infer.tar
--no-check-certificate
...
...
test_tipc/prepare_lite_cpp.sh
浏览文件 @
0d85119d
...
@@ -6,6 +6,7 @@ dataline=$(cat ${FILENAME})
...
@@ -6,6 +6,7 @@ dataline=$(cat ${FILENAME})
IFS
=
$'
\n
'
IFS
=
$'
\n
'
lines
=(
${
dataline
}
)
lines
=(
${
dataline
}
)
IFS
=
$'
\n
'
IFS
=
$'
\n
'
paddlelite_library_source
=
$2
inference_cmd
=
$(
func_parser_value
"
${
lines
[1]
}
"
)
inference_cmd
=
$(
func_parser_value
"
${
lines
[1]
}
"
)
DEVICE
=
$(
func_parser_value
"
${
lines
[2]
}
"
)
DEVICE
=
$(
func_parser_value
"
${
lines
[2]
}
"
)
...
@@ -13,40 +14,42 @@ det_lite_model_list=$(func_parser_value "${lines[3]}")
...
@@ -13,40 +14,42 @@ det_lite_model_list=$(func_parser_value "${lines[3]}")
rec_lite_model_list
=
$(
func_parser_value
"
${
lines
[4]
}
"
)
rec_lite_model_list
=
$(
func_parser_value
"
${
lines
[4]
}
"
)
cls_lite_model_list
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
cls_lite_model_list
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
if
[[
$inference_cmd
=
~
"det"
]]
;
then
if
[[
$inference_cmd
=
~
"det"
]]
;
then
lite_model_list
=
${
det_lite_model_list
}
lite_model_list
=
${
det_lite_model_list
}
elif
[[
$inference_cmd
=
~
"rec"
]]
;
then
elif
[[
$inference_cmd
=
~
"rec"
]]
;
then
lite_model_list
=(
${
rec_lite_model_list
[*]
}
${
cls_lite_model_list
[*]
}
)
lite_model_list
=(
${
rec_lite_model_list
[*]
}
${
cls_lite_model_list
[*]
}
)
elif
[[
$inference_cmd
=
~
"system"
]]
;
then
elif
[[
$inference_cmd
=
~
"system"
]]
;
then
lite_model_list
=(
${
det_lite_model_list
[*]
}
${
rec_lite_model_list
[*]
}
${
cls_lite_model_list
[*]
}
)
lite_model_list
=(
${
det_lite_model_list
[*]
}
${
rec_lite_model_list
[*]
}
${
cls_lite_model_list
[*]
}
)
else
else
echo
"inference_cmd is wrong, please check."
echo
"inference_cmd is wrong, please check."
exit
1
exit
1
fi
fi
if
[
${
DEVICE
}
=
"ARM_CPU"
]
;
then
if
[
${
DEVICE
}
=
"ARM_CPU"
]
;
then
valid_targets
=
"arm"
valid_targets
=
"arm"
paddlelite_url
=
"https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.10-rc/inference_lite_lib.android.armv8.gcc.c++_shared.with_extra.with_cv.tar.gz"
paddlelite_
library_
url
=
"https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.10-rc/inference_lite_lib.android.armv8.gcc.c++_shared.with_extra.with_cv.tar.gz"
end_index
=
"66"
end_index
=
"66"
elif
[
${
DEVICE
}
=
"ARM_GPU_OPENCL"
]
;
then
compile_with_opencl
=
"OFF"
elif
[
${
DEVICE
}
=
"ARM_GPU_OPENCL"
]
;
then
valid_targets
=
"opencl"
valid_targets
=
"opencl"
paddlelite_url
=
"https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.10-rc/inference_lite_lib.armv8.clang.with_exception.with_extra.with_cv.opencl.tar.gz"
paddlelite_
library_
url
=
"https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.10-rc/inference_lite_lib.armv8.clang.with_exception.with_extra.with_cv.opencl.tar.gz"
end_index
=
"71"
end_index
=
"71"
compile_with_opencl
=
"ON"
else
else
echo
"DEVICE only suport ARM_CPU, ARM_GPU_OPENCL."
echo
"DEVICE only sup
p
ort ARM_CPU, ARM_GPU_OPENCL."
exit
2
exit
2
fi
fi
# prepare
lite .nb
model
# prepare
paddlelite
model
pip
install
paddlelite
==
2.10-rc
pip
install
paddlelite
==
2.10-rc
current_dir
=
${
PWD
}
current_dir
=
${
PWD
}
IFS
=
"|"
IFS
=
"|"
model_path
=
./inference_models
model_path
=
./inference_models
for
model
in
${
lite_model_list
[*]
}
;
do
for
model
in
${
lite_model_list
[*]
}
;
do
if
[[
$model
=
~
"PP-OCRv2"
]]
;
then
if
[[
$model
=
~
"PP-OCRv2"
]]
;
then
inference_model_url
=
https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/
${
model
}
.tar
inference_model_url
=
https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/
${
model
}
.tar
elif
[[
$model
=
~
"v2.0"
]]
;
then
elif
[[
$model
=
~
"v2.0"
]]
;
then
inference_model_url
=
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/
${
model
}
.tar
inference_model_url
=
https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/
${
model
}
.tar
else
else
echo
"Model is wrong, please check."
echo
"Model is wrong, please check."
...
@@ -63,31 +66,42 @@ done
...
@@ -63,31 +66,42 @@ done
# prepare test data
# prepare test data
data_url
=
https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.tar
data_url
=
https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.tar
model_path
=
./inference_models
inference_model
=
${
inference_model_url
##*/
}
data_file
=
${
data_url
##*/
}
data_file
=
${
data_url
##*/
}
wget
-nc
-P
./inference_models
${
inference_model_url
}
wget
-nc
-P
./test_data
${
data_url
}
wget
-nc
-P
./test_data
${
data_url
}
cd
./inference_models
&&
tar
-xf
${
inference_model
}
&&
cd
../
cd
./test_data
&&
tar
-xf
${
data_file
}
&&
rm
${
data_file
}
&&
cd
../
cd
./test_data
&&
tar
-xf
${
data_file
}
&&
rm
${
data_file
}
&&
cd
../
# prepare lite env
# prepare paddlelite predict library
paddlelite_zipfile
=
$(
echo
$paddlelite_url
|
awk
-F
"/"
'{print $NF}'
)
if
[[
${
paddlelite_library_source
}
=
"download"
]]
;
then
paddlelite_file
=
${
paddlelite_zipfile
:0:
${
end_index
}}
paddlelite_library_zipfile
=
$(
echo
$paddlelite_library_url
|
awk
-F
"/"
'{print $NF}'
)
wget
${
paddlelite_url
}
&&
tar
-xf
${
paddlelite_zipfile
}
paddlelite_library_file
=
${
paddlelite_library_zipfile
:0:
${
end_index
}}
mkdir
-p
${
paddlelite_file
}
/demo/cxx/ocr/test_lite
wget
${
paddlelite_library_url
}
&&
tar
-xf
${
paddlelite_library_zipfile
}
cp
-r
${
model_path
}
/
*
_opt.nb test_data
${
paddlelite_file
}
/demo/cxx/ocr/test_lite
cd
${
paddlelite_library_zipfile
}
cp
ppocr/utils/ppocr_keys_v1.txt deploy/lite/config.txt
${
paddlelite_file
}
/demo/cxx/ocr/test_lite
elif
[[
${
paddlelite_library_source
}
=
"compile"
]]
;
then
cp
-r
./deploy/lite/
*
${
paddlelite_file
}
/demo/cxx/ocr/
git clone
-b
release/v2.10 https://github.com/PaddlePaddle/Paddle-Lite.git
cp
${
paddlelite_file
}
/cxx/lib/libpaddle_light_api_shared.so
${
paddlelite_file
}
/demo/cxx/ocr/test_lite
cd
Paddle-Lite
cp
${
FILENAME
}
test_tipc/test_lite_arm_cpp.sh test_tipc/common_func.sh
${
paddlelite_file
}
/demo/cxx/ocr/test_lite
./lite/tools/build_android.sh
--arch
=
armv8
--with_cv
=
ON
--with_extra
=
ON
--toolchain
=
clang
--with_opencl
=
${
compile_with_opencl
}
cd
${
paddlelite_file
}
/demo/cxx/ocr/
cd
../
cp
-r
Paddle-Lite/build.lite.android.armv8.clang/inference_lite_lib.android.armv8/
.
paddlelite_library_file
=
inference_lite_lib.android.armv8
else
echo
"paddlelite_library_source only support 'download' and 'compile'"
exit
3
fi
# organize the required files
mkdir
-p
${
paddlelite_library_file
}
/demo/cxx/ocr/test_lite
cp
-r
${
model_path
}
/
*
_opt.nb test_data
${
paddlelite_library_file
}
/demo/cxx/ocr/test_lite
cp
ppocr/utils/ppocr_keys_v1.txt deploy/lite/config.txt
${
paddlelite_library_file
}
/demo/cxx/ocr/test_lite
cp
-r
./deploy/lite/
*
${
paddlelite_library_file
}
/demo/cxx/ocr/
cp
${
paddlelite_library_file
}
/cxx/lib/libpaddle_light_api_shared.so
${
paddlelite_library_file
}
/demo/cxx/ocr/test_lite
cp
${
FILENAME
}
test_tipc/test_lite_arm_cpp.sh test_tipc/common_func.sh
${
paddlelite_library_file
}
/demo/cxx/ocr/test_lite
cd
${
paddlelite_library_file
}
/demo/cxx/ocr/
git clone https://github.com/cuicheng01/AutoLog.git
git clone https://github.com/cuicheng01/AutoLog.git
#
make
#
compile and do some postprocess
make
-j
make
-j
sleep
1
sleep
1
make
-j
make
-j
cp
ocr_db_crnn test_lite
&&
cp
test_lite/libpaddle_light_api_shared.so test_lite/libc++_shared.so
cp
ocr_db_crnn test_lite
&&
cp
test_lite/libpaddle_light_api_shared.so test_lite/libc++_shared.so
tar
-cf
test_lite.tar ./test_lite
&&
cp
test_lite.tar
${
current_dir
}
&&
cd
${
current_dir
}
tar
-cf
test_lite.tar ./test_lite
&&
cp
test_lite.tar
${
current_dir
}
&&
cd
${
current_dir
}
rm
-rf
${
paddlelite_file
}*
&&
rm
-rf
${
model_path
}
rm
-rf
${
paddlelite_
library_
file
}*
&&
rm
-rf
${
model_path
}
test_tipc/test_train_inference_python.sh
浏览文件 @
0d85119d
...
@@ -20,10 +20,10 @@ train_use_gpu_value=$(func_parser_value "${lines[4]}")
...
@@ -20,10 +20,10 @@ train_use_gpu_value=$(func_parser_value "${lines[4]}")
autocast_list
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
autocast_list
=
$(
func_parser_value
"
${
lines
[5]
}
"
)
autocast_key
=
$(
func_parser_key
"
${
lines
[5]
}
"
)
autocast_key
=
$(
func_parser_key
"
${
lines
[5]
}
"
)
epoch_key
=
$(
func_parser_key
"
${
lines
[6]
}
"
)
epoch_key
=
$(
func_parser_key
"
${
lines
[6]
}
"
)
epoch_num
=
$(
func_parser_params
"
${
lines
[6]
}
"
)
epoch_num
=
$(
func_parser_params
"
${
lines
[6]
}
"
"
${
MODE
}
"
)
save_model_key
=
$(
func_parser_key
"
${
lines
[7]
}
"
)
save_model_key
=
$(
func_parser_key
"
${
lines
[7]
}
"
)
train_batch_key
=
$(
func_parser_key
"
${
lines
[8]
}
"
)
train_batch_key
=
$(
func_parser_key
"
${
lines
[8]
}
"
)
train_batch_value
=
$(
func_parser_params
"
${
lines
[8]
}
"
)
train_batch_value
=
$(
func_parser_params
"
${
lines
[8]
}
"
"
${
MODE
}
"
)
pretrain_model_key
=
$(
func_parser_key
"
${
lines
[9]
}
"
)
pretrain_model_key
=
$(
func_parser_key
"
${
lines
[9]
}
"
)
pretrain_model_value
=
$(
func_parser_value
"
${
lines
[9]
}
"
)
pretrain_model_value
=
$(
func_parser_value
"
${
lines
[9]
}
"
)
train_model_name
=
$(
func_parser_value
"
${
lines
[10]
}
"
)
train_model_name
=
$(
func_parser_value
"
${
lines
[10]
}
"
)
...
...
tools/infer/utility.py
100755 → 100644
浏览文件 @
0d85119d
...
@@ -190,6 +190,7 @@ def create_predictor(args, mode, logger):
...
@@ -190,6 +190,7 @@ def create_predictor(args, mode, logger):
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
config
.
enable_use_gpu
(
args
.
gpu_mem
,
0
)
if
args
.
use_tensorrt
:
if
args
.
use_tensorrt
:
config
.
enable_tensorrt_engine
(
config
.
enable_tensorrt_engine
(
workspace_size
=
1
<<
30
,
precision_mode
=
precision
,
precision_mode
=
precision
,
max_batch_size
=
args
.
max_batch_size
,
max_batch_size
=
args
.
max_batch_size
,
min_subgraph_size
=
args
.
min_subgraph_size
)
min_subgraph_size
=
args
.
min_subgraph_size
)
...
@@ -310,10 +311,6 @@ def create_predictor(args, mode, logger):
...
@@ -310,10 +311,6 @@ def create_predictor(args, mode, logger):
def
get_infer_gpuid
():
def
get_infer_gpuid
():
cmd
=
"nvidia-smi"
res
=
os
.
popen
(
cmd
).
readlines
()
if
len
(
res
)
==
0
:
return
None
cmd
=
"env | grep CUDA_VISIBLE_DEVICES"
cmd
=
"env | grep CUDA_VISIBLE_DEVICES"
env_cuda
=
os
.
popen
(
cmd
).
readlines
()
env_cuda
=
os
.
popen
(
cmd
).
readlines
()
if
len
(
env_cuda
)
==
0
:
if
len
(
env_cuda
)
==
0
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录