返回一個矩陣以將線性比例譜圖扭曲到 mel 比例。
用法
tf.signal.linear_to_mel_weight_matrix(
num_mel_bins=20, num_spectrogram_bins=129, sample_rate=8000,
lower_edge_hertz=125.0, upper_edge_hertz=3800.0, dtype=tf.dtypes.float32,
name=None
)參數
-
num_mel_binsPython int. 生成的梅爾頻譜中有多少條帶。 -
num_spectrogram_bins一個整數Tensor。源頻譜圖數據中有多少個 bin,可以理解為fft_size // 2 + 1,即頻譜圖隻包含非冗餘 FFT bin。 -
sample_rate整數或浮點數Tensor。用於創建頻譜圖的輸入信號的每秒樣本數。用於計算與每個頻譜圖箱對應的頻率,這決定了它們如何映射到梅爾標度中。 -
lower_edge_hertzPython浮點數。要包含在 mel 頻譜中的頻率的下限。這對應於最低三角帶的下邊。 -
upper_edge_hertzPython浮點數。最高頻帶的所需頂部邊。 -
dtype結果矩陣的DType。必須是浮點類型。 -
name操作的可選名稱。
返回
-
形狀為
[num_spectrogram_bins, num_mel_bins]的Tensor。
拋出
-
ValueError如果num_mel_bins/num_spectrogram_bins/sample_rate不是正數,lower_edge_hertz是負數,頻率邊排序不正確,upper_edge_hertz大於奈奎斯特頻率。
返回一個權重矩陣,該矩陣可用於重新加權 Tensor ,其中包含 num_spectrogram_bins 從 [0, sample_rate / 2] 線性采樣的頻率信息到來自 [lower_edge_hertz, upper_edge_hertz] 的 num_mel_bins 頻率信息。
此函數遵循隱馬爾可夫模型工具包 (HTK) 約定,根據以下公式以頻率為單位定義梅爾標度:
$$\textrm{mel}(f) = 2595 * \textrm{log}_{10}(1 + \frac{f}{700})$$
在返回的矩陣中,所有三角形(濾波器組)的峰值均為 1.0。
例如,返回的矩陣 A 可用於 right-multiply 一個譜圖 S 的形狀為 [frames, num_spectrogram_bins] 的線性標度譜值(例如 STFT 幅度),以生成一個 "mel spectrogram" M 的形狀 [frames, num_mel_bins] .
# `S` has shape [frames, num_spectrogram_bins]
# `M` has shape [frames, num_mel_bins]
M = tf.matmul(S, A)
該矩陣可與tf.tensordot 一起使用,將線性尺度頻譜箱的任意秩Tensor 轉換為梅爾尺度。
# S has shape [..., num_spectrogram_bins].
# M has shape [..., num_mel_bins].
M = tf.tensordot(S, A, 1)
相關用法
- Python tf.signal.overlap_and_add用法及代碼示例
- Python tf.signal.frame用法及代碼示例
- Python tf.signal.fftshift用法及代碼示例
- Python tf.signal.inverse_mdct用法及代碼示例
- Python tf.signal.mfccs_from_log_mel_spectrograms用法及代碼示例
- Python tf.signal.ifftshift用法及代碼示例
- Python tf.signal.inverse_stft用法及代碼示例
- Python tf.size用法及代碼示例
- Python tf.summary.scalar用法及代碼示例
- Python tf.strings.substr用法及代碼示例
- Python tf.strings.reduce_join用法及代碼示例
- Python tf.sparse.cross用法及代碼示例
- Python tf.sparse.mask用法及代碼示例
- Python tf.strings.regex_full_match用法及代碼示例
- Python tf.sparse.split用法及代碼示例
- Python tf.strings.regex_replace用法及代碼示例
- Python tf.strings.length用法及代碼示例
- Python tf.strided_slice用法及代碼示例
- Python tf.sparse.to_dense用法及代碼示例
- Python tf.strings.bytes_split用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.signal.linear_to_mel_weight_matrix。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
