Spaces:
Sleeping
Sleeping
update
Browse files
examples/vm_sound_classification/step_1_prepare_data.py
CHANGED
@@ -37,18 +37,18 @@ def get_dataset(args):
|
|
37 |
file_dir = Path(args.file_dir)
|
38 |
file_dir.mkdir(exist_ok=True)
|
39 |
|
40 |
-
label2_map = {
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
}
|
52 |
# label3_map = {
|
53 |
# "bell": "voicemail",
|
54 |
# "white_noise": "mute",
|
@@ -61,6 +61,18 @@ def get_dataset(args):
|
|
61 |
# "voice": "voice_or_noise",
|
62 |
# "voicemail": "voicemail",
|
63 |
# }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
# label8_map = {
|
65 |
# "bell": "bell",
|
66 |
# "white_noise": "white_noise",
|
@@ -86,10 +98,10 @@ def get_dataset(args):
|
|
86 |
folder = filename.parts[-2]
|
87 |
country = filename.parts[-4]
|
88 |
|
89 |
-
if folder not in
|
90 |
continue
|
91 |
|
92 |
-
labels =
|
93 |
|
94 |
random1 = random.random()
|
95 |
random2 = random.random()
|
|
|
37 |
file_dir = Path(args.file_dir)
|
38 |
file_dir.mkdir(exist_ok=True)
|
39 |
|
40 |
+
# label2_map = {
|
41 |
+
# "bell": "non_voice",
|
42 |
+
# "white_noise": "non_voice",
|
43 |
+
# "low_white_noise": "non_voice",
|
44 |
+
# "high_white_noise": "non_voice",
|
45 |
+
# "music": "non_voice",
|
46 |
+
# "mute": "non_voice",
|
47 |
+
# "noise": "non_voice",
|
48 |
+
# "noise_mute": "non_voice",
|
49 |
+
# "voice": "voice",
|
50 |
+
# "voicemail": "voice",
|
51 |
+
# }
|
52 |
# label3_map = {
|
53 |
# "bell": "voicemail",
|
54 |
# "white_noise": "mute",
|
|
|
61 |
# "voice": "voice_or_noise",
|
62 |
# "voicemail": "voicemail",
|
63 |
# }
|
64 |
+
label4_map = {
|
65 |
+
"bell": "voicemail",
|
66 |
+
"white_noise": "mute",
|
67 |
+
"low_white_noise": "mute",
|
68 |
+
"high_white_noise": "mute",
|
69 |
+
# "music": "music",
|
70 |
+
"mute": "mute",
|
71 |
+
"noise": "noise",
|
72 |
+
"noise_mute": "noise",
|
73 |
+
"voice": "voice_or_noise",
|
74 |
+
"voicemail": "voicemail",
|
75 |
+
}
|
76 |
# label8_map = {
|
77 |
# "bell": "bell",
|
78 |
# "white_noise": "white_noise",
|
|
|
98 |
folder = filename.parts[-2]
|
99 |
country = filename.parts[-4]
|
100 |
|
101 |
+
if folder not in label4_map.keys():
|
102 |
continue
|
103 |
|
104 |
+
labels = label4_map[folder]
|
105 |
|
106 |
random1 = random.random()
|
107 |
random2 = random.random()
|