prepare.sh 23.3 KB
Newer Older
LDOUBLEV's avatar
LDOUBLEV committed
1
#!/bin/bash
MissPenguin's avatar
MissPenguin committed
2
3
source test_tipc/common_func.sh

LDOUBLEV's avatar
LDOUBLEV committed
4
FILENAME=$1
5

LDOUBLEV's avatar
rename  
LDOUBLEV committed
6
7
# MODE be one of ['lite_train_lite_infer' 'lite_train_whole_infer' 'whole_train_whole_infer',  
#                 'whole_infer', 'klquant_whole_infer',
cuicheng01's avatar
cuicheng01 committed
8
#                 'cpp_infer', 'serving_infer']
LDOUBLEV's avatar
LDOUBLEV committed
9

LDOUBLEV's avatar
LDOUBLEV committed
10
11
12
13
14
15
16
MODE=$2

dataline=$(cat ${FILENAME})

# parser params
IFS=$'\n'
lines=(${dataline})
MissPenguin's avatar
MissPenguin committed
17

LDOUBLEV's avatar
LDOUBLEV committed
18
# The training params
LDOUBLEV's avatar
LDOUBLEV committed
19
model_name=$(func_parser_value "${lines[1]}")
LDOUBLEV's avatar
LDOUBLEV committed
20

LDOUBLEV's avatar
LDOUBLEV committed
21
trainer_list=$(func_parser_value "${lines[14]}")
Double_V's avatar
Double_V committed
22

LDOUBLEV's avatar
LDOUBLEV committed
23
if [ ${MODE} = "benchmark_train" ];then
LDOUBLEV's avatar
LDOUBLEV committed
24
    pip install -r requirements.txt
LDOUBLEV's avatar
LDOUBLEV committed
25
    if [[ ${model_name} =~ "det_mv3_db_v2.0" ]];then
LDOUBLEV's avatar
LDOUBLEV committed
26
27
28
29
30
31
        rm -rf ./train_data/icdar2015
        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 ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar --no-check-certificate
        cd ./train_data/ && tar xf icdar2015.tar && cd ../
    fi
fi
LDOUBLEV's avatar
LDOUBLEV committed
32

LDOUBLEV's avatar
rename  
LDOUBLEV committed
33
if [ ${MODE} = "lite_train_lite_infer" ];then
Double_V's avatar
Double_V committed
34
    # pretrain lite train data
LDOUBLEV's avatar
LDOUBLEV committed
35
36
    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
LDOUBLEV's avatar
LDOUBLEV committed
37
    if [[ ${model_name} =~ "PPOCRv2_det" ]];then
LDOUBLEV's avatar
LDOUBLEV committed
38
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
39
40
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
LDOUBLEV's avatar
LDOUBLEV committed
41
    cd ./pretrain_models/ && tar xf det_mv3_db_v2.0_train.tar && cd ../
Double_V's avatar
Double_V committed
42
    rm -rf ./train_data/icdar2015
tink2123's avatar
tink2123 committed
43
    rm -rf ./train_data/ic15_data
LDOUBLEV's avatar
LDOUBLEV committed
44
45
46
47
    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 ./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
LDOUBLEV's avatar
LDOUBLEV committed
48
    
tink2123's avatar
tink2123 committed
49
    cd ./train_data/ && tar xf icdar2015_lite.tar && tar xf ic15_data.tar
Double_V's avatar
Double_V committed
50
51
    ln -s ./icdar2015_lite ./icdar2015
    cd ../
tink2123's avatar
tink2123 committed
52
    cd ./inference && tar xf rec_inference.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
53
    if [ ${model_name} == "en_server_pgnetA" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
54
55
56
        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 ../
LDOUBLEV's avatar
LDOUBLEV committed
57
        cd ./train_data && tar xf total_text_lite.tar && ln -s total_text_lite total_text && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
58
    fi
LDOUBLEV's avatar
LDOUBLEV committed
59
    if [ ${model_name} == "det_r50_vd_sast_icdar15_v2.0" ] || [ ${model_name} == "det_r50_vd_sast_totaltext_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
60
        wget -nc -P ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet50_vd_ssld_pretrained.pdparams --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
61
        wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/total_text_lite.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
62
        cd ./train_data && tar xf total_text_lite.tar && ln -s total_text_lite total_text  && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
63
    fi
64
    if [ ${model_name} == "det_mv3_db_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
65
66
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar  --no-check-certificate
        cd ./inference/ && tar xf det_mv3_db_v2.0_train.tar && cd ../
67
68
69
    fi
    if [ ${model_name} == "det_r50_db_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
LDOUBLEV's avatar
LDOUBLEV committed
70
71
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_db_v2.0_train.tar  --no-check-certificate
        cd ./inference/ && tar xf det_r50_vd_db_v2.0_train.tar && cd ../
72
    fi
WenmuZhou's avatar
WenmuZhou committed
73
74
75
76
    if [ ${model_name} == "ch_ppocr_mobile_v2.0_rec_FPGM" ]; then
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_train.tar --no-check-certificate
        cd ./pretrain_models/ && tar xf ch_ppocr_mobile_v2.0_rec_train.tar && cd ../
    fi
LDOUBLEV's avatar
LDOUBLEV committed
77

LDOUBLEV's avatar
rename  
LDOUBLEV committed
78
elif [ ${MODE} = "whole_train_whole_infer" ];then
LDOUBLEV's avatar
LDOUBLEV committed
79
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams --no-check-certificate
Double_V's avatar
Double_V committed
80
    rm -rf ./train_data/icdar2015
tink2123's avatar
tink2123 committed
81
    rm -rf ./train_data/ic15_data
LDOUBLEV's avatar
LDOUBLEV committed
82
83
    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
tink2123's avatar
tink2123 committed
84
    cd ./train_data/ && tar xf icdar2015.tar && tar xf ic15_data.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
85
    if [ ${model_name} == "ch_PPOCRv2_det" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
86
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
87
88
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
LDOUBLEV's avatar
LDOUBLEV committed
89
    if [ ${model_name} == "en_server_pgnetA" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
90
        wget -nc -P ./train_data/  https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/total_text_lite.tar  --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
91
92
        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 ../
LDOUBLEV's avatar
LDOUBLEV committed
93
        cd ./train_data && tar xf total_text.tar && ln -s total_text_lite total_text  && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
94
    fi
LDOUBLEV's avatar
LDOUBLEV committed
95
    if [ ${model_name} == "det_r50_vd_sast_totaltext_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
96
        wget -nc -P ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/ResNet50_vd_ssld_pretrained.pdparams --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
97
98
        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 ../
LDOUBLEV's avatar
LDOUBLEV committed
99
    fi
LDOUBLEV's avatar
rename  
LDOUBLEV committed
100
elif [ ${MODE} = "lite_train_whole_infer" ];then
LDOUBLEV's avatar
LDOUBLEV committed
101
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams --no-check-certificate
Double_V's avatar
Double_V committed
102
    rm -rf ./train_data/icdar2015
tink2123's avatar
tink2123 committed
103
    rm -rf ./train_data/ic15_data
LDOUBLEV's avatar
LDOUBLEV committed
104
105
    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
tink2123's avatar
tink2123 committed
106
    cd ./train_data/ && tar xf icdar2015_infer.tar && tar xf ic15_data.tar
Double_V's avatar
Double_V committed
107
108
    ln -s ./icdar2015_infer ./icdar2015
    cd ../
LDOUBLEV's avatar
LDOUBLEV committed
109
    if [ ${model_name} == "ch_PPOCRv2_det" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
110
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
111
112
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
LDOUBLEV's avatar
rename  
LDOUBLEV committed
113
elif [ ${MODE} = "whole_infer" ];then
LDOUBLEV's avatar
LDOUBLEV committed
114
    wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
115
    wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
116
    cd ./inference && tar xf rec_inference.tar  && tar xf ch_det_data_50.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
117
    if [ ${model_name} = "ch_ppocr_mobile_v2.0_det" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
118
        eval_model_name="ch_ppocr_mobile_v2.0_det_train"
tink2123's avatar
tink2123 committed
119
        rm -rf ./train_data/icdar2015
LDOUBLEV's avatar
LDOUBLEV committed
120
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_train.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
121
122
        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 ../
andyjpaddle's avatar
andyjpaddle committed
123
124
125
126
    elif [ ${model_name} = "ch_ppocr_mobile_v2.0_det_PACT" ]; then
        eval_model_name="ch_ppocr_mobile_v2.0_det_prune_infer"
        wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/slim/ch_ppocr_mobile_v2.0_det_prune_infer.tar --no-check-certificate
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
127
    elif [ ${model_name} = "ch_ppocr_server_v2.0_det" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
128
        wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_train.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
129
        cd ./inference && tar xf ch_ppocr_server_v2.0_det_train.tar && tar xf ch_det_data_50.tar && cd ../
130
    elif  [ ${model_name} = "ch_ppocr_mobile_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
131
132
        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_rec_infer.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
133
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf ch_det_data_50.tar && cd ../
134
    elif  [ ${model_name} = "ch_ppocr_server_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
135
136
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_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
tink2123's avatar
tink2123 committed
137
        cd ./inference && tar xf ch_ppocr_server_v2.0_det_infer.tar && tar xf ch_ppocr_server_v2.0_rec_infer.tar && tar xf ch_det_data_50.tar && cd ../
andyjpaddle's avatar
andyjpaddle committed
138
    elif [ ${model_name} = "ch_ppocr_mobile_v2.0_rec_PACT" ]; then
andyjpaddle's avatar
andyjpaddle committed
139
140
        eval_model_name="ch_ppocr_mobile_v2.0_rec_slim_infer"
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_slim_infer.tar --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
141
142
        cd ./inference && tar xf ${eval_model_name}.tar && cd ../
    elif [ ${model_name} = "ch_ppocr_mobile_v2.0_rec_FPGM" ]; then
andyjpaddle's avatar
andyjpaddle committed
143
144
        eval_model_name="ch_PP-OCRv2_rec_infer"
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_rec_infer.tar --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
145
        cd ./inference && tar xf ${eval_model_name}.tar && cd ../
Double_V's avatar
Double_V committed
146
    fi 
andyjpaddle's avatar
andyjpaddle committed
147
    if [[ ${model_name} =~ "ch_PPOCRv2_det" ]]; then
LDOUBLEV's avatar
LDOUBLEV committed
148
        eval_model_name="ch_PP-OCRv2_det_infer"
LDOUBLEV's avatar
LDOUBLEV committed
149
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_infer.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
150
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
andyjpaddle's avatar
andyjpaddle committed
151
    fi
andyjpaddle's avatar
andyjpaddle committed
152
    if [[ ${model_name} =~ "PPOCRv2_ocr_rec" ]]; then
andyjpaddle's avatar
andyjpaddle committed
153
154
        eval_model_name="ch_PP-OCRv2_rec_infer"
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_rec_infer.tar --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
155
156
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_rec_slim_quant_infer.tar --no-check-certificate
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_PP-OCRv2_rec_slim_quant_infer.tar && cd ../
andyjpaddle's avatar
andyjpaddle committed
157
    fi   
LDOUBLEV's avatar
LDOUBLEV committed
158
    if [ ${model_name} == "en_server_pgnetA" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
159
        wget -nc -P ./inference/  https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/en_server_pgnetA.tar  --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
160
        cd ./inference && tar xf en_server_pgnetA.tar && tar xf ch_det_data_50.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
161
    fi
LDOUBLEV's avatar
LDOUBLEV committed
162
    if [ ${model_name} == "det_r50_vd_sast_icdar15_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
163
        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
andyjpaddle's avatar
andyjpaddle committed
164
        cd ./inference/ && tar xf det_r50_vd_sast_icdar15_v2.0_train.tar && tar xf ch_det_data_50.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
165
    fi
tink2123's avatar
tink2123 committed
166
167
    if [ ${model_name} == "rec_mv3_none_none_ctc_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_none_none_ctc_v2.0_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
168
        cd ./inference/ && tar xf rec_mv3_none_none_ctc_v2.0_train.tar && cd ../
tink2123's avatar
tink2123 committed
169
170
171
    fi
    if [ ${model_name} == "rec_r34_vd_none_none_ctc_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_none_ctc_v2.0_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
172
        cd ./inference/ && tar xf rec_r34_vd_none_none_ctc_v2.0_train.tar && cd ../
tink2123's avatar
tink2123 committed
173
174
175
    fi
    if [ ${model_name} == "rec_mv3_none_bilstm_ctc_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_none_bilstm_ctc_v2.0_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
176
        cd ./inference/ && tar xf rec_mv3_none_bilstm_ctc_v2.0_train.tar && cd ../
tink2123's avatar
tink2123 committed
177
178
179
    fi
    if [ ${model_name} == "rec_r34_vd_none_bilstm_ctc_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_none_bilstm_ctc_v2.0_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
180
        cd ./inference/ && tar xf rec_r34_vd_none_bilstm_ctc_v2.0_train.tar && cd ../
tink2123's avatar
tink2123 committed
181
182
183
    fi
    if [ ${model_name} == "rec_mv3_tps_bilstm_ctc_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_tps_bilstm_ctc_v2.0_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
184
        cd ./inference/ && tar xf rec_mv3_tps_bilstm_ctc_v2.0_train.tar && cd ../
tink2123's avatar
tink2123 committed
185
186
187
    fi
    if [ ${model_name} == "rec_r34_vd_tps_bilstm_ctc_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_ctc_v2.0_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
188
        cd ./inference/ && tar xf rec_r34_vd_tps_bilstm_ctc_v2.0_train.tar && cd ../
tink2123's avatar
tink2123 committed
189
190
    fi
    if [ ${model_name} == "ch_ppocr_server_v2.0_rec" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
191
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_train.tar --no-check-certificate
tink2123's avatar
tink2123 committed
192
        cd ./inference/ && tar xf ch_ppocr_server_v2.0_rec_train.tar && cd ../
tink2123's avatar
tink2123 committed
193
    fi
andyjpaddle's avatar
andyjpaddle committed
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
    if [ ${model_name} == "ch_ppocr_mobile_v2.0_rec" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_train.tar --no-check-certificate
        cd ./inference/ && tar xf ch_ppocr_mobile_v2.0_rec_train.tar && cd ../
    fi
    if [ ${model_name} == "rec_mtb_nrtr" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mtb_nrtr_train.tar --no-check-certificate
        cd ./inference/ && tar xf rec_mtb_nrtr_train.tar && cd ../
    fi
    if [ ${model_name} == "rec_mv3_tps_bilstm_att_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_mv3_tps_bilstm_att_v2.0_train.tar --no-check-certificate
        cd ./inference/ && tar xf rec_mv3_tps_bilstm_att_v2.0_train.tar && cd ../
    fi
    if [ ${model_name} == "rec_r34_vd_tps_bilstm_att_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r34_vd_tps_bilstm_att_v2.0_train.tar --no-check-certificate
        cd ./inference/ && tar xf rec_r34_vd_tps_bilstm_att_v2.0_train.tar && cd ../
    fi
    if [ ${model_name} == "rec_r31_sar" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.1/rec/rec_r31_sar_train.tar --no-check-certificate
        cd ./inference/ && tar xf rec_r31_sar_train.tar && cd ../
    fi
    if [ ${model_name} == "rec_r50_fpn_vd_none_srn" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/rec_r50_vd_srn_train.tar --no-check-certificate
        cd ./inference/ && tar xf rec_r50_vd_srn_train.tar && cd ../
    fi
tink2123's avatar
tink2123 committed
218
    
LDOUBLEV's avatar
LDOUBLEV committed
219
220
221
222
    if [ ${model_name} == "det_r50_vd_sast_totaltext_v2.0" ]; then
        wget -nc -P  ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_sast_totaltext_v2.0_train.tar --no-check-certificate
        cd ./inference/ && tar xf det_r50_vd_sast_totaltext_v2.0_train.tar && cd ../
    fi
223
224
    if [ ${model_name} == "det_mv3_db_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_db_v2.0_train.tar  --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
225
        cd ./inference/ && tar xf det_mv3_db_v2.0_train.tar && tar xf ch_det_data_50.tar && cd ../
226
227
228
    fi
    if [ ${model_name} == "det_r50_db_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_r50_vd_db_v2.0_train.tar  --no-check-certificate
andyjpaddle's avatar
andyjpaddle committed
229
        cd ./inference/ && tar xf det_r50_vd_db_v2.0_train.tar && tar xf ch_det_data_50.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
230
    fi
LDOUBLEV's avatar
LDOUBLEV committed
231
232
233
234
235
236
237
238
239
240
241
242
243
    if [ ${model_name} == "det_mv3_pse_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.1/en_det/det_mv3_pse_v2.0_train.tar --no-check-certificate
        cd ./inference/ && tar xf det_mv3_pse_v2.0_train.tar & cd ../
    fi
    if [ ${model_name} == "det_r50_vd_pse_v2.0" ]; then
        wget -nc -P ./inference/  https://paddleocr.bj.bcebos.com/dygraph_v2.1/en_det/det_r50_vd_pse_v2.0_train.tar  --no-check-certificate
        cd ./inference/ && tar xf det_r50_vd_pse_v2.0_train.tar & cd ../
    fi
    if [ ${model_name} == "det_mv3_east_v2.0" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/en/det_mv3_east_v2.0_train.tar --no-check-certificate
        cd ./inference/ && tar xf det_mv3_east_v2.0_train.tar & cd ../
    fi
    if [ ${model_name} == "det_r50_vd_east_v2.0" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
244
245
        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 ../
LDOUBLEV's avatar
LDOUBLEV committed
246
    fi
LDOUBLEV's avatar
LDOUBLEV committed
247
fi
LDOUBLEV's avatar
LDOUBLEV committed
248

LDOUBLEV's avatar
fix bug  
LDOUBLEV committed
249
if [ ${MODE} = "klquant_whole_infer" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
250
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.tar --no-check-certificate
LDOUBLEV's avatar
LDOUBLEV committed
251
    cd ./train_data/ && tar xf icdar2015_lite.tar && rm -rf ./icdar2015 && ln -s ./icdar2015_lite ./icdar2015 && cd ../
LDOUBLEV's avatar
fix kl  
LDOUBLEV committed
252
    if [ ${model_name} = "ch_ppocr_mobile_v2.0_det_KL" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
253
254
255
        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
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_det_data_50.tar && cd ../ 
LDOUBLEV's avatar
LDOUBLEV committed
256
    fi
LDOUBLEV's avatar
reset  
LDOUBLEV committed
257
258
259
    if [ ${model_name} = "PPOCRv2_ocr_rec_kl" ]; then
        wget -nc -P ./inference https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_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
260
261
        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 ../
LDOUBLEV's avatar
reset  
LDOUBLEV committed
262
263
264
        cd ./inference && tar xf rec_inference.tar && tar xf ch_PP-OCRv2_rec_infer.tar && cd ../
    fi
    if [ ${model_name} = "PPOCRv2_ocr_det_kl" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
265
        wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar  --no-check-certificate
LDOUBLEV's avatar
reset  
LDOUBLEV committed
266
267
        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 ch_PP-OCRv2_det_infer.tar && tar xf ch_det_data_50.tar && cd ../
LDOUBLEV's avatar
LDOUBLEV committed
268
    fi 
WenmuZhou's avatar
WenmuZhou committed
269
270
271
272
273
274
275
    if [ ${model_name} = "ch_ppocr_mobile_v2.0_rec_KL" ]; then
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_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 ./inference && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf rec_inference.tar &&  cd ../ 
    fi 
LDOUBLEV's avatar
fix bug  
LDOUBLEV committed
276
277
278
fi

if [ ${MODE} = "cpp_infer" ];then
MissPenguin's avatar
MissPenguin committed
279
    if [ ${model_name} = "ocr_det" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
280
281
        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_infer.tar  --no-check-certificate
MissPenguin's avatar
MissPenguin committed
282
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_det_data_50.tar && cd ../
tink2123's avatar
tink2123 committed
283
    elif [ ${model_name} = "ch_ppocr_mobile_v2.0_rec" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
284
285
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar  --no-check-certificate
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar  --no-check-certificate
MissPenguin's avatar
MissPenguin committed
286
287
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf rec_inference.tar && cd ../
    elif  [ ${model_name} = "ocr_system" ]; then
LDOUBLEV's avatar
LDOUBLEV committed
288
289
290
        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/ch/ch_ppocr_mobile_v2.0_rec_infer.tar  --no-check-certificate
MissPenguin's avatar
MissPenguin committed
291
292
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf ch_det_data_50.tar && cd ../
    fi 
Double_V's avatar
Double_V committed
293
fi
tink2123's avatar
tink2123 committed
294

tink2123's avatar
tink2123 committed
295
296
if [ ${MODE} = "serving_infer" ];then
    # prepare serving env
tink2123's avatar
tink2123 committed
297
298
299
300
301
    python_name_list=$(func_parser_value "${lines[2]}")
    IFS='|'
    array=(${python_name_list})
    python_name=${array[0]}
    wget -nc https://paddle-serving.bj.bcebos.com/chain/paddle_serving_server_gpu-0.0.0.post101-py3-none-any.whl
302
    ${python_name} -m pip install install paddle_serving_server_gpu-0.0.0.post101-py3-none-any.whl
tink2123's avatar
tink2123 committed
303
    ${python_name} -m pip install paddle_serving_client==0.6.1
304
    ${python_name} -m pip install paddle-serving-app==0.6.3
tink2123's avatar
tink2123 committed
305
306
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar
307
308
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_infer.tar
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar
tink2123's avatar
tink2123 committed
309
    cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf ch_ppocr_server_v2.0_rec_infer.tar && tar xf ch_ppocr_server_v2.0_det_infer.tar && cd ../
tink2123's avatar
tink2123 committed
310
fi
cuicheng01's avatar
cuicheng01 committed
311

tink2123's avatar
tink2123 committed
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
if [ ${MODE} = "paddle2onnx_infer" ];then
    # prepare serving env
    python_name=$(func_parser_value "${lines[2]}")
    ${python_name} -m pip install install paddle2onnx
    ${python_name} -m pip install onnxruntime==1.4.0
    # wget model
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_det_infer.tar
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_server_v2.0_rec_infer.tar
    # wget data
    wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
    wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar
    cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf ch_ppocr_server_v2.0_rec_infer.tar && tar xf ch_ppocr_server_v2.0_det_infer.tar && tar xf ch_det_data_50.tar && tar xf rec_inference.tar && cd ../
    
fi