-
Notifications
You must be signed in to change notification settings - Fork 9
/
evaluate_all.sh
134 lines (103 loc) · 4.53 KB
/
evaluate_all.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
res_end="results"
results_start=""
device=0
## FFHQ ##
Write_results="Quantitative_Analysis/FFHQ"
declare -a names=(
results/REFace/FFHQ/results
# "other_swappers/MegaFs/FFHQ_outs"
# "other_swappers/hififace/FFHQ_results"
# "e4s/Results/testbench/results_on_FFHQ_orig_ckpt/results"
# "other_swappers/SimSwap/output/FFHQ/results"
# "other_swappers/FaceDancer/FaceDancer_c_HQ-FFHQ/results"
# "other_swappers/DiffSwap/all_images_with_folders_named_2_FFHQ"
# "other_swappers/DiffFace/results/FFHQ/results"
)
source_path="dataset/FaceData/FFHQ/Val"
target_path="dataset/FaceData/FFHQ/Val_target"
source_mask_path="dataset/FaceData/FFHQ/src_mask"
target_mask_path="dataset/FaceData/FFHQ/target_mask"
Dataset_path="dataset/FaceData/FFHQ/images512"
for name in "${names[@]}"
do
# Results_out="${results_start}/${name}/${res_end}"
# Results_out="${name}/${res_end}"
Results_out="${name}"
current_time=$(date +"%Y%m%d_%H%M%S")
Write_results_n="${Write_results}/${name}"
output_filename="${Write_results_n}/out_${current_time}.txt"
if [ ! -d "$Write_results_n" ]; then
mkdir -p "$Write_results_n"
echo "Directory created: $Write_results_n"
else
echo "Directory already exists: $Write_results_n"
fi
echo "FID score with Dataset:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/fid/fid_score.py --device cuda \
"${Dataset_path}" \
"${Results_out}" >> "$output_filename"
echo "ID similarity with Source using Arcface:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/ID_retrieval/ID_retrieval.py --device cuda \
"${source_path}" \
"${Results_out}" \
"${source_mask_path}" \
"${target_mask_path}" \
--dataset "ffhq" \
--print_sim True \
--arcface True >> "$output_filename"
echo "Pose comarison with target:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/Pose/pose_compare.py --device cuda \
"${target_path}" \
"${Results_out}" >> "$output_filename"
echo "Expression comarison with target:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/Expression/expression_compare_face_recon.py --device cuda \
"${target_path}" \
"${Results_out}" >> "$output_filename"
done
######### CelebA #######
Write_results="Quantitative_Analysis/CelebA"
source_path="dataset/FaceData/CelebAMask-HQ/Val"
target_path="dataset/FaceData/CelebAMask-HQ/Val_target"
source_mask_path="dataset/FaceData/CelebAMask-HQ/src_mask"
target_mask_path="dataset/FaceData/CelebAMask-HQ/target_mask"
Dataset_path="dataset/FaceData/CelebAMask-HQ/CelebA-HQ-img"
declare -a names=(
results/REFace/CelebA/results
)
for name in "${names[@]}"
do
# Results_out="${results_start}/${name}/${res_end}"
# Results_out="${name}/${res_end}"
Results_out="${name}"
current_time=$(date +"%Y%m%d_%H%M%S")
Write_results_n="${Write_results}/${name}"
output_filename="${Write_results_n}/out_${current_time}.txt"
if [ ! -d "$Write_results_n" ]; then
mkdir -p "$Write_results_n"
echo "Directory created: $Write_results_n"
else
echo "Directory already exists: $Write_results_n"
fi
echo "FID score with Dataset:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/fid/fid_score.py --device cuda \
"${Dataset_path}" \
"${Results_out}" >> "$output_filename"
echo "ID similarity with Source using Arcface:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/ID_retrieval/ID_retrieval.py --device cuda \
"${source_path}" \
"${Results_out}" \
"${source_mask_path}" \
"${target_mask_path}" \
--dataset "ffhq" \
--print_sim True \
--arcface True >> "$output_filename"
echo "Pose comarison with target:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/Pose/pose_compare.py --device cuda \
"${target_path}" \
"${Results_out}" >> "$output_filename"
echo "Expression comarison with target:" >> "$output_filename"
CUDA_VISIBLE_DEVICES=${device} python eval_tool/Expression/expression_compare_face_recon.py --device cuda \
"${target_path}" \
"${Results_out}" >> "$output_filename"
done