-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexperiments.sh
More file actions
executable file
·275 lines (250 loc) · 18.6 KB
/
Copy pathexperiments.sh
File metadata and controls
executable file
·275 lines (250 loc) · 18.6 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
#!/bin/bash
# experiments.sh - Run all combinations of frameworks, tasks, model indices, sequential strategies, and editions
# This script runs the benchmark workflow for every possible combination without loops
# Use this like:
# ./experiments.sh data/I-Ct_91
# ./experiments.sh data/I-Fn_BR_18 --debug
# ./experiments.sh data/I-Ct_91 --device cuda:1
# ./experiments.sh data/I-Fn_BR_18 --debug --device cpu
#===================
# Argument parsing
#===================
# Initialize variables
DATA_DIR=""
DEBUG_FLAG=""
DEVICE_FLAG=""
ALLOWED_DATA_DIRS=("data/I-Ct_91" "data/I-Fn_BR_18")
# Function to show usage
show_usage() {
echo "Usage: $0 <data_directory> [--debug] [--device <device>]"
echo " data_directory: Must be one of: ${ALLOWED_DATA_DIRS[*]}"
echo " --debug: Enable debug mode (optional)"
echo " --device: Specify device (e.g., cuda:0, cpu) (optional)"
exit 1
}
# Function to validate data directory
validate_data_dir() {
local dir="$1"
for allowed_dir in "${ALLOWED_DATA_DIRS[@]}"; do
if [ "$dir" = "$allowed_dir" ]; then
return 0
fi
done
return 1
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--debug)
set -e
DEBUG_FLAG="--debug"
shift
;;
--device)
if [ -z "$2" ]; then
echo "Error: --device requires a value"
show_usage
fi
DEVICE_FLAG="--device $2"
shift 2
;;
-*)
echo "Error: Unknown option $1"
show_usage
;;
*)
if [ -z "$DATA_DIR" ]; then
DATA_DIR="$1"
else
echo "Error: Multiple data directories specified"
show_usage
fi
shift
;;
esac
done
# Validate required arguments
if [ -z "$DATA_DIR" ]; then
echo "Error: Data directory is required"
show_usage
fi
if [ ! -d "$DATA_DIR" ]; then
echo "Error: Data directory '$DATA_DIR' does not exist"
exit 1
fi
if ! validate_data_dir "$DATA_DIR"; then
echo "Error: Data directory must be one of: ${ALLOWED_DATA_DIRS[*]}"
exit 1
fi
# Generate experiment ID that includes dataset name for traceability
# This ensures concurrent experiments on the same or different datasets don't conflict
DATASET_NAME=$(basename "$DATA_DIR")
export LAUDARE_EXPERIMENT_ID="${DATASET_NAME}_$(date +%Y%m%d_%H%M%S)_$$"
echo "🔬 Experiment ID: $LAUDARE_EXPERIMENT_ID"
echo ""
mkdir -p models/$LAUDARE_EXPERIMENT_ID
mkdir -p results/$LAUDARE_EXPERIMENT_ID
echo "Now you can inject pretrained models and results."
echo "Experiment ID: $LAUDARE_EXPERIMENT_ID"
if [[ -t 0 ]]; then
read -p "Press [enter] to continue or CTRL-C to exit > "
else
echo "Non-interactive session detected; continuing without pause."
fi
# Build the common arguments string
COMMON_ARGS="$DEBUG_FLAG $DEVICE_FLAG"
# #@@@@@@@@@@@@@@@
# #@ Annotations @
# #@@@@@@@@@@@@@@@
# # These are the commands used to generate annotations and pre-trained data
# # ./run.sh --task synthesis
# # ./run.sh --task annotations --edition diplomatic --data-dir data/I-Ct_91
# # ./run.sh --task annotations --edition editorial --data-dir data/I-Ct_91
# # ./run.sh --task annotations --edition diplomatic --data-dir data/I-Fn_BR_18
# # ./run.sh --task annotations --edition editorial --data-dir data/I-Fn_BR_18
#
# #@@@@@@@@@@
# #@ 5-fold @
# #@@@@@@@@@@
#
./run.sh --framework detr --task layout --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework detr --task layout --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
#
./run.sh --framework faster_rcnn --task layout --model-name "mobilenet" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "resnet50" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "mobilenet" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "resnet50" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
#
./run.sh --framework yolo --task layout --model-name "yolo26m" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26s" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26m" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26s" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
#
# ./run.sh --framework trocr --task ocr --model-name "large" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "small" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "large" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "small" --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "large" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "small" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "large" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "small" --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
#
# ./run.sh --framework kraken --task ocr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task ocr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
#
# ./run.sh --framework calamari --task ocr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task ocr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework paddleocr_vl --task ocr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework paddleocr_vl --task ocr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework paddleocr_vl --task omr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework paddleocr_vl --task omr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework vlt --task ocr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework vlt --task ocr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework vlt --task omr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework vlt --task omr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework bgk --task omr --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework bgk --task omr --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework doclayout_yolo --task layout --edition diplomatic --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework doclayout_yolo --task layout --edition editorial --n-fold --data-dir "$DATA_DIR" $COMMON_ARGS
# #@@@@@@@@@@@@@@
# #@ Sequential @
# #@@@@@@@@@@@@@@
#
./run.sh --framework detr --task layout --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework detr --task layout --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "mobilenet" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "resnet50" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "mobilenet" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework faster_rcnn --task layout --model-name "resnet50" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26m" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26s" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26m" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26s" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "large" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "small" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "large" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "small" --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "large" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "small" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "large" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "small" --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
#
# ./run.sh --framework kraken --task ocr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task ocr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
#
# ./run.sh --framework calamari --task ocr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task ocr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task ocr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task ocr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task omr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework vlt --task ocr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework vlt --task ocr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework vlt --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework vlt --task omr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework bgk --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework bgk --task omr --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework doclayout_yolo --task layout --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework doclayout_yolo --task layout --edition editorial --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
#@@@@@@@@@@@@@@
#@ Pretrained @
#@@@@@@@@@@@@@@
# ./run.sh --framework trocr --task ocr --model-name "large" --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task ocr --model-name "small" --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "large" --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework trocr --task omr --model-name "small" --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task ocr --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task ocr --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition diplomatic --strategy random_sample --enable-pretrain --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task ocr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework vlt --task ocr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
./run.sh --framework vlt --task omr --edition diplomatic --strategy random_sample --data-dir "$DATA_DIR" $COMMON_ARGS
#@@@@@@@@@@@@@@
#@ train-test @
#@@@@@@@@@@@@@@
# Determine train and test directories based on data directory
if [ "$DATA_DIR" == "data/I-Ct_91" ]; then
train_dir="data/I-Ct_91"
# test_dir="data/I-Ct_91"
test_dir="data/I-Fn_BR_18"
else
train_dir="data/I-Fn_BR_18"
# train_dir="data/I-Ct_91"
test_dir="data/I-Ct_91"
fi
# ./run.sh --framework kraken --task ocr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
# ./run.sh --framework calamari --task ocr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
# ./run.sh --framework trocr --model-name "large" --task ocr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
# ./run.sh --framework trocr --model-name "large" --task omr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26m" --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task ocr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework paddleocr_vl --task omr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework vlt --task ocr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework vlt --task omr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework bgk --task omr --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
./run.sh --framework doclayout_yolo --task layout --edition diplomatic --train-dir "$train_dir" --test-dir "$test_dir" $COMMON_ARGS
# ./run.sh --framework trocr --model-name "large" --task ocr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
# ./run.sh --framework trocr --model-name "large" --task omr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
# ./run.sh --framework kraken --task ocr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
# ./run.sh --framework kraken --task omr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
# ./run.sh --framework calamari --task ocr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
# ./run.sh --framework calamari --task omr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework yolo --task layout --model-name "yolo26m" --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework paddleocr_vl --task ocr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework paddleocr_vl --task omr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework vlt --task ocr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework vlt --task omr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework bgk --task omr --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS
./run.sh --framework doclayout_yolo --task layout --edition diplomatic --pretrain-dir "$train_dir" --data-dir "$test_dir" --strategy random_sample --enable-pretrain $COMMON_ARGS