George
commited on
Commit
•
6a30e38
1
Parent(s):
9ead6ca
add img col
Browse files- .gitignore +2 -0
- chest_falsetto.py +23 -24
- data/client_data.zip +2 -2
.gitignore
CHANGED
@@ -1,2 +1,4 @@
|
|
1 |
rename.sh
|
2 |
test.py
|
|
|
|
|
|
1 |
rename.sh
|
2 |
test.py
|
3 |
+
*.wav
|
4 |
+
*.jpg
|
chest_falsetto.py
CHANGED
@@ -9,7 +9,7 @@ _NAMES = ['m_chest', 'f_chest', 'm_falsetto', 'f_falsetto']
|
|
9 |
|
10 |
_DBNAME = os.path.basename(__file__).split('.')[0]
|
11 |
|
12 |
-
_HOMEPAGE = "https://huggingface.co/datasets/ccmusic-database/"
|
13 |
|
14 |
_CITATION = """\
|
15 |
@dataset{zhaorui_liu_2021_5676893,
|
@@ -31,7 +31,7 @@ the Mel-spectrogram, MFCC, and spectral characteristics of each audio segment ar
|
|
31 |
for a total of 5120 CSV files.
|
32 |
"""
|
33 |
|
34 |
-
_URL = _HOMEPAGE
|
35 |
|
36 |
|
37 |
class chest_falsetto(datasets.GeneratorBasedBuilder):
|
@@ -41,6 +41,7 @@ class chest_falsetto(datasets.GeneratorBasedBuilder):
|
|
41 |
features=datasets.Features(
|
42 |
{
|
43 |
"audio": datasets.Audio(sampling_rate=44_100),
|
|
|
44 |
"label": datasets.features.ClassLabel(names=_NAMES),
|
45 |
"gender": datasets.features.ClassLabel(names=_GENDER),
|
46 |
"singing_method": datasets.features.ClassLabel(names=_CF),
|
@@ -63,50 +64,48 @@ class chest_falsetto(datasets.GeneratorBasedBuilder):
|
|
63 |
def _split_generators(self, dl_manager):
|
64 |
data_files = dl_manager.download_and_extract(_URL)
|
65 |
files = dl_manager.iter_files([data_files])
|
66 |
-
|
67 |
|
68 |
-
for
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
random.shuffle(
|
72 |
-
data_count = len(
|
73 |
p80 = int(data_count * 0.8)
|
74 |
p90 = int(data_count * 0.9)
|
75 |
-
validationset = trainset[p80:p90]
|
76 |
-
testset = trainset[p90:]
|
77 |
-
trainset = trainset[:p80]
|
78 |
|
79 |
return [
|
80 |
datasets.SplitGenerator(
|
81 |
name=datasets.Split.TRAIN,
|
82 |
gen_kwargs={
|
83 |
-
"files":
|
84 |
},
|
85 |
),
|
86 |
datasets.SplitGenerator(
|
87 |
name=datasets.Split.VALIDATION,
|
88 |
gen_kwargs={
|
89 |
-
"files":
|
90 |
},
|
91 |
),
|
92 |
datasets.SplitGenerator(
|
93 |
name=datasets.Split.TEST,
|
94 |
gen_kwargs={
|
95 |
-
"files":
|
96 |
},
|
97 |
),
|
98 |
]
|
99 |
|
100 |
def _generate_examples(self, files):
|
101 |
for i, path in enumerate(files):
|
102 |
-
|
103 |
-
if file_name.endswith(".wav"):
|
104 |
-
sex = file_name.split('_')[1]
|
105 |
-
gender = 'male' if sex == 'm' else 'female'
|
106 |
-
method = file_name.split('_')[2][:-4]
|
107 |
-
yield i, {
|
108 |
-
"audio": path,
|
109 |
-
"label": sex + '_' + method,
|
110 |
-
"gender": gender,
|
111 |
-
"singing_method": method,
|
112 |
-
}
|
|
|
9 |
|
10 |
_DBNAME = os.path.basename(__file__).split('.')[0]
|
11 |
|
12 |
+
_HOMEPAGE = f"https://huggingface.co/datasets/ccmusic-database/{_DBNAME}"
|
13 |
|
14 |
_CITATION = """\
|
15 |
@dataset{zhaorui_liu_2021_5676893,
|
|
|
31 |
for a total of 5120 CSV files.
|
32 |
"""
|
33 |
|
34 |
+
_URL = f"{_HOMEPAGE}/resolve/main/data/client_data.zip"
|
35 |
|
36 |
|
37 |
class chest_falsetto(datasets.GeneratorBasedBuilder):
|
|
|
41 |
features=datasets.Features(
|
42 |
{
|
43 |
"audio": datasets.Audio(sampling_rate=44_100),
|
44 |
+
"image": datasets.Image(),
|
45 |
"label": datasets.features.ClassLabel(names=_NAMES),
|
46 |
"gender": datasets.features.ClassLabel(names=_GENDER),
|
47 |
"singing_method": datasets.features.ClassLabel(names=_CF),
|
|
|
64 |
def _split_generators(self, dl_manager):
|
65 |
data_files = dl_manager.download_and_extract(_URL)
|
66 |
files = dl_manager.iter_files([data_files])
|
67 |
+
dataset = []
|
68 |
|
69 |
+
for path in files:
|
70 |
+
file_name = os.path.basename(path)
|
71 |
+
if file_name.endswith(".wav"):
|
72 |
+
sex = file_name.split('_')[1]
|
73 |
+
gender = 'male' if sex == 'm' else 'female'
|
74 |
+
method = file_name.split('_')[2][:-4]
|
75 |
+
dataset.append({
|
76 |
+
"audio": path,
|
77 |
+
"image": path.replace('.wav', '.jpg').replace('/audio/', '/image/'),
|
78 |
+
"label": sex + '_' + method,
|
79 |
+
"gender": gender,
|
80 |
+
"singing_method": method,
|
81 |
+
})
|
82 |
|
83 |
+
random.shuffle(dataset)
|
84 |
+
data_count = len(dataset)
|
85 |
p80 = int(data_count * 0.8)
|
86 |
p90 = int(data_count * 0.9)
|
|
|
|
|
|
|
87 |
|
88 |
return [
|
89 |
datasets.SplitGenerator(
|
90 |
name=datasets.Split.TRAIN,
|
91 |
gen_kwargs={
|
92 |
+
"files": dataset[:p80],
|
93 |
},
|
94 |
),
|
95 |
datasets.SplitGenerator(
|
96 |
name=datasets.Split.VALIDATION,
|
97 |
gen_kwargs={
|
98 |
+
"files": dataset[p80:p90],
|
99 |
},
|
100 |
),
|
101 |
datasets.SplitGenerator(
|
102 |
name=datasets.Split.TEST,
|
103 |
gen_kwargs={
|
104 |
+
"files": dataset[p90:],
|
105 |
},
|
106 |
),
|
107 |
]
|
108 |
|
109 |
def _generate_examples(self, files):
|
110 |
for i, path in enumerate(files):
|
111 |
+
yield i, path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/client_data.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:b477e7f813be6f1e6a4c47a86abb5d32c4b7789d1eb81553e5e716ee678d6d15
|
3 |
+
size 70399735
|