Datasets:
Size:
10K<n<100K
License:
George
commited on
Commit
•
b925a79
1
Parent(s):
6860b71
upd mel zip
Browse files- data/mel.zip +2 -2
- music_genre.py +9 -2
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:84bd6ee179a3bb59a18c1aed7f896c9016f8058452f5988ba2cfef2455e69a5b
|
3 |
+
size 77047276
|
music_genre.py
CHANGED
@@ -61,6 +61,7 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
61 |
"fst_level_label": datasets.features.ClassLabel(names=_NAMES),
|
62 |
"sec_level_label": datasets.features.ClassLabel(names=_NAMES),
|
63 |
"thr_level_label": datasets.features.ClassLabel(names=_NAMES),
|
|
|
64 |
}
|
65 |
),
|
66 |
supervised_keys=("image", "fst_level_label"),
|
@@ -113,9 +114,14 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
113 |
]
|
114 |
|
115 |
def _calc_label(self, path, depth, substr='/mel/'):
|
|
|
116 |
dirpath = os.path.dirname(path)
|
117 |
-
substr_index = dirpath.find(
|
118 |
-
|
|
|
|
|
|
|
|
|
119 |
labs = labstr.split('/')
|
120 |
if depth <= len(labs):
|
121 |
return int(labs[depth - 1].split('_')[0])
|
@@ -129,4 +135,5 @@ class music_genre(datasets.GeneratorBasedBuilder):
|
|
129 |
"fst_level_label": _NAMES[self._calc_label(path, 1)],
|
130 |
"sec_level_label": _NAMES[self._calc_label(path, 2)],
|
131 |
"thr_level_label": _NAMES[self._calc_label(path, 3)],
|
|
|
132 |
}
|
|
|
61 |
"fst_level_label": datasets.features.ClassLabel(names=_NAMES),
|
62 |
"sec_level_label": datasets.features.ClassLabel(names=_NAMES),
|
63 |
"thr_level_label": datasets.features.ClassLabel(names=_NAMES),
|
64 |
+
"duration": datasets.Value('float64')
|
65 |
}
|
66 |
),
|
67 |
supervised_keys=("image", "fst_level_label"),
|
|
|
114 |
]
|
115 |
|
116 |
def _calc_label(self, path, depth, substr='/mel/'):
|
117 |
+
mel = substr
|
118 |
dirpath = os.path.dirname(path)
|
119 |
+
substr_index = dirpath.find(mel)
|
120 |
+
if substr_index < 0:
|
121 |
+
mel = '\\mel\\'
|
122 |
+
substr_index = dirpath.find(mel)
|
123 |
+
|
124 |
+
labstr = dirpath[substr_index + len(mel):]
|
125 |
labs = labstr.split('/')
|
126 |
if depth <= len(labs):
|
127 |
return int(labs[depth - 1].split('_')[0])
|
|
|
135 |
"fst_level_label": _NAMES[self._calc_label(path, 1)],
|
136 |
"sec_level_label": _NAMES[self._calc_label(path, 2)],
|
137 |
"thr_level_label": _NAMES[self._calc_label(path, 3)],
|
138 |
+
"duration": float(os.path.basename(path).split('_')[1].split('.jp')[0])
|
139 |
}
|