From a2df17dc0e83d755bafc7c8874d9a9bc775adf82 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 19 Jul 2021 07:09:35 +0000 Subject: [PATCH] fix set epoch and batchsize --- tests/ocr_det_params.txt | 4 ++-- tests/test.sh | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/tests/ocr_det_params.txt b/tests/ocr_det_params.txt index 9383250e..3efe804e 100644 --- a/tests/ocr_det_params.txt +++ b/tests/ocr_det_params.txt @@ -4,9 +4,9 @@ python:python3.7 gpu_list:0|0,1 Global.use_gpu:True|True Global.auto_cast:False -Global.epoch_num:2 +Global.epoch_num:lite_train_infer=2|whole_train_infer=300 Global.save_model_dir:./output/ -Train.loader.batch_size_per_card:2 +Train.loader.batch_size_per_card:lite_train_infer=2|whole_train_infer=4 Global.pretrained_model:null train_model_name:latest train_infer_img_dir:./train_data/icdar2015/text_localization/ch4_test_images/ diff --git a/tests/test.sh b/tests/test.sh index a976ba4b..2c1591f6 100644 --- a/tests/test.sh +++ b/tests/test.sh @@ -34,6 +34,28 @@ function func_set_params(){ echo "${key}=${value}" fi } +function func_parser_params(){ + strs=$1 + IFS=":" + array=(${strs}) + key=${array[0]} + tmp=${array[1]} + IFS="|" + res="" + for _params in ${tmp[*]}; do + IFS="=" + array=(${_params}) + mode=${array[0]} + value=${array[1]} + if [[ ${mode} = ${MODE} ]]; then + IFS="|" + echo $(func_set_params "${mode}" "${value}") + break + fi + IFS="|" + done + echo ${res} +} function status_check(){ last_status=$1 # the exit code run_command=$2 @@ -55,10 +77,10 @@ train_use_gpu_value=$(func_parser_value "${lines[4]}") autocast_list=$(func_parser_value "${lines[5]}") autocast_key=$(func_parser_key "${lines[5]}") epoch_key=$(func_parser_key "${lines[6]}") -epoch_num=$(func_parser_value "${lines[6]}") +epoch_num=$(func_parser_params "${lines[6]}") save_model_key=$(func_parser_key "${lines[7]}") train_batch_key=$(func_parser_key "${lines[8]}") -train_batch_value=$(func_parser_value "${lines[8]}") +train_batch_value=$(func_parser_params "${lines[8]}") pretrain_model_key=$(func_parser_key "${lines[9]}") pretrain_model_value=$(func_parser_value "${lines[9]}") train_model_name=$(func_parser_value "${lines[10]}") -- GitLab