MarginNCE: Robust Sound Localization with a Negative Margin

Sooyoung Park, Arda Senocak, Joon Son Chung

TL;DR

Self-supervised sound localization often fails because audio-visual pairs aren't always perfectly matched—sometimes the sound is off-screen, or "negative" samples are actually similar. MarginNCE introduces a simple "negative margin" to the contrastive loss function, creating a looser decision boundary that makes the model significantly more robust to these noisy correspondences.

What Problem Does This Paper Address?

The goal of sound source localization is to identify exactly which pixels in a video are responsible for a specific sound. In a self-supervised setting, researchers typically use contrastive learning: the model learns that audio and video from the same clip are a "positive" pair, while audio and video from different clips are "negatives."

However, real-world data is messy. This approach suffers from two types of noisy correspondences:

  1. False Positives: A video of a park might have the sound of a bird chirping, but the bird isn't actually visible. The model is forced to associate the park scenery with the bird sound, leading to confusion.
  2. False Negatives: If the model picks a "negative" audio sample of a dog barking to contrast against a "positive" video of a different dog barking, it punishes the model for recognizing the semantic similarity between two dogs.

Existing methods try to fix this with complex strategies like hard negative mining or aggressive data augmentation. MarginNCE proposes that the problem isn't the data, but the strictness of the loss function itself.

Methods

The authors build upon the standard InfoNCE loss, a staple in contrastive learning. Usually, researchers might add a positive margin to push classes further apart and increase discriminability.

Instead, MarginNCE introduces a negative margin ($m$). By subtracting a margin from the similarity score of positive pairs in the loss calculation, the model effectively adopts a "looser" decision boundary. It doesn't try to force a perfect match between every audio-visual pair, which prevents the model from over-correcting when faced with noisy or unrelated signals.

The architecture uses standard ResNet18 backbones for both audio (spectrograms) and visual (video frames) modalities. The core innovation is purely in the training objective: $$L_{marginNCE} = -\frac{1}{n} \sum_{i=1}^{n} \log \frac{e^{(S_{i,i}-m)/\tau}}{e^{(S_{i,i}-m)/\tau} + \sum_{i \neq j} e^{S_{i,j}/\tau}}$$

Datasets

The models were trained and evaluated on two primary benchmarks:

  • VGGSound: A large-scale dataset with ~200k videos. The model was specifically tested on the VGG-SS subset, which contains human-annotated bounding boxes for evaluation.
  • SoundNet-Flickr: A dataset of ~144k samples used for both training and cross-dataset generalization testing.

Key Insights and Ideas

  • Less is More: Unlike other state-of-the-art (SOTA) methods that require complex sub-modules (like background suppression or geometric consistency losses), MarginNCE achieves competitive results by changing just one hyperparameter in the loss function.
  • The Power of Negativity: While positive margins are common in face recognition to separate identities, a negative margin is uniquely suited for noisy self-supervised tasks. It acts as a buffer, acknowledging that the "ground truth" correspondence might be imperfect.
  • Plug-and-Play Robustness: The negative margin isn't just for one specific architecture. The authors demonstrated that adding it to other existing models (like LVS or EZ-VSL) consistently improved their performance.

Key Results

MarginNCE achieved state-of-the-art results on the SoundNet-Flickr test set and performed on-par with much more complex models on VGG-SS.

Quantitative results showing MarginNCE outperforming prior work on SoundNet-Flickr.

Qualitatively, the model produces much more compact and accurate localization maps. For example, in a video of a person playing a flute, MarginNCE focuses strictly on the instrument, whereas other models often bleed into the background or the person's head.

Visual comparison of localization heatmaps. MarginNCE (Ours) shows tighter, more accurate focus on the sound source compared to LVS and EZ-VSL.

The authors also tested Open-Set Localization, where the model is evaluated on sound categories it never saw during training. MarginNCE showed superior generalization here, particularly in the "Unheard" categories, proving that the looser boundary helps the model learn more generalizable features rather than just memorizing specific training pairs.

Limitations and Future Work

While the negative margin provides a significant boost, the authors note that the optimal margin value ($m$) can vary. In their experiments, $m = -0.2$ was generally effective, but performance dropped if the margin was too large (e.g., $-0.4$).

Future work could explore adaptive margins that change based on the model's confidence or the estimated noise level of a specific batch. Additionally, while this paper focuses on sound localization, the principle of negative margins could likely be applied to other noisy multi-modal tasks like video-text retrieval.

Summary updated

BibTeX
@inproceedings{park2023marginnce,
  author = {Sooyoung Park and Arda Senocak and Joon Son Chung},
  title = {{MarginNCE: Robust Sound Localization with a Negative Margin}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2023},
  doi = {10.1109/icassp49357.2023.10097234},
}
Figure