Datasets:
Tasks:
Image Classification
Formats:
parquet
Sub-tasks:
multi-label-image-classification
Size:
10K - 100K
License:
Bazyl
commited on
Commit
•
3084203
1
Parent(s):
cadced2
lfs
Browse files- .gitattributes +7 -0
- Meta.csv +3 -44
- Test.csv +0 -0
- Train.csv +0 -0
- dataset_infos.json +2 -2
- gtsrb.py +36 -17
.gitattributes
CHANGED
@@ -36,3 +36,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
36 |
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.wav filter=lfs diff=lfs merge=lfs -text
|
38 |
dataset_infos.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.wav filter=lfs diff=lfs merge=lfs -text
|
38 |
dataset_infos.json filter=lfs diff=lfs merge=lfs -text
|
39 |
+
Test filter=lfs diff=lfs merge=lfs -text
|
40 |
+
Train filter=lfs diff=lfs merge=lfs -text
|
41 |
+
test filter=lfs diff=lfs merge=lfs -text
|
42 |
+
train filter=lfs diff=lfs merge=lfs -text
|
43 |
+
Meta.csv filter=lfs diff=lfs merge=lfs -text
|
44 |
+
Test.csv filter=lfs diff=lfs merge=lfs -text
|
45 |
+
Train.csv filter=lfs diff=lfs merge=lfs -text
|
Meta.csv
CHANGED
@@ -1,44 +1,3 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
Meta/1.png,1,1,0,3.29
|
5 |
-
Meta/10.png,10,1,0,3.27
|
6 |
-
Meta/11.png,11,0,0,1.22
|
7 |
-
Meta/12.png,12,2,2,2.3
|
8 |
-
Meta/13.png,13,4,0,2.1
|
9 |
-
Meta/14.png,14,3,0,2.2
|
10 |
-
Meta/15.png,15,1,0,3.1
|
11 |
-
Meta/16.png,16,1,0,3.3
|
12 |
-
Meta/17.png,17,1,0,3.21
|
13 |
-
Meta/18.png,18,0,0,1.39
|
14 |
-
Meta/19.png,19,0,0,1.2
|
15 |
-
Meta/2.png,2,1,0,3.29
|
16 |
-
Meta/20.png,20,0,0,1.1
|
17 |
-
Meta/21.png,21,0,0,1.3.2
|
18 |
-
Meta/22.png,22,0,0,1.1
|
19 |
-
Meta/23.png,23,0,0,1.13
|
20 |
-
Meta/24.png,24,0,0,1.5.2
|
21 |
-
Meta/25.png,25,0,0,1.37
|
22 |
-
Meta/26.png,26,0,0,1.24
|
23 |
-
Meta/28.png,28,0,0,1.33
|
24 |
-
Meta/29.png,29,0,0,1.34
|
25 |
-
Meta/3.png,3,1,0,3.29
|
26 |
-
Meta/30.png,30,0,0,None
|
27 |
-
Meta/31.png,31,0,0,1.36
|
28 |
-
Meta/32.png,32,1,3,3.42
|
29 |
-
Meta/33.png,33,1,1,4.2
|
30 |
-
Meta/34.png,34,1,1,4.3
|
31 |
-
Meta/35.png,35,1,1,4.1
|
32 |
-
Meta/36.png,36,1,1,4.4
|
33 |
-
Meta/37.png,37,1,1,4.5
|
34 |
-
Meta/38.png,38,1,1,4.7
|
35 |
-
Meta/39.png,39,1,1,4.8
|
36 |
-
Meta/4.png,4,1,0,3.29
|
37 |
-
Meta/40.png,40,1,1,4.1
|
38 |
-
Meta/41.png,41,1,3,3.26
|
39 |
-
Meta/42.png,42,1,3,3.28
|
40 |
-
Meta/5.png,5,1,0,3.29
|
41 |
-
Meta/6.png,6,1,3,3.3
|
42 |
-
Meta/7.png,7,1,0,3.29
|
43 |
-
Meta/8.png,8,1,0,3.29
|
44 |
-
Meta/9.png,9,1,0,3.25
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:50b90aed8f9d4f071f841c3f2a92e4fc0378275fb6c7770849ec9f5937fc9cce
|
3 |
+
size 1033
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Test.csv
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
Train.csv
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
dataset_infos.json
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9eee3b1780fa2e64c2be9c1d0faf0984dabfa6fa8278ad4feb00518361aa8877
|
3 |
+
size 6646
|
gtsrb.py
CHANGED
@@ -21,6 +21,7 @@ import datasets
|
|
21 |
from datasets import Dataset, DatasetDict
|
22 |
|
23 |
import os
|
|
|
24 |
|
25 |
|
26 |
logger = datasets.logging.get_logger(__name__)
|
@@ -72,11 +73,13 @@ _FEATURES = datasets.Features({
|
|
72 |
"Roi.Y1": datasets.Value("uint8"),
|
73 |
"Roi.X2": datasets.Value("uint8"),
|
74 |
"Roi.Y2": datasets.Value("uint8"),
|
75 |
-
"ClassId": datasets.
|
76 |
"Path": datasets.Image("png"),
|
77 |
# "Path": datasets.Value("string"),
|
78 |
})
|
79 |
|
|
|
|
|
80 |
_URL = "https://github.com/bazylhorsey/gtsrb/archive/refs/tags/0.0.0.tar.gz"
|
81 |
|
82 |
|
@@ -119,27 +122,31 @@ class GTSRB(datasets.GeneratorBasedBuilder):
|
|
119 |
homepage="https://benchmark.ini.rub.de/gtsrb_news.html",
|
120 |
citation=_CITATION,
|
121 |
license="gnu public license",
|
|
|
|
|
122 |
)
|
123 |
|
124 |
def _split_generators(self, dl_manager):
|
|
|
125 |
|
126 |
-
print("success")
|
127 |
return [
|
128 |
datasets.SplitGenerator(
|
129 |
name=datasets.Split.TRAIN,
|
130 |
gen_kwargs={
|
131 |
"filepath": "Train.csv",
|
|
|
132 |
},
|
133 |
),
|
134 |
datasets.SplitGenerator(
|
135 |
name=datasets.Split.TEST,
|
136 |
gen_kwargs={
|
137 |
"filepath": "Test.csv",
|
|
|
138 |
}
|
139 |
),
|
140 |
]
|
141 |
|
142 |
-
def _generate_examples(self, filepath):
|
143 |
"""This function returns the examples in the raw (text) form."""
|
144 |
# logger.info("generating examples from = %s", filepath)
|
145 |
# key = 0
|
@@ -165,18 +172,30 @@ class GTSRB(datasets.GeneratorBasedBuilder):
|
|
165 |
# },
|
166 |
# }
|
167 |
# key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
with open(filepath, encoding="utf-8") as f:
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
"
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
"Roi.Y2": int(row[5]),
|
180 |
-
"ClassId": int(row[6]),
|
181 |
-
"Path": str(row[7]),
|
182 |
-
}
|
|
|
21 |
from datasets import Dataset, DatasetDict
|
22 |
|
23 |
import os
|
24 |
+
from datasets.tasks import ImageClassification
|
25 |
|
26 |
|
27 |
logger = datasets.logging.get_logger(__name__)
|
|
|
73 |
"Roi.Y1": datasets.Value("uint8"),
|
74 |
"Roi.X2": datasets.Value("uint8"),
|
75 |
"Roi.Y2": datasets.Value("uint8"),
|
76 |
+
"ClassId": datasets.ClassLabel(num_classes=43),
|
77 |
"Path": datasets.Image("png"),
|
78 |
# "Path": datasets.Value("string"),
|
79 |
})
|
80 |
|
81 |
+
_IMAGES_DIR = "GTSRB/Images"
|
82 |
+
|
83 |
_URL = "https://github.com/bazylhorsey/gtsrb/archive/refs/tags/0.0.0.tar.gz"
|
84 |
|
85 |
|
|
|
122 |
homepage="https://benchmark.ini.rub.de/gtsrb_news.html",
|
123 |
citation=_CITATION,
|
124 |
license="gnu public license",
|
125 |
+
task_templates=[ImageClassification(image_column="Path", label_column="ClassId")],
|
126 |
+
|
127 |
)
|
128 |
|
129 |
def _split_generators(self, dl_manager):
|
130 |
+
archive_path = dl_manager.download(_URL)
|
131 |
|
|
|
132 |
return [
|
133 |
datasets.SplitGenerator(
|
134 |
name=datasets.Split.TRAIN,
|
135 |
gen_kwargs={
|
136 |
"filepath": "Train.csv",
|
137 |
+
"images": dl_manager.startswith("GTSRB/Train/").iter_archive(archive_path),
|
138 |
},
|
139 |
),
|
140 |
datasets.SplitGenerator(
|
141 |
name=datasets.Split.TEST,
|
142 |
gen_kwargs={
|
143 |
"filepath": "Test.csv",
|
144 |
+
"images": dl_manager.startswith("GTSRB/Test/").iter_archive(archive_path),
|
145 |
}
|
146 |
),
|
147 |
]
|
148 |
|
149 |
+
def _generate_examples(self, images, filepath):
|
150 |
"""This function returns the examples in the raw (text) form."""
|
151 |
# logger.info("generating examples from = %s", filepath)
|
152 |
# key = 0
|
|
|
172 |
# },
|
173 |
# }
|
174 |
# key += 1
|
175 |
+
# with open(filepath, encoding="utf-8") as f:
|
176 |
+
# reader = csv.reader(f)
|
177 |
+
# for id_, row in enumerate(reader):
|
178 |
+
# if id_ == 0:
|
179 |
+
# continue
|
180 |
+
# yield id_, {
|
181 |
+
# "Width": int(row[0]),
|
182 |
+
# "Height": int(row[1]),
|
183 |
+
# "Roi.X1": int(row[2]),
|
184 |
+
# "Roi.Y1": int(row[3]),
|
185 |
+
# "Roi.X2": int(row[4]),
|
186 |
+
# "Roi.Y2": int(row[5]),
|
187 |
+
# "ClassId": int(row[6]),
|
188 |
+
# "Path": str(row[7]),
|
189 |
+
# }
|
190 |
+
|
191 |
with open(filepath, encoding="utf-8") as f:
|
192 |
+
files_to_keep = set(f.read().split("\n"))
|
193 |
+
for file_path, file_obj in images:
|
194 |
+
print(file_path, file_obj)
|
195 |
+
if file_path.startswith(_IMAGES_DIR):
|
196 |
+
if file_path[len(_IMAGES_DIR) : -len(".jpg")] in files_to_keep:
|
197 |
+
label = file_path.split("/")[2]
|
198 |
+
yield file_path, {
|
199 |
+
"image": {"path": file_path, "bytes": file_obj.read()},
|
200 |
+
"label": label,
|
201 |
+
}
|
|
|
|
|
|
|
|