(*wavefiles, **kwargs)
tensorflow fbank feat
tensorflow fbank feat
tensorflow fbank feat
def extract_feature(*wavefiles, **kwargs):
  ''' tensorflow fbank feat '''
  dry_run = kwargs.get('dry_run')
  feat_name = 'fbank'
  feat_name = kwargs.get('feature_name')
  assert feat_name

  graph, (input_tensor, output_tensor) = _freq_feat_graph(feat_name, **kwargs)
  sess = _get_session(_get_out_tensor_name(feat_name, 0), graph)

  for wavpath in wavefiles:
    savepath = os.path.splitext(wavpath)[0] + '.npy'
    logging.debug('extract_feat: input: {}, output: {}'.format(
        wavpath, savepath))

    feat = sess.run(output_tensor, feed_dict={input_tensor: wavpath})

    # save feat
    if dry_run:
      logging.info('save feat: path {} shape:{} dtype:{}'.format(
          savepath, feat.shape, feat.dtype))
    else:
      np.save(savepath, feat)
def extract_feature ( * wavefiles , * * kwargs ) : dry_run = kwargs . get ( 'dry_run' ) feat_name = 'fbank' feat_name = kwargs . get ( 'feature_name' ) assert feat_name graph , ( input_tensor , output_tensor ) = _freq_feat_graph ( feat_name , * * kwargs ) sess = _get_session ( _get_out_tensor_name ( feat_name , 0 ) , graph ) for wavpath in wavefiles : savepath = os . path . splitext ( wavpath ) [ 0 ] + '.npy' logging . debug ( 'extract_feat: input: {}, output: {}' . format ( wavpath , savepath ) ) feat = sess . run ( output_tensor , feed_dict = { input_tensor : wavpath } ) # save feat if dry_run : logging . info ( 'save feat: path {} shape:{} dtype:{}' . format ( savepath , feat . shape , feat . dtype ) ) else : np . save ( savepath , feat )