pub struct SpecAugment { /* private fields */ }Expand description
SpecAugment: Data augmentation for speech recognition (Park et al., 2019).
Applies time warping, frequency masking, and time masking to spectrograms.
§Methods
- Time Warping: Warps spectrogram along time axis
- Frequency Masking: Masks F consecutive frequency channels
- Time Masking: Masks T consecutive time steps
§Reference
- Park, D., et al. (2019).
SpecAugment: A Simple Data Augmentation Method for Automatic Speech Recognition. Interspeech.
Implementations§
Source§impl SpecAugment
impl SpecAugment
Sourcepub fn new() -> Self
pub fn new() -> Self
Create SpecAugment with default parameters.
Default: 2 frequency masks (F=27), 2 time masks (T=100)
Sourcepub fn with_params(
num_freq_masks: usize,
freq_mask_param: usize,
num_time_masks: usize,
time_mask_param: usize,
) -> Self
pub fn with_params( num_freq_masks: usize, freq_mask_param: usize, num_time_masks: usize, time_mask_param: usize, ) -> Self
Create with custom parameters.
Sourcepub fn with_mask_value(self, value: f32) -> Self
pub fn with_mask_value(self, value: f32) -> Self
Set the mask value.
Sourcepub fn freq_mask(
&self,
spec: &[f32],
freq_bins: usize,
time_steps: usize,
) -> Vec<f32>
pub fn freq_mask( &self, spec: &[f32], freq_bins: usize, time_steps: usize, ) -> Vec<f32>
Apply only frequency masking.
Sourcepub fn time_mask(
&self,
spec: &[f32],
freq_bins: usize,
time_steps: usize,
) -> Vec<f32>
pub fn time_mask( &self, spec: &[f32], freq_bins: usize, time_steps: usize, ) -> Vec<f32>
Apply only time masking.
pub fn num_freq_masks(&self) -> usize
pub fn num_time_masks(&self) -> usize
Trait Implementations§
Source§impl Clone for SpecAugment
impl Clone for SpecAugment
Source§fn clone(&self) -> SpecAugment
fn clone(&self) -> SpecAugment
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpecAugment
impl Debug for SpecAugment
Auto Trait Implementations§
impl Freeze for SpecAugment
impl RefUnwindSafe for SpecAugment
impl Send for SpecAugment
impl Sync for SpecAugment
impl Unpin for SpecAugment
impl UnwindSafe for SpecAugment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more