Update dcase23-task2-enriched.py
Browse files- dcase23-task2-enriched.py +0 -32
dcase23-task2-enriched.py
CHANGED
@@ -65,13 +65,6 @@ DATASET = {
|
|
65 |
'dev': 'DCASE 2023 Challenge Task 2 Development Dataset',
|
66 |
}
|
67 |
|
68 |
-
_SPOTLIGHT_LAYOUT = "data/config-spotlight-layout.json"
|
69 |
-
|
70 |
-
_SPOTLIGHT_RENAME = {
|
71 |
-
"audio": "original_audio",
|
72 |
-
"path": "audio",
|
73 |
-
}
|
74 |
-
|
75 |
|
76 |
class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
77 |
"""BuilderConfig for DCASE2023Task2Dataset."""
|
@@ -81,8 +74,6 @@ class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
|
81 |
self.homepage = kwargs.pop("homepage", None)
|
82 |
self.data_urls = kwargs.pop("data_urls", None)
|
83 |
self.splits = kwargs.pop("splits", None)
|
84 |
-
self._rename = kwargs.pop("rename", None)
|
85 |
-
self._layout = kwargs.pop("layout", None)
|
86 |
description = (
|
87 |
f"Dataset for the DCASE 2023 Challenge Task 2 'First-Shot Unsupervised Anomalous Sound Detection "
|
88 |
f"for Machine Condition Monitoring'. released on {self.release_date}. Original data available under"
|
@@ -95,27 +86,6 @@ class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
|
95 |
description=description,
|
96 |
)
|
97 |
|
98 |
-
def to_spotlight(self, data: Union[pd.DataFrame, datasets.Dataset]) -> pd.DataFrame:
|
99 |
-
if type(data) == datasets.Dataset:
|
100 |
-
df = data.to_pandas()
|
101 |
-
df["split"] = data.split
|
102 |
-
df["config"] = data.config_name
|
103 |
-
|
104 |
-
class_names = data.features["class"].names
|
105 |
-
df["class_name"] = df["class"].apply(lambda x: class_names[x])
|
106 |
-
elif type(data) == pd.DataFrame:
|
107 |
-
df = data
|
108 |
-
else:
|
109 |
-
raise TypeError("type(data) not in Union[pd.DataFrame, datasets.Dataset]")
|
110 |
-
|
111 |
-
df["file_path"] = df["path"]
|
112 |
-
df.rename(columns=self._rename, inplace=True)
|
113 |
-
|
114 |
-
return df.copy()
|
115 |
-
|
116 |
-
def get_layout(self):
|
117 |
-
return self._layout
|
118 |
-
|
119 |
|
120 |
class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
121 |
"""Dataset for the DCASE 2023 Challenge Task 2 "First-Shot Unsupervised Anomalous Sound Detection
|
@@ -134,8 +104,6 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
134 |
data_urls=DATA_URLS[key],
|
135 |
release_date=stats["date"],
|
136 |
splits=stats["splits"],
|
137 |
-
layout=_SPOTLIGHT_LAYOUT,
|
138 |
-
rename=_SPOTLIGHT_RENAME,
|
139 |
)
|
140 |
for key, stats in STATS["configs"].items()
|
141 |
]
|
|
|
65 |
'dev': 'DCASE 2023 Challenge Task 2 Development Dataset',
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
70 |
"""BuilderConfig for DCASE2023Task2Dataset."""
|
|
|
74 |
self.homepage = kwargs.pop("homepage", None)
|
75 |
self.data_urls = kwargs.pop("data_urls", None)
|
76 |
self.splits = kwargs.pop("splits", None)
|
|
|
|
|
77 |
description = (
|
78 |
f"Dataset for the DCASE 2023 Challenge Task 2 'First-Shot Unsupervised Anomalous Sound Detection "
|
79 |
f"for Machine Condition Monitoring'. released on {self.release_date}. Original data available under"
|
|
|
86 |
description=description,
|
87 |
)
|
88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
90 |
class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
91 |
"""Dataset for the DCASE 2023 Challenge Task 2 "First-Shot Unsupervised Anomalous Sound Detection
|
|
|
104 |
data_urls=DATA_URLS[key],
|
105 |
release_date=stats["date"],
|
106 |
splits=stats["splits"],
|
|
|
|
|
107 |
)
|
108 |
for key, stats in STATS["configs"].items()
|
109 |
]
|