prepare.sh 12.8 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} == "PPOCRv2_ocr_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 45 46 47 48 49
    if [ ${model_name} == "en_pgnetA" ]; then
        wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/total_text_lite.tar --no-check-certificate
        wget -nc -P ./pretrain_models/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/en_server_pgnetA.tar --no-check-certificate
        cd ./pretrain_models/ && tar xf en_server_pgnetA.tar && cd ../
        cd ./train_data && tar xf total_text_lite.tar && ln -s total_text && cd ../
    fi
L
rename  
LDOUBLEV 已提交
50
elif [ ${MODE} = "whole_train_whole_infer" ];then
L
LDOUBLEV 已提交
51
    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 已提交
52
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
53
    rm -rf ./train_data/ic15_data
L
LDOUBLEV 已提交
54 55
    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 已提交
56
    cd ./train_data/ && tar xf icdar2015.tar && tar xf ic15_data.tar && cd ../
L
LDOUBLEV 已提交
57
    if [ ${model_name} == "PPOCRv2_ocr_det" ]; then
L
LDOUBLEV 已提交
58
        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 已提交
59 60
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
L
rename  
LDOUBLEV 已提交
61
elif [ ${MODE} = "lite_train_whole_infer" ];then
L
LDOUBLEV 已提交
62
    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 已提交
63
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
64
    rm -rf ./train_data/ic15_data
L
LDOUBLEV 已提交
65 66
    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 已提交
67
    cd ./train_data/ && tar xf icdar2015_infer.tar && tar xf ic15_data.tar
D
Double_V 已提交
68 69
    ln -s ./icdar2015_infer ./icdar2015
    cd ../
L
LDOUBLEV 已提交
70
    if [ ${model_name} == "PPOCRv2_ocr_det" ]; then
L
LDOUBLEV 已提交
71
        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 已提交
72 73
        cd ./pretrain_models/ && tar xf ch_PP-OCRv2_det_distill_train.tar && cd ../
    fi
L
rename  
LDOUBLEV 已提交
74
elif [ ${MODE} = "whole_infer" ];then
T
tink2123 已提交
75
    if [ ${model_name} = "ocr_det" ]; then
L
LDOUBLEV 已提交
76
        eval_model_name="ch_ppocr_mobile_v2.0_det_train"
T
tink2123 已提交
77
        rm -rf ./train_data/icdar2015
L
LDOUBLEV 已提交
78 79
        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 已提交
80 81
        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 已提交
82
    elif [ ${model_name} = "ocr_server_det" ]; then
L
LDOUBLEV 已提交
83 84
        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 已提交
85
        cd ./inference && tar xf ch_ppocr_server_v2.0_det_train.tar && tar xf ch_det_data_50.tar && cd ../
T
tink2123 已提交
86
    elif  [ ${model_name} = "ocr_system_mobile" ]; then
L
LDOUBLEV 已提交
87 88 89
        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 已提交
90
        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 已提交
91
    elif  [ ${model_name} = "ocr_system_server" ]; then
L
LDOUBLEV 已提交
92 93 94
        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 已提交
95
        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 ../
96
    elif [ ${model_name} = "ocr_rec" ]; then
T
tink2123 已提交
97
        rm -rf ./train_data/ic15_data
T
tink2123 已提交
98
        eval_model_name="ch_ppocr_mobile_v2.0_rec_infer"
L
LDOUBLEV 已提交
99 100
        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 已提交
101
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf rec_inference.tar && cd ../
102 103 104
    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 已提交
105 106
        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
107
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf rec_inference.tar && cd ../
D
Double_V 已提交
108
    fi 
109

L
LDOUBLEV 已提交
110 111
    elif [ ${model_name} = "PPOCRv2_ocr_det" ]; then
        eval_model_name="ch_PP-OCRv2_det_infer"
L
LDOUBLEV 已提交
112 113
        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 已提交
114
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
L
fix bug  
LDOUBLEV 已提交
115
    fi
L
LDOUBLEV 已提交
116 117 118 119 120
    elif [ ${model_name} = "PPOCRv2_ocr_det" ]; then
        wget -nc -P ./inference/  https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar --no-check-certificate
        wget -nc -P ./inference/  https://paddleocr.bj.bcebos.com/dygraph_v2.0/pgnet/e2e_server_pgnetA_infer.tar --no-check-certificate
         cd ./inference && tar xf e2e_server_pgnetA_infer.tar && tar xf ch_det_data_50.tar && cd ../ 
    fi
121

L
fix bug  
LDOUBLEV 已提交
122
if [ ${MODE} = "klquant_whole_infer" ]; then
L
LDOUBLEV 已提交
123
    if [ ${model_name} = "ocr_det" ]; then
L
LDOUBLEV 已提交
124 125 126
        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 已提交
127
    fi
L
LDOUBLEV 已提交
128 129
    if [ ${model_name} = "PPOCRv2_ocr_det" ]; then
        eval_model_name="ch_PP-OCRv2_det_infer"
L
LDOUBLEV 已提交
130 131
        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 已提交
132 133
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
    fi 
L
fix bug  
LDOUBLEV 已提交
134 135 136
fi

if [ ${MODE} = "cpp_infer" ];then
M
MissPenguin 已提交
137
    if [ ${model_name} = "ocr_det" ]; then
L
LDOUBLEV 已提交
138 139
        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 已提交
140 141
        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 已提交
142 143
        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 已提交
144 145
        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 已提交
146 147 148
        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 已提交
149 150
        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 已提交
151
fi
T
tink2123 已提交
152

T
tink2123 已提交
153 154 155
if [ ${MODE} = "serving_infer" ];then
    # prepare serving env
    python_name=$(func_parser_value "${lines[2]}")
156 157
    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 已提交
158
    ${python_name} -m pip install paddle_serving_client==0.6.1
159
    ${python_name} -m pip install paddle-serving-app==0.6.3
T
tink2123 已提交
160 161
    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
162 163
    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 已提交
164
    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 已提交
165
fi
C
cuicheng01 已提交
166

T
tink2123 已提交
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
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