Datasets:
Size:
10K<n<100K
License:
George
commited on
Commit
•
77286d4
1
Parent(s):
85331aa
replace none thr lv label with sec lv label
Browse files- README.md +10 -2
- music_genre.py +7 -2
README.md
CHANGED
@@ -29,13 +29,21 @@ Audio classification
|
|
29 |
### Languages
|
30 |
Multilingual
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
## Dataset Structure
|
33 |
### Data Instances
|
34 |
-
.
|
35 |
|
36 |
### Data Fields
|
37 |
```
|
38 |
-
0_None
|
39 |
1_Classic
|
40 |
3_Symphony
|
41 |
4_Opera
|
|
|
29 |
### Languages
|
30 |
Multilingual
|
31 |
|
32 |
+
## Usage
|
33 |
+
When doing classification task, only one colum of fst_level_label, sec_level_label and thr_level_label can be used, not for mixing.
|
34 |
+
```
|
35 |
+
from datasets import load_dataset
|
36 |
+
|
37 |
+
dataset = load_dataset("ccmusic-database/music_genre")
|
38 |
+
print(dataset)
|
39 |
+
```
|
40 |
+
|
41 |
## Dataset Structure
|
42 |
### Data Instances
|
43 |
+
.zip(.png) .csv
|
44 |
|
45 |
### Data Fields
|
46 |
```
|
|
|
47 |
1_Classic
|
48 |
3_Symphony
|
49 |
4_Opera
|
music_genre.py
CHANGED
@@ -125,10 +125,15 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
125 |
def _generate_examples(self, files, labels):
|
126 |
for path in files:
|
127 |
i = int(os.path.basename(path)[:-4])
|
|
|
|
|
|
|
|
|
|
|
128 |
yield i, {
|
129 |
"image": path,
|
130 |
"fst_level_label": _NAMES[int(labels.iloc[i]['fst_level_label'])],
|
131 |
-
"sec_level_label": _NAMES[
|
132 |
-
"thr_level_label": _NAMES[
|
133 |
"duration": labels.iloc[i]['duration'],
|
134 |
}
|
|
|
125 |
def _generate_examples(self, files, labels):
|
126 |
for path in files:
|
127 |
i = int(os.path.basename(path)[:-4])
|
128 |
+
sec_level_label = int(labels.iloc[i]['sec_level_label'])
|
129 |
+
thr_level_label = int(labels.iloc[i]['thr_level_label'])
|
130 |
+
if thr_level_label == 0:
|
131 |
+
thr_level_label = sec_level_label
|
132 |
+
|
133 |
yield i, {
|
134 |
"image": path,
|
135 |
"fst_level_label": _NAMES[int(labels.iloc[i]['fst_level_label'])],
|
136 |
+
"sec_level_label": _NAMES[sec_level_label],
|
137 |
+
"thr_level_label": _NAMES[thr_level_label],
|
138 |
"duration": labels.iloc[i]['duration'],
|
139 |
}
|