Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleOCR
提交
8686dddf
P
PaddleOCR
项目概览
s920243400
/
PaddleOCR
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleOCR
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleOCR
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8686dddf
编写于
6月 16, 2022
作者:
A
andyjpaddle
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dygraph' of
https://github.com/PaddlePaddle/PaddleOCR
into dygraph
上级
e1f947b9
bdefa140
变更
29
展开全部
隐藏空白更改
内联
并排
Showing
29 changed file
with
685 addition
and
45 deletion
+685
-45
applications/PCB字符识别/PCB字符识别.md
applications/PCB字符识别/PCB字符识别.md
+0
-0
applications/PCB字符识别/gen_data/background/bg.jpg
applications/PCB字符识别/gen_data/background/bg.jpg
+0
-0
applications/PCB字符识别/gen_data/corpus/text.txt
applications/PCB字符识别/gen_data/corpus/text.txt
+31
-0
applications/PCB字符识别/gen_data/det_background/1.png
applications/PCB字符识别/gen_data/det_background/1.png
+0
-0
applications/PCB字符识别/gen_data/det_background/2.png
applications/PCB字符识别/gen_data/det_background/2.png
+0
-0
applications/PCB字符识别/gen_data/gen.py
applications/PCB字符识别/gen_data/gen.py
+261
-0
applications/轻量级车牌识别.md
applications/轻量级车牌识别.md
+3
-3
ppstructure/table/README.md
ppstructure/table/README.md
+1
-1
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
+3
-3
test_tipc/configs/ch_PP-OCRv3/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+3
-3
test_tipc/configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_distillation.yml
.../configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_distillation.yml
+2
-2
test_tipc/configs/ch_PP-OCRv3_rec/train_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt
...ain_linux_gpu_fleet_normal_infer_python_linux_gpu_cpu.txt
+1
-1
test_tipc/configs/ch_PP-OCRv3_rec/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
...train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
+2
-2
test_tipc/configs/ch_PP-OCRv3_rec_PACT/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
...train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
+1
-1
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
+3
-3
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt
...det/model_linux_gpu_normal_normal_infer_python_jetson.txt
+4
-4
test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_mac_cpu_normal_normal_infer_python_mac_cpu.txt
..._det/train_mac_cpu_normal_normal_infer_python_mac_cpu.txt
+1
-1
test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_windows_gpu_normal_normal_infer_python_windows_cpu_gpu.txt
...indows_gpu_normal_normal_infer_python_windows_cpu_gpu.txt
+3
-3
test_tipc/configs/ch_ppocr_server_v2.0/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+2
-2
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
+2
-2
test_tipc/configs/en_table_structure/table_mv3.yml
test_tipc/configs/en_table_structure/table_mv3.yml
+117
-0
test_tipc/configs/en_table_structure/train_infer_python.txt
test_tipc/configs/en_table_structure/train_infer_python.txt
+53
-0
test_tipc/configs/en_table_structure/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
...train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
+1
-1
test_tipc/configs/en_table_structure_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
...el_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
+21
-0
test_tipc/configs/en_table_structure_PACT/train_infer_python.txt
...pc/configs/en_table_structure_PACT/train_infer_python.txt
+53
-0
test_tipc/configs/en_table_structure_PACT/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
...train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
+53
-0
test_tipc/docs/test_train_fleet_inference_python.md
test_tipc/docs/test_train_fleet_inference_python.md
+5
-5
test_tipc/prepare.sh
test_tipc/prepare.sh
+56
-5
test_tipc/test_inference_python.sh
test_tipc/test_inference_python.sh
+3
-3
未找到文件。
applications/PCB字符识别/PCB字符识别.md
0 → 100644
浏览文件 @
8686dddf
此差异已折叠。
点击以展开。
applications/PCB字符识别/gen_data/background/bg.jpg
0 → 100644
浏览文件 @
8686dddf
2.0 KB
applications/PCB字符识别/gen_data/corpus/text.txt
0 → 100644
浏览文件 @
8686dddf
5ZQ
I4UL
PWL
SNOG
ZL02
1C30
O3H
YHRS
N03S
1U5Y
JTK
EN4F
YKJ
DWNH
R42W
X0V
4OF5
08AM
Y93S
GWE2
0KR
9U2A
DBQ
Y6J
ROZ
K06
KIEY
NZQJ
UN1B
6X4
\ No newline at end of file
applications/PCB字符识别/gen_data/det_background/1.png
0 → 100644
浏览文件 @
8686dddf
145 字节
applications/PCB字符识别/gen_data/det_background/2.png
0 → 100644
浏览文件 @
8686dddf
141 字节
applications/PCB字符识别/gen_data/gen.py
0 → 100644
浏览文件 @
8686dddf
# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This code is refer from:
https://github.com/zcswdt/Color_OCR_image_generator
"""
import
os
import
random
from
PIL
import
Image
,
ImageDraw
,
ImageFont
import
json
import
argparse
def
get_char_lines
(
txt_root_path
):
"""
desc:get corpus line
"""
txt_files
=
os
.
listdir
(
txt_root_path
)
char_lines
=
[]
for
txt
in
txt_files
:
f
=
open
(
os
.
path
.
join
(
txt_root_path
,
txt
),
mode
=
'r'
,
encoding
=
'utf-8'
)
lines
=
f
.
readlines
()
f
.
close
()
for
line
in
lines
:
char_lines
.
append
(
line
.
strip
())
return
char_lines
def
get_horizontal_text_picture
(
image_file
,
chars
,
fonts_list
,
cf
):
"""
desc:gen horizontal text picture
"""
img
=
Image
.
open
(
image_file
)
if
img
.
mode
!=
'RGB'
:
img
=
img
.
convert
(
'RGB'
)
img_w
,
img_h
=
img
.
size
# random choice font
font_path
=
random
.
choice
(
fonts_list
)
# random choice font size
font_size
=
random
.
randint
(
cf
.
font_min_size
,
cf
.
font_max_size
)
font
=
ImageFont
.
truetype
(
font_path
,
font_size
)
ch_w
=
[]
ch_h
=
[]
for
ch
in
chars
:
wt
,
ht
=
font
.
getsize
(
ch
)
ch_w
.
append
(
wt
)
ch_h
.
append
(
ht
)
f_w
=
sum
(
ch_w
)
f_h
=
max
(
ch_h
)
# add space
char_space_width
=
max
(
ch_w
)
f_w
+=
(
char_space_width
*
(
len
(
chars
)
-
1
))
x1
=
random
.
randint
(
0
,
img_w
-
f_w
)
y1
=
random
.
randint
(
0
,
img_h
-
f_h
)
x2
=
x1
+
f_w
y2
=
y1
+
f_h
crop_y1
=
y1
crop_x1
=
x1
crop_y2
=
y2
crop_x2
=
x2
best_color
=
(
0
,
0
,
0
)
draw
=
ImageDraw
.
Draw
(
img
)
for
i
,
ch
in
enumerate
(
chars
):
draw
.
text
((
x1
,
y1
),
ch
,
best_color
,
font
=
font
)
x1
+=
(
ch_w
[
i
]
+
char_space_width
)
crop_img
=
img
.
crop
((
crop_x1
,
crop_y1
,
crop_x2
,
crop_y2
))
return
crop_img
,
chars
def
get_vertical_text_picture
(
image_file
,
chars
,
fonts_list
,
cf
):
"""
desc:gen vertical text picture
"""
img
=
Image
.
open
(
image_file
)
if
img
.
mode
!=
'RGB'
:
img
=
img
.
convert
(
'RGB'
)
img_w
,
img_h
=
img
.
size
# random choice font
font_path
=
random
.
choice
(
fonts_list
)
# random choice font size
font_size
=
random
.
randint
(
cf
.
font_min_size
,
cf
.
font_max_size
)
font
=
ImageFont
.
truetype
(
font_path
,
font_size
)
ch_w
=
[]
ch_h
=
[]
for
ch
in
chars
:
wt
,
ht
=
font
.
getsize
(
ch
)
ch_w
.
append
(
wt
)
ch_h
.
append
(
ht
)
f_w
=
max
(
ch_w
)
f_h
=
sum
(
ch_h
)
x1
=
random
.
randint
(
0
,
img_w
-
f_w
)
y1
=
random
.
randint
(
0
,
img_h
-
f_h
)
x2
=
x1
+
f_w
y2
=
y1
+
f_h
crop_y1
=
y1
crop_x1
=
x1
crop_y2
=
y2
crop_x2
=
x2
best_color
=
(
0
,
0
,
0
)
draw
=
ImageDraw
.
Draw
(
img
)
i
=
0
for
ch
in
chars
:
draw
.
text
((
x1
,
y1
),
ch
,
best_color
,
font
=
font
)
y1
=
y1
+
ch_h
[
i
]
i
=
i
+
1
crop_img
=
img
.
crop
((
crop_x1
,
crop_y1
,
crop_x2
,
crop_y2
))
crop_img
=
crop_img
.
transpose
(
Image
.
ROTATE_90
)
return
crop_img
,
chars
def
get_fonts
(
fonts_path
):
"""
desc: get all fonts
"""
font_files
=
os
.
listdir
(
fonts_path
)
fonts_list
=
[]
for
font_file
in
font_files
:
font_path
=
os
.
path
.
join
(
fonts_path
,
font_file
)
fonts_list
.
append
(
font_path
)
return
fonts_list
if
__name__
==
'__main__'
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--num_img'
,
type
=
int
,
default
=
30
,
help
=
"Number of images to generate"
)
parser
.
add_argument
(
'--font_min_size'
,
type
=
int
,
default
=
11
)
parser
.
add_argument
(
'--font_max_size'
,
type
=
int
,
default
=
12
,
help
=
"Help adjust the size of the generated text and the size of the picture"
)
parser
.
add_argument
(
'--bg_path'
,
type
=
str
,
default
=
'./background'
,
help
=
'The generated text pictures will be pasted onto the pictures of this folder'
)
parser
.
add_argument
(
'--det_bg_path'
,
type
=
str
,
default
=
'./det_background'
,
help
=
'The generated text pictures will use the pictures of this folder as the background'
)
parser
.
add_argument
(
'--fonts_path'
,
type
=
str
,
default
=
'../../StyleText/fonts'
,
help
=
'The font used to generate the picture'
)
parser
.
add_argument
(
'--corpus_path'
,
type
=
str
,
default
=
'./corpus'
,
help
=
'The corpus used to generate the text picture'
)
parser
.
add_argument
(
'--output_dir'
,
type
=
str
,
default
=
'./output/'
,
help
=
'Images save dir'
)
cf
=
parser
.
parse_args
()
# save path
if
not
os
.
path
.
exists
(
cf
.
output_dir
):
os
.
mkdir
(
cf
.
output_dir
)
# get corpus
txt_root_path
=
cf
.
corpus_path
char_lines
=
get_char_lines
(
txt_root_path
=
txt_root_path
)
# get all fonts
fonts_path
=
cf
.
fonts_path
fonts_list
=
get_fonts
(
fonts_path
)
# rec bg
img_root_path
=
cf
.
bg_path
imnames
=
os
.
listdir
(
img_root_path
)
# det bg
det_bg_path
=
cf
.
det_bg_path
bg_pics
=
os
.
listdir
(
det_bg_path
)
# OCR det files
det_val_file
=
open
(
cf
.
output_dir
+
'det_gt_val.txt'
,
'w'
,
encoding
=
'utf-8'
)
det_train_file
=
open
(
cf
.
output_dir
+
'det_gt_train.txt'
,
'w'
,
encoding
=
'utf-8'
)
# det imgs
det_save_dir
=
'imgs/'
if
not
os
.
path
.
exists
(
cf
.
output_dir
+
det_save_dir
):
os
.
mkdir
(
cf
.
output_dir
+
det_save_dir
)
det_val_save_dir
=
'imgs_val/'
if
not
os
.
path
.
exists
(
cf
.
output_dir
+
det_val_save_dir
):
os
.
mkdir
(
cf
.
output_dir
+
det_val_save_dir
)
# OCR rec files
rec_val_file
=
open
(
cf
.
output_dir
+
'rec_gt_val.txt'
,
'w'
,
encoding
=
'utf-8'
)
rec_train_file
=
open
(
cf
.
output_dir
+
'rec_gt_train.txt'
,
'w'
,
encoding
=
'utf-8'
)
# rec imgs
rec_save_dir
=
'rec_imgs/'
if
not
os
.
path
.
exists
(
cf
.
output_dir
+
rec_save_dir
):
os
.
mkdir
(
cf
.
output_dir
+
rec_save_dir
)
rec_val_save_dir
=
'rec_imgs_val/'
if
not
os
.
path
.
exists
(
cf
.
output_dir
+
rec_val_save_dir
):
os
.
mkdir
(
cf
.
output_dir
+
rec_val_save_dir
)
val_ratio
=
cf
.
num_img
*
0.2
# val dataset ratio
print
(
'start generating...'
)
for
i
in
range
(
0
,
cf
.
num_img
):
imname
=
random
.
choice
(
imnames
)
img_path
=
os
.
path
.
join
(
img_root_path
,
imname
)
rnd
=
random
.
random
()
# gen horizontal text picture
if
rnd
<
0.5
:
gen_img
,
chars
=
get_horizontal_text_picture
(
img_path
,
char_lines
[
i
],
fonts_list
,
cf
)
ori_w
,
ori_h
=
gen_img
.
size
gen_img
=
gen_img
.
crop
((
0
,
3
,
ori_w
,
ori_h
))
# gen vertical text picture
else
:
gen_img
,
chars
=
get_vertical_text_picture
(
img_path
,
char_lines
[
i
],
fonts_list
,
cf
)
ori_w
,
ori_h
=
gen_img
.
size
gen_img
=
gen_img
.
crop
((
3
,
0
,
ori_w
,
ori_h
))
ori_w
,
ori_h
=
gen_img
.
size
# rec imgs
save_img_name
=
str
(
i
).
zfill
(
4
)
+
'.jpg'
if
i
<
val_ratio
:
save_dir
=
os
.
path
.
join
(
rec_val_save_dir
,
save_img_name
)
line
=
save_dir
+
'
\t
'
+
char_lines
[
i
]
+
'
\n
'
rec_val_file
.
write
(
line
)
else
:
save_dir
=
os
.
path
.
join
(
rec_save_dir
,
save_img_name
)
line
=
save_dir
+
'
\t
'
+
char_lines
[
i
]
+
'
\n
'
rec_train_file
.
write
(
line
)
gen_img
.
save
(
cf
.
output_dir
+
save_dir
,
quality
=
95
,
subsampling
=
0
)
# det img
# random choice bg
bg_pic
=
random
.
sample
(
bg_pics
,
1
)[
0
]
det_img
=
Image
.
open
(
os
.
path
.
join
(
det_bg_path
,
bg_pic
))
# the PCB position is fixed, modify it according to your own scenario
if
bg_pic
==
'1.png'
:
x1
=
38
y1
=
3
else
:
x1
=
34
y1
=
1
det_img
.
paste
(
gen_img
,
(
x1
,
y1
))
# text pos
chars_pos
=
[[
x1
,
y1
],
[
x1
+
ori_w
,
y1
],
[
x1
+
ori_w
,
y1
+
ori_h
],
[
x1
,
y1
+
ori_h
]]
label
=
[{
"transcription"
:
char_lines
[
i
],
"points"
:
chars_pos
}]
if
i
<
val_ratio
:
save_dir
=
os
.
path
.
join
(
det_val_save_dir
,
save_img_name
)
det_val_file
.
write
(
save_dir
+
'
\t
'
+
json
.
dumps
(
label
,
ensure_ascii
=
False
)
+
'
\n
'
)
else
:
save_dir
=
os
.
path
.
join
(
det_save_dir
,
save_img_name
)
det_train_file
.
write
(
save_dir
+
'
\t
'
+
json
.
dumps
(
label
,
ensure_ascii
=
False
)
+
'
\n
'
)
det_img
.
save
(
cf
.
output_dir
+
save_dir
,
quality
=
95
,
subsampling
=
0
)
applications/轻量级车牌识别.md
浏览文件 @
8686dddf
...
...
@@ -249,7 +249,7 @@ tar -xf ch_PP-OCRv3_det_distill_train.tar
cd
/home/aistudio/PaddleOCR
```
预训练模型下载完成后,我们使用
[
ch_PP-OCRv3_det_student.yml
](
../configs/
chepai
/ch_PP-OCRv3_det_student.yml
)
配置文件进行后续实验,在开始评估之前需要对配置文件中部分字段进行设置,具体如下:
预训练模型下载完成后,我们使用
[
ch_PP-OCRv3_det_student.yml
](
../configs/
det/ch_PP-OCRv3
/ch_PP-OCRv3_det_student.yml
)
配置文件进行后续实验,在开始评估之前需要对配置文件中部分字段进行设置,具体如下:
1.
模型存储和训练相关:
1.
Global.pretrained_model: 指向PP-OCRv3文本检测预训练模型地址
...
...
@@ -787,12 +787,12 @@ python tools/infer/predict_system.py \
-
端侧部署
端侧部署我们采用基于 PaddleLite 的 cpp 推理。Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理能力,并广泛整合跨平台硬件,为端侧部署及应用落地问题提供轻量化的部署方案。具体可参考
[
PaddleOCR lite教程
](
../d
ygraph/d
eploy/lite/readme_ch.md
)
端侧部署我们采用基于 PaddleLite 的 cpp 推理。Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理能力,并广泛整合跨平台硬件,为端侧部署及应用落地问题提供轻量化的部署方案。具体可参考
[
PaddleOCR lite教程
](
../deploy/lite/readme_ch.md
)
### 4.5 实验总结
我们分别使用PP-OCRv3中英文超轻量预训练模型在车牌数据集上进行了直接评估和 fine-tune 和 fine-tune +量化3种方案的实验,并基于
[
PaddleOCR lite教程
](
https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph
/deploy/lite/readme_ch.md
)
进行了速度测试,指标对比如下:
我们分别使用PP-OCRv3中英文超轻量预训练模型在车牌数据集上进行了直接评估和 fine-tune 和 fine-tune +量化3种方案的实验,并基于
[
PaddleOCR lite教程
](
..
/deploy/lite/readme_ch.md
)
进行了速度测试,指标对比如下:
-
检测
...
...
ppstructure/table/README.md
浏览文件 @
8686dddf
...
...
@@ -18,7 +18,7 @@ The table recognition mainly contains three models
The table recognition flow chart is as follows
![
tableocr_pipeline
](
../
../doc
/table/tableocr_pipeline_en.jpg
)
![
tableocr_pipeline
](
../
docs
/table/tableocr_pipeline_en.jpg
)
1.
The coordinates of single-line text is detected by DB model, and then sends it to the recognition model to get the recognition result.
2.
The table structure and cell coordinates is predicted by RARE model.
...
...
test_tipc/configs/ch_PP-OCRv2/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -6,10 +6,10 @@ infer_export:null
infer_quant:False
inference:tools/infer/predict_system.py
--use_gpu:False|True
--enable_mkldnn:False
|True
--cpu_threads:
1|
6
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
|True
--use_tensorrt:False
--precision:fp32
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
...
...
test_tipc/configs/ch_PP-OCRv3/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -6,10 +6,10 @@ infer_export:null
infer_quant:False
inference:tools/infer/predict_system.py --rec_image_shape="3,48,320"
--use_gpu:False|True
--enable_mkldnn:False
|True
--cpu_threads:
1|
6
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
|True
--use_tensorrt:False
--precision:fp32
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
...
...
test_tipc/configs/ch_PP-OCRv3_rec/ch_PP-OCRv3_rec_distillation.yml
浏览文件 @
8686dddf
...
...
@@ -153,7 +153,7 @@ Train:
data_dir
:
./train_data/ic15_data/
ext_op_transform_idx
:
1
label_file_list
:
-
./train_data/ic15_data/rec_gt_train.txt
-
./train_data/ic15_data/rec_gt_train
_lite
.txt
transforms
:
-
DecodeImage
:
img_mode
:
BGR
...
...
@@ -183,7 +183,7 @@ Eval:
name
:
SimpleDataSet
data_dir
:
./train_data/ic15_data
label_file_list
:
-
./train_data/ic15_data/rec_gt_test.txt
-
./train_data/ic15_data/rec_gt_test
_lite
.txt
transforms
:
-
DecodeImage
:
img_mode
:
BGR
...
...
test_tipc/configs/ch_PP-OCRv3_rec/train_
fleet_infer_python
.txt
→
test_tipc/configs/ch_PP-OCRv3_rec/train_
linux_gpu_fleet_normal_infer_python_linux_gpu_cpu
.txt
浏览文件 @
8686dddf
...
...
@@ -38,7 +38,7 @@ infer_model:./inference/ch_PP-OCRv3_rec_infer
infer_export:null
infer_quant:False
inference:tools/infer/predict_rec.py --rec_image_shape="3,48,320"
--use_gpu:
True|
False
--use_gpu:False
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1|6
...
...
test_tipc/configs/ch_PP-OCRv3_rec/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -4,7 +4,7 @@ python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:amp
Global.epoch_num:lite_train_lite_infer=
3
|whole_train_whole_infer=50
Global.epoch_num:lite_train_lite_infer=
1
|whole_train_whole_infer=50
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=128
Global.pretrained_model:null
...
...
@@ -41,7 +41,7 @@ inference:tools/infer/predict_rec.py --rec_image_shape="3,48,320"
--use_gpu:True|False
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:
1|
6
--rec_batch_num:6
--use_tensorrt:False
--precision:fp32
--rec_model_dir:
...
...
test_tipc/configs/ch_PP-OCRv3_rec_PACT/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -41,7 +41,7 @@ inference:tools/infer/predict_rec.py --rec_image_shape="3,48,320"
--use_gpu:True|False
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:
1|
6
--rec_batch_num:6
--use_tensorrt:False
--precision:fp32
--rec_model_dir:
...
...
test_tipc/configs/ch_ppocr_mobile_v2.0/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -6,10 +6,10 @@ infer_export:null
infer_quant:False
inference:tools/infer/predict_system.py
--use_gpu:False|True
--enable_mkldnn:False
|True
--cpu_threads:
1|
6
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
|True
--use_tensorrt:False
--precision:fp32
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
...
...
test_tipc/configs/ch_ppocr_mobile_v2.0_det/model_linux_gpu_normal_normal_infer_python_jetson.txt
浏览文件 @
8686dddf
===========================infer_params===========================
model_name:
ocr
_det
model_name:
ch_ppocr_mobile_v2.0
_det
python:python
infer_model:./inference/ch_ppocr_mobile_v2.0_det_infer
infer_export:null
...
...
@@ -7,10 +7,10 @@ infer_quant:False
inference:tools/infer/predict_det.py
--use_gpu:True|False
--enable_mkldnn:False
--cpu_threads:
1|
6
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
|True
--precision:fp
16|fp
32
--use_tensorrt:False
--precision:fp32
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
null:null
...
...
test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_mac_cpu_normal_normal_infer_python_mac_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -4,7 +4,7 @@ python:python
gpu_list:-1
Global.use_gpu:False
Global.auto_cast:null
Global.epoch_num:lite_train_lite_infer=5|whole_train_whole_infer=
30
0
Global.epoch_num:lite_train_lite_infer=5|whole_train_whole_infer=
5
0
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
...
...
test_tipc/configs/ch_ppocr_mobile_v2.0_det/train_windows_gpu_normal_normal_infer_python_windows_cpu_gpu.txt
浏览文件 @
8686dddf
...
...
@@ -4,7 +4,7 @@ python:python
gpu_list:0
Global.use_gpu:True
Global.auto_cast:fp32|amp
Global.epoch_num:lite_train_lite_infer=5|whole_train_whole_infer=
30
0
Global.epoch_num:lite_train_lite_infer=5|whole_train_whole_infer=
5
0
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
...
...
@@ -39,10 +39,10 @@ infer_export:tools/export_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2
infer_quant:False
inference:tools/infer/predict_det.py
--use_gpu:True|False
--enable_mkldnn:
True|
False
--enable_mkldnn:False
--cpu_threads:1|6
--rec_batch_num:1
--use_tensorrt:False
|True
--use_tensorrt:False
--precision:fp32|fp16|int8
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
...
...
test_tipc/configs/ch_ppocr_server_v2.0/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -6,8 +6,8 @@ infer_export:null
infer_quant:True
inference:tools/infer/predict_system.py
--use_gpu:False|True
--enable_mkldnn:False
|True
--cpu_threads:
1|
6
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
--precision:fp32
...
...
test_tipc/configs/det_r50_vd_sast_icdar15_v2.0/train_infer_python.txt
浏览文件 @
8686dddf
...
...
@@ -4,7 +4,7 @@ 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
0
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
...
...
@@ -45,7 +45,7 @@ inference:tools/infer/predict_det.py
--use_tensorrt:False
--precision:fp32
--det_model_dir:
--image_dir:./inference/ch_det_data_50/all-sum-510/
--image_dir:./inference/ch_det_data_50/all-sum-510/
00008790.jpg
null:null
--benchmark:True
--det_algorithm:SAST
...
...
test_tipc/configs/en_table_structure/table_mv3.yml
0 → 100755
浏览文件 @
8686dddf
Global
:
use_gpu
:
true
epoch_num
:
10
log_smooth_window
:
20
print_batch_step
:
5
save_model_dir
:
./output/table_mv3/
save_epoch_step
:
3
# evaluation is run every 400 iterations after the 0th iteration
eval_batch_step
:
[
0
,
400
]
cal_metric_during_train
:
True
pretrained_model
:
checkpoints
:
save_inference_dir
:
use_visualdl
:
False
infer_img
:
doc/table/table.jpg
# for data or label process
character_dict_path
:
ppocr/utils/dict/table_structure_dict.txt
character_type
:
en
max_text_length
:
100
max_elem_length
:
800
max_cell_num
:
500
infer_mode
:
False
process_total_num
:
0
process_cut_num
:
0
Optimizer
:
name
:
Adam
beta1
:
0.9
beta2
:
0.999
clip_norm
:
5.0
lr
:
learning_rate
:
0.001
regularizer
:
name
:
'
L2'
factor
:
0.00000
Architecture
:
model_type
:
table
algorithm
:
TableAttn
Backbone
:
name
:
MobileNetV3
scale
:
1.0
model_name
:
large
Head
:
name
:
TableAttentionHead
hidden_size
:
256
l2_decay
:
0.00001
loc_type
:
2
max_text_length
:
100
max_elem_length
:
800
max_cell_num
:
500
Loss
:
name
:
TableAttentionLoss
structure_weight
:
100.0
loc_weight
:
10000.0
PostProcess
:
name
:
TableLabelDecode
Metric
:
name
:
TableMetric
main_indicator
:
acc
Train
:
dataset
:
name
:
PubTabDataSet
data_dir
:
./train_data/pubtabnet/train
label_file_path
:
./train_data/pubtabnet/train.jsonl
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
ResizeTableImage
:
max_len
:
488
-
TableLabelEncode
:
-
NormalizeImage
:
scale
:
1./255.
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
hwc'
-
PaddingTableImage
:
-
ToCHWImage
:
-
KeepKeys
:
keep_keys
:
[
'
image'
,
'
structure'
,
'
bbox_list'
,
'
sp_tokens'
,
'
bbox_list_mask'
]
loader
:
shuffle
:
True
batch_size_per_card
:
32
drop_last
:
True
num_workers
:
1
Eval
:
dataset
:
name
:
PubTabDataSet
data_dir
:
./train_data/pubtabnet/test/
label_file_path
:
./train_data/pubtabnet/test.jsonl
transforms
:
-
DecodeImage
:
# load image
img_mode
:
BGR
channel_first
:
False
-
ResizeTableImage
:
max_len
:
488
-
TableLabelEncode
:
-
NormalizeImage
:
scale
:
1./255.
mean
:
[
0.485
,
0.456
,
0.406
]
std
:
[
0.229
,
0.224
,
0.225
]
order
:
'
hwc'
-
PaddingTableImage
:
-
ToCHWImage
:
-
KeepKeys
:
keep_keys
:
[
'
image'
,
'
structure'
,
'
bbox_list'
,
'
sp_tokens'
,
'
bbox_list_mask'
]
loader
:
shuffle
:
False
drop_last
:
False
batch_size_per_card
:
16
num_workers
:
1
test_tipc/configs/en_table_structure/train_infer_python.txt
0 → 100644
浏览文件 @
8686dddf
===========================train_params===========================
model_name:en_table_structure
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=50
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=128
Global.pretrained_model:./pretrain_models/en_ppocr_mobile_v2.0_table_structure_train/best_accuracy
train_model_name:latest
train_infer_img_dir:./ppstructure/docs/table/table.jpg
null:null
##
trainer:norm_train
norm_train:tools/train.py -c test_tipc/configs/en_table_structure/table_mv3.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.checkpoints:
norm_export:tools/export_model.py -c test_tipc/configs/en_table_structure/table_mv3.yml -o
quant_export:
fpgm_export:
distill_export:null
export1:null
export2:null
##
infer_model:./inference/en_ppocr_mobile_v2.0_table_structure_infer
infer_export:null
infer_quant:False
inference:ppstructure/table/predict_table.py --det_model_dir=./inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=./inference/en_ppocr_mobile_v2.0_table_rec_infer --rec_char_dict_path=./ppocr/utils/dict/table_dict.txt --table_char_dict_path=./ppocr/utils/dict/table_structure_dict.txt --image_dir=./ppstructure/docs/table/table.jpg --det_limit_side_len=736 --det_limit_type=min --output ./output/table
--use_gpu:True|False
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
--precision:fp32
--table_model_dir:
--image_dir:./ppstructure/docs/table/table.jpg
null:null
--benchmark:False
null:null
===========================infer_benchmark_params==========================
random_infer_input:[{float32,[3,488,488]}]
test_tipc/configs/en_table_structure/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
浏览文件 @
8686dddf
...
...
@@ -7,7 +7,7 @@ Global.auto_cast:amp
Global.epoch_num:lite_train_lite_infer=3|whole_train_whole_infer=50
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=128
Global.pretrained_model:./
inference
/en_ppocr_mobile_v2.0_table_structure_train/best_accuracy
Global.pretrained_model:./
pretrain_models
/en_ppocr_mobile_v2.0_table_structure_train/best_accuracy
train_model_name:latest
train_infer_img_dir:./ppstructure/docs/table/table.jpg
null:null
...
...
test_tipc/configs/en_table_structure_KL/model_linux_gpu_normal_normal_infer_python_linux_gpu_cpu.txt
0 → 100644
浏览文件 @
8686dddf
===========================train_params===========================
model_name:en_table_structure_KL
python:python3.7
Global.pretrained_model:
Global.save_inference_dir:null
infer_model:./inference/en_ppocr_mobile_v2.0_table_structure_infer/
infer_export:deploy/slim/quantization/quant_kl.py -c test_tipc/configs/en_table_structure/table_mv3.yml -o
infer_quant:True
inference:ppstructure/table/predict_table.py --det_model_dir=./inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=./inference/en_ppocr_mobile_v2.0_table_rec_infer --rec_char_dict_path=./ppocr/utils/dict/table_dict.txt --table_char_dict_path=./ppocr/utils/dict/table_structure_dict.txt --image_dir=./ppstructure/docs/table/table.jpg --det_limit_side_len=736 --det_limit_type=min --output ./output/table
--use_gpu:True|False
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
--precision:int8
--table_model_dir:
--image_dir:./ppstructure/docs/table/table.jpg
null:null
--benchmark:False
null:null
null:null
test_tipc/configs/
ch_ppocr_mobile_v2.0_det/train_linux_gpu_fleet_amp_infer_python_linux_gpu_cpu
.txt
→
test_tipc/configs/
en_table_structure_PACT/train_infer_python
.txt
浏览文件 @
8686dddf
===========================train_params===========================
model_name:
ocr_det
model_name:
en_table_structure_PACT
python:python3.7
gpu_list:
xx.xx.xx.xx,yy.yy.yy.yy;
0,1
Global.use_gpu:True
Global.auto_cast:fp32
|amp
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=
30
0
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=
5
0
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.loader.batch_size_per_card:lite_train_lite_infer=
16|whole_train_whole_infer=128
Global.pretrained_model:
./pretrain_models/en_ppocr_mobile_v2.0_table_structure_train/best_accuracy
train_model_name:latest
train_infer_img_dir:./
train_data/icdar2015/text_localization/ch4_test_images/
train_infer_img_dir:./
ppstructure/docs/table/table.jpg
null:null
##
trainer:
norm_train|pact_train|fpgm
_train
norm_train:
tools/train.py -c test_tipc/configs/ppocr_det_mobile/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/MobileNetV3_large_x0_5_pretrained
pact_train:deploy/slim/quantization/quant.py -c test_tipc/configs/
ppocr_det_mobile/det_mv3_db.yml -o
fpgm_train:
deploy/slim/prune/sensitivity_anal.py -c test_tipc/configs/ppocr_det_mobile/det_mv3_db.yml -o Global.pretrained_model=./pretrain_models/det_mv3_db_v2.0_train/best_accuracy
trainer:
pact
_train
norm_train:
null
pact_train:deploy/slim/quantization/quant.py -c test_tipc/configs/
en_table_structure/table_mv3.yml -o
fpgm_train:
null
distill_train:null
null:null
null:null
...
...
@@ -26,26 +26,28 @@ null:null
##
===========================infer_params===========================
Global.save_inference_dir:./output/
Global.
pretrained_model
:
norm_export:
tools/export_model.py -c test_tipc/configs/ppocr_det_mobile/det_mv3_db.yml -o
quant_export:deploy/slim/quantization/export_model.py -c test_tipc/configs/
ppocr_det_mobile/det_mv3_db
.yml -o
fpgm_export:
deploy/slim/prune/export_prune_model.py -c test_tipc/configs/ppocr_det_mobile/det_mv3_db.yml -o
Global.
checkpoints
:
norm_export:
null
quant_export:deploy/slim/quantization/export_model.py -c test_tipc/configs/
en_table_structure/table_mv3
.yml -o
fpgm_export:
distill_export:null
export1:null
export2:null
inference_dir:null
train_model:./inference/ch_ppocr_mobile_v2.0_det_train/best_accuracy
infer_export:
tools/export_model.py -c configs/det/ch_ppocr_v2.0/ch_det_mv3_db_v2.0.yml -o
infer_quant:
Fals
e
inference:
tools/infer/predict_det.py
##
infer_model:./inference/en_ppocr_mobile_v2.0_table_structure_infer
infer_export:
null
infer_quant:
Tru
e
inference:
ppstructure/table/predict_table.py --det_model_dir=./inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=./inference/en_ppocr_mobile_v2.0_table_rec_infer --rec_char_dict_path=./ppocr/utils/dict/table_dict.txt --table_char_dict_path=./ppocr/utils/dict/table_structure_dict.txt --image_dir=./ppstructure/docs/table/table.jpg --det_limit_side_len=736 --det_limit_type=min --output ./output/table
--use_gpu:True|False
--enable_mkldnn:
True|
False
--cpu_threads:
1|
6
--enable_mkldnn:False
--cpu_threads: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/
--use_tensorrt:False
--precision:fp32
--
table
_model_dir:
--image_dir:./
ppstructure/docs/table/table.jpg
null:null
--benchmark:
Tru
e
--benchmark:
Fals
e
null:null
===========================infer_benchmark_params==========================
random_infer_input:[{float32,[3,488,488]}]
test_tipc/configs/en_table_structure_PACT/train_linux_gpu_normal_amp_infer_python_linux_gpu_cpu.txt
0 → 100644
浏览文件 @
8686dddf
===========================train_params===========================
model_name:en_table_structure_PACT
python:python3.7
gpu_list:0|0,1
Global.use_gpu:True|True
Global.auto_cast:amp
Global.epoch_num:lite_train_lite_infer=1|whole_train_whole_infer=50
Global.save_model_dir:./output/
Train.loader.batch_size_per_card:lite_train_lite_infer=16|whole_train_whole_infer=128
Global.pretrained_model:./pretrain_models/en_ppocr_mobile_v2.0_table_structure_train/best_accuracy
train_model_name:latest
train_infer_img_dir:./ppstructure/docs/table/table.jpg
null:null
##
trainer:pact_train
norm_train:null
pact_train:deploy/slim/quantization/quant.py -c test_tipc/configs/en_table_structure/table_mv3.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.checkpoints:
norm_export:null
quant_export:deploy/slim/quantization/export_model.py -c test_tipc/configs/en_table_structure/table_mv3.yml -o
fpgm_export:
distill_export:null
export1:null
export2:null
##
infer_model:./inference/en_ppocr_mobile_v2.0_table_structure_infer
infer_export:null
infer_quant:True
inference:ppstructure/table/predict_table.py --det_model_dir=./inference/en_ppocr_mobile_v2.0_table_det_infer --rec_model_dir=./inference/en_ppocr_mobile_v2.0_table_rec_infer --rec_char_dict_path=./ppocr/utils/dict/table_dict.txt --table_char_dict_path=./ppocr/utils/dict/table_structure_dict.txt --image_dir=./ppstructure/docs/table/table.jpg --det_limit_side_len=736 --det_limit_type=min --output ./output/table
--use_gpu:True|False
--enable_mkldnn:False
--cpu_threads:6
--rec_batch_num:1
--use_tensorrt:False
--precision:fp32
--table_model_dir:
--image_dir:./ppstructure/docs/table/table.jpg
null:null
--benchmark:False
null:null
===========================infer_benchmark_params==========================
random_infer_input:[{float32,[3,488,488]}]
test_tipc/docs/test_train_fleet_inference_python.md
浏览文件 @
8686dddf
...
...
@@ -15,7 +15,7 @@ Linux GPU/CPU 多机多卡训练推理测试的主程序为`test_train_inference
| 算法名称 | 模型名称 | device_CPU | device_GPU | batchsize |
| :----: | :----: | :----: | :----: | :----: |
| PP-OCRv3 | ch_PP-OCRv3_rec | 支持 |
支持 | 1
|
| PP-OCRv3 | ch_PP-OCRv3_rec | 支持 |
- | 1/6
|
## 2. 测试流程
...
...
@@ -31,10 +31,10 @@ Linux GPU/CPU 多机多卡训练推理测试的主程序为`test_train_inference
#### 2.1.2 准备数据
运行
`prepare.sh`
准备数据和模型,以配置文件
`test_tipc/configs/ch_PP-OCRv3_rec/train_
fleet_infer_python
.txt`
为例,数据准备命令如下所示。
运行
`prepare.sh`
准备数据和模型,以配置文件
`test_tipc/configs/ch_PP-OCRv3_rec/train_
linux_gpu_fleet_normal_infer_python_linux_gpu_cpu
.txt`
为例,数据准备命令如下所示。
```
shell
bash test_tipc/prepare.sh test_tipc/configs/ch_PP-OCRv3_rec/train_
fleet_infer_python
.txt lite_train_lite_infer
bash test_tipc/prepare.sh test_tipc/configs/ch_PP-OCRv3_rec/train_
linux_gpu_fleet_normal_infer_python_linux_gpu_cpu
.txt lite_train_lite_infer
```
**注意:**
由于是多机训练,这里需要在所有的节点上均运行启动上述命令,准备数据。
...
...
@@ -47,10 +47,10 @@ bash test_tipc/prepare.sh test_tipc/configs/ch_PP-OCRv3_rec/train_fleet_infer_py
export
FLAGS_START_PORT
=
17000
```
以配置文件
`test_tipc/configs/ch_PP-OCRv3_rec/train_
fleet_infer_python
.txt`
为例,测试方法如下所示。
以配置文件
`test_tipc/configs/ch_PP-OCRv3_rec/train_
linux_gpu_fleet_normal_infer_python_linux_gpu_cpu
.txt`
为例,测试方法如下所示。
```
shell
bash test_tipc/test_train_inference_python.sh test_tipc/configs/ch_PP-OCRv3_rec/train_
fleet_infer_python
.txt lite_train_lite_infer
bash test_tipc/test_train_inference_python.sh test_tipc/configs/ch_PP-OCRv3_rec/train_
linux_gpu_fleet_normal_infer_python_linux_gpu_cpu
.txt lite_train_lite_infer
```
**注意:**
由于是多机训练,这里需要在所有的节点上均运行启动上述命令进行测试。
...
...
test_tipc/prepare.sh
浏览文件 @
8686dddf
...
...
@@ -52,16 +52,27 @@ if [ ${MODE} = "lite_train_lite_infer" ];then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_distill_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv3_det_distill_train.tar
&&
cd
../
fi
if
[
${
model_name
}
==
"en_table_structure"
]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.1/table/en_ppocr_mobile_v2.0_table_structure_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf en_ppocr_mobile_v2.0_table_structure_train.tar
&&
cd
../
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_rec_infer.tar
--no-check-certificate
cd
./inference/
&&
tar
xf en_ppocr_mobile_v2.0_table_det_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_rec_infer.tar
&&
cd
../
fi
cd
./pretrain_models/
&&
tar
xf det_mv3_db_v2.0_train.tar
&&
cd
../
rm
-rf
./train_data/icdar2015
rm
-rf
./train_data/ic15_data
rm
-rf
./train_data/pubtabnet
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.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/dataset/pubtabnet.tar
--no-check-certificate
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar
--no-check-certificate
wget
-nc
-P
./deploy/slim/prune https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/sen.pickle
--no-check-certificate
cd
./train_data/
&&
tar
xf icdar2015_lite.tar
&&
tar
xf ic15_data.tar
cd
./train_data/
&&
tar
xf icdar2015_lite.tar
&&
tar
xf ic15_data.tar
&&
tar
xf pubtabnet.tar
ln
-s
./icdar2015_lite ./icdar2015
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_train_lite.txt
--no-check-certificate
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_test_lite.txt
--no-check-certificate
cd
../
cd
./inference
&&
tar
xf rec_inference.tar
&&
cd
../
if
[
${
model_name
}
==
"ch_PP-OCRv2_det"
]
||
[
${
model_name
}
==
"ch_PP-OCRv2_det_PACT"
]
;
then
...
...
@@ -112,9 +123,14 @@ 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
rm
-rf
./train_data/icdar2015
rm
-rf
./train_data/ic15_data
rm
-rf
./train_data/pubtabnet
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
cd
./train_data/
&&
tar
xf icdar2015.tar
&&
tar
xf ic15_data.tar
&&
cd
../
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dataset/pubtabnet.tar
--no-check-certificate
cd
./train_data/
&&
tar
xf icdar2015.tar
&&
tar
xf ic15_data.tar
&&
tar
xf pubtabnet.tar
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_train_lite.txt
--no-check-certificate
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_test_lite.txt
--no-check-certificate
cd
../
if
[
${
model_name
}
==
"ch_PP-OCRv2_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
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv2_det_distill_train.tar
&&
cd
../
...
...
@@ -134,14 +150,25 @@ elif [ ${MODE} = "whole_train_whole_infer" ];then
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.tar
&&
ln
-s
total_text_lite total_text
&&
cd
../
fi
if
[[
${
model_name
}
=
~
"en_table_structure"
]]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.1/table/en_ppocr_mobile_v2.0_table_structure_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf en_ppocr_mobile_v2.0_table_structure_train.tar
&&
cd
../
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_rec_infer.tar
--no-check-certificate
cd
./inference/
&&
tar
xf en_ppocr_mobile_v2.0_table_det_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_rec_infer.tar
&&
cd
../
fi
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
rm
-rf
./train_data/icdar2015
rm
-rf
./train_data/ic15_data
rm
-rf
./train_data/pubtabnet
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_infer.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_infer.tar
&&
tar
xf ic15_data.tar
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dataset/pubtabnet.tar
--no-check-certificate
cd
./train_data/
&&
tar
xf icdar2015_infer.tar
&&
tar
xf ic15_data.tar
&&
tar
xf pubtabnet.tar
ln
-s
./icdar2015_infer ./icdar2015
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_train_lite.txt
--no-check-certificate
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_test_lite.txt
--no-check-certificate
cd
../
if
[
${
model_name
}
==
"ch_PP-OCRv2_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
...
...
@@ -151,6 +178,13 @@ elif [ ${MODE} = "lite_train_whole_infer" ];then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_distill_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf ch_PP-OCRv3_det_distill_train.tar
&&
cd
../
fi
if
[[
${
model_name
}
=
~
"en_table_structure"
]]
;
then
wget
-nc
-P
./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.1/table/en_ppocr_mobile_v2.0_table_structure_train.tar
--no-check-certificate
cd
./pretrain_models/
&&
tar
xf en_ppocr_mobile_v2.0_table_structure_train.tar
&&
cd
../
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_rec_infer.tar
--no-check-certificate
cd
./inference/
&&
tar
xf en_ppocr_mobile_v2.0_table_det_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_rec_infer.tar
&&
cd
../
fi
elif
[
${
MODE
}
=
"whole_infer"
]
;
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/test/rec_inference.tar
--no-check-certificate
...
...
@@ -310,6 +344,12 @@ elif [ ${MODE} = "whole_infer" ];then
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_east_v2.0_train.tar
--no-check-certificate
cd
./inference/
&&
tar
xf det_r50_vd_east_v2.0_train.tar &
cd
../
fi
if
[[
${
model_name
}
=
~
"en_table_structure"
]]
;
then
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_structure_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_rec_infer.tar
--no-check-certificate
cd
./inference/
&&
tar
xf en_ppocr_mobile_v2.0_table_structure_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_det_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_rec_infer.tar
&&
cd
../
fi
fi
if
[
${
MODE
}
=
"klquant_whole_infer"
]
;
then
...
...
@@ -331,7 +371,10 @@ if [ ${MODE} = "klquant_whole_infer" ]; then
wget
-nc
-P
./inference https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.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 ic15_data.tar
&&
cd
../
cd
./train_data/
&&
tar
xf ic15_data.tar
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_train_lite.txt
--no-check-certificate
wget
-nc
-P
./ic15_data/ https://paddleocr.bj.bcebos.com/dataset/rec_gt_test_lite.txt
--no-check-certificate
cd
../
cd
./inference
&&
tar
xf rec_inference.tar
&&
tar
xf ch_PP-OCRv3_rec_infer.tar
&&
cd
../
fi
if
[
${
model_name
}
=
"ch_PP-OCRv2_det_KL"
]
;
then
...
...
@@ -350,7 +393,15 @@ if [ ${MODE} = "klquant_whole_infer" ]; then
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 ic15_data.tar
&&
cd
../
cd
./inference
&&
tar
xf ch_ppocr_mobile_v2.0_rec_infer.tar
&&
tar
xf rec_inference.tar
&&
cd
../
fi
fi
if
[
${
model_name
}
=
"en_table_structure_KL"
]
;
then
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_structure_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_det_infer.tar
--no-check-certificate
wget
-nc
-P
./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/table/en_ppocr_mobile_v2.0_table_rec_infer.tar
--no-check-certificate
wget
-nc
-P
./train_data/ https://paddleocr.bj.bcebos.com/dataset/pubtabnet.tar
--no-check-certificate
cd
./inference/
&&
tar
xf en_ppocr_mobile_v2.0_table_structure_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_det_infer.tar
&&
tar
xf en_ppocr_mobile_v2.0_table_rec_infer.tar
&&
cd
../
cd
./train_data/
&&
tar
xf pubtabnet.tar
&&
cd
../
fi
fi
if
[
${
MODE
}
=
"cpp_infer"
]
;
then
...
...
test_tipc/test_inference_python.sh
浏览文件 @
8686dddf
...
...
@@ -88,7 +88,7 @@ function func_inference(){
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
status_check
$last_status
"
${
command
}
"
"
${
status_log
}
"
status_check
$last_status
"
${
command
}
"
"
${
status_log
}
"
"
${
model_name
}
"
done
done
done
...
...
@@ -119,7 +119,7 @@ function func_inference(){
eval
$command
last_status
=
${
PIPESTATUS
[0]
}
eval
"cat
${
_save_log_path
}
"
status_check
$last_status
"
${
command
}
"
"
${
status_log
}
"
status_check
$last_status
"
${
command
}
"
"
${
status_log
}
"
"
${
model_name
}
"
done
done
...
...
@@ -153,7 +153,7 @@ if [ ${MODE} = "whole_infer" ]; then
echo
${
infer_run_exports
[Count]
}
eval
$export_cmd
status_export
=
$?
status_check
$status_export
"
${
export_cmd
}
"
"
${
status_log
}
"
status_check
$status_export
"
${
export_cmd
}
"
"
${
status_log
}
"
"
${
model_name
}
"
else
save_infer_dir
=
${
infer_model
}
fi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录