| @@ -20,13 +20,25 @@ then | |||||
| exit 1 | exit 1 | ||||
| fi | fi | ||||
| if [ ! -d $1 ] | |||||
| get_real_path(){ | |||||
| if [ "${1:0:1}" == "/" ]; then | |||||
| echo "$1" | |||||
| else | |||||
| echo "$(realpath -m $PWD/$1)" | |||||
| fi | |||||
| } | |||||
| PATH1=$(get_real_path $1) | |||||
| PATH2=$(get_real_path $2) | |||||
| if [ ! -d $PATH1 ] | |||||
| then | then | ||||
| echo "error: DATASET_PATH=$1 is not a directory" | echo "error: DATASET_PATH=$1 is not a directory" | ||||
| exit 1 | exit 1 | ||||
| fi | fi | ||||
| if [ ! -f $2 ] | |||||
| if [ ! -f $PATH2 ] | |||||
| then | then | ||||
| echo "error: CHECKPOINT_PATH=$2 is not a file" | echo "error: CHECKPOINT_PATH=$2 is not a file" | ||||
| exit 1 | exit 1 | ||||
| @@ -48,5 +60,5 @@ cp *.sh ./infer | |||||
| cd ./infer || exit | cd ./infer || exit | ||||
| env > env.log | env > env.log | ||||
| echo "start infering for device $DEVICE_ID" | echo "start infering for device $DEVICE_ID" | ||||
| python eval.py --do_eval=True --dataset_path=$1 --checkpoint_path=$2 &> log & | |||||
| python eval.py --do_eval=True --dataset_path=$PATH1 --checkpoint_path=$PATH2 &> log & | |||||
| cd .. | cd .. | ||||
| @@ -77,7 +77,8 @@ if __name__ == '__main__': | |||||
| opt = Momentum(filter(lambda x: x.requires_grad, net.get_parameters()), lr, config.momentum, | opt = Momentum(filter(lambda x: x.requires_grad, net.get_parameters()), lr, config.momentum, | ||||
| config.weight_decay, config.loss_scale) | config.weight_decay, config.loss_scale) | ||||
| model = Model(net, loss_fn=loss, optimizer=opt, loss_scale_manager=loss_scale, metrics={'acc'}) | |||||
| model = Model(net, loss_fn=loss, optimizer=opt, loss_scale_manager=loss_scale, metrics={'acc'}, amp_level="O2", | |||||
| keep_batchnorm_fp32=False) | |||||
| time_cb = TimeMonitor(data_size=step_size) | time_cb = TimeMonitor(data_size=step_size) | ||||
| loss_cb = LossMonitor() | loss_cb = LossMonitor() | ||||