Datasets:

Size Categories:
10K<n<100K
Language Creators:
found
Annotations Creators:
crowdsourced
Source Datasets:
original
Tags:
License:
Bazyl commited on
Commit
6c041cc
1 Parent(s): f5d9aec

first version

Browse files
datasets/huggingface/dummy/gtsrb/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61cb8c9824a59a6fa68b29f6fcaa85103f1bb90f34a984fe901bce78a3292773
3
+ size 120
gtsrb.py ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # Lint as: python3
17
+ """GTSRB: German Traffic Sign Recognition Benchmark."""
18
+
19
+
20
+ import csv
21
+ import pandas as pd
22
+
23
+ import datasets
24
+ from datasets import Dataset, DatasetDict
25
+
26
+ import os
27
+
28
+
29
+ logger = datasets.logging.get_logger(__name__)
30
+
31
+ # df_train = pd.read_csv('Test.csv')
32
+ # df_test = pd.read_csv('Train.csv')
33
+
34
+ # train = Dataset.from_pandas(df_train)
35
+ # test = Dataset.from_pandas(df_test)
36
+
37
+ # dataset = DatasetDict()
38
+
39
+ # dataset['train'] = train
40
+ # dataset['test'] = test
41
+
42
+ _CITATION = """\
43
+ @article
44
+ {
45
+ Stallkamp2012,
46
+ title = "Man vs. computer: Benchmarking machine learning algorithms for traffic sign recognition",
47
+ journal = "Neural Networks",
48
+ volume = "",
49
+ number = "0",
50
+ pages = " - ",
51
+ year = "2012",
52
+ note = "",
53
+ issn = "0893-6080",
54
+ doi = "10.1016/j.neunet.2012.02.016",
55
+ url = "http://www.sciencedirect.com/science/article/pii/S0893608012000457",
56
+ author = "J. Stallkamp and M. Schlipsing and J. Salmen and C. Igel",
57
+ keywords = "Traffic sign recognition",
58
+ keywords = "Machine learning",
59
+ keywords = "Convolutional neural networks",
60
+ keywords = "Benchmarking"
61
+ }
62
+ """
63
+
64
+ _DESCRIPTION = """\
65
+ Recognition of traffic signs is a challenging real-world problem of high industrial relevance. Although commercial systems have reached the market and several studies on this topic have been published, systematic unbiased comparisons of different approaches are missing and comprehensive benchmark datasets are not freely available. \
66
+ Traffic sign recognition is a multi-class classification problem with unbalanced class frequencies. Traffic signs can provide a wide range of variations between classes in terms of color, shape, and the presence of pictograms or text. However, there exist subsets of classes (e. g., speed limit signs) that are very similar to each other. \
67
+ The classifer has to cope with large variations in visual appearances due to illumination changes, partial occlusions, rotations, weather conditions, etc. \
68
+ Humans are capable of recognizing the large variety of existing road signs with close to 100% correctness. This does not only apply to real-world driving, which provides both context and multiple views of a single traffic sign, but also to the recognition from single images.
69
+ """
70
+
71
+ _FEATURES = datasets.Features({
72
+ "Width": datasets.Value("uint16"),
73
+ "Height": datasets.Value("uint8"),
74
+ "Roi.X1": datasets.Value("uint8"),
75
+ "Roi.Y1": datasets.Value("uint8"),
76
+ "Roi.X2": datasets.Value("uint8"),
77
+ "Roi.Y2": datasets.Value("uint8"),
78
+ "ClassId": datasets.Value("uint8"),
79
+ "Path": datasets.Value("string"),
80
+ })
81
+
82
+ _URL = "https://github.com/bazylhorsey/gtsrb/archive/refs/tags/0.0.0.tar.gz"
83
+
84
+
85
+
86
+
87
+ class GTSRBConfig(datasets.BuilderConfig):
88
+ """BuilderConfig for GTSRB."""
89
+
90
+ def __init__(self, **kwargs):
91
+ """BuilderConfig for GTSRB.
92
+ Args:
93
+ **kwargs: keyword arguments forwarded to super.
94
+ """
95
+ super(GTSRBConfig, self).__init__(**kwargs)
96
+
97
+
98
+ class GTSRB(datasets.GeneratorBasedBuilder):
99
+ """GTSRB: German Traffic Sign Recognition Benchmark."""
100
+
101
+ BUILDER_CONFIGS = [
102
+ GTSRBConfig(
103
+ name="gtsrb",
104
+ version=datasets.Version("0.0.0", ""),
105
+ description="GTSRB: German Traffic Sign Recognition Benchmark.",
106
+ ),
107
+ ]
108
+
109
+ def _info(self):
110
+ return datasets.DatasetInfo(
111
+ description=_DESCRIPTION,
112
+ features=_FEATURES,
113
+ # No default supervised_keys (as we have to pass both question
114
+ # and context as input).
115
+ supervised_keys=None,
116
+ homepage="https://benchmark.ini.rub.de/gtsrb_news.html",
117
+ citation=_CITATION,
118
+ license="gnu public license",
119
+ )
120
+
121
+ def _split_generators(self, dl_manager):
122
+ # downloaded_files = dl_manager.download_and_extract(_URLS)
123
+ # print(downloaded_files)
124
+ return [
125
+ datasets.SplitGenerator(
126
+ name=datasets.Split.TRAIN,
127
+ gen_kwargs={
128
+ "filepath": "Train.csv",
129
+ },
130
+ ),
131
+ datasets.SplitGenerator(
132
+ name=datasets.Split.TEST,
133
+ gen_kwargs={
134
+ "filepath": "Test.csv",
135
+ }
136
+ ),
137
+ ]
138
+
139
+ def _generate_examples(self, filepath):
140
+ """This function returns the examples in the raw (text) form."""
141
+ # logger.info("generating examples from = %s", filepath)
142
+ # key = 0
143
+ # with open(filepath, encoding="utf-8") as f:
144
+ # GTSRB = csv.reader(f)
145
+ # for article in GTSRB["data"]:
146
+ # title = article.get("title", "")
147
+ # for paragraph in article["paragraphs"]:
148
+ # context = paragraph["context"] # do not strip leading blank spaces GH-2585
149
+ # for qa in paragraph["qas"]:
150
+ # answer_starts = [answer["answer_start"] for answer in qa["answers"]]
151
+ # answers = [answer["text"] for answer in qa["answers"]]
152
+ # # Features currently used are "context", "question", and "answers".
153
+ # # Others are extracted here for the ease of future expansions.
154
+ # yield key, {
155
+ # "title": title,
156
+ # "context": context,
157
+ # "question": qa["question"],
158
+ # "id": qa["id"],
159
+ # "answers": {
160
+ # "answer_start": answer_starts,
161
+ # "text": answers,
162
+ # },
163
+ # }
164
+ # key += 1
165
+ with open(filepath, encoding="utf-8") as f:
166
+ reader = csv.reader(f)
167
+ for id_, row in enumerate(reader):
168
+ if id_ == 0:
169
+ continue
170
+ yield id_, {
171
+ "Width": int(row[0]),
172
+ "Height": int(row[1]),
173
+ "Roi.X1": int(row[2]),
174
+ "Roi.Y1": int(row[3]),
175
+ "Roi.X2": int(row[4]),
176
+ "Roi.Y2": int(row[5]),
177
+ "ClassId": int(row[6]),
178
+ "Path": row[7],
179
+ }