sps44 commited on
Commit
a656d98
·
1 Parent(s): e66b8d9

first dataset version

Browse files
Files changed (3) hide show
  1. data/emodb.parquet +3 -0
  2. data/wav.zip +3 -0
  3. emodb_enriched.py +93 -0
data/emodb.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e10f3ddf042f4ab930073b2dcf55c77f04bd7b4b57cb4f990d815a35291be04b
3
+ size 7463
data/wav.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e28cbd561c22303b55bac2e1190199afc7aa3773498f94154466877b06033e0
3
+ size 39054275
emodb_enriched.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ import datasets
4
+
5
+ import pandas as pd
6
+
7
+ from pathlib import Path
8
+ from datasets import load_dataset
9
+
10
+
11
+ _DATA_URLS = {
12
+ 'raw': "data/wav.zip",
13
+ 'metadata': 'data/emodb.parquet'
14
+ }
15
+
16
+ _GENDER = ['male', 'female']
17
+ _EMOTION = ['happiness', 'neutral', 'anger', 'boredom', 'disgust', 'fear', 'sadness']
18
+
19
+
20
+ class emoDBEnriched(datasets.GeneratorBasedBuilder):
21
+ """EmoDBEnriched Data Set"""
22
+
23
+ BUILDER_CONFIGS = [
24
+ datasets.BuilderConfig(
25
+ name="enriched",
26
+ version=datasets.Version("1.0.0", ""),
27
+ description="Import of enriched EmoDB Data Set",
28
+ )
29
+ ]
30
+
31
+ def _info(self):
32
+ return datasets.DatasetInfo(
33
+ features=datasets.Features(
34
+ {
35
+ "audio": datasets.Value("string"),
36
+ "emotion": datasets.features.ClassLabel(names=_EMOTION),
37
+ "gender": datasets.features.ClassLabel(names=_GENDER),
38
+ "emotion_str": datasets.Value("string"),
39
+ "gender_str": datasets.Value("string"),
40
+ "age": datasets.Value("int32")
41
+ }
42
+ ),
43
+ )
44
+
45
+ def _split_generators(self, dl_manager):
46
+
47
+ archive_path = dl_manager.download_and_extract(_DATA_URLS['raw'])
48
+ metadata = pd.read_parquet(dl_manager.download(_DATA_URLS['metadata']))
49
+
50
+
51
+ return [
52
+ datasets.SplitGenerator(
53
+ name=datasets.Split.TRAIN, gen_kwargs={"archive_path": archive_path, 'metadata': metadata, "split": "train"}
54
+ ),
55
+
56
+ ]
57
+
58
+ def _generate_examples(self, archive_path, metadata, split):
59
+ """This function returns the examples in the raw (text) form."""
60
+
61
+ if split == "train":
62
+ df = metadata
63
+
64
+
65
+ if split == "all":
66
+ df = metadata
67
+
68
+
69
+
70
+
71
+ for index, row in df.iterrows():
72
+ audio_path = archive_path + "/" + row['file']
73
+ #img = {"path": img_path, "bytes": None}
74
+ #print(str(len(row['probabilities'])))
75
+ #print(str(index))
76
+ result = {
77
+ "audio": audio_path,
78
+ "emotion": row['emotion'],
79
+ "gender": row['gender'],
80
+ "emotion_str": row['emotion'],
81
+ "gender_str": row['gender'],
82
+ "age": row['age'],
83
+ }
84
+ yield index, result
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+ #if __name__ == "__main__":
93
+ # ds = load_dataset("emodb_enriched.py", split="all")