PANNs

PANNs

IntermediateAcoustic Models

Educational content in the form of a scientific draft that needs expert review before being adopted as an academic reference. No experimental result that was not actually run is shown here.

Definition

A family of convolutional networks pre-trained on AudioSet for audio pattern recognition, used directly or fine-tuned for audio classification and detection tasks.

Mathematical Idea

The model processes a mel spectrogram with convolutional blocks, then pools the frequency axis and pools the time axis with max and mean to move from a frame-level representation to a clip-level representation, and a sigmoid layer predicts the multiple labels. The clip representation is suitable for transfer to other tasks.

How It Works

  1. Log-mel spectrogram
  2. Convolutional blocks with decreasing resolution
  3. Pool the frequency axis
  4. Temporal pooling: max + mean
  5. Linear layers and sigmoid
  6. Transfer or fine-tune for the downstream task

Stages Diagram

  1. Mel Spectrogram
  2. CNN Blocks
  3. Frequency/time pooling
  4. Linear layer
  5. Sigmoid

Equations

$$z=\max_t f_t+\frac1T\sum_t f_t$$

Temporal pooling combining max and mean.

$$\hat{y}=\sigma(Wz+b)$$

Independent multiple labels.

Advantages

  • Representations that transfer well across audio tasks
  • Well-known, effective convolutional architecture
  • Ready-to-use models

Limitations

  • Larger models may outperform it
  • Depends on the AudioSet domain
  • Long context is limited for convolution

Use Cases

  • Audio event classification
  • Temporal event detection
  • Extracting embeddings for downstream classifiers

Applied Example

On a clip of 100 frames and dimension 32, the pooling operation produces a vector of length 32 and then 5 independent probabilities (see the code).

Code Example

PythonImplemented and Tested
import numpy as np
rng = np.random.default_rng(0)
T, C, n_cls = 100, 32, 5
frame_feat = np.abs(rng.normal(size=(T, C)))          # frame features after the convolutional part
clip = frame_feat.max(axis=0) + frame_feat.mean(axis=0)   # temporal pooling: max + mean
W = rng.normal(size=(n_cls, C))*0.1; b = np.zeros(n_cls)
p = 1/(1+np.exp(-(W @ clip + b)))                      # independent probability per label
print(clip.shape, p.shape)

References

  1. Kong et al.. PANNs: Large-Scale Pretrained Audio Neural Networks for Audio Pattern Recognition. arXiv (2019). DOI
  2. Gemmeke et al.. Audio Set: An ontology and human-labeled dataset for audio events (2017). Source
  3. Google. YAMNet (Google, Kaggle Models). Kaggle Models. Source

Audio processing in the experiments takes place inside your browser. Audio, texts, and conversations are not saved on the server. Privacy Policy