speechbrain.lobes.downsampling moduleο
Combinations of processing algorithms to implement downsampling methods.
- Authors
Salah Zaiem
Summaryο
Classes:
Concatenation downsampling with naive frame dropping. |
|
1D Convolutional downsampling with a learned convolution |
|
Wrapper for downsampling techniques |
|
1D Pooling downsampling (non-learned) |
|
Signal downsampling (Decimation) |
Referenceο
- class speechbrain.lobes.downsampling.Downsampler(*args, **kwargs)[source]ο
Bases:
ModuleWrapper for downsampling techniques
- class speechbrain.lobes.downsampling.SignalDownsampler(downsampling_factor, initial_sampling_rate)[source]ο
Bases:
DownsamplerSignal downsampling (Decimation)
- Parameters:
Example
>>> sd = SignalDownsampler(2, 16000) >>> a = torch.rand([8, 28000]) >>> a = sd(a) >>> print(a.shape) torch.Size([8, 14000])
- class speechbrain.lobes.downsampling.Conv1DDownsampler(downsampling_factor, kernel_size)[source]ο
Bases:
Downsampler1D Convolutional downsampling with a learned convolution
- Parameters:
Example
>>> sd = Conv1DDownsampler(3, 161) >>> a = torch.rand([8, 33000]) >>> a = sd(a) >>> print(a.shape) torch.Size([8, 10947])
- class speechbrain.lobes.downsampling.PoolingDownsampler(downsampling_factor, kernel_size, padding=0, pool_type='avg')[source]ο
Bases:
Downsampler1D Pooling downsampling (non-learned)
- Parameters:
downsampling_factor (int) β Factor of downsampling (i.e. ratio (length before ds / length after ds))
kernel_size (int) β Kernel size of the 1D filter (must be an odd integer)
padding (int) β The number of padding elements to apply.
pool_type (string) β Pooling approach, must be within [βavgβ,βmaxβ]
Example
>>> sd = PoolingDownsampler(3, 41) >>> a = torch.rand([8, 33000]) >>> a = sd(a) >>> print(a.shape) torch.Size([8, 10987])
- class speechbrain.lobes.downsampling.ConcatDownsampler(downsampling_factor)[source]ο
Bases:
DownsamplerConcatenation downsampling with naive frame dropping. Frames are dropped to make the time dimension divisible by the downsampling_factor.
- Parameters:
downsampling_factor (int) β Factor of downsampling (i.e. ratio (length before ds / length after ds))
Example
>>> down = ConcatDownsampler(2) >>> a = torch.rand([8, 40, 40]) >>> a = down(a) >>> print(a.shape) torch.Size([8, 20, 80])
- forward(x)[source]ο
Downsamples x given the resampling factor.
- Parameters:
x (torch.Tensor) β Factor of downsampling (i.e. ratio (length before ds / length after ds)).
- Returns:
x β The downsampled tensor.
- Return type: