task_categories:audio-classification task_categories:image-classification size_categories:10K<n<100K language:en license:mit music art region:us
While there are many music datasets with emotion labels in the literature, 
they cannot be used for research on symbolic-domain music analysis or generation, 
as there are usually audio files only. In this paper, 
we present the EMOPIA (pronounced `yee-mo-pi-uh') dataset, 
a shared multi-modal (audio and MIDI) database focusing on perceived emotion in pop piano music, 
to facilitate research on various tasks related to music emotion. 
The dataset contains 1,087 music clips from 387 songs and clip-level emotion labels annotated by four dedicated annotators. 
Since the clips are not restricted to one clip per song, they can also be used for song-level analysis. 
We present the methodology for building the dataset, 
covering the song list curation, clip selection, and emotion annotation processes. 
Moreover, we prototype use cases on clip-level music emotion classification and 
emotion-based symbolic music generation by training and evaluating corresponding models using the dataset. 
The result demonstrates the potential of EMOPIA for being used in future exploration on piano emotion-related MIR tasks.
@article{Hung2021EMOPIAAM,
  title={EMOPIA A Multi-Modal Pop Piano Dataset For Emotion Recognition and Emotion-based Music Generation},
  author={Hsiao-Tzu Hung and Joann Ching and Seungheon Doh and Nabin Kim and Juhan Nam and Yi-Hsuan Yang},
  journal={ArXiv},
  year={2021},
  volume={abs/2108.01374}
}
---
license: mit
task_categories:
- audio-classification
- image-classification
language:
- en
tags:
- music
- art
pretty_name: EMOPIA-mel
size_categories:
- 10K<n<100K
---

## Usage
### Supported Soundfonts
```
000_Florestan_Piano_sf2
Arachno_SoundFont_-_Version_1.0_sf2
GeneralUser_GS_MuseScore_v1.442_sf2
GeneralUser_GS_v1.471_sf2
grand_piano_sf2
J800_Piano_sf2
JV1080_Nice_Piano_m_sf2
Riky-Kraunkofer_Soundfont_sf2
Roland_XP-50_sf2
Roland_XP-80_sf2
SF2.Piano.DGX.Chung.Song.130.564KB_sf2
Splendid.136_sf2
Velocity_Grand_Piano_sf2
Yamaha-C5-Salamander-JNv5.1_sf2
YDP-GrandPiano-20160804_sf2
MS_Basic_sf3
```

### Example
```
import torch
from torchvision.transforms import *
from torch.utils.data import DataLoader
from datasets import load_dataset, concatenate_datasets


device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

compose = Compose([
    Resize(300),
    CenterCrop(300),
    RandomAffine(5),
    ToTensor(),
    Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])


def transform(example_batch):
    inputs = [compose(x.convert("RGB")) for x in example_batch["image"]]
    example_batch["image"] = inputs
    return example_batch


cols = ["image", "label"]
ds_1 = load_dataset("george-chou/emopia_mel",
                    "000_Florestan_Piano").with_transform(transform, columns=cols)
ds_2 = load_dataset("george-chou/emopia_mel",
                    "J800_Piano").with_transform(transform, columns=cols)

trainset = concatenate_datasets([ds_1["train"], ds_2["train"]])
validset = concatenate_datasets([ds_1["validation"], ds_2["validation"]])
testset = concatenate_datasets([ds_1["test"], ds_2["test"]])

traLoader = DataLoader(trainset, batch_size=4, shuffle=True)
valLoader = DataLoader(validset, batch_size=4, shuffle=True)
tesLoader = DataLoader(testset, batch_size=4, shuffle=True)

for i, data in enumerate(traLoader, 0):
    inputs, labels = data["image"].to(device), data["label"].to(device)
    print("inputs: ", inputs)
    print("labels: ", labels)

for i, data in enumerate(valLoader, 0):
    inputs, labels = data["image"].to(device), data["label"].to(device)
    print("inputs: ", inputs)
    print("labels: ", labels)

for i, data in enumerate(tesLoader, 0):
    inputs, labels = data["image"].to(device), data["label"].to(device)
    print("inputs: ", inputs)
    print("labels: ", labels)
```

## Skip Large Files
Open Git bash here and input following command:
'''
GIT_LFS_SKIP_SMUDGE=1
'''

## Maintenance
```
git clone git@hf.co:datasets/george-chou/emopia_mel
```

## Cite
```
@article{Hung2021EMOPIAAM,
  title={EMOPIA: A Multi-Modal Pop Piano Dataset For Emotion Recognition and Emotion-based Music Generation},
  author={Hsiao-Tzu Hung and Joann Ching and Seungheon Doh and Nabin Kim and Juhan Nam and Yi-Hsuan Yang},
  journal={ArXiv},
  year={2021},
  volume={abs/2108.01374}
}
```