moved spotlight variable in loading script
Browse files- dcase23-task2-enriched.py +38 -6
- spotlight_config.py +0 -32
dcase23-task2-enriched.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
import os
|
|
|
2 |
import datasets
|
3 |
import datasets.info
|
4 |
import pandas as pd
|
5 |
import numpy as np
|
|
|
6 |
from pathlib import Path
|
7 |
from datasets import load_dataset
|
8 |
from typing import Iterable, Dict, Optional, Union, List
|
9 |
-
from .spotlight_config import SPOTLIGHT_LAYOUTS, SPOTLIGHT_RENAME
|
10 |
|
11 |
|
12 |
_CITATION = """\
|
@@ -115,6 +116,38 @@ DATASET = {
|
|
115 |
'eval': 'DCASE 2023 Challenge Task 2 Evaluation Dataset',
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
|
120 |
class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
@@ -191,7 +224,6 @@ class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
|
191 |
return layout_json
|
192 |
|
193 |
|
194 |
-
|
195 |
class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
196 |
"""Dataset for the DCASE 2023 Challenge Task 2 "First-Shot Unsupervised Anomalous Sound Detection
|
197 |
for Machine Condition Monitoring"."""
|
@@ -210,7 +242,7 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
210 |
embeddings_urls=EMBEDDING_URLS[key],
|
211 |
release_date=stats["date"],
|
212 |
splits=stats["splits"],
|
213 |
-
layout=
|
214 |
rename=SPOTLIGHT_RENAME,
|
215 |
)
|
216 |
for key, stats in STATS["configs"].items()
|
@@ -221,15 +253,15 @@ class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
|
221 |
"audio": datasets.Audio(sampling_rate=16_000),
|
222 |
"path": datasets.Value("string"),
|
223 |
"section": datasets.Value("int64"),
|
|
|
|
|
|
|
224 |
"d1p": datasets.Value("string"),
|
225 |
"d1v": datasets.Value("string"),
|
226 |
"d2p": datasets.Value("string"),
|
227 |
"d2v": datasets.Value("string"),
|
228 |
"d3p": datasets.Value("string"),
|
229 |
"d3v": datasets.Value("string"),
|
230 |
-
"domain": datasets.ClassLabel(num_classes=2, names=["source", "target"]),
|
231 |
-
"label": datasets.ClassLabel(num_classes=_NUM_TARGETS, names=_TARGET_NAMES),
|
232 |
-
"class": datasets.ClassLabel(num_classes=_NUM_CLASSES, names=_CLASS_NAMES),
|
233 |
}
|
234 |
if self.config.embeddings_urls is not None:
|
235 |
features.update({
|
|
|
1 |
import os
|
2 |
+
import json
|
3 |
import datasets
|
4 |
import datasets.info
|
5 |
import pandas as pd
|
6 |
import numpy as np
|
7 |
+
import tempfile
|
8 |
from pathlib import Path
|
9 |
from datasets import load_dataset
|
10 |
from typing import Iterable, Dict, Optional, Union, List
|
|
|
11 |
|
12 |
|
13 |
_CITATION = """\
|
|
|
116 |
'eval': 'DCASE 2023 Challenge Task 2 Evaluation Dataset',
|
117 |
}
|
118 |
|
119 |
+
SPOTLIGHT_LAYOUTS = {
|
120 |
+
"standard": {"orientation": "vertical", "children": [
|
121 |
+
{"kind": "split", "weight": 51.96463654223969, "orientation": "horizontal", "children": [
|
122 |
+
{"kind": "tab", "weight": 60, "children": [{"kind": "widget", "name": "Table", "type": "table",
|
123 |
+
"config": {"tableView": "full",
|
124 |
+
"visibleColumns": ["class", "class_name", "config",
|
125 |
+
"d1p", "d1v", "d2p", "d2v", "d3p",
|
126 |
+
"d3v", "file_path", "label",
|
127 |
+
"section", "split"],
|
128 |
+
"sorting": None, "orderByRelevance": False}}]},
|
129 |
+
{"kind": "tab", "weight": 40, "children": [
|
130 |
+
{"kind": "widget", "name": "Similarity Map", "type": "similaritymap",
|
131 |
+
"config": {"placeBy": None, "reductionMethod": None, "colorBy": None, "sizeBy": None, "filter": False,
|
132 |
+
"umapNNeighbors": None, "umapMetric": None, "umapMinDist": None, "pcaNormalization": None,
|
133 |
+
"umapMenuLocalGlobalBalance": None, "umapMenuIsAdvanced": False}},
|
134 |
+
{"kind": "widget", "name": "Scatter Plot", "type": "scatterplot",
|
135 |
+
"config": {"xAxisColumn": None, "yAxisColumn": None, "colorBy": None, "sizeBy": None,
|
136 |
+
"filter": False}}, {"kind": "widget", "name": "Histogram", "type": "histogram",
|
137 |
+
"config": {"columnKey": None, "stackByColumnKey": None,
|
138 |
+
"filter": False}}]}]},
|
139 |
+
{"kind": "tab", "weight": 48.03536345776031, "children": [
|
140 |
+
{"kind": "widget", "name": "Inspector", "type": "inspector", "config": {"views": [
|
141 |
+
{"view": "AudioView", "columns": ["audio"], "name": "view",
|
142 |
+
"key": "9c37fe2d-6305-436b-b944-30dbda7b1f4d"},
|
143 |
+
{"view": "SpectrogramView", "columns": ["audio"], "name": "view",
|
144 |
+
"key": "9e676bb9-0b21-4214-806f-4e8c0f6db4c3"}], "visibleColumns": 4}}]}]}
|
145 |
+
}
|
146 |
+
|
147 |
+
SPOTLIGHT_RENAME = {
|
148 |
+
"audio": "original_audio",
|
149 |
+
"path": "audio",
|
150 |
+
}
|
151 |
|
152 |
|
153 |
class DCASE2023Task2DatasetConfig(datasets.BuilderConfig):
|
|
|
224 |
return layout_json
|
225 |
|
226 |
|
|
|
227 |
class DCASE2023Task2Dataset(datasets.GeneratorBasedBuilder):
|
228 |
"""Dataset for the DCASE 2023 Challenge Task 2 "First-Shot Unsupervised Anomalous Sound Detection
|
229 |
for Machine Condition Monitoring"."""
|
|
|
242 |
embeddings_urls=EMBEDDING_URLS[key],
|
243 |
release_date=stats["date"],
|
244 |
splits=stats["splits"],
|
245 |
+
layout=SPOTLIGHT_LAYOUTS,
|
246 |
rename=SPOTLIGHT_RENAME,
|
247 |
)
|
248 |
for key, stats in STATS["configs"].items()
|
|
|
253 |
"audio": datasets.Audio(sampling_rate=16_000),
|
254 |
"path": datasets.Value("string"),
|
255 |
"section": datasets.Value("int64"),
|
256 |
+
"domain": datasets.ClassLabel(num_classes=2, names=["source", "target"]),
|
257 |
+
"label": datasets.ClassLabel(num_classes=_NUM_TARGETS, names=_TARGET_NAMES),
|
258 |
+
"class": datasets.ClassLabel(num_classes=_NUM_CLASSES, names=_CLASS_NAMES),
|
259 |
"d1p": datasets.Value("string"),
|
260 |
"d1v": datasets.Value("string"),
|
261 |
"d2p": datasets.Value("string"),
|
262 |
"d2v": datasets.Value("string"),
|
263 |
"d3p": datasets.Value("string"),
|
264 |
"d3v": datasets.Value("string"),
|
|
|
|
|
|
|
265 |
}
|
266 |
if self.config.embeddings_urls is not None:
|
267 |
features.update({
|
spotlight_config.py
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
SPOTLIGHT_LAYOUTS = {
|
2 |
-
"standard": {"orientation": "vertical", "children": [
|
3 |
-
{"kind": "split", "weight": 51.96463654223969, "orientation": "horizontal", "children": [
|
4 |
-
{"kind": "tab", "weight": 60, "children": [{"kind": "widget", "name": "Table", "type": "table",
|
5 |
-
"config": {"tableView": "full",
|
6 |
-
"visibleColumns": ["class", "class_name", "config",
|
7 |
-
"d1p", "d1v", "d2p", "d2v", "d3p",
|
8 |
-
"d3v", "file_path", "label",
|
9 |
-
"section", "split"],
|
10 |
-
"sorting": None, "orderByRelevance": False}}]},
|
11 |
-
{"kind": "tab", "weight": 40, "children": [
|
12 |
-
{"kind": "widget", "name": "Similarity Map", "type": "similaritymap",
|
13 |
-
"config": {"placeBy": None, "reductionMethod": None, "colorBy": None, "sizeBy": None, "filter": False,
|
14 |
-
"umapNNeighbors": None, "umapMetric": None, "umapMinDist": None, "pcaNormalization": None,
|
15 |
-
"umapMenuLocalGlobalBalance": None, "umapMenuIsAdvanced": False}},
|
16 |
-
{"kind": "widget", "name": "Scatter Plot", "type": "scatterplot",
|
17 |
-
"config": {"xAxisColumn": None, "yAxisColumn": None, "colorBy": None, "sizeBy": None,
|
18 |
-
"filter": False}}, {"kind": "widget", "name": "Histogram", "type": "histogram",
|
19 |
-
"config": {"columnKey": None, "stackByColumnKey": None,
|
20 |
-
"filter": False}}]}]},
|
21 |
-
{"kind": "tab", "weight": 48.03536345776031, "children": [
|
22 |
-
{"kind": "widget", "name": "Inspector", "type": "inspector", "config": {"views": [
|
23 |
-
{"view": "AudioView", "columns": ["audio"], "name": "view",
|
24 |
-
"key": "9c37fe2d-6305-436b-b944-30dbda7b1f4d"},
|
25 |
-
{"view": "SpectrogramView", "columns": ["audio"], "name": "view",
|
26 |
-
"key": "9e676bb9-0b21-4214-806f-4e8c0f6db4c3"}], "visibleColumns": 4}}]}]}
|
27 |
-
}
|
28 |
-
|
29 |
-
SPOTLIGHT_RENAME = {
|
30 |
-
"audio": "original_audio",
|
31 |
-
"path": "audio",
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|