-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathkqq_runme.sh
executable file
·328 lines (272 loc) · 10.6 KB
/
kqq_runme.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
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
WORKSPACE="/Users/bytedance/workspaces/uss"
### FSDKaggle2018
DATASET_DIR="/Users/bytedance/datasets/fsdkaggle2018"
SPLIT="train"
OUTPUT_AUDIOS_DIR="${WORKSPACE}/evaluation/fsdkaggle2018/2s_segments_${SPLIT}"
OUTPUT_META_CSV_PATH="${WORKSPACE}/evaluation/fsdkaggle2018/2s_segments_${SPLIT}.csv"
python ./evaluation/fsdkaggle2018/create_evaluation_data.py \
--dataset_dir=$DATASET_DIR \
--split=$SPLIT \
--output_audios_dir=$OUTPUT_AUDIOS_DIR \
--output_meta_csv_path=$OUTPUT_META_CSV_PATH
### FSD50k
DATASET_DIR="/Users/bytedance/datasets/fsd50k"
SPLIT="train"
OUTPUT_AUDIOS_DIR="${WORKSPACE}/evaluation/fsd50k/2s_segments_${SPLIT}"
OUTPUT_META_CSV_PATH="${WORKSPACE}/evaluation/fsd50k/2s_segments_${SPLIT}.csv"
python ./evaluation/fsd50k/create_evaluation_data.py \
--dataset_dir=$DATASET_DIR \
--split=$SPLIT \
--output_audios_dir=$OUTPUT_AUDIOS_DIR \
--output_meta_csv_path=$OUTPUT_META_CSV_PATH
### Slakh2100
DATASET_DIR="/Users/bytedance/datasets/slakh2100"
SPLIT="train"
OUTPUT_AUDIOS_DIR="${WORKSPACE}/evaluation/slakh2100/2s_segments_${SPLIT}"
OUTPUT_META_CSV_PATH="${WORKSPACE}/evaluation/slakh2100/2s_segments_${SPLIT}.csv"
python ./evaluation/slakh2100/create_evaluation_data.py \
--dataset_dir=$DATASET_DIR \
--split=$SPLIT \
--output_audios_dir=$OUTPUT_AUDIOS_DIR \
--output_meta_csv_path=$OUTPUT_META_CSV_PATH
######### Calcualte emb
CONFIG_YAML="./scripts/train/ss_model=resunet30,querynet=at_soft,data=balanced.yaml"
CHECKPOINT_PATH="${WORKSPACE}/checkpoints/ss_model=resunet30,querynet=at_soft,data=balanced,devices=1/steps=1000000.ckpt"
### FSDKaggle2018
python uss/test9.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="fsdkaggle2018" \
--audios_dir="${WORKSPACE}/evaluation/fsdkaggle2018/2s_segments_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/fsdkaggle2018" \
--device="mps"
# FSD50k
python uss/test9.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="fsd50k" \
--audios_dir="${WORKSPACE}/evaluation/fsd50k/2s_segments_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/fsd50k" \
--device="mps"
# Voicebank-Demand
python uss/test9.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="voicebank-demand" \
--audios_dir="/Users/bytedance/datasets/voicebank-demand" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/voicebank-demand" \
--device="mps"
python uss/test9.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="voicebank-demand" \
--audios_dir="/Users/bytedance/datasets/voicebank-demand" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/voicebank-demand" \
--device="mps"
python uss/test9.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="musdb18" \
--audios_dir="/Users/bytedance/datasets/musdb18hq/train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/musdb18" \
--device="mps"
python uss/test9.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="slakh2100" \
--audios_dir="${WORKSPACE}/evaluation/slakh2100/2s_segments_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/slakh2100" \
--device="mps"
###### Evaluate
# Fsdkaggle2018
python evaluation/test8.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="fsdkaggle2018" \
--audios_dir="${WORKSPACE}/evaluation/fsdkaggle2018/2s_segments_test" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/fsdkaggle2018" \
--device="mps"
python evaluation/test8.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="fsd50k" \
--audios_dir="${WORKSPACE}/evaluation/fsd50k/2s_segments_test" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/fsd50k" \
--device="mps"
python evaluation/test8.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="slakh2100" \
--audios_dir="${WORKSPACE}/evaluation/slakh2100/2s_segments_test" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/slakh2100" \
--device="mps"
# voicebank-demand
python evaluation/test8.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="voicebank-demand" \
--audios_dir="/Users/bytedance/datasets/voicebank-demand/" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/voicebank-demand" \
--device="mps"
# musdb18
python evaluation/test8.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="musdb18" \
--audios_dir="/Users/bytedance/datasets/musdb18hq/test" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/musdb18" \
--device="mps"
################# Create data
WORKSPACE="./workspaces/uss"
DATASETS_DIR="./datasets"
DEVICE="cuda"
# AudioSet
for SPLIT in "balanced_train" "test"
do
CUDA_VISIBLE_DEVICES=0 python3 evaluation/dataset_creation/audioset.py \
--indexes_hdf5_path="${WORKSPACE}/hdf5s/indexes/${SPLIT}.h5" \
--output_audios_dir="${WORKSPACE}/evaluation/audioset/2s_segments_${SPLIT}" \
--output_meta_csv_path="${WORKSPACE}/evaluation/audioset/2s_segments_${SPLIT}.csv" \
--device=$DEVICE
done
# FSDKaggle2018
DATASET_TYPE="fsdkaggle2018"
for SPLIT in "train" "test"
do
python evaluation/dataset_creation/fsd50k.py \
--dataset_dir="${DATASETS_DIR}/${DATASET_TYPE}" \
--split=$SPLIT \
--output_audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--output_meta_csv_path="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}.csv"
done
# FSD50k
DATASET_TYPE="fsd50k"
for SPLIT in "train" "test"
do
python evaluation/dataset_creation/fsdkaggle2018.py \
--dataset_dir="${DATASETS_DIR}/${DATASET_TYPE}" \
--split=$SPLIT \
--output_audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--output_meta_csv_path="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}.csv"
done
# Slakh2100
DATASET_TYPE="slakh2100"
for SPLIT in "train" "test"
do
python evaluation/dataset_creation/slakh2100.py \
--dataset_dir="${DATASETS_DIR}/${DATASET_TYPE}" \
--split=$SPLIT \
--output_audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--output_meta_csv_path="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}.csv"
done
#################### Emb
WORKSPACE="./workspaces/uss"
DATASETS_DIR="./datasets"
CONFIG_YAML="./scripts/train/ss_model=resunet30,querynet=at_soft,data=balanced.yaml"
CHECKPOINT_PATH="${WORKSPACE}/checkpoints/ss_model=resunet30,querynet=at_soft,data=balanced,devices=1/steps=1000000.ckpt"
DEVICE="cuda"
BASE_CONFIG=`basename $CONFIG_YAML .yaml`
# AudioSet
python evaluation/calculate_embeddings.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="audioset" \
--audios_dir="${WORKSPACE}/evaluation/audioset/2s_segments_balanced_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/audioset/${BASE_CONFIG}" \
--device=$DEVICE
# FSDKaggle2018
python evaluation/calculate_embeddings.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="fsdkaggle2018" \
--audios_dir="${WORKSPACE}/evaluation/fsdkaggle2018/2s_segments_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/fsdkaggle2018/${BASE_CONFIG}" \
--device=$DEVICE
# FSD50K
python evaluation/calculate_embeddings.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="fsd50k" \
--audios_dir="${WORKSPACE}/evaluation/fsd50k/2s_segments_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/fsd50k/${BASE_CONFIG}" \
--device=$DEVICE
# Slakh2100
python evaluation/calculate_embeddings.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="slakh2100" \
--audios_dir="${WORKSPACE}/evaluation/slakh2100/2s_segments_train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/slakh2100/${BASE_CONFIG}" \
--device=$DEVICE
# Musdb18
python evaluation/calculate_embeddings.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="musdb18" \
--audios_dir="${DATASETS_DIR}/musdb18hq/train" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/musdb18" \
--device=$DEVICE
# Voicebank-Demand
python evaluation/calculate_embeddings.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type="voicebank-demand" \
--audios_dir="${DATASETS_DIR}/voicebank-demand" \
--output_embs_dir="${WORKSPACE}/evaluation/embeddings/voicebank-demand" \
--device=$DEVICE
#################### Evaluate
DATASET_TYPE="audioset"
SPLIT="test"
# Audioset
python evaluation/separate_and_evaluate.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type=$DATASET_TYPE \
--audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/${DATASET_TYPE}/${BASE_CONFIG}" \
--device=$DEVICE
# Fsdkaggle2018
DATASET_TYPE="fsdkaggle2018"
python evaluation/separate_and_evaluate.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type=$DATASET_TYPE \
--audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/${DATASET_TYPE}/${BASE_CONFIG}" \
--device=$DEVICE
# FSD50k
DATASET_TYPE="fsd50k"
python evaluation/separate_and_evaluate.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type=$DATASET_TYPE \
--audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/${DATASET_TYPE}/${BASE_CONFIG}" \
--device=$DEVICE
# Slakh2100
DATASET_TYPE="slakh2100"
python evaluation/separate_and_evaluate.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type=$DATASET_TYPE \
--audios_dir="${WORKSPACE}/evaluation/${DATASET_TYPE}/2s_segments_${SPLIT}" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/${DATASET_TYPE}/${BASE_CONFIG}" \
--device=$DEVICE
# Musdb18
DATASET_TYPE="musdb18"
python evaluation/separate_and_evaluate.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type=$DATASET_TYPE \
--audios_dir="${DATASETS_DIR}/musdb18hq/${SPLIT}" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/${DATASET_TYPE}/${BASE_CONFIG}" \
--device=$DEVICE
# Voicebank-Demand
DATASET_TYPE="voicebank-demand"
python evaluation/separate_and_evaluate.py \
--config_yaml=$CONFIG_YAML \
--checkpoint_path=$CHECKPOINT_PATH \
--dataset_type=$DATASET_TYPE \
--audios_dir="${DATASETS_DIR}/${DATASET_TYPE}" \
--query_embs_dir="${WORKSPACE}/evaluation/embeddings/${DATASET_TYPE}/${BASE_CONFIG}" \
--device=$DEVICE