OpenPIR / README.md
charisreneec's picture
Update README.md
30c1b02 verified
---
license: cc-by-4.0
task_categories:
- audio-classification
tags:
- audio
- music
- instrument-recognition
- predominant-instrument
- openmic
- irmas
- multi-label
pretty_name: OpenPIR
size_categories:
- 1K<n<10K
configs:
- config_name: default
data_files:
- split: train
path: openpir_metadata.jsonl
---
# OpenPIR: Open Predominant Instrument Recognition Dataset
OpenPIR is a hand-labeled dataset for **predominant instrument recognition (PIR)** built from [OpenMic-2018](https://zenodo.org/record/1432913), a Creative Commons-licensed collection of 10-second music clips sourced from the [Free Music Archive](https://freemusicarchive.org/). It was introduced as part of the ICASSP 2026 paper:
> **Leveraging Diffusion U-Net Features for Predominant Instrument Recognition**
> Charis Cochran, Yeongheon Lee, Youngmoo Kim — Drexel University / University of Pennsylvania
> [IEEE Xplore](https://ieeexplore.ieee.org/document/11464738) · [Code & Demo](https://github.com/charisrenee/InstrumentRecognitionWithDiffusion)
---
Note: The OpenPIR predominant instrument and genre labels in this dataset are our original contribution. The remaining fields (artist, album, and additional tags) are not our work; they are sourced directly from OpenMic-2018 (Humphrey et al., 2018) and reproduced here solely to enable cross-referencing with the original OpenMic samples. Users should consult the original OpenMic-2018 release for the licensing and attribution terms governing that metadata.
## Dataset Summary
[IRMAS](https://www.upf.edu/web/mtg/irmas) is the standard training dataset for predominant instrument recognition, but it has two well-known limitations: relatively small size (6,705 clips), and training examples with only one predomiant instrument label (even if more than one is present) that do not reflect the overlapping timbres of real-world music and the test set ( which may have 1-5 predominant labels per clip). OpenPIR addresses both by adding 1,228 annotated clips from OpenMic-2018 that are compatible with IRMAS labels — supplementing every instrument category and introducing genuine multi-label annotations.
## Dataset Construction
OpenMic-2018 provides crowd-sourced instrument *presence/absence* scores (0–1) across 20 classes for ~20,000 clips from the Free Music Archive, but does not identify which instrument is **predominant**. To produce PIR-compatible labels, the following pipeline was applied:
1. **Filter to IRMAS classes.** OpenMic-2018 annotations were filtered to retain only the 11 instrument classes shared with IRMAS.
2. **Candidate selection.** From the filtered set, clips where exactly one instrument received a relevance score above **0.80** and all others fell below **0.40** were kept. This yielded ~4,500 candidates.
3. **Manual labeling.** Each candidate was listened to and annotated for:
- Predominant instrument(s) — guitar was differentiated into *acoustic* vs. *electric* to match IRMAS classes
- IRMAS-equivalent genre (mapped from FMA tags)
- Drum/percussion presence (to match the IRMAS annotation convention)
4. **Consistency check.** Only clips where the labeled instrument was predominant for the entire 10-second clip were retained. For clips where the instrument was predominant for only part of the clip, a start/stop time was selected manually, keeping the segment above 3 seconds.
5. **Genre exclusion.** Clips from genres diverging strongly from IRMAS content (e.g., Drone, Glitch) were removed.
This process yielded **1,228 clips** across 11 instrument classes.
---
## Dataset Statistics
| | Count |
|---|---|
| **Total clips** | 1,228 |
| **Single-instrument clips** | 905 |
| **Multi-instrument clips** | 323 |
| **Instrument classes** | 11 (+ "other instrument") |
| **Genre classes** | 6 IRMAS genres + instrumental + soundtrack |
### Instrument Distribution
Labels are multi-hot (a clip can have more than one predominant instrument).
| Instrument | IRMAS code | Label occurrences |
|---|---|---|
| Electric guitar | `gel` | 222 |
| Piano | `pia` | 195 |
| Voice / singing | `voi` | 188 |
| Cello | `cel` | 172 |
| Acoustic guitar | `gac` | 166 |
| Violin | `vio` | 142 |
| Organ | `org` | 130 |
| Saxophone | `sax` | 107 |
| Trumpet | `tru` | 72 |
| Other instrument | — | 69 |
| Flute | `flu` | 68 |
| Clarinet | `cla` | 40 |
*"Other instrument" is used for clips whose predominant instrument falls outside the 11 IRMAS classes (e.g., synthesizer, banjo, mandolin). These clips are included in the dataset but excluded from IRMAS-code evaluation.*
### Genre Distribution
Genre labels are mapped to the IRMAS genre taxonomy.
| Genre | IRMAS code | Clips |
|---|---|---|
| Instrumental / no clear genre | `instrumental` | 361 |
| Pop / rock | `pop_roc` | 328 |
| Country / folk | `cou_fol` | 300 |
| Classical | `cla` | 280 |
| Jazz / blues | `jaz_blu` | 168 |
| Soundtrack / score | `soundtrack` | 127 |
| Latin / soul | `lat_sou` | 65 |
| Not available | `NA` | 83 |
*Genre counts exceed 1,228 because a small number of clips carry two genre labels. The `NA` category covers clips whose FMA genre tags could not be reliably mapped.*
---
## Experimental Results
OpenPIR was used to fine-tune a baseline PIR model (trained on IRMAS + MUMS solo recordings) and measure the effect on held-out evaluation performance. Four model variants were compared:
| Model | Training procedure |
|---|---|
| **Baseline** | Trained on IRMAS + MUMS solos, 400 epochs |
| **Model A** | Baseline fine-tuned 100 epochs on IRMAS only |
| **Model B** | Baseline fine-tuned 100 epochs on IRMAS + OpenPIR |
| **Model C** | Sequential fine-tune: B → 100 more epochs on IRMAS + OpenPIR |
### Comparison with prior work
Adding OpenPIR (≈3.2 hours of additional data) achieves competitive Micro and Macro F1 against systems that use substantially more augmentation data. Reference numbers correspond to the [References](#references) section below.
![SOTA comparison table](OpenPIR_PerformanceStat_SOTA.png)
¹ Yu et al. results reproduced from the original paper; evaluated on a different test split.
### Per-class performance vs. Han et al. \[2\]
The chart below compares per-class Precision, Recall, and F1 for our best model (Model C) against a reimplementation of Han et al.
![Per-class precision, recall, and F1 comparison](OpenPIR_PerformanceStat_Han.png)
---
## Data Fields
The dataset is distributed as `openpir_metadata.jsonl`. Each line is a JSON object with the following fields:
| Field | Type | Description |
|---|---|---|
| `sample_key` | `string` | OpenMic-2018 sample identifier (`{track_id}_{start_frame}`) |
| `filepath` | `string` | Relative path to the audio file within the OpenMic-2018 archive |
| `artist` | `string` | Artist name from FMA metadata |
| `title` | `string` | Track title from FMA metadata |
| `album` | `string` | Album name from FMA metadata |
| `instrument` | `list[string]` | Predominant instrument(s), full English names (e.g. `"acoustic guitar"`) |
| `openmic_genres` | `list[string]` | Original FMA genre tags carried through from OpenMic-2018 |
| `genre` | `list[string]` | Genre(s) mapped to IRMAS taxonomy codes |
| `tags` | `list[string]` | Additional free-form tags (may be empty) |
---
## How to Use
### Load the metadata
```python
from datasets import load_dataset
ds = load_dataset("charisreneec/OpenPIR", split="train")
print(ds[0])
```
### Map labels to IRMAS codes
```python
INSTRUMENT_TO_IRMAS = {
"cello": "cel",
"clarinet": "cla",
"flute": "flu",
"acoustic guitar": "gac",
"electric guitar": "gel",
"organ": "org",
"piano": "pia",
"saxophone": "sax",
"trumpet": "tru",
"violin": "vio",
"voice": "voi",
}
def get_irmas_labels(example):
return [INSTRUMENT_TO_IRMAS[i] for i in example["instrument"] if i in INSTRUMENT_TO_IRMAS]
```
### Load audio (requires OpenMic-2018)
The audio files are not redistributed here because they originate from OpenMic-2018 (CC BY 4.0, Free Music Archive). Download the archive from Zenodo and point your loader at it:
```python
import json, soundfile as sf
from pathlib import Path
openmic_root = Path("/path/to/openmic-2018") # set to your local copy
with open("openpir_metadata.jsonl") as f:
records = [json.loads(line) for line in f]
for record in records:
audio_path = openmic_root / record["filepath"]
audio, sr = sf.read(audio_path)
labels = record["instrument"]
# ... your processing here
```
---
## Source Data & License
OpenPIR labels are released under **CC BY 4.0**.
The underlying audio clips come from **OpenMic-2018**, which is itself derived from the **Free Music Archive** and also released under CC BY 4.0. If you use OpenPIR, you must also comply with the OpenMic-2018 license terms:
- OpenMic-2018: Humphrey et al., "OpenMIC-2018: An Open Data-set for Multiple Instrument Recognition," *ISMIR 2018*. [Zenodo record](https://zenodo.org/record/1432913)
- Free Music Archive: [freemusicarchive.org](https://freemusicarchive.org/)
---
## Citation
If you use OpenPIR in your work, please cite:
```bibtex
@inproceedings{cochran2026openpir,
title = {Leveraging Diffusion U-Net Features for Predominant Instrument Recognition},
author = {Cochran, Charis and Lee, Yeongheon and Kim, Youngmoo},
booktitle = {Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)},
year = {2026},
url = {https://ieeexplore.ieee.org/document/11464738}
}
```
and OpenMic-2018:
```bibtex
@inproceedings{humphrey2018openmic,
title = {{OpenMIC-2018}: An Open Data-set for Multiple Instrument Recognition},
author = {Humphrey, Eric J. and Durand, Simon and McFee, Brian},
booktitle = {Proceedings of the International Society for Music Information Retrieval Conference (ISMIR)},
year = {2018}
}
```
---
## References
References cited in the SOTA comparison table, renumbered [1]–[8]:
\[1\] J. J. Bosch, J. Janer, F. Fuhrmann, and P. Herrera. "A Comparison of Sound Segregation Techniques for Predominant Instrument Recognition in Musical Audio Signals." *ISMIR*, 2012.
\[2\] Y. Han, J. Kim, and K. Lee. "Deep Convolutional Neural Networks for Predominant Instrument Recognition in Polyphonic Music." *IEEE/ACM Trans. Audio, Speech, Lang. Process.*, 2017.
\[3\] J. Pons, O. Slizovskaia, R. Gong, E. Gómez, and X. Serra. "Timbre Analysis of Music Audio Signals with Convolutional Neural Networks." *EUSIPCO*, 2017.
\[4\] K. Avramidis, A. Kratimenos, C. Garoufis, and P. Maragos. "Deep Convolutional and Recurrent Networks for Polyphonic Instrument Classification from Monophonic Raw Audio." *ICASSP*, 2021.
\[5\] D. Yu, H. Wang, P. Chen, and Z. Wei. "Predominant Instrument Recognition Based on Deep Neural Network with Auxiliary Classification." *IEEE/ACM Trans. Audio, Speech, Lang. Process.* 28 (2020), pp. 852–861.
\[6\] A. Kratimenos, K. Avramidis, M. Kosta, and M. Kokiopoulou. "Augmentation Methods on Monophonic Audio for Instrument Classification in Polyphonic Music." *EUSIPCO*, 2021.
\[7\] L. C. Reghunath and R. Rajan. "Transformer-Based Ensemble Method for Multiple Predominant Instruments Recognition in Polyphonic Music." *EURASIP J. Audio, Speech, Music Process.* 2022.1 (2022), p. 11.
\[8\] L. Zhong, Z. Chen, W. Liang, J. Li, and C. Shi. "Exploring Isolated Musical Notes as Pre-Training Data for Predominant Instrument Recognition in Polyphonic Music." *APSIPA ASC*, 2023, pp. 2312–2319.
---
## Contact
Charis Cochran — crc356 [at] drexel [dot] edu
Drexel University / University of Pennsylvania