def transform_spec_from_raw(raw):
'''
Read raw features from TFRecords and shape them into spectrograms
'''
spec = tf.decode_raw(raw, tf.float32)
spec.set_shape([EmbeddingConfig.num_time_frames * EmbeddingConfig.num_freq_bins * 2])
spec = tf.reshape(spec, [-1, EmbeddingConfig.num_freq_bins * 2])
real, imag = tf.split(spec, [EmbeddingConfig.num_freq_bins, EmbeddingConfig.num_freq_bins], axis=1)
orig_spec = tf.complex(real, imag)
# orig_spec = librosa.feature.melspectrogram(S=orig_spec, n_mels=150)
return orig_spec # shape: [time_frames, num_freq_bins]
embedding_run.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录