-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_all.sh
executable file
·120 lines (110 loc) · 3.58 KB
/
run_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
#!/bin/bash
# Help message
show_help() {
echo "Usage: $0 -d DATA_DIR -o OUTPUT_DIR [-n NUM_IMAGES] [-r NUM_RUNS] [--max-warmup MAX_WARMUP] [--warmup-window WINDOW] [--warmup-threshold THRESHOLD] [--min-warmup-windows MIN_WINDOWS] [--update-docs]"
echo
echo "Required arguments:"
echo " -d DATA_DIR Directory containing images"
echo " -o OUTPUT_DIR Directory for output files"
echo
echo "Optional arguments:"
echo " -n NUM_IMAGES Number of images to process (default: 2000)"
echo " -r NUM_RUNS Number of benchmark runs (default: 5)"
echo " --max-warmup Maximum warmup iterations (default: 1000)"
echo " --warmup-window Window size for variance check (default: 5)"
echo " --warmup-threshold Variance stability threshold (default: 0.05)"
echo " --min-warmup-windows Minimum windows to check (default: 10)"
echo " --update-docs Update documentation with results (default: false)"
echo " -h Show this help message"
}
# Default values
NUM_IMAGES=2000
NUM_RUNS=5
MAX_WARMUP=1000
WARMUP_WINDOW=5
WARMUP_THRESHOLD=0.05
MIN_WARMUP_WINDOWS=10
UPDATE_DOCS=false
# Parse command line arguments
while getopts "d:o:n:r:h-:" opt; do
case "${opt}" in
-)
case "${OPTARG}" in
max-warmup)
MAX_WARMUP="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
;;
warmup-window)
WARMUP_WINDOW="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
;;
warmup-threshold)
WARMUP_THRESHOLD="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
;;
min-warmup-windows)
MIN_WARMUP_WINDOWS="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
;;
update-docs)
UPDATE_DOCS=true
;;
*)
echo "Unknown option --${OPTARG}"
show_help
exit 1
;;
esac
;;
d)
DATA_DIR="${OPTARG}"
;;
o)
OUTPUT_DIR="${OPTARG}"
;;
n)
NUM_IMAGES="${OPTARG}"
;;
r)
NUM_RUNS="${OPTARG}"
;;
h)
show_help
exit 0
;;
*)
show_help
exit 1
;;
esac
done
# Check required arguments
if [ -z "$DATA_DIR" ] || [ -z "$OUTPUT_DIR" ]; then
echo "Error: Missing required arguments."
show_help
exit 1
fi
# Create output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
# Run benchmarks for each library
LIBRARIES=("albumentations" "imgaug" "torchvision" "kornia" "augly")
for lib in "${LIBRARIES[@]}"; do
echo "Running benchmark for $lib..."
./run_single.sh \
-l "$lib" \
-d "$DATA_DIR" \
-o "$OUTPUT_DIR" \
-n "$NUM_IMAGES" \
-r "$NUM_RUNS" \
--max-warmup "$MAX_WARMUP" \
--warmup-window "$WARMUP_WINDOW" \
--warmup-threshold "$WARMUP_THRESHOLD" \
--min-warmup-windows "$MIN_WARMUP_WINDOWS"
done
# Generate comparison table
echo "Generating comparison table..."
python -m tools.compare_results -r "$OUTPUT_DIR" -o"${OUTPUT_DIR}/comparison.md"
echo "All benchmarks complete."
echo "Individual results saved in: $OUTPUT_DIR"
echo "Comparison table saved as: ${OUTPUT_DIR}/comparison.md"
# Update documentation if requested
if [ "$UPDATE_DOCS" = true ]; then
echo "Updating documentation..."
./tools/update_docs.sh --image-results "$OUTPUT_DIR"
fi