def get_params( args, sample_rate=16000, num_window_samples=320, num_window_step_samples=80, fft_length=512, kernel_length=7, freq_cutoff=3000, use_mel=False, ): # we get the basic file paths right here # TODO: make this system adaptive root_path = "/home/mark/Template-Speech-Recognition/" utterances_path = "/home/mark/Template-Speech-Recognition/Data/Train/" try: file_indices = np.load("data_parts/train_file_indices.npy") except: file_indices = gtrd.get_data_files_indices(utterances_path) np.save("data_parts/train_file_indices.npy", file_indices) num_mix_params = [1, 2, 3, 5, 7, 9] test_path = "/home/mark/Template-Speech-Recognition/Data/Test/" train_path = "/home/mark/Template-Speech-Recognition/Data/Train/" try: test_example_lengths = np.load("data_parts/test_example_lengths.npy") test_file_indices = np.load("data_parts/test_file_indices.npy") except: test_file_indices = gtrd.get_data_files_indices(test_path) test_example_lengths = gtrd.get_detect_lengths(test_file_indices, test_path) np.save("data_parts/test_example_lengths.npy", test_example_lengths) np.save("data_parts/test_file_indices.npy", test_file_indices) try: train_example_lengths = np.load("data_parts/train_example_lengths.npy") train_file_indices = np.load("data_parts/train_file_indices.npy") except: train_file_indices = gtrd.get_data_files_indices(train_path) train_example_lengths = gtrd.get_detect_lengths(train_file_indices, train_path) np.save("data_parts/train_example_lengths.npy", train_example_lengths) np.save("data_parts/train_file_indices.npy", train_file_indices) return ( gtrd.SpectrogramParameters( sample_rate=16000, num_window_samples=320, num_window_step_samples=80, fft_length=512, kernel_length=7, freq_cutoff=3000, use_mel=args.use_mel, ), gtrd.makeEdgemapParameters( block_length=args.edgeMapBlockLength, spread_length=args.edgeMapSpreadLength, threshold=args.edgeMapThreshold, ), root_path, utterances_path, file_indices, num_mix_params, test_path, train_path, train_example_lengths, train_file_indices, test_example_lengths, test_file_indices, )
import matplotlib.cm as cm import argparse import template_speech_rec.code_parts as code_parts import pickle, collections, cPickle sp = gtrd.makeSpectrogramParameters( sample_rate=16000, num_window_samples=320, num_window_step_samples=80, fft_length=512, kernel_length=7, freq_cutoff=3000, use_mel=False, ) ep = gtrd.makeEdgemapParameters(block_length=40, spread_length=1, threshold=0.7) def getEdgeDistribution(file_indices, hw, file_indices_chunks=20): return None def get_file_indices(file_indices_path, data_path): try: file_indices = np.load(file_indices_path) except: file_indices = gtrd.get_data_files_indices(data_path) np.save(file_indices_path, file_indices) return file_indices