MAT-SED: A Masked Audio Transformer with Masked-Reconstruction Based Pre-training for Sound Event Detection

Pengfei Cai, Yan Song, Shuo Li, Haoyu Song, Ian McLoughlin

Abstract

Sound event detection (SED) methods that leverage a large pre-trained Transformer encoder network have shown promising performance in recent DCASE challenges. However, they still rely on an RNN-based context network to model temporal dependencies, largely due to the scarcity of labeled data. In this work, we propose a pure Transformer-based SED model with masked-reconstruction based pre-training, termed MAT-SED. Specifically, a Transformer with relative positional encoding is first designed as the context network, pre-trained by the masked-reconstruction task on all available target data in a self-supervised way. Both the encoder and the context network are jointly fine-tuned in a semi-supervised manner. Furthermore, a global-local feature fusion strategy is proposed to enhance the localization capability. Evaluation of MAT-SED on DCASE2023 task4 surpasses state-of-the-art performance, achieving 0.587/0.896 PSDS1/PSDS2 respectively.

Introduction

Sound Event Detection (SED) involves identifying the presence and precise temporal boundaries of sound events within an audio stream. While Transformer architectures have become the standard in various domains, SED has traditionally utilized hybrid models. These models typically pair a Transformer-based encoder (e.g., PaSST) with a Recurrent Neural Network (RNN) context network. The reliance on RNNs stems from their inherent inductive bias for sequential data, which is advantageous given the limited labeled data in SED benchmarks. However, RNNs can limit the modeling of long-range dependencies. MAT-SED addresses this by introducing a pure Transformer architecture optimized for SED through self-supervised pre-training.

Methodology

The MAT-SED framework consists of three primary components designed to overcome the limitations of standard Transformers in low-data regimes.

1. Masked-Reconstruction Pre-training

To mitigate overfitting on small datasets, the context network undergoes self-supervised pre-training. As shown in Figure 1(a), the model is tasked with reconstructing masked portions of the audio feature sequence. A high masking ratio of 75% is employed, forcing the model to learn robust temporal representations and semantic structures from unlabeled data.

2. Relative Positional Encoding (RPE)

Unlike Absolute Positional Encoding, RPE focuses on the relative distance between frames. This is particularly suited for audio, where sound events are translation equivariant—their identity remains constant regardless of their absolute temporal position.

3. Global-Local Feature Fusion

To enhance localization accuracy, MAT-SED utilizes a dual-branch approach during fine-tuning. A global branch processes the entire spectrogram, while a local branch focuses on short chunks via sliding windows. The fusion of these features provides the model with both broad context and fine-grained temporal detail.

Overview of the MAT-SED framework, including masked-reconstruction pre-training and mean-teacher fine-tuning.

Experiments and Results

MAT-SED was evaluated on the DCASE2023 Task 4 dataset, which includes a mix of weakly-labeled, strongly-labeled, synthetic, and unlabeled domestic audio data.

Performance Comparison

The model achieves state-of-the-art results on the validation set. As detailed in Table 1, MAT-SED (median filter) achieves a PSDS1 of 0.587, while the maximum filter variant reaches a PSDS2 of 0.896. These results significantly outperform existing hybrid models like ATST-SED and PaSST-SED.

Performance comparison of MAT-SED against state-of-the-art models on the DCASE2023 Task 4 benchmark.

Ablation Insights

  • Masking Ratio: Optimal performance was observed at a 75% masking ratio, suggesting that high-level reconstruction tasks provide better regularization for audio context modeling.
  • Pre-training Impact: Self-supervised pre-training acts as a critical regularizer, preventing the pure Transformer from overfitting and enabling it to surpass RNN-based counterparts.

Conclusion

MAT-SED demonstrates that a pure Transformer architecture, when combined with effective self-supervised pre-training and relative positional encoding, can outperform traditional hybrid SED models. The proposed global-local fusion further refines localization. Future work will explore more efficient fusion implementations to reduce the memory overhead associated with multi-window processing.

Summary updated

Abstract

Sound event detection (SED) methods that leverage a large pre-trained Transformer encoder network have shown promising performance in recent DCASE challenges. However, they still rely on an RNN-based context network to model temporal dependencies, largely due to the scarcity of labeled data. In this work, we propose a pure Transformer-based SED model with masked-reconstruction based pre-training, termed MAT-SED. Specifically, a Transformer with relative positional encoding is first designed as the context network, pre-trained by the masked-reconstruction task on all available target data in a self-supervised way. Both the encoder and the context network are jointly fine-tuned in a semi-supervised manner. Furthermore, a global-local feature fusion strategy is proposed to enhance the localization capability. Evaluation of MAT-SED on DCASE2023 task4 surpasses state-of-the-art performance, achieving 0.587/0.896 PSDS1/PSDS2 respectively.
BibTeX
@misc{cai2024mat,
  author = {Pengfei Cai and Yan Song and Shuo Li and Haoyu Song and Ian McLoughlin},
  title = {{MAT-SED: A Masked Audio Transformer with Masked-Reconstruction Based Pre-training for Sound Event Detection}},
  year = {2024},
  eprint = {2408.08673},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.08673},
}
Figure