torchsig.transforms.dataset_transforms.CutOut¶
- class torchsig.transforms.dataset_transforms.CutOut(duration=(0.01, 0.2), cut_type: List[str] = ['zeros', 'ones', 'low_noise', 'avg_noise', 'high_noise'], **kwargs)[source]¶
Bases:
DatasetTransformApplies the CutOut transform operation in the time domain. The cut_dur input specifies how long the cut region should be, and the cut_fill input specifies what the cut region should be filled in with. Options for the cut type include: zeros, ones, low_noise, avg_noise, and high_noise. Zeros fills in the region with zeros; ones fills in the region with 1+1j samples; low_noise fills in the region with noise with -100dB power; avg_noise adds noise at power average of input data, effectively slicing/removing existing signals in the most RF realistic way of the options; and high_noise adds noise with 40dB power. If a list of multiple options are passed in, they are randomly sampled from.
This transform is loosely based on “Improved Regularization of Convolutional Neural Networks with Cutout”.
- duration¶
cut_dur sets the duration of the region to cut out * If float, cut_dur is fixed at the value provided. * If list, cut_dur is any element in the list. * If tuple, cut_dur is in range of (tuple[0], tuple[1]).
- cut_type¶
cut_fill sets the type of data to fill in the cut region with from the options: zeros, ones, low_noise, avg_noise, and high_noise * If list, cut_fill is any element in the list. * If str, cut_fill is fixed at the method provided.
Methods
Add parent Seedable object and set up RNGs accordingly
get_distributionGets second seed, usually used to seed both torch and numpy generators with slightly different seeds
Seed number generators with given seed.
Initialize torch and numpy number generators, and update its children.
Updates bookkeeping to transforms in DatasetSignal's SignalMetadata and checks signal valididty.
Update numpy and torch number generators with parent seed
- __init__(duration=(0.01, 0.2), cut_type: List[str] = ['zeros', 'ones', 'low_noise', 'avg_noise', 'high_noise'], **kwargs)[source]¶
Transform initialization as Seedable.
- __call__(signal: DatasetSignal) DatasetSignal[source]¶
Performs transforms.
- Parameters:
signal (DatasetSignal) – DatasetSignal to be transformed.
- Raises:
NotImplementedError – Inherited classes must override this method.
- Returns:
Transformed DatasetSignal.
- Return type:
- __repr__() str¶
Transform string representation. Should be able to recreate class from this string.
- Returns:
Transform representation.
- Return type:
- get_second_seed(seed: int) int¶
Gets second seed, usually used to seed both torch and numpy generators with slightly different seeds
- update(signal: DatasetSignal) None¶
Updates bookkeeping to transforms in DatasetSignal’s SignalMetadata and checks signal valididty. Inherited classes should always call self.update() after performing transform operation (inside __call__).
- Parameters:
signal (DatasetSignal) – transformed DatasetSignal.