(self, inputs)
return feats
Speech preprocessing.
Speech preprocessing.
Speech preprocessing .
def preprocess(self, inputs):
    ''' Speech preprocessing. '''
    with tf.variable_scope('feature'):
      if self.input_type == 'samples':
        # FIXME: stub
        feats = None
      else:
        if 'cmvn_type' in self.audioconf:
          cmvn_type = self.audioconf['cmvn_type']
        else:
          cmvn_type = 'global'
        logging.info('cmvn_type: %s' % (cmvn_type))
        if cmvn_type == 'global':
          self.mean, self.std = utils.load_cmvn(self.audioconf['cmvn_path'])
          feats = utils.apply_cmvn(inputs, self.mean, self.std)
        elif cmvn_type == 'local':
          feats = utils.apply_local_cmvn(inputs)
        elif cmvn_type == 'sliding':
          raise ValueError('cmvn_type %s not implemented yet.' % (cmvn_type))
        elif cmvn_type == 'none':
          feats = inputs
        else:
          raise ValueError('Error cmvn_type %s.' % (cmvn_type))
    return feats
def preprocess ( self , inputs ) : with tf . variable_scope ( 'feature' ) : if self . input_type == 'samples' : # FIXME: stub feats = None else : if 'cmvn_type' in self . audioconf : cmvn_type = self . audioconf [ 'cmvn_type' ] else : cmvn_type = 'global' logging . info ( 'cmvn_type: %s' % ( cmvn_type ) ) if cmvn_type == 'global' : self . mean , self . std = utils . load_cmvn ( self . audioconf [ 'cmvn_path' ] ) feats = utils . apply_cmvn ( inputs , self . mean , self . std ) elif cmvn_type == 'local' : feats = utils . apply_local_cmvn ( inputs ) elif cmvn_type == 'sliding' : raise ValueError ( 'cmvn_type %s not implemented yet.' % ( cmvn_type ) ) elif cmvn_type == 'none' : feats = inputs else : raise ValueError ( 'Error cmvn_type %s.' % ( cmvn_type ) ) return feats