diff --git a/experiments/ldcnn20k60.yaml b/experiments/ldcnn20k60.yaml index 149571b..c4b2624 100644 --- a/experiments/ldcnn20k60.yaml +++ b/experiments/ldcnn20k60.yaml @@ -4,8 +4,8 @@ fmin: 0 fmax: 11025 n_fft: 1024 hop_length: 512 -augmentations: 12 -augment: 1 +augmentations: 0 +augment: 0 frames: 31 batch: 400 epochs: 100 diff --git a/microesc/features.py b/microesc/features.py index 89d3f36..a5e6c69 100644 --- a/microesc/features.py +++ b/microesc/features.py @@ -6,6 +6,7 @@ import urllib.request import zipfile import collections +import time import pandas import numpy @@ -108,6 +109,8 @@ def download_progress(count, blocksize, totalsize): def load_sample(sample, settings, feature_dir, window_frames, start_time=None, augment=None, normalize='meanstd'): + start_t = time.time() + n_mels = settings['n_mels'] sample_rate = settings['samplerate'] hop_length = settings['hop_length'] @@ -121,7 +124,12 @@ def load_sample(sample, settings, feature_dir, window_frames, # Load precomputed features folder = os.path.join(feature_dir, settings_id(settings)) path = feature_path(sample, out_folder=folder, augmentation=aug) + + + before_load = time.time() mels = numpy.load(path)['arr_0'] + after_load = time.time() + assert mels.shape[0] == n_mels, mels.shape if start_time is None: @@ -161,6 +169,11 @@ def load_sample(sample, settings, feature_dir, window_frames, # add channel dimension data = numpy.expand_dims(padded, -1) + + end_t = time.time() + + #print(f'load feature {(end_t-start_t)*1000}, {(after_load-before_load)*1000}') + return data diff --git a/microesc/train.py b/microesc/train.py index 6c74801..354f294 100644 --- a/microesc/train.py +++ b/microesc/train.py @@ -33,7 +33,10 @@ def dataframe_generator(X, Y, loader, batchsize=10, n_classes=10): while True: idx = numpy.random.choice(len(X), size=batchsize, replace=False) rows = X.iloc[idx, :].iterrows() - data = [ loader(d) for _, d in rows ] + + #data = [ loader(d) for _, d in rows ] + data = numpy.zeros(shape=(400, 60, 31, 1)) + y = Y.iloc[idx] y = keras.utils.to_categorical(y, num_classes=n_classes) batch = (numpy.array(data), numpy.array(y))