-
Notifications
You must be signed in to change notification settings - Fork 23
/
run_single_test_landcover.sh
executable file
·83 lines (66 loc) · 2.04 KB
/
run_single_test_landcover.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
LOSSES=(
"crossentropy"
"jaccard"
"superres"
)
MODEL_TYPES=(
"unet"
"unet_large"
"fcdensenet"
)
TEST_SPLITS=(
ny_1m_2013
)
GPU_ID=3
LOSS=${LOSSES[0]}
MODEL_TYPE=${MODEL_TYPES[0]}
BATCH_SIZE=16
LEARNING_RATE=0.001
TRAIN_STATE_LIST="md_1m_2013"
VAL_STATE_LIST="ny_1m_2013"
SUPERRES_STATE_LIST="ny_1m_2013"
MODEL_FN="model_10.h5"
MODEL_FN_INST=${MODEL_FN%.*}
EXP_NAME=CVPR-for_github-loss-${LOSS}-model-${MODEL_TYPE}-training_states-${TRAIN_STATE_LIST// /-}
EXP_NAME_OUT=${EXP_NAME}-instance-${MODEL_FN_INST}
OUTPUT=/results/train-output/
PRED_OUTPUT=/results/pred-output/
if [ ! -f "${OUTPUT}/${EXP_NAME}/${MODEL_FN}" ]; then
echo "This experiment hasn't been trained! Exiting..."
exit
fi
if [ -d "${PRED_OUTPUT}/${EXP_NAME_OUT}" ]; then
echo "Experiment output ${PRED_OUTPUT}/${EXP_NAME_OUT} exists"
while true; do
read -p "Do you wish to overwrite this experiment? [y/n]" yn
case $yn in
[Yy]* ) rm -rf ${PRED_OUTPUT}/${EXP_NAME_OUT}; break;;
[Nn]* ) exit;;
* ) echo "Please answer y or n.";;
esac
done
fi
mkdir -p ${PRED_OUTPUT}/${EXP_NAME_OUT}
echo ${MODEL_FN} > ${PRED_OUTPUT}/${EXP_NAME_OUT}/model_fn.txt
for TEST_SPLIT in "${TEST_SPLITS[@]}"
do
echo $TEST_SPLIT
TEST_CSV=/home/caleb/data//${TEST_SPLIT}_test_tiles.csv
echo ${PRED_OUTPUT}/${EXP_NAME_OUT}/log_test_${TEST_SPLIT}.txt
unbuffer python -u landcover/testing_model_landcover.py \
--input ${TEST_CSV} \
--output ${PRED_OUTPUT}/${EXP_NAME_OUT}/ \
--model ${OUTPUT}/${EXP_NAME}/${MODEL_FN} \
--gpu ${GPU_ID} \
&> ${PRED_OUTPUT}/${EXP_NAME_OUT}/log_test_${TEST_SPLIT}.txt
#--superres \
echo ${PRED_OUTPUT}/${EXP_NAME_OUT}/log_acc_${TEST_SPLIT}.txt
unbuffer python -u compute_accuracy.py \
--input ${TEST_CSV} \
--output ${PRED_OUTPUT}/${EXP_NAME_OUT} \
&> ${PRED_OUTPUT}/${EXP_NAME_OUT}/log_acc_${TEST_SPLIT}.txt &
done
wait;
echo "./eval_all_landcover_results.sh ${PRED_OUTPUT}/${EXP_NAME_OUT}"
exit 0