prepare.sh 4.0 KB
Newer Older
L
LDOUBLEV 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/bash
FILENAME=$1
# MODE be one of ['lite_train_infer' 'whole_infer' 'whole_train_infer', 'infer']
MODE=$2

dataline=$(cat ${FILENAME})

# parser params
IFS=$'\n'
lines=(${dataline})
function func_parser_key(){
    strs=$1
    IFS=":"
    array=(${strs})
    tmp=${array[0]}
    echo ${tmp}
}
function func_parser_value(){
    strs=$1
    IFS=":"
    array=(${strs})
    tmp=${array[1]}
    echo ${tmp}
}
IFS=$'\n'
# The training params
L
LDOUBLEV 已提交
27
model_name=$(func_parser_value "${lines[1]}")
L
LDOUBLEV 已提交
28

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

D
Double_V 已提交
31 32
# MODE be one of ['lite_train_infer' 'whole_infer' 'whole_train_infer']
MODE=$2
L
LDOUBLEV 已提交
33

D
Double_V 已提交
34 35 36 37
if [ ${MODE} = "lite_train_infer" ];then
    # pretrain lite train data
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
38
    rm -rf ./train_data/ic15_data
D
Double_V 已提交
39
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.tar
T
tink2123 已提交
40
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar # todo change to bcebos
T
tink2123 已提交
41
    wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar
T
tink2123 已提交
42
    cd ./train_data/ && tar xf icdar2015_lite.tar && tar xf ic15_data.tar
D
Double_V 已提交
43 44
    ln -s ./icdar2015_lite ./icdar2015
    cd ../
T
tink2123 已提交
45
    cd ./inference && tar xf rec_inference.tar && cd ../
D
Double_V 已提交
46 47 48
elif [ ${MODE} = "whole_train_infer" ];then
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
49
    rm -rf ./train_data/ic15_data
D
Double_V 已提交
50
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar
T
tink2123 已提交
51 52
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar
    cd ./train_data/ && tar xf icdar2015.tar && tar xf ic15_data.tar && cd ../
D
Double_V 已提交
53 54 55
elif [ ${MODE} = "whole_infer" ];then
    wget -nc -P  ./pretrain_models/ https://paddle-imagenet-models-name.bj.bcebos.com/dygraph/MobileNetV3_large_x0_5_pretrained.pdparams
    rm -rf ./train_data/icdar2015
T
tink2123 已提交
56
    rm -rf ./train_data/ic15_data
D
Double_V 已提交
57
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_infer.tar
T
tink2123 已提交
58 59
    wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar
    cd ./train_data/ && tar xf icdar2015_infer.tar && tar xf ic15_data.tar
D
Double_V 已提交
60 61
    ln -s ./icdar2015_infer ./icdar2015
    cd ../
L
LDOUBLEV 已提交
62
else
T
tink2123 已提交
63
    if [ ${model_name} = "ocr_det" ]; then
D
Double_V 已提交
64
        eval_model_name="ch_ppocr_mobile_v2.0_det_infer"
T
tink2123 已提交
65 66
        rm -rf ./train_data/icdar2015
        wget -nc -P ./train_data https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
D
Double_V 已提交
67 68 69
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_det_infer.tar
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf ch_det_data_50.tar && cd ../
    else 
T
tink2123 已提交
70
        rm -rf ./train_data/ic15_data
T
tink2123 已提交
71
        eval_model_name="ch_ppocr_mobile_v2.0_rec_infer"
T
tink2123 已提交
72
        wget -nc -P ./inference/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/rec_inference.tar
T
tink2123 已提交
73
        wget -nc  -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar
T
tink2123 已提交
74
        cd ./inference && tar xf ${eval_model_name}.tar && tar xf rec_inference.tar && cd ../
D
Double_V 已提交
75 76
    fi 
fi
T
tink2123 已提交
77

T
tink2123 已提交
78 79
# prepare serving env
python_name=$(func_parser_value "${lines[2]}")
T
tink2123 已提交
80 81
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 已提交
82
${python_name} -m pip install paddle_serving_client==0.6.1
T
tink2123 已提交
83
${python_name} -m pip install paddle-serving-app==0.6.3
T
tink2123 已提交
84 85 86 87 88
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
cd ./inference && tar xf ch_ppocr_mobile_v2.0_det_infer.tar && tar xf ch_ppocr_mobile_v2.0_rec_infer.tar