def __init__(self, step=10, window=20, max_freq=8000, mfcc_dim=13, minibatch_size=20, desc_file=None, spectrogram=True, max_duration=10.0, sort_by_duration=False): """ Params: step (int): Step size in milliseconds between windows (for spectrogram ONLY) window (int): FFT window size in milliseconds (for spectrogram ONLY) max_freq (int): Only FFT bins corresponding to frequencies between [0, max_freq] are returned (for spectrogram ONLY) desc_file (str, optional): Path to a JSON-line file that contains labels and paths to the audio files. If this is None, then load metadata right away """ self.feat_dim = calc_feat_dim(window, max_freq) self.mfcc_dim = mfcc_dim self.feats_mean = np.zeros((self.feat_dim,)) self.feats_std = np.ones((self.feat_dim,)) self.rng = random.Random(RNG_SEED) if desc_file is not None: self.load_metadata_from_desc_file(desc_file) self.step = step self.window = window self.max_freq = max_freq self.cur_train_index = 0 self.cur_valid_index = 0 self.cur_test_index = 0 self.max_duration=max_duration self.minibatch_size = minibatch_size self.spectrogram = spectrogram self.sort_by_duration = sort_by_duration
def __init__(self, step=10, window=20, max_freq=8000, desc_file=None, pad=0): """ Params: step (int): Step size in milliseconds between windows window (int): FFT window size in milliseconds max_freq (int): Only FFT bins corresponding to frequencies between [0, max_freq] are returned desc_file (str, optional): Path to a JSON-line file that contains labels and paths to the audio files. If this is None, then load metadata right away """ self.feat_dim = calc_feat_dim(window, max_freq) self.feats_mean = np.zeros((self.feat_dim, )) self.feats_std = np.ones((self.feat_dim, )) if desc_file is not None: self.load_metadata_from_desc_file(desc_file) self.step = step self.window = window self.max_freq = max_freq self.pad = pad
def __init__(self, step=10, window=20, max_freq=8000, mfcc_dim=13, minibatch_size=20, desc_file=None, spectrogram=True, max_duration=10.0, sort_by_duration=False): self.feat_dim = calc_feat_dim(window, max_freq) self.mfcc_dim = mfcc_dim self.feats_mean = np.zeros((self.feat_dim, )) self.feats_std = np.ones((self.feat_dim, )) self.rng = random.Random(RNG_SEED) if desc_file is not None: self.load_metadata_from_desc_file(desc_file) self.step = step self.window = window self.max_freq = max_freq self.cur_train_index = 0 self.cur_valid_index = 0 self.cur_test_index = 0 self.max_duration = max_duration self.minibatch_size = minibatch_size self.spectrogram = spectrogram self.sort_by_duration = sort_by_duration