def __init__(self, conf, segment_lengths): """Matrix2MatrixProcessor constructor Args: conf: Matrix2MatrixProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # the number of rows in the matrix self.nrCol = int(conf['nrcol']) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # set the type of mean and variance normalisation self.mvn_type = conf['mvn_type'] if conf['mvn_type'] == 'global': self.obs_cnt = 0 self.glob_mean = np.zeros([self.nrCol]) self.glob_std = np.zeros([self.nrCol]) elif conf['mvn_type'] == 'None': pass else: raise Exception('Unknown way to apply mvn: %s' % conf['mvn_type']) super(Matrix2MatrixProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """AudioFeatProcessor constructor Args: conf: AudioFeatProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.dim = self.comp.get_dim() self.max_length = np.zeros(len(self.segment_lengths)) # self.sequence_length_histogram = np.zeros(0, dtype=np.int32) self.nontime_dims = [self.dim] # set the type of mean and variance normalisation self.mvn_type = conf['mvn_type'] if conf['mvn_type'] == 'global': self.obs_cnt = 0 self.glob_mean = np.zeros([1, self.dim]) self.glob_std = np.zeros([1, self.dim]) elif conf['mvn_type'] in ['local', 'none', 'None', 'from_files']: pass else: raise Exception('Unknown way to apply mvn: %s' % conf['mvn_type']) super(AudioFeatProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """MultiTargetProcessor constructor Args: conf: MultiTargetProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths self.dim = self.comp.get_dim() # initialize the metadata self.nrS = int(conf['nrs']) self.target_dim = self.comp.get_dim() self.nontime_dims = [self.target_dim, self.nrS] if 'mvn_type' in conf: self.mvn_type = conf['mvn_type'] else: self.mvn_type = 'None' if self.mvn_type == 'global': self.obs_cnt = 0 self.glob_mean = np.zeros([1, self.dim]) self.glob_std = np.zeros([1, self.dim]) elif self.mvn_type in ['local', 'none', 'None', 'from_files']: pass else: raise Exception('Unknown way to apply mvn: %s' % conf['mvn_type']) super(MultiTargetProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """IdealRatioProcessor constructor Args: conf: IdealRatioProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer if 'pow' not in conf['feature']: raise Exception('expecting feature to be in power domain') self.comp = feature_computer_factory.factory(conf['feature'])(conf) if 'apply_sqrt' in conf and conf['apply_sqrt'] != 'True': self.apply_sqrt = False else: self.apply_sqrt = True # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.nr_channels = int(conf['nr_channels']) self.dim = self.comp.get_dim() self.nontime_dims = [self.dim] super(IdealRatioMultimicProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """VadTimingsProcessor constructor Args: conf: VadTimingsProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory('frames')(conf) self.winlen = float(conf['winlen']) self.winstep = float(conf['winstep']) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths self.nrS = int(conf['nrs']) # initialize the metadata self.dim = self.nrS self.max_length = np.zeros(len(self.segment_lengths)) # self.sequence_length_histogram = np.zeros(0, dtype=np.int32) self.nontime_dims = [self.dim] super(VadTimingsProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.nrS = int(conf['nrs']) if 'spk_select' in conf: self.nrS_select = map(int, conf['spk_select'].split(' ')) else: self.nrS_select = range(0, self.nrS) self.nr_channels = int(conf['nr_channels']) self.dim = self.comp.get_dim() * len(self.nrS_select) self.nontime_dims = [self.dim] super(onehotperfeatureTargetMultimicProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """AudioFeatProcessor constructor Args: conf: SpatialFeatProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # the channel pairs for which to compute the spatial features channel_pairs = conf['channels_pairs'].split(' ') channel_pairs = [map(int, pair.split('-')) for pair in channel_pairs] self.channel_pairs = [[ch - 1 for ch in pair] for pair in channel_pairs ] # python index starts at 0 # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.dim = self.comp.get_dim() * 2 * len(channel_pairs) self.max_length = np.zeros(len(self.segment_lengths)) # self.sequence_length_histogram = np.zeros(0, dtype=np.int32) self.nontime_dims = [self.dim] super(SpatialFeatProcessor, self).__init__(conf)
def __init__(self, conf, proc_conf, evalconf, expdir, rec_dir, task, name=None): '''IvectorExtractor constructor Args: conf: the ivector_extractor configuration as a dictionary proc_conf: the processor configuration for the postprocessor, as a dict evalconf: the evaluator configuration as a ConfigParser expdir: the experiment directory rec_dir: the directory where the reconstructions are task: name of the task ''' super(IvectorExtractor, self).__init__(conf, proc_conf, evalconf, expdir, rec_dir, task, name) #The directory where all models for iVector extraction are stored. E.g. the #Universal Background Model (UBM), the total variability matrix, ... self.model_dir = conf['model_dir'] UBM_w_file = os.path.join(self.model_dir, 'UBM_w.npy') self.UBM_w = np.load(UBM_w_file) UBM_mu_file = os.path.join(self.model_dir, 'UBM_mu.npy') self.UBM_mu = np.load(UBM_mu_file) UBM_sigma_file = os.path.join(self.model_dir, 'UBM_sigma.npy') self.UBM_sigma = np.load(UBM_sigma_file) TV_file = os.path.join(self.model_dir, 'T%d.npy' % (int(conf['tv_dim']))) self.TV = np.load(TV_file) self.apply_lda = conf['lda'] == 'True' if self.apply_lda: V_file = os.path.join(self.model_dir, 'V.npy') self.V = np.load(V_file) self.V = self.V[:int(conf['v_dim']), :] #create the feature computer self.comp = feature_computer_factory.factory( proc_conf['feature'])(proc_conf) self.VAD_thres = float(proc_conf['vad_thres'])
def __init__(self, conf): '''AudioProcessor constructor Args: conf: processor configuration as a configparser ''' #create the feature computer self.comp = feature_computer_factory.factory( conf.get('feature', 'feature'))(conf) #initialize the metadata self.dim = self.comp.get_dim() self.max_length = 0 self.sequence_length_histogram = np.zeros(0, dtype=np.int32) super(AudioProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """AudioMultiSignalProcessor constructor Args: conf: AudioMultiSignalProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.dim = self.comp.get_dim() super(AudioMultiSignalProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """indexProcessor constructor Args: conf: indexProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # create the string label to index dictionary self.nrS = int(conf['nrs']) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths super(indexProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): '''Strlabel2indexProcessor constructor Args: conf: Strlabel2indexProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths''' #create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) #create the string label to index dictionary self.label2index = dict() self.next_index = 0 #set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths super(Strlabel2indexProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): '''IdealRatioProcessor constructor Args: conf: IdealRatioProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths''' #create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) #set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths #initialize the metadata self.dim = self.comp.get_dim() self.nontime_dims = [self.dim] super(IdealRatioProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """onehotperfeatureTargetProcessor constructor Args: conf: onehotperfeatureTargetProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.nrS = int(conf['nrs']) self.dim = self.comp.get_dim() * self.nrS self.nontime_dims = [self.dim] super(onehotperfeatureTargetProcessor, self).__init__(conf)
def __init__(self, conf, segment_lengths): """ScorelabelperfeatureProcessor constructor Args: conf: ScorelabelperfeatureProcessor configuration as a dict of strings segment_lengths: A list containing the desired lengths of segments. Possibly multiple segment lengths""" # create the feature computer self.comp = feature_computer_factory.factory(conf['feature'])(conf) self.mag_thres = float(conf['mag_thres']) # set the length of the segments. Possibly multiple segment lengths self.segment_lengths = segment_lengths # initialize the metadata self.dim = self.comp.get_dim() self.nontime_dims = [self.dim] super(ScorelabelperfeatureProcessor, self).__init__(conf)