-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcompute_results.sh
executable file
·71 lines (56 loc) · 1.92 KB
/
compute_results.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
#!/bin/bash
set -e
OPTIND=1
begin=0
end=500
cpus=4
CLEVRDIR=""
usage="\nUsage: $(basename "$0") -d clevr_dir [OPTIONS]\nOPTIONS:\n -s\tSpecifies start query index [default: $begin]\n -e\tSpecifies end query index [default: $end]\n -p\tSpecifies number of processes to use for computing GED [default: $cpus]\n"
while getopts "s:e:p:d:h" opt; do
case "$opt" in
s) begin=$OPTARG
;;
e) end=$OPTARG
;;
p) cpus=$OPTARG
;;
d) CLEVRDIR=$OPTARG
;;
h) printf "$usage"
exit
;;
esac
done
if [ -z "$CLEVRDIR" ]; then
echo "CLEVR directory not specified. Please use -d option"
exit
fi
if [ ! -d "$CLEVRDIR" ]; then
echo "Specified CLEVR directory does not exist!"
exit
fi
if [ ! -f .venvok ]; then
echo "Virtual environment not installed. Have you run setup.sh?"
exit
fi
source ./retrieval_env/bin/activate
if [ ! -f .statsok ]; then
echo "Computing all the metrics from index "$begin" to "$end" using "$cpus" cpus"
#Compute soft-match metrics
printf "\n\nStep 1/4\n"
python3 build_stats.py --clevr-dir $CLEVRDIR --query-img-index $begin --until-img-index $end --cpus $cpus
printf "\n\nStep 2/4\n"
python3 build_stats.py --clevr-dir $CLEVRDIR --query-img-index $begin --until-img-index $end --normalize --cpus $cpus
#Compute hard-match metrics
printf "\n\nStep 3/4\n"
python3 build_stats.py --clevr-dir $CLEVRDIR --graph-ground-truth atleastone --query-img-index $begin --until-img-index $end --cpus $cpus
printf "\n\nStep 4/4\n"
python3 build_stats.py --clevr-dir $CLEVRDIR --graph-ground-truth atleastone --query-img-index $begin --until-img-index $end --normalize --cpus $cpus
fi
touch .statsok
#Emit spearman-rho stats and build pdf
printf "\nSoft-match results\n"
python3 visualize_stats.py --ground-truth graph-approx-proportional --aggregate
printf "\nHard-match results\n"
python3 visualize_stats.py --ground-truth graph-approx-atleastone --aggregate
deactivate