torchaudio.compliance.kaldi.fbank¶
- torchaudio.compliance.kaldi.fbank(waveform: Tensor, blackman_coeff: float = 0.42, channel: int = -1, dither: float = 0.0, energy_floor: float = 1.0, frame_length: float = 25.0, frame_shift: float = 10.0, high_freq: float = 0.0, htk_compat: bool = False, low_freq: float = 20.0, min_duration: float = 0.0, num_mel_bins: int = 23, preemphasis_coefficient: float = 0.97, raw_energy: bool = True, remove_dc_offset: bool = True, round_to_power_of_two: bool = True, sample_frequency: float = 16000.0, snip_edges: bool = True, subtract_mean: bool = False, use_energy: bool = False, use_log_fbank: bool = True, use_power: bool = True, vtln_high: float = -500.0, vtln_low: float = 100.0, vtln_warp: float = 1.0, window_type: str = 'povey') Tensor [source]¶
從原始音訊訊號建立 fbank。這與 Kaldi 的 compute-fbank-feats 的輸入/輸出相符。
- 參數:
waveform (Tensor) – 音訊張量,大小為 (c, n),其中 c 的範圍為 [0,2)
blackman_coeff (float, optional) – 廣義 Blackman 視窗的常數係數。(預設值:
0.42
)channel (int, optional) – 要提取的聲道 (-1 -> 預期為單聲道, 0 -> 左聲道, 1 -> 右聲道) (預設值:
-1
)dither (float, optional) – 抖動常數 (0.0 表示沒有抖動)。 如果您關閉此選項,則應設定 energy_floor 選項,例如設定為 1.0 或 0.1 (預設值:
0.0
)energy_floor (float, optional) – Spectrogram 計算中的能量下限 (絕對值,非相對值)。注意:此下限適用於第零個分量,代表總訊號能量。個別 spectrogram 元素的下限固定為 std::numeric_limits<float>::epsilon()。(預設值:
1.0
)frame_length (float, optional) – 幀長度,以毫秒為單位 (預設值:
25.0
)frame_shift (float, optional) – 幀移,以毫秒為單位 (預設值:
10.0
)high_freq (float, optional) – mel bins 的高截止頻率 (如果 <= 0,則從 Nyquist 偏移) (預設值:
0.0
)htk_compat (bool, optional) – 若為真,則將能量放在最後。警告:這不足以獲得與 HTK 相容的特徵(需要更改其他參數)。(預設值:
False
)low_freq (float, optional) – mel 頻率箱的低截止頻率(預設值:
20.0
)min_duration (float, optional) – 要處理的片段的最小持續時間(以秒為單位)。(預設值:
0.0
)num_mel_bins (int, optional) – 三角形 mel 頻率箱的數量(預設值:
23
)preemphasis_coefficient (float, optional) – 用於信號預加重的係數(預設值:
0.97
)raw_energy (bool, optional) – 若為 True,在預加重和視窗化之前計算能量(預設值:
True
)remove_dc_offset (bool, optional) – 從每個影格的波形中減去平均值(預設值:
True
)round_to_power_of_two (bool, optional) – 若為 True,則透過對 FFT 的輸入進行零填充,將視窗大小四捨五入為 2 的冪。(預設值:
True
)sample_frequency (float, optional) – 波形資料取樣頻率(必須與波形檔案匹配,如果在檔案中指定)(預設值:
16000.0
)snip_edges (bool, optional) – 若為 True,則終端效應將透過僅輸出完全適合檔案的影格來處理,並且影格的數量取決於 frame_length。若為 False,則影格的數量僅取決於 frame_shift,並且我們會在末端反映資料。(預設值:
True
)subtract_mean (bool, optional) – 減去每個特徵檔案的平均值 [CMS];不建議以這種方式執行。(預設值:
False
)use_energy (bool, optional) – 將一個額外的維度(帶有能量)新增到 FBANK 輸出。(預設值:
False
)use_log_fbank (bool, optional) – 若為 True,則產生 log-filterbank,否則產生線性 filterbank。(預設值:
True
)use_power (bool, optional) – 若為 True,則使用功率,否則使用幅度。(預設值:
True
)vtln_high (float, optional) – 分段線性 VTLN 扭曲函數中的高反曲點(如果為負數,則從 high-mel-freq 偏移(預設值:
-500.0
))vtln_low (float, optional) – 分段線性 VTLN 扭曲函數中的低反曲點(預設值:
100.0
)vtln_warp (float, optional) – Vtln 扭曲因子(僅適用於未指定 vtln_map 的情況)(預設值:
1.0
)window_type (str, optional) – 視窗類型 ('hamming'|'hanning'|'povey'|'rectangular'|'blackman')(預設值:
'povey'
)
- Returns:
與 Kaldi 輸出的 fbank 相同。形狀為 (m,
num_mel_bins + use_energy
),其中 m 在 _get_strided 中計算- Return type:
Tensor
- 使用
fbank
的教學課程