Deep Within-Class Covariance Analysis for Robust Audio Representation Learning

Hamid Eghbal-zadeh, Matthias Dorfer, Gerhard WidmerarXiv 2017

TL;DR

Deep Neural Networks often suffer severe performance drops when evaluated on data from a shifted distribution. This paper introduces Deep Within-Class Covariance Analysis (DWCCA), a novel, end-to-end trainable neural network layer that minimizes the variance of internal representations within each class. By tightly clustering these embeddings, DWCCA provides a 6 percentage point boost in acoustic scene classification accuracy under distribution shifts.

What Problem Does This Paper Address?

While Convolutional Neural Networks (CNNs) excel at supervised classification, they are notoriously sensitive to distribution mismatch—situations where the test data distribution deviates from the training data. In real-world applications like Acoustic Scene Classification (ASC), this happens constantly; for instance, audio recorded in a city center might sound completely different depending on the city, the recording equipment, or the season.

The authors investigate the internal representations of CNNs to understand this drop in performance. They discover that representations of unseen data spread out much more widely (exhibiting higher variance) in the embedding space compared to the training data. When a distribution shift occurs, this variance explodes, causing data points to cross decision boundaries and leading to misclassification.

Methods

To combat this high within-class variance, the authors propose Deep Within-Class Covariance Analysis (DWCCA). This method reformulates a classic machine learning technique called Within-Class Covariance Normalization (WCCN) into a deep-learning-compatible layer.

Traditional WCCN requires calculating a covariance matrix across the entire dataset at once, making it incompatible with mini-batch Stochastic Gradient Descent (SGD). DWCCA solves this by estimating the within-class covariance matrix ($\hat{S}_b$) on individual mini-batches and maintaining a running moving average of the projection matrix ($\bar{B}$). Crucially, the layer is fully differentiable, allowing it to be trained end-to-end using standard backpropagation. It can be inserted into any arbitrary position within a DNN, typically right after the global average pooling layer.

Figure 1: Diagram of the proposed layer in a DNN architecture.

Datasets

The authors evaluate their approach on two Acoustic Scene Classification benchmarks:

  • TUT Acoustic Scenes 2016 (DCASE2016): Represents a scenario without a distribution shift, where development and test sets were collected jointly.
  • TUT Acoustic Scenes 2017 (DCASE2017): Represents a scenario with a distribution shift. While it shares the same 15 acoustic scene classes (e.g., home, library, city center) and development data as DCASE2016, its evaluation set consists of entirely new recordings captured at later times and in different locations.

Key Insights and Ideas

  • The Variance Explosion: Eigenvalue decomposition of the within-class covariance matrix revealed that the maximum eigenvalue for unseen data can be up to 10 times larger than that of the training data, quantitatively proving that unseen embeddings spread out drastically.
  • Visualizing the Fix: Using 2D Principal Component Analysis (PCA) projections, the authors visually demonstrate that DWCCA successfully forces unseen test embeddings to cluster tightly around the training data embeddings, directly countering the distribution shift.
Figure 2: DNN representations projected to 2D by PCA. The gray embeddings in low opacity (available only in validation and test plots) represent the training data. Note the distribution mismatch for vanilla.
  • Equalizing Class Performance: DWCCA acts as a performance equalizer across classes. It significantly boosts accuracy on the hardest, lowest-performing classes (such as "beach" or "train") without degrading the performance of classes that the network already classifies well.

Key Results

  • DCASE2017 (With Distribution Shift): Adding DWCCA to a baseline VGG network improved the end-to-end classification accuracy on the unseen test set by approximately 6 percentage points (improving from 62.47% to 68.70% after calibration).
  • DCASE2016 (No Distribution Shift): Performance remained stable and comparable to the baseline (~85.90% vs ~85.64%), proving that DWCCA does not harm performance when a distribution mismatch is absent.
  • K-Nearest Neighbor (KNN) Evaluation: KNN classification accuracy directly on the raw embeddings increased significantly with DWCCA, confirming that the learned representation space itself is inherently more robust and generalizable.

Limitations and Future Work

The authors note that DWCCA is highly effective when a substantial generalization gap exists between training and test sets. However, if the test set is already very similar to the training set (as in DCASE2016), DWCCA provides little to no additional benefit for end-to-end classification. Beyond this observation, explicit limitations and specific directions for future work are not discussed in the paper.

Summary updated

Abstract

Convolutional Neural Networks (CNNs) can learn effective features, though have been shown to suffer from a performance drop when the distribution of the data changes from training to test data. In this paper we analyze the internal representations of CNNs and observe that the representations of unseen data in each class, spread more (with higher variance) in the embedding space of the CNN compared to representations of the training data. More importantly, this difference is more extreme if the unseen data comes from a shifted distribution. Based on this observation, we objectively evaluate the degree of representation's variance in each class via eigenvalue decomposition on the within-class covariance of the internal representations of CNNs and observe the same behaviour. This can be problematic as larger variances might lead to mis-classification if the sample crosses the decision boundary of its class. We apply nearest neighbor classification on the representations and empirically show that the embeddings with the high variance actually have significantly worse KNN classification performances, although this could not be foreseen from their end-to-end classification results. To tackle this problem, we propose Deep Within-Class Covariance Analysis (DWCCA), a deep neural network layer that significantly reduces the within-class covariance of a DNN's representation, improving performance on unseen test data from a shifted distribution. We empirically evaluate DWCCA on two datasets for Acoustic Scene Classification (DCASE2016 and DCASE2017). We demonstrate that not only does DWCCA significantly improve the network's internal representation, it also increases the end-to-end classification accuracy, especially when the test set exhibits a distribution shift. By adding DWCCA to a VGG network, we achieve around 6 percentage points improvement in the case of a distribution mismatch.
BibTeX
@misc{eghbalzadeh2017deep,
  author = {Hamid Eghbal-zadeh and Matthias Dorfer and Gerhard Widmer},
  title = {{Deep Within-Class Covariance Analysis for Robust Audio Representation Learning}},
  year = {2017},
  eprint = {1711.04022},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.04022},
}
Figure