def generate_samples(self): """Generate training samples (network inputs and outputs)""" filenames = glob_all(self.args.random_data_folder, '*.wav') shuffle(filenames) while True: for fn in filenames: for x, y in self.vectors_from_fn(fn): yield x, y
def run(self): """ Begin reading through audio files, saving false activations and retraining when necessary """ for fn in glob_all(self.args.random_data_folder, '*.wav'): if fn in self.trained_fns: print('Skipping ' + fn + '...') continue print('Starting file ' + fn + '...') self.train_on_audio(fn) print('\r100% ') self.trained_fns.append(fn) save_trained_fns(self.trained_fns, self.args.model)