Skip to main content
QUICK REVIEW

[Paper Review] An Attention Mechanism for Musical Instrument Recognition

Siddharth Gururani, Mohit Sharma|arXiv (Cornell University)|Jul 9, 2019
Music and Audio ProcessingComputer Science39 references7 citations
TL;DR

This paper proposes an attention mechanism for multi-label musical instrument recognition using weakly labeled polyphonic audio data from the OpenMIC dataset. By modeling the task as a multi-instance multi-label learning problem, the attention mechanism improves classification performance—particularly recall and F1-score—by focusing on relevant time segments per instrument, leading to more accurate and interpretable predictions compared to baseline models.

ABSTRACT

While the automatic recognition of musical instruments has seen significant progress, the task is still considered hard for music featuring multiple instruments as opposed to single instrument recordings. Datasets for polyphonic instrument recognition can be categorized into roughly two categories. Some, such as MedleyDB, have strong per-frame instrument activity annotations but are usually small in size. Other, larger datasets such as OpenMIC only have weak labels, i.e., instrument presence or absence is annotated only for long snippets of a song. We explore an attention mechanism for handling weakly labeled data for multi-label instrument recognition. Attention has been found to perform well for other tasks with weakly labeled data. We compare the proposed attention model to multiple models which include a baseline binary relevance random forest, recurrent neural network, and fully connected neural networks. Our results show that incorporating attention leads to an overall improvement in classification accuracy metrics across all 20 instruments in the OpenMIC dataset. We find that attention enables models to focus on (or 'attend to') specific time segments in the audio relevant to each instrument label leading to interpretable results.

Motivation & Objective

  • Address the challenge of training accurate instrument recognition models on weakly labeled polyphonic music datasets, which lack fine-grained temporal annotations.
  • Overcome class imbalance issues in multi-label instrument recognition, especially for rare instruments like clarinet or flute.
  • Improve model interpretability by localizing relevant audio segments for each instrument label through attention mechanisms.
  • Demonstrate that attention-based aggregation of instance-level predictions outperforms traditional models like random forests, fully connected networks, and RNNs on the OpenMIC dataset.

Proposed method

  • Formulate the instrument recognition task as a multi-instance multi-label (MIML) learning problem, where each audio clip is a 'bag' of short-time audio instances.
  • Apply an attention mechanism to dynamically weigh individual time instances based on their relevance to each instrument label, enabling selective focus on salient segments.
  • Use a feedforward neural network to predict instrument presence per instance, followed by a differentiable attention layer that aggregates predictions using learned attention weights.
  • Train the model end-to-end using binary cross-entropy loss with sigmoid activation for multi-label output, and apply a threshold of 0.5 for final binary predictions.
  • Compare the attention model (ATT) against baselines: binary relevance random forest (RF_BR), fully connected network with mean pooling (FC_T), and recurrent neural network (RNN).
  • Visualize attention weights to assess model interpretability and verify that attention localizes relevant instrument activity in audio clips.

Experimental results

Research questions

  • RQ1Can an attention mechanism improve multi-label instrument recognition performance on weakly labeled polyphonic music data compared to standard deep learning and traditional machine learning baselines?
  • RQ2Does attention help mitigate class imbalance in instrument recognition, especially for low-frequency instruments like clarinet or flute?
  • RQ3To what extent can the attention mechanism localize relevant time segments in audio clips, enhancing model interpretability?
  • RQ4How does the attention-based model compare in performance to models using mean pooling (FC_T) or recurrent structures (RNN) for aggregating instance-level predictions?

Key findings

  • The attention mechanism significantly improves recall and F1-score across all 20 instruments in the OpenMIC dataset, particularly benefiting instruments with high class imbalance such as clarinet, flute, and organ.
  • The attention model (ATT) outperforms the binary relevance random forest (RF_BR) baseline in F1-score for nearly all instruments, especially those with imbalanced positive-negative class ratios.
  • ATT achieves better performance than the fully connected network with mean pooling (FC_T), demonstrating that attention-based aggregation is more effective than simple averaging for instance-level predictions.
  • The RNN baseline outperforms RF_BR, indicating that modeling temporal correlations in instance sequences improves performance, but ATT surpasses RNNs in overall accuracy.
  • Visualization of attention weights confirms that the model successfully localizes instrument activity in audio clips, such as focusing on violin during its prominent playing periods and vocals when present.
  • The model maintains a lightweight architecture while achieving state-of-the-art performance on weakly supervised instrument recognition, suggesting scalability and practicality for real-world MIR applications.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.