prepare.sh 14.9 KB
Newer Older
L
LDOUBLEV 已提交
1
#!/bin/bash
M
MissPenguin 已提交
2 3
source test_tipc/common_func.sh

L
LDOUBLEV 已提交
4
FILENAME=$1
5

L
rename  
LDOUBLEV 已提交
6 7
# MODE be one of ['lite_train_lite_infer' 'lite_train_whole_infer' 'whole_train_whole_infer',  
#                 'whole_infer', 'klquant_whole_infer',
C
cuicheng01 已提交
8
#                 'cpp_infer', 'serving_infer']
L
LDOUBLEV 已提交
9

L
LDOUBLEV 已提交
10 11 12 13 14 15 16
MODE=$2

dataline=$(cat ${FILENAME})

# parser params
IFS=$'\n'
lines=(${dataline})
M
MissPenguin 已提交
17

L
LDOUBLEV 已提交
18
# The training params
L
LDOUBLEV 已提交
19
model_name=$(func_parser_value "${lines[1]}")
L
LDOUBLEV 已提交
20

L
LDOUBLEV 已提交
21
trainer_list=$(func_parser_value "${lines[14]}")
D
Double_V 已提交
22

L
LDOUBLEV 已提交
23

L
rename  
LDOUBLEV 已提交
24
if [ ${MODE} = "lite_train_lite_infer" ];then
D
Double_V 已提交
25
    # pretrain lite train data
L
LDOUBLEV 已提交
26 27
    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
L
LDOUBLEV 已提交
28
    if [ ${model_name} == "ch_PPOCRv2_det" ]; then
L
LDOUBLEV 已提交
29
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar --no-check-certificate
L
LDOUBLEV 已提交
30 31
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
L
LDOUBLEV 已提交
32
    cd ./pretrain_models/ && tar xf det_mv3_db_v2.0_train.tar && cd ../
D
Double_V 已提交
33
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
34
    rm -rf ./train_data/ic15_data
L
LDOUBLEV 已提交
35 36 37 38
    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
L
LDOUBLEV 已提交
39
    
T
tink2123 已提交
40
    cd ./train_data/ && tar xf icdar2015_lite.tar && tar xf ic15_data.tar
D
Double_V 已提交
41 42
    ln -s ./icdar2015_lite ./icdar2015
    cd ../
T
tink2123 已提交
43
    cd ./inference && tar xf rec_inference.tar && cd ../
L
LDOUBLEV 已提交
44
    if [ ${model_name} == "en_server_pgnetA" ]; then
L
LDOUBLEV 已提交
45 46 47 48 49
        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
L
LDOUBLEV 已提交
50
    if [ ${model_name} == "det_r50_vd_sast_icdar15_v2.0" ] || [ ${model_name} == "det_r50_vd_sast_totaltext_v2.0" ]; then
L
LDOUBLEV 已提交
51 52 53 54 55
        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

L
rename  
LDOUBLEV 已提交
56
elif [ ${MODE} = "whole_train_whole_infer" ];then
L
LDOUBLEV 已提交
57
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams --no-check-certificate
D
Double_V 已提交
58
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
59
    rm -rf ./train_data/ic15_data
L
LDOUBLEV 已提交
60 61
    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
T
tink2123 已提交
62
    cd ./train_data/ && tar xf icdar2015.tar && tar xf ic15_data.tar && cd ../
L
LDOUBLEV 已提交
63
    if [ ${model_name} == "ch_PPOCRv2_det" ]; then
L
LDOUBLEV 已提交
64
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar --no-check-certificate
L
LDOUBLEV 已提交
65 66
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
L
LDOUBLEV 已提交
67
    if [ ${model_name} == "en_server_pgnetA" ]; then
L
LDOUBLEV 已提交
68 69 70 71 72
        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
L
LDOUBLEV 已提交
73
    if [ ${model_name} == "det_r50_vd_sast_totaltext_v2.0" ]; then
L
LDOUBLEV 已提交
74 75 76 77
        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
L
rename  
LDOUBLEV 已提交
78
elif [ ${MODE} = "lite_train_whole_infer" ];then
L
LDOUBLEV 已提交
79
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams --no-check-certificate
D
Double_V 已提交
80
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
81
    rm -rf ./train_data/ic15_data
L
LDOUBLEV 已提交
82 83
    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
T
tink2123 已提交
84
    cd ./train_data/ && tar xf icdar2015_infer.tar && tar xf ic15_data.tar
D
Double_V 已提交
85 86
    ln -s ./icdar2015_infer ./icdar2015
    cd ../
L
LDOUBLEV 已提交
87
    if [ ${model_name} == "ch_PPOCRv2_det" ]; then
L
LDOUBLEV 已提交
88
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_distill_train.tar --no-check-certificate
L
LDOUBLEV 已提交
89 90
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
L
rename  
LDOUBLEV 已提交
91
elif [ ${MODE} = "whole_infer" ];then
L
LDOUBLEV 已提交
92
    wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar --no-check-certificate
L
LDOUBLEV 已提交
93
    if [ ${model_name} = "ch_ppocr_mobile_v2.0_det" ]; then
L
LDOUBLEV 已提交
94
        eval_model_name="ch_ppocr_mobile_v2.0_det_train"
T
tink2123 已提交
95
        rm -rf ./train_data/icdar2015
L
LDOUBLEV 已提交
96 97
        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
L
LDOUBLEV 已提交
98 99
        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 ../
L
LDOUBLEV 已提交
100
    elif [ ${model_name} = "ch_ppocr_server_v2.0_det" ]; then
L
LDOUBLEV 已提交
101 102
        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
L
LDOUBLEV 已提交
103
        cd ./inference && tar xf ch_ppocr_server_v2.0_det_train.tar && tar xf ch_det_data_50.tar && cd ../
T
tink2123 已提交
104
    elif  [ ${model_name} = "ocr_system_mobile" ]; then
L
LDOUBLEV 已提交
105 106 107
        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
L
LDOUBLEV 已提交
108
        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 ../
T
tink2123 已提交
109
    elif  [ ${model_name} = "ocr_system_server" ]; then
L
LDOUBLEV 已提交
110 111 112
        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/test/ch_det_data_50.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
T
tink2123 已提交
113
        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 ../
114
    elif [ ${model_name} = "ocr_rec" ]; then
T
tink2123 已提交
115
        rm -rf ./train_data/ic15_data
T
tink2123 已提交
116
        eval_model_name="ch_ppocr_mobile_v2.0_rec_infer"
L
LDOUBLEV 已提交
117 118
        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
T
tink2123 已提交
119
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf rec_inference.tar && cd ../
120 121 122
    elif [ ${model_name} = "ocr_server_rec" ]; then
        rm -rf ./train_data/ic15_data
        eval_model_name="ch_ppocr_server_v2.0_rec_infer"
L
LDOUBLEV 已提交
123 124
        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_server_v2.0_rec_infer.tar --no-check-certificate
125
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf rec_inference.tar && cd ../
D
Double_V 已提交
126
    fi 
L
LDOUBLEV 已提交
127
    elif [ ${model_name} = "ch_PPOCRv2_det" ]; then
L
LDOUBLEV 已提交
128
        eval_model_name="ch_PP-OCRv2_det_infer"
L
LDOUBLEV 已提交
129 130
        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
L
LDOUBLEV 已提交
131
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
L
fix bug  
LDOUBLEV 已提交
132
    fi
L
LDOUBLEV 已提交
133
    elif [ ${model_name} = "ch_PPOCRv2_det" ]; then
L
LDOUBLEV 已提交
134 135 136 137
        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
L
LDOUBLEV 已提交
138
    if [ ${model_name} == "en_server_pgnetA" ]; then
L
LDOUBLEV 已提交
139 140 141
        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
L
LDOUBLEV 已提交
142
    if [ ${model_name} == "det_r50_vd_sast_icdar15_v2.0" ]; then
L
LDOUBLEV 已提交
143 144 145
        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
146

L
fix bug  
LDOUBLEV 已提交
147
if [ ${MODE} = "klquant_whole_infer" ]; then
L
LDOUBLEV 已提交
148
    if [ ${model_name} = "ch_ppocr_mobile_v2.0_det" ]; then
L
LDOUBLEV 已提交
149 150 151
        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 ../ 
L
LDOUBLEV 已提交
152
    fi
L
LDOUBLEV 已提交
153
    if [ ${model_name} = "ch_PPOCRv2_det" ]; then
L
LDOUBLEV 已提交
154
        eval_model_name="ch_PP-OCRv2_det_infer"
L
LDOUBLEV 已提交
155 156
        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
L
LDOUBLEV 已提交
157 158
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
    fi 
L
fix bug  
LDOUBLEV 已提交
159 160 161
fi

if [ ${MODE} = "cpp_infer" ];then
M
MissPenguin 已提交
162
    if [ ${model_name} = "ocr_det" ]; then
L
LDOUBLEV 已提交
163 164
        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
M
MissPenguin 已提交
165 166
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_det_data_50.tar && cd ../
    elif [ ${model_name} = "ocr_rec" ]; then
L
LDOUBLEV 已提交
167 168
        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
M
MissPenguin 已提交
169 170
        cd ./inference && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar && tar xf rec_inference.tar && cd ../
    elif  [ ${model_name} = "ocr_system" ]; then
L
LDOUBLEV 已提交
171 172 173
        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
M
MissPenguin 已提交
174 175
        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 
D
Double_V 已提交
176
fi
T
tink2123 已提交
177

T
tink2123 已提交
178 179 180
if [ ${MODE} = "serving_infer" ];then
    # prepare serving env
    python_name=$(func_parser_value "${lines[2]}")
181 182
    wget https://paddle-serving.bj.bcebos.com/chain/paddle_serving_server_gpu-0.0.0.post101-py3-none-any.whl
    ${python_name} -m pip install install paddle_serving_server_gpu-0.0.0.post101-py3-none-any.whl
T
tink2123 已提交
183
    ${python_name} -m pip install paddle_serving_client==0.6.1
184
    ${python_name} -m pip install paddle-serving-app==0.6.3
T
tink2123 已提交
185 186
    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
187 188
    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
T
tink2123 已提交
189
    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 ../
T
tink2123 已提交
190
fi
C
cuicheng01 已提交
191

T
tink2123 已提交
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
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