embedding_run.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:source_separation_ml_jeju 作者: hjkwon0609 项目源码 文件源码
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]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号