mirror of
https://github.com/PaddlePaddle/PaddleOCR.git
synced 2025-06-03 21:53:39 +08:00
* Update PP-OCRv4_introduction.md * Update PP-OCRv4_introduction.md (#10616) * Update PP-OCRv4_introduction.md * Update PP-OCRv4_introduction.md * Update PP-OCRv4_introduction.md * Update README.md * Cherrypicking GH-10217 and GH-10216 to PaddlePaddle:Release/2.7 (#10655) * Don't break overall processing on a bad image * Add preprocessing common to OCR tasks Add preprocessing to options * Update requirements.txt (#10656) added missing pyyaml library * [TIPC]update xpu tipc script (#10658) * fix-typo (#10642) Co-authored-by: Dennis <dvorst@users.noreply.github.com> Co-authored-by: shiyutang <34859558+shiyutang@users.noreply.github.com> * 修改数据增强导致的DSR报错 (#10662) (#10681) * 修改数据增强导致的DSR报错 * 错误修改回滚 * Update algorithm_overview_en.md (#10670) Fixed simple spelling errors. * Implement recoginition method ParseQ * Document update for new recognition method ParseQ * add prediction for parseq * Update rec_vit_parseq.yml * Update rec_r31_sar.yml * Update rec_r31_sar.yml * Update rec_r50_fpn_srn.yml * Update rec_vit_parseq.py * Update rec_vit_parseq.yml * Update rec_parseq_head.py * Update rec_img_aug.py * Update rec_vit_parseq.yml * Update __init__.py * Update predict_rec.py * Update paddleocr.py * Update requirements.txt * Update utility.py * Update utility.py --------- Co-authored-by: xiaoting <31891223+tink2123@users.noreply.github.com> Co-authored-by: topduke <784990967@qq.com> Co-authored-by: dyning <dyning.2003@163.com> Co-authored-by: UserUnknownFactor <63057995+UserUnknownFactor@users.noreply.github.com> Co-authored-by: itasli <ilyas.tasli@outlook.fr> Co-authored-by: Kai Song <50285351+USTCKAY@users.noreply.github.com> Co-authored-by: dvorst <87502756+dvorst@users.noreply.github.com> Co-authored-by: Dennis <dvorst@users.noreply.github.com> Co-authored-by: shiyutang <34859558+shiyutang@users.noreply.github.com> Co-authored-by: Dec20B <1192152456@qq.com> Co-authored-by: ncoffman <51147417+ncoffman@users.noreply.github.com>
63 lines
1.9 KiB
Bash
63 lines
1.9 KiB
Bash
#!/bin/bash
|
|
source test_tipc/common_func.sh
|
|
|
|
function readlinkf() {
|
|
perl -MCwd -e 'print Cwd::abs_path shift' "$1";
|
|
}
|
|
|
|
function func_parser_config() {
|
|
strs=$1
|
|
IFS=" "
|
|
array=(${strs})
|
|
tmp=${array[2]}
|
|
echo ${tmp}
|
|
}
|
|
|
|
BASEDIR=$(dirname "$0")
|
|
REPO_ROOT_PATH=$(readlinkf ${BASEDIR}/../)
|
|
|
|
FILENAME=$1
|
|
|
|
# disable mkldnn on non x86_64 env
|
|
arch=$(uname -i)
|
|
if [ $arch != 'x86_64' ]; then
|
|
sed -i 's/--enable_mkldnn:True|False/--enable_mkldnn:False/g' $FILENAME
|
|
sed -i 's/--enable_mkldnn:True/--enable_mkldnn:False/g' $FILENAME
|
|
fi
|
|
|
|
# change gpu to xpu in tipc txt configs
|
|
sed -i 's/use_gpu/use_xpu/g' $FILENAME
|
|
# disable benchmark as AutoLog required nvidia-smi command
|
|
sed -i 's/--benchmark:True/--benchmark:False/g' $FILENAME
|
|
# python has been updated to version 3.9 for xpu backend
|
|
sed -i "s/python3.7/python3.9/g" $FILENAME
|
|
dataline=`cat $FILENAME`
|
|
|
|
# parser params
|
|
IFS=$'\n'
|
|
lines=(${dataline})
|
|
|
|
modelname=$(echo ${lines[1]} | cut -d ":" -f2)
|
|
if [ $modelname == "rec_r31_sar" ] || [ $modelname == "rec_mtb_nrtr" ]; then
|
|
sed -i "s/Global.epoch_num:lite_train_lite_infer=2/Global.epoch_num:lite_train_lite_infer=1/g" $FILENAME
|
|
sed -i "s/gpu_list:0|0,1/gpu_list:0,1/g" $FILENAME
|
|
sed -i "s/Global.use_xpu:True|True/Global.use_xpu:True/g" $FILENAME
|
|
fi
|
|
|
|
# replace training config file
|
|
grep -n 'tools/.*yml' $FILENAME | cut -d ":" -f 1 \
|
|
| while read line_num ; do
|
|
train_cmd=$(func_parser_value "${lines[line_num-1]}")
|
|
trainer_config=$(func_parser_config ${train_cmd})
|
|
sed -i 's/use_gpu/use_xpu/g' "$REPO_ROOT_PATH/$trainer_config"
|
|
sed -i 's/use_sync_bn: True/use_sync_bn: False/g' "$REPO_ROOT_PATH/$trainer_config"
|
|
done
|
|
|
|
# change gpu to xpu in execution script
|
|
sed -i 's/\"gpu\"/\"xpu\"/g' test_tipc/test_train_inference_python.sh
|
|
|
|
# pass parameters to test_train_inference_python.sh
|
|
cmd='bash test_tipc/test_train_inference_python.sh ${FILENAME} $2'
|
|
echo -e '\033[1;32m Started to run command: ${cmd}! \033[0m'
|
|
eval $cmd
|