志浩
2023-02-10 be3ade87488f70104f5be71d891c0c8500ffdedd
add sond model
1个文件已修改
10 ■■■■ 已修改文件
funasr/models/frontend/wav_frontend.py 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/models/frontend/wav_frontend.py
@@ -90,7 +90,9 @@
        filter_length_max: int = -1,
        lfr_m: int = 1,
        lfr_n: int = 1,
        dither: float = 1.0
        dither: float = 1.0,
        snip_edges: bool = True,
        upsacle_samples: bool = True,
    ):
        assert check_argument_types()
        super().__init__()
@@ -105,6 +107,8 @@
        self.lfr_n = lfr_n
        self.cmvn_file = cmvn_file
        self.dither = dither
        self.snip_edges = snip_edges
        self.upsacle_samples = upsacle_samples
    def output_size(self) -> int:
        return self.n_mels * self.lfr_m
@@ -119,6 +123,7 @@
        for i in range(batch_size):
            waveform_length = input_lengths[i]
            waveform = input[i][:waveform_length]
            if self.upsacle_samples:
            waveform = waveform * (1 << 15)
            waveform = waveform.unsqueeze(0)
            mat = kaldi.fbank(waveform,
@@ -128,7 +133,8 @@
                              dither=self.dither,
                              energy_floor=0.0,
                              window_type=self.window,
                              sample_frequency=self.fs)
                              sample_frequency=self.fs,
                              snip_edges=self.snip_edges)
     
            if self.lfr_m != 1 or self.lfr_n != 1:
                mat = apply_lfr(mat, self.lfr_m, self.lfr_n)