PaddleOCR/tests/prepare.sh

77 lines
3.1 KiB
Bash
Raw Normal View History

2021-07-14 14:19:08 +08:00
#!/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
2021-07-19 15:27:38 +08:00
model_name=$(func_parser_value "${lines[1]}")
2021-07-14 14:19:08 +08:00
2021-07-19 15:27:38 +08:00
trainer_list=$(func_parser_value "${lines[14]}")
2021-07-28 15:47:53 +08:00
2021-07-28 15:49:25 +08:00
# MODE be one of ['lite_train_infer' 'whole_infer' 'whole_train_infer']
MODE=$2
2021-07-14 14:19:08 +08:00
2021-07-28 15:49:25 +08:00
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
2021-08-05 14:18:44 +08:00
rm -rf ./train_data/ic15_data
2021-07-28 15:49:25 +08:00
wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_lite.tar
2021-08-05 14:18:44 +08:00
wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar # todo change to bcebos
cd ./train_data/ && tar xf icdar2015_lite.tar && tar xf ic15_data.tar
2021-07-28 15:49:25 +08:00
ln -s ./icdar2015_lite ./icdar2015
cd ../
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
2021-08-05 14:18:44 +08:00
rm -rf ./train_data/ic15_data
2021-07-28 15:49:25 +08:00
wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015.tar
2021-08-05 14:18:44 +08:00
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 ../
2021-07-28 15:49:25 +08:00
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
2021-08-05 14:18:44 +08:00
rm -rf ./train_data/ic15_data
2021-07-28 15:49:25 +08:00
wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/icdar2015_infer.tar
2021-08-05 14:18:44 +08:00
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
2021-07-28 15:49:25 +08:00
ln -s ./icdar2015_infer ./icdar2015
cd ../
2021-07-14 14:19:08 +08:00
else
2021-08-05 14:18:44 +08:00
if [ ${model_name} = "ocr_det" ]; then
2021-07-28 15:49:25 +08:00
eval_model_name="ch_ppocr_mobile_v2.0_det_infer"
2021-08-05 14:18:44 +08:00
rm -rf ./train_data/icdar2015
wget -nc -P ./train_data https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ch_det_data_50.tar
2021-07-28 15:49:25 +08:00
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
2021-08-05 14:18:44 +08:00
rm -rf ./train_data/ic15_data
2021-08-05 15:02:17 +08:00
eval_model_name="ch_ppocr_mobile_v2.0_rec_infer"
2021-08-05 14:18:44 +08:00
wget -nc -P ./train_data/ https://paddleocr.bj.bcebos.com/dygraph_v2.0/test/ic15_data.tar
2021-08-05 15:02:17 +08:00
wget -nc -P ./inference https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_rec_infer.tar
2021-08-05 14:18:44 +08:00
cd ./inference && tar xf ${eval_model_name}.tar && tar xf ic15_data.tar && cd ../
2021-07-28 15:49:25 +08:00
fi
fi
2021-08-05 14:18:44 +08:00