SpectrogramStripeDropLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

SpecAugment-style stripe dropping on a spectrogram during training (Park et al. 2019), as PANNs and HTS-AT apply it inside the network (torchlibrosa SpecAugmentation): zeroes random bands of time frames and then random bands of frequency bins in every training forward, and passes the input through unchanged otherwise.

Inheritance: LayerBase<T> → SpectrogramStripeDropLayer<T>

Implements: IShapeContract

For Beginners

While training, a few random slices of time and of pitch are blanked out, so the model learns not to depend on any single moment or frequency band.

How It Works

Input: [batch, channels, time, frequency]. For each sample, timeStripes times: a width w is drawn from [0, timeDropWidth), a start from [0, T − w), and those frames are zeroed in every channel; then the same along frequency with freqDropWidth and freqStripes. HTS-AT uses widths 64 (time) and 8 (frequency) with two stripes each. A width is capped below the axis length, so a short spectrogram is never wiped out entirely.

The drop is a multiplication by a 0/1 mask, so gradients flow through the kept positions.

Constructors

Constructor Summary
SpectrogramStripeDropLayer(int timeDropWidth, int timeStripes, int freqDropWidth, int freqStripes) Creates the stripe dropper.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank) Derived from this type’s [TensorLayout] declarations.
void ResetState()