Commit 3404aa9e authored by Alexander Fuchs's avatar Alexander Fuchs
Browse files

Fixed shuffle of dataset

parent 44b85dff
......@@ -121,6 +121,7 @@ def main(argv):
train_data_gen = data_generator(dg_train.generate,batch_size,
is_training=True,
shuffle_buffer = 256,
take_n=n_train)
val_data_gen = data_generator(dg_train.generate,10,
......
......@@ -7,6 +7,7 @@ import glob
import warnings
import multiprocessing
import sys
import random
import tensorflow as tf
warnings.filterwarnings('ignore')
......@@ -250,8 +251,9 @@ class DataGenerator(object):
samples = self.dataset.train_samples
else:
samples = self.dataset.test_samples
#Shuffle files before loading since dataset is ordered by class
random.shuffle(samples)
for sample in samples:
filename = sample['filename']
#If feature was already created load from file
......@@ -262,6 +264,9 @@ class DataGenerator(object):
#Create features via STFT if no file exists
spectra = self.create_feature(sample)
#Check for None type
if np.any(spectra) == None:
continue
#If only mono --> duplicate
if spectra.shape[0] == 1:
spectra = np.tile(spectra,[2,1,1])
......
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