Skip to content

Commit f21c343

Browse files
committed
TEMP: test training time with no batch loading time
1 parent d41c79e commit f21c343

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

experiments/ldcnn20k60.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ fmin: 0
44
fmax: 11025
55
n_fft: 1024
66
hop_length: 512
7-
augmentations: 12
8-
augment: 1
7+
augmentations: 0
8+
augment: 0
99
frames: 31
1010
batch: 400
1111
epochs: 100

microesc/features.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import urllib.request
77
import zipfile
88
import collections
9+
import time
910

1011
import pandas
1112
import numpy
@@ -108,6 +109,8 @@ def download_progress(count, blocksize, totalsize):
108109

109110
def load_sample(sample, settings, feature_dir, window_frames,
110111
start_time=None, augment=None, normalize='meanstd'):
112+
start_t = time.time()
113+
111114
n_mels = settings['n_mels']
112115
sample_rate = settings['samplerate']
113116
hop_length = settings['hop_length']
@@ -121,7 +124,12 @@ def load_sample(sample, settings, feature_dir, window_frames,
121124
# Load precomputed features
122125
folder = os.path.join(feature_dir, settings_id(settings))
123126
path = feature_path(sample, out_folder=folder, augmentation=aug)
127+
128+
129+
before_load = time.time()
124130
mels = numpy.load(path)['arr_0']
131+
after_load = time.time()
132+
125133
assert mels.shape[0] == n_mels, mels.shape
126134

127135
if start_time is None:
@@ -161,6 +169,11 @@ def load_sample(sample, settings, feature_dir, window_frames,
161169

162170
# add channel dimension
163171
data = numpy.expand_dims(padded, -1)
172+
173+
end_t = time.time()
174+
175+
#print(f'load feature {(end_t-start_t)*1000}, {(after_load-before_load)*1000}')
176+
164177
return data
165178

166179

microesc/train.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ def dataframe_generator(X, Y, loader, batchsize=10, n_classes=10):
3333
while True:
3434
idx = numpy.random.choice(len(X), size=batchsize, replace=False)
3535
rows = X.iloc[idx, :].iterrows()
36-
data = [ loader(d) for _, d in rows ]
36+
37+
#data = [ loader(d) for _, d in rows ]
38+
data = numpy.zeros(shape=(400, 60, 31, 1))
39+
3740
y = Y.iloc[idx]
3841
y = keras.utils.to_categorical(y, num_classes=n_classes)
3942
batch = (numpy.array(data), numpy.array(y))

0 commit comments

Comments
 (0)