Delete loading script
Browse files
gtsrb.py
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
import datasets
|
2 |
-
from datasets.data_files import DataFilesDict
|
3 |
-
from datasets.packaged_modules.imagefolder.imagefolder import ImageFolder, ImageFolderConfig
|
4 |
-
|
5 |
-
logger = datasets.logging.get_logger(__name__)
|
6 |
-
|
7 |
-
|
8 |
-
class GTSRB(ImageFolder):
|
9 |
-
R"""
|
10 |
-
GTSRB dataset for image classification.
|
11 |
-
"""
|
12 |
-
|
13 |
-
BUILDER_CONFIG_CLASS = ImageFolderConfig
|
14 |
-
BUILDER_CONFIGS = [
|
15 |
-
ImageFolderConfig(name='default', features=("images", "labels"), data_files=DataFilesDict({split: f"data/{split}.zip" for split in ["train", "test"] + ["contrast", "gaussian_noise", "impulse_noise", "jpeg_compression", "motion_blur", "pixelate", "spatter"]}),)
|
16 |
-
]
|
17 |
-
|
18 |
-
|
19 |
-
classnames = [
|
20 |
-
"red and white circle 20 kph speed limit",
|
21 |
-
"red and white circle 30 kph speed limit",
|
22 |
-
"red and white circle 50 kph speed limit",
|
23 |
-
"red and white circle 60 kph speed limit",
|
24 |
-
"red and white circle 70 kph speed limit",
|
25 |
-
"red and white circle 80 kph speed limit",
|
26 |
-
"end / de-restriction of 80 kph speed limit",
|
27 |
-
"red and white circle 100 kph speed limit",
|
28 |
-
"red and white circle 120 kph speed limit",
|
29 |
-
"red and white circle red car and black car no passing",
|
30 |
-
"red and white circle red truck and black car no passing",
|
31 |
-
"red and white triangle road intersection warning",
|
32 |
-
"white and yellow diamond priority road",
|
33 |
-
"red and white upside down triangle yield right-of-way",
|
34 |
-
"stop",
|
35 |
-
"empty red and white circle",
|
36 |
-
"red and white circle no truck entry",
|
37 |
-
"red circle with white horizonal stripe no entry",
|
38 |
-
"red and white triangle with exclamation mark warning",
|
39 |
-
"red and white triangle with black left curve approaching warning",
|
40 |
-
"red and white triangle with black right curve approaching warning",
|
41 |
-
"red and white triangle with black double curve approaching warning",
|
42 |
-
"red and white triangle rough / bumpy road warning",
|
43 |
-
"red and white triangle car skidding / slipping warning",
|
44 |
-
"red and white triangle with merging / narrow lanes warning",
|
45 |
-
"red and white triangle with person digging / construction / road work warning",
|
46 |
-
"red and white triangle with traffic light approaching warning",
|
47 |
-
"red and white triangle with person walking warning",
|
48 |
-
"red and white triangle with child and person walking warning",
|
49 |
-
"red and white triangle with bicyle warning",
|
50 |
-
"red and white triangle with snowflake / ice warning",
|
51 |
-
"red and white triangle with deer warning",
|
52 |
-
"white circle with gray strike bar no speed limit",
|
53 |
-
"blue circle with white right turn arrow mandatory",
|
54 |
-
"blue circle with white left turn arrow mandatory",
|
55 |
-
"blue circle with white forward arrow mandatory",
|
56 |
-
"blue circle with white forward or right turn arrow mandatory",
|
57 |
-
"blue circle with white forward or left turn arrow mandatory",
|
58 |
-
"blue circle with white keep right arrow mandatory",
|
59 |
-
"blue circle with white keep left arrow mandatory",
|
60 |
-
"blue circle with white arrows indicating a traffic circle",
|
61 |
-
"white circle with gray strike bar indicating no passing for cars has ended",
|
62 |
-
"white circle with gray strike bar indicating no passing for trucks has ended",
|
63 |
-
]
|
64 |
-
|
65 |
-
clip_templates = [
|
66 |
-
lambda c: f'a zoomed in photo of a "{c}" traffic sign.',
|
67 |
-
lambda c: f'a centered photo of a "{c}" traffic sign.',
|
68 |
-
lambda c: f'a close up photo of a "{c}" traffic sign.',
|
69 |
-
]
|
70 |
-
|
71 |
-
def _info(self):
|
72 |
-
return datasets.DatasetInfo(
|
73 |
-
description="GTSRB dataset for image classification.",
|
74 |
-
features=datasets.Features(
|
75 |
-
{
|
76 |
-
"image": datasets.Image(),
|
77 |
-
"label": datasets.ClassLabel(names=self.classnames),
|
78 |
-
}
|
79 |
-
),
|
80 |
-
supervised_keys=("image", "label"),
|
81 |
-
task_templates=[datasets.ImageClassification(image_column="image", label_column="label")],
|
82 |
-
)
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|