Commit fbed93ec authored by Jean Ibarz's avatar Jean Ibarz
Browse files

Removed randomization process in generate_augmented_labelled_dataset(), at...

Removed randomization process in generate_augmented_labelled_dataset(), at this process is now done inside the model.
parent b2d41cb7
......@@ -96,7 +96,7 @@ def generate_augmented_labelled_dataset(signals, labels, convolve_mode='valid',
if sounds is None:
for i in range(n_augment):
for j, signal in enumerate(signals):
for i_label, label in enumerate(labels):
......@@ -107,12 +107,11 @@ def generate_augmented_labelled_dataset(signals, labels, convolve_mode='valid',
signal, label = signal_label
if j % len(sounds) == 0:
randomized_hrir = data_generator(signal)
sound = np.zeros(shape=[len(sounds[0]), n_channels])
new_signals = []
for i_channel in range(n_channels):
sound[0:n_samples, i_channel] = sounds[j % len(sounds)][0:n_samples]
convolved_sound = scipy.signal.convolve(in1=sound[:, i_channel], in2=randomized_hrir[:, i_channel],
convolved_sound = scipy.signal.convolve(in1=sound[:, i_channel], in2=signal[:, i_channel],
......@@ -56,7 +56,7 @@ if __name__ == '__main__':
if not 'convolve_mode' in exp_config.keys() or exp_config['convolve_mode'] == 'valid':
# the valid part from the convolved sound is sound[len(hrir)-1:-len(hrir)+1]
# hence we have to do len(hrir)-1 left and right zero padding so that the dirac belong to the result
n_zeros = 512-1+exp_config['model_config']['random_shift']['maxval']
n_zeros = 512-1
zeros = np.zeros(shape=(2, n_zeros))
sounds = np.concatenate([zeros, np.ones(shape=(2, 1)), zeros], axis=1)
training_sounds, test_sounds = np.array_split(sounds, 2, axis=0)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment