From 319a41035198b073f3b050679b9fd5a3b257b853 Mon Sep 17 00:00:00 2001 From: cj Date: Sun, 20 Sep 2020 20:03:32 +0800 Subject: [PATCH] add imagenet support for google in shell script. --- .../official/cv/googlenet/scripts/run_eval.sh | 13 ++++++++++++- .../cv/googlenet/scripts/run_eval_gpu.sh | 17 ++++++++++++++--- .../cv/googlenet/scripts/run_train_gpu.sh | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/model_zoo/official/cv/googlenet/scripts/run_eval.sh b/model_zoo/official/cv/googlenet/scripts/run_eval.sh index 4aad02a4af..dd7a4d453b 100644 --- a/model_zoo/official/cv/googlenet/scripts/run_eval.sh +++ b/model_zoo/official/cv/googlenet/scripts/run_eval.sh @@ -20,4 +20,15 @@ BASEPATH=$(cd "`dirname $0`" || exit; pwd) export PYTHONPATH=${BASEPATH}:$PYTHONPATH export DEVICE_ID=0 -python ${BASEPATH}/../eval.py > ./eval.log 2>&1 & +dataset_type='cifar10' +if [ $# == 1 ] +then + if [ $1 != "cifar10" ] && [ $1 != "imagenet" ] + then + echo "error: the selected dataset is neither cifar10 nor imagenet" + exit 1 + fi + dataset_type=$1 +fi + +python ${BASEPATH}/../eval.py --dataset_name=$dataset_type > ./eval.log 2>&1 & diff --git a/model_zoo/official/cv/googlenet/scripts/run_eval_gpu.sh b/model_zoo/official/cv/googlenet/scripts/run_eval_gpu.sh index b2e2a38737..0f422ec775 100644 --- a/model_zoo/official/cv/googlenet/scripts/run_eval_gpu.sh +++ b/model_zoo/official/cv/googlenet/scripts/run_eval_gpu.sh @@ -16,9 +16,9 @@ ulimit -u unlimited -if [ $# != 1 ] +if [ $# != 1 ] && [ $# != 2 ] then - echo "GPU: sh run_eval_gpu.sh [CHECKPOINT_PATH]" + echo "GPU: sh run_eval_gpu.sh [CHECKPOINT_PATH] [cifar10|imagenet]" exit 1 fi @@ -29,6 +29,17 @@ then exit 1 fi +dataset_type='cifar10' +if [ $# == 2 ] +then + if [ $2 != "cifar10" ] && [ $2 != "imagenet" ] + then + echo "error: the selected dataset is neither cifar10 nor imagenet" + exit 1 + fi + dataset_type=$2 +fi + BASEPATH=$(cd "`dirname $0`" || exit; pwd) export PYTHONPATH=${BASEPATH}:$PYTHONPATH export DEVICE_ID=0 @@ -40,4 +51,4 @@ fi mkdir ../eval cd ../eval || exit -python3 ${BASEPATH}/../eval.py --checkpoint_path=$1 > ./eval.log 2>&1 & +python3 ${BASEPATH}/../eval.py --checkpoint_path=$1 --dataset_name=$dataset_type > ./eval.log 2>&1 & diff --git a/model_zoo/official/cv/googlenet/scripts/run_train_gpu.sh b/model_zoo/official/cv/googlenet/scripts/run_train_gpu.sh index ba47943917..75f37c905a 100644 --- a/model_zoo/official/cv/googlenet/scripts/run_train_gpu.sh +++ b/model_zoo/official/cv/googlenet/scripts/run_train_gpu.sh @@ -17,7 +17,7 @@ if [ $# -lt 3 ] then echo "Usage: \ - sh run_train.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [cifar10|imagenet]\ + sh run_train_gpu.sh [DEVICE_NUM] [VISIABLE_DEVICES(0,1,2,3,4,5,6,7)] [cifar10|imagenet]\ " exit 1 fi