hpds_control_center/scripts/runTrainScript.sh

92 lines
2.0 KiB
Bash

#!/bin/bash
#获取对应的参数 没有的话赋默认值
ARGS=`getopt -o d::s::b::e::m::o:: --long dataset::,img_size::,batch_size::,epochs::,model::,model_save:: -n 'example.sh' -- "$@"`
if [ $? != 0 ]; then
echo "Terminating..."
exit 1
fi
echo $ARGS
eval set -- "${ARGS}"
while true;
do
case "$1" in
-d|--dataset)
case "$2" in
"")
echo "Internal error!"
exit 1
;;
*)
Dataset=$2
shift 2;
;;
esac
;;
-s|--img_size)
case "$2" in
"")
echo "Internal error!"
exit 1
;;
*)
ImgSize=$2;
shift 2;
;;
esac
;;
-b|--batch_size)
case "$2" in
*)
BatchSize=$2;
shift 2;
;;
esac
;;
-e|--epochs)
case "$2" in
*)
Epochs=$2;
shift 2;
;;
esac
;;
-m|--model)
case "$2" in
*)
Model=$2;
shift 2;
;;
esac
;;
-o|--model_save)
case "$2" in
*)
ModelSave=$2;
shift 2;
;;
esac
;;
--)
shift
break
;;
*)
echo "Internal error!"
exit 1
;;
esac
done
#echo ${Dataset}
eval "$(conda shell.bash hook)"
conda activate hpds_train
cd /home/data/hpds_train_keras
python train.py --dataset ${Dataset} --img_size ${ImgSize} --batch_size ${BatchSize} \
--epochs ${Epochs} --model ${Model} --model_save ${ModelSave}