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
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)
在此处打开Git bash,并输入以下命令:'''GIT_LFS_SKIP_SMUDGE=1'''
git clone git@hf.co:datasets/george-chou/emopia_mel
@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} }