Datasets:
Size:
10K<n<100K
License:
MuGeminorum
commited on
Commit
•
ce1dcb7
1
Parent(s):
eefd4d5
upd mel
Browse files- README.md +1 -1
- data/mel.zip +2 -2
- music_genre.py +47 -43
README.md
CHANGED
@@ -144,7 +144,7 @@ SOFTWARE.
|
|
144 |
### Citation Information
|
145 |
```
|
146 |
@dataset{zhaorui_liu_2021_5676893,
|
147 |
-
author = {Zhaorui Liu, Monan Zhou, Shenyang Xu and Zijin Li},
|
148 |
title = {CCMUSIC DATABASE: A Music Data Sharing Platform for Computational Musicology Research},
|
149 |
month = {nov},
|
150 |
year = {2021},
|
|
|
144 |
### Citation Information
|
145 |
```
|
146 |
@dataset{zhaorui_liu_2021_5676893,
|
147 |
+
author = {Zhaorui Liu, Monan Zhou, Shenyang Xu, Zhaowen Wang, Wei Li and Zijin Li},
|
148 |
title = {CCMUSIC DATABASE: A Music Data Sharing Platform for Computational Musicology Research},
|
149 |
month = {nov},
|
150 |
year = {2021},
|
data/mel.zip
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb6bb316d1fd7cd43737f30fba0aeaa81475daaa8f0b0e2c56b341e69465209b
|
3 |
+
size 1424507306
|
music_genre.py
CHANGED
@@ -3,40 +3,46 @@ import random
|
|
3 |
import datasets
|
4 |
from datasets.tasks import ImageClassification
|
5 |
|
6 |
-
|
7 |
-
"
|
8 |
-
"
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
"
|
13 |
-
"
|
14 |
-
"
|
15 |
-
"
|
16 |
-
"
|
17 |
-
"
|
18 |
-
"
|
19 |
-
"
|
20 |
-
"
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
"
|
25 |
-
"
|
26 |
-
"
|
27 |
-
"
|
28 |
-
"
|
29 |
-
"
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
_HOMEPAGE = f"https://huggingface.co/datasets/ccmusic-database/{os.path.basename(__file__).split('.')[0]}"
|
33 |
|
34 |
_CITATION = """\
|
35 |
@dataset{zhaorui_liu_2021_5676893,
|
36 |
-
author = {Zhaorui Liu, Monan Zhou, Shenyang Xu and Zijin Li},
|
37 |
-
title = {
|
38 |
-
month = nov,
|
39 |
-
year = 2021,
|
40 |
publisher = {Zenodo},
|
41 |
version = {1.1},
|
42 |
doi = {10.5281/zenodo.5676893},
|
@@ -57,14 +63,13 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
57 |
return datasets.DatasetInfo(
|
58 |
features=datasets.Features(
|
59 |
{
|
60 |
-
"
|
61 |
-
"fst_level_label": datasets.features.ClassLabel(names=
|
62 |
-
"sec_level_label": datasets.features.ClassLabel(names=
|
63 |
-
"thr_level_label": datasets.features.ClassLabel(names=
|
64 |
-
"duration": datasets.Value('float64')
|
65 |
}
|
66 |
),
|
67 |
-
supervised_keys=("
|
68 |
homepage=_HOMEPAGE,
|
69 |
license="mit",
|
70 |
citation=_CITATION,
|
@@ -72,8 +77,8 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
72 |
task_templates=[
|
73 |
ImageClassification(
|
74 |
task="image-classification",
|
75 |
-
image_column="
|
76 |
-
label_column="
|
77 |
)
|
78 |
]
|
79 |
)
|
@@ -127,16 +132,15 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
127 |
labs = labstr.split('\\')
|
128 |
|
129 |
if depth <= len(labs):
|
130 |
-
return
|
131 |
else:
|
132 |
return int(labs[-1].split('_')[0])
|
133 |
|
134 |
def _generate_examples(self, files):
|
135 |
for i, path in enumerate(files):
|
136 |
yield i, {
|
137 |
-
"
|
138 |
-
"fst_level_label":
|
139 |
-
"sec_level_label":
|
140 |
-
"thr_level_label":
|
141 |
-
"duration": float(os.path.basename(path).split('_')[1].split('.jp')[0])
|
142 |
}
|
|
|
3 |
import datasets
|
4 |
from datasets.tasks import ImageClassification
|
5 |
|
6 |
+
_NAMES_1 = {
|
7 |
+
1: "Classic",
|
8 |
+
2: "Non_classic"
|
9 |
+
}
|
10 |
+
|
11 |
+
_NAMES_2 = {
|
12 |
+
3: "Symphony",
|
13 |
+
4: "Opera",
|
14 |
+
5: "Solo",
|
15 |
+
6: "Chamber",
|
16 |
+
7: "Pop",
|
17 |
+
8: "Dance_and_house",
|
18 |
+
9: "Indie",
|
19 |
+
10: "Soul_or_r_and_b",
|
20 |
+
11: "Rock"
|
21 |
+
}
|
22 |
+
|
23 |
+
_NAMES_3 = {
|
24 |
+
0: "None",
|
25 |
+
12: "Pop_vocal_ballad",
|
26 |
+
13: "Adult_contemporary",
|
27 |
+
14: "Teen_pop",
|
28 |
+
15: "Contemporary_dance_pop",
|
29 |
+
16: "Dance_pop",
|
30 |
+
17: "Classic_indie_pop",
|
31 |
+
18: "Chamber_cabaret_and_art_pop",
|
32 |
+
19: "Adult_alternative_rock",
|
33 |
+
20: "Uplifting_anthemic_rock",
|
34 |
+
21: "Soft_rock",
|
35 |
+
22: "Acoustic_pop"
|
36 |
+
}
|
37 |
|
38 |
_HOMEPAGE = f"https://huggingface.co/datasets/ccmusic-database/{os.path.basename(__file__).split('.')[0]}"
|
39 |
|
40 |
_CITATION = """\
|
41 |
@dataset{zhaorui_liu_2021_5676893,
|
42 |
+
author = {Zhaorui Liu, Monan Zhou, Shenyang Xu, Zhaowen Wang, Wei Li and Zijin Li},
|
43 |
+
title = {CCMUSIC DATABASE: A Music Data Sharing Platform for Computational Musicology Research},
|
44 |
+
month = {nov},
|
45 |
+
year = {2021},
|
46 |
publisher = {Zenodo},
|
47 |
version = {1.1},
|
48 |
doi = {10.5281/zenodo.5676893},
|
|
|
63 |
return datasets.DatasetInfo(
|
64 |
features=datasets.Features(
|
65 |
{
|
66 |
+
"mel": datasets.Image(),
|
67 |
+
"fst_level_label": datasets.features.ClassLabel(names=list(_NAMES_1.values())),
|
68 |
+
"sec_level_label": datasets.features.ClassLabel(names=list(_NAMES_2.values())),
|
69 |
+
"thr_level_label": datasets.features.ClassLabel(names=list(_NAMES_3.values()))
|
|
|
70 |
}
|
71 |
),
|
72 |
+
supervised_keys=("mel", "sec_level_label"),
|
73 |
homepage=_HOMEPAGE,
|
74 |
license="mit",
|
75 |
citation=_CITATION,
|
|
|
77 |
task_templates=[
|
78 |
ImageClassification(
|
79 |
task="image-classification",
|
80 |
+
image_column="mel",
|
81 |
+
label_column="sec_level_label",
|
82 |
)
|
83 |
]
|
84 |
)
|
|
|
132 |
labs = labstr.split('\\')
|
133 |
|
134 |
if depth <= len(labs):
|
135 |
+
return 0
|
136 |
else:
|
137 |
return int(labs[-1].split('_')[0])
|
138 |
|
139 |
def _generate_examples(self, files):
|
140 |
for i, path in enumerate(files):
|
141 |
yield i, {
|
142 |
+
"mel": path,
|
143 |
+
"fst_level_label": _NAMES_1[self._calc_label(path, 1)],
|
144 |
+
"sec_level_label": _NAMES_2[self._calc_label(path, 2)],
|
145 |
+
"thr_level_label": _NAMES_3[self._calc_label(path, 3)]
|
|
|
146 |
}
|