-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathevaluate_celebAWild.sh
executable file
·85 lines (61 loc) · 2.89 KB
/
evaluate_celebAWild.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
84
85
#!/bin/bash
# Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
# Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
DATASET="CelebAWild"
DATA_DIR="data/CelebA"
MODEL_DIR="snapshots_CelebA"
TRAIN_LIST="data/CelebA/MAFL/training.txt"
TEST_LIST="data/CelebA/MAFL/testing.txt"
MODEL="DeepLab50_2branch"
nvidia-smi
read -e -p "Which GPU to use? : " -i "0" GPU
read -e -p "Model: " -i $MODEL MODEL
read -e -p "Evaluate on train set and calculate landmark errors? (y/n) : " -i "n" EVAL_TRAIN
read -e -p "Model dir: " -i $MODEL_DIR MODEL_DIR
ls $MODEL_DIR
echo ""
read -e -p "Model name(s): " -i "SCOPS_K8" METHOD
ls $MODEL_DIR/$METHOD/model*
echo ""
read -e -p "Iter(s): " -i "100000" ITER
read -e -p "Save Dir: " -i "results_CelebA" SAVE_DIR
read -e -p "extra args for test set : " -i "--crf --save-viz" ARG_TEST
read -e -p "extra args for train set : " ARG_TRAIN
for iter in $ITER
do
for method in $METHOD
do
K_index=${method##*_K}
K_index=${K_index%%_*}
NUM_PARTS=$((K_index))
echo 'num classes' $NUM_CLASS
SNAPSHOT="${MODEL_DIR}/$method/model_${iter}.pth"
# Testing
CMD_TEST="CUDA_VISIBLE_DEVICES=${GPU} python evaluate_celebAWild.py $ARG_TEST --dataset $DATASET --data-dir $DATA_DIR --data-list $TEST_LIST --num-parts $NUM_PARTS --model $MODEL --restore-from $SNAPSHOT --save-dir $SAVE_DIR/$method/ITER_$iter/test/"
echo ""
echo "$CMD_TEST"
echo ""
eval "$CMD_TEST"
if [[ $EVAL_TRAIN == "y" ]]
then
if [ ! -d "$SAVE_DIR/$method/ITER_$iter/train/" ]; then
CMD_TRAIN="CUDA_VISIBLE_DEVICES=${GPU} python evaluate_celebAWild.py $ARG_TRAIN --dataset $DATASET --data-dir $DATA_DIR --data-list $TRAIN_LIST --num-parts $NUM_PARTS --model $MODEL --restore-from $SNAPSHOT --save-dir $SAVE_DIR/$method/ITER_$iter/train/"
echo ""
echo "$CMD_TRAIN"
echo ""
eval "$CMD_TRAIN"
fi
echo "Evaluating landmarks"
CMD_EVAL="python evaluation/face_evaluation_wild.py $SAVE_DIR/$method/ITER_$iter | tee $SAVE_DIR/$method/ITER_$iter/lm_evaluation.txt"
fi
echo ""
echo "$CMD_EVAL"
echo ""
eval "$CMD_EVAL"
CMD_WEB="python web_visualize.py -o $SAVE_DIR/$method/ITER_$iter/web_html -dirs ../datasets/CelebA/img_celeba $SAVE_DIR/$method/ITER_$iter/test/landmarks $SAVE_DIR/$method/ITER_$iter/test/part_overlay $SAVE_DIR/$method/ITER_$iter/test/part_dcrf_overlay $SAVE_DIR/$method/ITER_$iter/test/part_map $SAVE_DIR/$method/ITER_$iter/test/part_map_dcrf -names Img Landmarks PartoOverlay PartoOverlayDCRF PartMaps PartMapsDCRF -ref 1"
echo ""
echo "$CMD_WEB"
echo ""
eval "$CMD_WEB"
done
done