-
Notifications
You must be signed in to change notification settings - Fork 0
/
extractTestData.py
30 lines (22 loc) · 776 Bytes
/
extractTestData.py
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
import sys
sys.path.append("./stqft")
sys.path.append("./qcnn")
import os
import glob
import shutil
from qcnn.main_qsr import labels
datasetPath = "/ceph/mstrobl/dataset"
testDatasetPath = "/ceph/mstrobl/testDataset"
portion = 10
for label in labels:
datasetLabelFiles = glob.glob(f"{datasetPath}/{label}/*.wav")
try:
os.makedirs(f"{testDatasetPath}/{label}")
except FileExistsError:
pass
all_wave = list()
all_label = list()
portDatsetLabelFiles = datasetLabelFiles[0::portion]
print(f"Using {len(portDatsetLabelFiles)} out of {len(datasetLabelFiles)} files for label '{label}'")
for datasetLabelFile in portDatsetLabelFiles:
shutil.move(datasetLabelFile, datasetLabelFile.replace(datasetPath, testDatasetPath))