-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_batch_eval.sh
executable file
·104 lines (89 loc) · 2.84 KB
/
run_batch_eval.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
#!/bin/bash
# Created on 07 February 2022
# Purpose: automation of the process of surface reconstruction evaluation from real data
# store arguments
args=("$@")
executable="./evaluate_reconstruction_real_data"
#visualEvalFlag="--visual-eval"
#exportFPPointsFlag="--export-FP-points"
maxDistance="0.5" # default 0.2
print_help(){
echo -e "\n\n ===> BATCH REAL-DATA EVALUATION <===\n\n"
echo -e "--ground-truth-dir , -GT | Specify GROUND-TRUTH directory\n"
echo -e "--recon-dir , -Rec | Specify RECONSTRUCTIONS directory\n"
echo -e "--numerical-results-dir , -Res | Specify where to store NUMERICAL result files\n"
echo -e "--visual-eval-dir , -Visu | Specify where to store VISUAL result files\n"
}
extract_cmd_line_params() {
nbArgs=${#args[@]}
# Default values:
param_file="./eval.txt" # file to set evaluation parameters
verboseFlag=""
exampleFlag=""
ext=".ply"
# Browse arguments:
for (( i=0; i<$nbArgs; i++ )); do
if [ "${args[${i}]}" = "--ground-truth-dir" ] || [ "${args[${i}]}" = "-GT" ]; then
((i=i+1))
GTDir="${args[${i}]}"
elif [ "${args[${i}]}" = "--recon-dir" ] || [ "${args[${i}]}" = "-Rec" ]; then
((i=i+1))
ReconDir="${args[${i}]}"
elif [ "${args[${i}]}" = "--numerical-results-dir" ] || [ "${args[${i}]}" = "-Res" ]; then
((i=i+1))
NumericalResultsDir="${args[${i}]}"
elif [ "${args[${i}]}" = "--visual-eval-dir" ] || [ "${args[${i}]}" = "-Visu" ]; then
((i=i+1))
VisualResDir="${args[${i}]}"
elif [ "${args[${i}]}" = "--help" ] || [ "${args[${i}]}" = "-h" ]; then
print_help
exit 0
else
echo "Error: argument '${args[${i}]}' not valid"
print_help
fi
done
}
set_gt_files_string() {
firstFile="1"
for file in ${GTDir}/*; do
if [ "${firstFile}" = "1" ]; then
GTFiles="${file}"
firstFile=0
else
GTFiles="${GTFiles}***${file}"
fi
done
}
process_meshes(){
verboseFlag="--verbose"
for mesh in ${ReconDir}/*; do
meshBasename=$(basename -- "$mesh") # removes path
meshBasename="${meshBasename%.*}" # removes extension
cmd="${executable}\
--in-gtPcd ${GTFiles}\
--in-recon ${mesh}\
--out-pcd ${VisualResDir}/${meshBasename}_VISU.ply\
--max-distance ${maxDistance}\
${visualEvalFlag}\
${exportFPPointsFlag}
${verboseFlag}\
2>&1 | tee ${NumericalResultsDir}/${meshBasename}_NUM.txt"
# echo -e "---> executing: ${cmd}\n"
eval ${cmd}
done
}
print_general_information(){
echo -e "\n\n ===> BATCH REAL-DATA EVALUATION <===\n\n"
echo -e " - Ground-truth directory: ${GTDir}\n"
echo -e " - Reconstructions directory: ${ReconDir}\n"
echo -e " - Numerical results directory: ${NumericalResultsDir}\n"
echo -e " - Visual results directory: ${VisualResDir}\n\n"
echo -e " - Ground-truth files: ${GTFiles}\n\n"
}
# main #
extract_cmd_line_params
set_gt_files_string
print_general_information
process_meshes
exit 0