-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathrun_train_test.sh
51 lines (45 loc) · 993 Bytes
/
run_train_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -x
set -e
source activate py37
PHASE=$1
GPUS=$2
DATA=$3
BATCH_SIZE=$4
LOG_DIR="./logs"
if [ ! -d $LOG_DIR ]; then
mkdir -p -m 777 $LOG_DIR
echo "mkdir -p -m 777 ${LOG_DIR} done"
fi
LOG="${LOG_DIR}/${PHASE}_`date +'%Y-%m-%d_%H-%M'`.log"
exec &> >(tee -a "$LOG")
echo Logging output to "$LOG"
OUT_DIR=output/UString/vgg16
# experiments on DAD dataset
case ${PHASE} in
train)
CUDA_VISIBLE_DEVICES=$GPUS python main.py \
--dataset $DATA \
--feature_name vgg16 \
--phase train \
--base_lr 0.0005 \
--batch_size $BATCH_SIZE \
--gpus $GPUS \
--output_dir $OUT_DIR
;;
test)
CUDA_VISIBLE_DEVICES=$GPUS python main.py \
--dataset $DATA \
--feature_name vgg16 \
--phase test \
--batch_size $BATCH_SIZE \
--gpus $GPUS \
--visualize \
--output_dir $OUT_DIR \
--model_file $OUT_DIR/$DATA/snapshot/final_model.pth
;;
*)
echo "Invalid argument!"
exit
;;
esac