-
Notifications
You must be signed in to change notification settings - Fork 31
/
reload_data.py
24 lines (20 loc) · 1002 Bytes
/
reload_data.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
import pickle
from librosa.util import find_files
import scipy.io as sio
access_type = "LA"
# # on air station gpu
path_to_mat = '/data/neil/LAmat/'
path_to_audio = '/data/neil/DS_10283_3336/'+access_type+'/ASVspoof2019_'+access_type+'_'
path_to_features = '/dataNVME/neil/ASVspoof2019'+access_type+'Features/'
def reload_data(path_to_features, part):
matfiles = find_files(path_to_mat + part + '/', ext='mat')
for i in range(len(matfiles)):
if matfiles[i][len(path_to_mat)+len(part)+1:].startswith('LFCC'):
key = matfiles[i][len(path_to_mat) + len(part) + 6:-4]
lfcc = sio.loadmat(matfiles[i], verify_compressed_data_integrity=False)['x']
with open(path_to_features + part +'/'+ key + 'LFCC.pkl', 'wb') as handle2:
pickle.dump(lfcc, handle2, protocol=pickle.HIGHEST_PROTOCOL)
if __name__ == "__main__":
reload_data(path_to_features, 'train')
reload_data(path_to_features, 'dev')
reload_data(path_to_features, 'eval')