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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
---
|
10 |
|
11 |
# License Plates
|
|
|
6 |
- en
|
7 |
tags:
|
8 |
- finance
|
9 |
+
dataset_info:
|
10 |
+
- config_name: Brazil_youtube
|
11 |
+
features:
|
12 |
+
- name: image
|
13 |
+
dtype: image
|
14 |
+
- name: labeled_image
|
15 |
+
dtype: image
|
16 |
+
- name: bbox
|
17 |
+
dtype: string
|
18 |
+
- name: license_plate.id
|
19 |
+
dtype: string
|
20 |
+
- name: license_plate.visibility
|
21 |
+
dtype: string
|
22 |
+
- name: license_plate.rows_count
|
23 |
+
dtype: uint8
|
24 |
+
- name: license_plate.number
|
25 |
+
dtype: string
|
26 |
+
- name: license_plate.serial
|
27 |
+
dtype: string
|
28 |
+
- name: license_plate.country
|
29 |
+
dtype: string
|
30 |
+
- name: license_plate.mask
|
31 |
+
dtype: string
|
32 |
+
splits:
|
33 |
+
- name: train
|
34 |
+
num_bytes: 173536648
|
35 |
+
num_examples: 72
|
36 |
+
download_size: 22606962
|
37 |
+
dataset_size: 173536648
|
38 |
+
- config_name: Estonia_platesmania
|
39 |
+
features:
|
40 |
+
- name: image
|
41 |
+
dtype: image
|
42 |
+
- name: labeled_image
|
43 |
+
dtype: image
|
44 |
+
- name: bbox
|
45 |
+
dtype: string
|
46 |
+
- name: license_plate.id
|
47 |
+
dtype: string
|
48 |
+
- name: license_plate.visibility
|
49 |
+
dtype: string
|
50 |
+
- name: license_plate.rows_count
|
51 |
+
dtype: uint8
|
52 |
+
- name: license_plate.number
|
53 |
+
dtype: string
|
54 |
+
- name: license_plate.serial
|
55 |
+
dtype: string
|
56 |
+
- name: license_plate.country
|
57 |
+
dtype: string
|
58 |
+
- name: license_plate.mask
|
59 |
+
dtype: string
|
60 |
+
splits:
|
61 |
+
- name: train
|
62 |
+
num_bytes: 7990452
|
63 |
+
num_examples: 10
|
64 |
+
download_size: 7863164
|
65 |
+
dataset_size: 7990452
|
66 |
+
- config_name: Finland_platesmania
|
67 |
+
features:
|
68 |
+
- name: image
|
69 |
+
dtype: image
|
70 |
+
- name: labeled_image
|
71 |
+
dtype: image
|
72 |
+
- name: bbox
|
73 |
+
dtype: string
|
74 |
+
- name: license_plate.id
|
75 |
+
dtype: string
|
76 |
+
- name: license_plate.visibility
|
77 |
+
dtype: string
|
78 |
+
- name: license_plate.rows_count
|
79 |
+
dtype: uint8
|
80 |
+
- name: license_plate.number
|
81 |
+
dtype: string
|
82 |
+
- name: license_plate.serial
|
83 |
+
dtype: string
|
84 |
+
- name: license_plate.country
|
85 |
+
dtype: string
|
86 |
+
- name: license_plate.mask
|
87 |
+
dtype: string
|
88 |
+
splits:
|
89 |
+
- name: train
|
90 |
+
num_bytes: 9650579
|
91 |
+
num_examples: 10
|
92 |
+
download_size: 9485725
|
93 |
+
dataset_size: 9650579
|
94 |
+
- config_name: Kazakhstan_platesmania
|
95 |
+
features:
|
96 |
+
- name: image
|
97 |
+
dtype: image
|
98 |
+
- name: labeled_image
|
99 |
+
dtype: image
|
100 |
+
- name: bbox
|
101 |
+
dtype: string
|
102 |
+
- name: license_plate.id
|
103 |
+
dtype: string
|
104 |
+
- name: license_plate.visibility
|
105 |
+
dtype: string
|
106 |
+
- name: license_plate.rows_count
|
107 |
+
dtype: uint8
|
108 |
+
- name: license_plate.number
|
109 |
+
dtype: string
|
110 |
+
- name: license_plate.serial
|
111 |
+
dtype: string
|
112 |
+
- name: license_plate.country
|
113 |
+
dtype: string
|
114 |
+
- name: license_plate.mask
|
115 |
+
dtype: string
|
116 |
+
splits:
|
117 |
+
- name: train
|
118 |
+
num_bytes: 14064541
|
119 |
+
num_examples: 19
|
120 |
+
download_size: 7265915
|
121 |
+
dataset_size: 14064541
|
122 |
+
- config_name: Kazakhstan_youtube
|
123 |
+
features:
|
124 |
+
- name: image
|
125 |
+
dtype: image
|
126 |
+
- name: labeled_image
|
127 |
+
dtype: image
|
128 |
+
- name: bbox
|
129 |
+
dtype: string
|
130 |
+
- name: license_plate.id
|
131 |
+
dtype: string
|
132 |
+
- name: license_plate.visibility
|
133 |
+
dtype: string
|
134 |
+
- name: license_plate.rows_count
|
135 |
+
dtype: uint8
|
136 |
+
- name: license_plate.number
|
137 |
+
dtype: string
|
138 |
+
- name: license_plate.serial
|
139 |
+
dtype: string
|
140 |
+
- name: license_plate.country
|
141 |
+
dtype: string
|
142 |
+
- name: license_plate.mask
|
143 |
+
dtype: string
|
144 |
+
splits:
|
145 |
+
- name: train
|
146 |
+
num_bytes: 6324396
|
147 |
+
num_examples: 22
|
148 |
+
download_size: 2852873
|
149 |
+
dataset_size: 6324396
|
150 |
+
- config_name: Lithuania_platesmania
|
151 |
+
features:
|
152 |
+
- name: image
|
153 |
+
dtype: image
|
154 |
+
- name: labeled_image
|
155 |
+
dtype: image
|
156 |
+
- name: bbox
|
157 |
+
dtype: string
|
158 |
+
- name: license_plate.id
|
159 |
+
dtype: string
|
160 |
+
- name: license_plate.visibility
|
161 |
+
dtype: string
|
162 |
+
- name: license_plate.rows_count
|
163 |
+
dtype: uint8
|
164 |
+
- name: license_plate.number
|
165 |
+
dtype: string
|
166 |
+
- name: license_plate.serial
|
167 |
+
dtype: string
|
168 |
+
- name: license_plate.country
|
169 |
+
dtype: string
|
170 |
+
- name: license_plate.mask
|
171 |
+
dtype: string
|
172 |
+
splits:
|
173 |
+
- name: train
|
174 |
+
num_bytes: 8127614
|
175 |
+
num_examples: 10
|
176 |
+
download_size: 7940839
|
177 |
+
dataset_size: 8127614
|
178 |
+
- config_name: Serbia_platesmania
|
179 |
+
features:
|
180 |
+
- name: image
|
181 |
+
dtype: image
|
182 |
+
- name: labeled_image
|
183 |
+
dtype: image
|
184 |
+
- name: bbox
|
185 |
+
dtype: string
|
186 |
+
- name: license_plate.id
|
187 |
+
dtype: string
|
188 |
+
- name: license_plate.visibility
|
189 |
+
dtype: string
|
190 |
+
- name: license_plate.rows_count
|
191 |
+
dtype: uint8
|
192 |
+
- name: license_plate.number
|
193 |
+
dtype: string
|
194 |
+
- name: license_plate.serial
|
195 |
+
dtype: string
|
196 |
+
- name: license_plate.country
|
197 |
+
dtype: string
|
198 |
+
- name: license_plate.mask
|
199 |
+
dtype: string
|
200 |
+
splits:
|
201 |
+
- name: train
|
202 |
+
num_bytes: 10000777
|
203 |
+
num_examples: 10
|
204 |
+
download_size: 9808356
|
205 |
+
dataset_size: 10000777
|
206 |
+
- config_name: Serbia_youtube
|
207 |
+
features:
|
208 |
+
- name: image
|
209 |
+
dtype: image
|
210 |
+
- name: labeled_image
|
211 |
+
dtype: image
|
212 |
+
- name: bbox
|
213 |
+
dtype: string
|
214 |
+
- name: license_plate.id
|
215 |
+
dtype: string
|
216 |
+
- name: license_plate.visibility
|
217 |
+
dtype: string
|
218 |
+
- name: license_plate.rows_count
|
219 |
+
dtype: uint8
|
220 |
+
- name: license_plate.number
|
221 |
+
dtype: string
|
222 |
+
- name: license_plate.serial
|
223 |
+
dtype: string
|
224 |
+
- name: license_plate.country
|
225 |
+
dtype: string
|
226 |
+
- name: license_plate.mask
|
227 |
+
dtype: string
|
228 |
+
splits:
|
229 |
+
- name: train
|
230 |
+
num_bytes: 26535839
|
231 |
+
num_examples: 67
|
232 |
+
download_size: 4044272
|
233 |
+
dataset_size: 26535839
|
234 |
+
- config_name: UAE_platesmania
|
235 |
+
features:
|
236 |
+
- name: image
|
237 |
+
dtype: image
|
238 |
+
- name: labeled_image
|
239 |
+
dtype: image
|
240 |
+
- name: bbox
|
241 |
+
dtype: string
|
242 |
+
- name: license_plate.id
|
243 |
+
dtype: string
|
244 |
+
- name: license_plate.visibility
|
245 |
+
dtype: string
|
246 |
+
- name: license_plate.rows_count
|
247 |
+
dtype: uint8
|
248 |
+
- name: license_plate.number
|
249 |
+
dtype: string
|
250 |
+
- name: license_plate.serial
|
251 |
+
dtype: string
|
252 |
+
- name: license_plate.country
|
253 |
+
dtype: string
|
254 |
+
- name: license_plate.mask
|
255 |
+
dtype: string
|
256 |
+
splits:
|
257 |
+
- name: train
|
258 |
+
num_bytes: 8236358
|
259 |
+
num_examples: 10
|
260 |
+
download_size: 8028800
|
261 |
+
dataset_size: 8236358
|
262 |
+
- config_name: UAE_youtube
|
263 |
+
features:
|
264 |
+
- name: image
|
265 |
+
dtype: image
|
266 |
+
- name: labeled_image
|
267 |
+
dtype: image
|
268 |
+
- name: bbox
|
269 |
+
dtype: string
|
270 |
+
- name: license_plate.id
|
271 |
+
dtype: string
|
272 |
+
- name: license_plate.visibility
|
273 |
+
dtype: string
|
274 |
+
- name: license_plate.rows_count
|
275 |
+
dtype: uint8
|
276 |
+
- name: license_plate.number
|
277 |
+
dtype: string
|
278 |
+
- name: license_plate.serial
|
279 |
+
dtype: string
|
280 |
+
- name: license_plate.country
|
281 |
+
dtype: string
|
282 |
+
- name: license_plate.mask
|
283 |
+
dtype: string
|
284 |
+
splits:
|
285 |
+
- name: train
|
286 |
+
num_bytes: 41202317
|
287 |
+
num_examples: 162
|
288 |
+
download_size: 2666314
|
289 |
+
dataset_size: 41202317
|
290 |
---
|
291 |
|
292 |
# License Plates
|
license_plates.py
CHANGED
@@ -27,13 +27,16 @@ _DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/d
|
|
27 |
class LicensePlates(datasets.GeneratorBasedBuilder):
|
28 |
|
29 |
BUILDER_CONFIGS = [
|
30 |
-
datasets.BuilderConfig(name="
|
31 |
-
datasets.BuilderConfig(name="
|
32 |
-
datasets.BuilderConfig(name="
|
33 |
-
datasets.BuilderConfig(name="
|
34 |
-
datasets.BuilderConfig(name="
|
35 |
-
datasets.BuilderConfig(name="
|
36 |
-
datasets.BuilderConfig(name="
|
|
|
|
|
|
|
37 |
]
|
38 |
|
39 |
DEFAULT_CONFIG_NAME = "Brazil"
|
@@ -64,34 +67,29 @@ class LicensePlates(datasets.GeneratorBasedBuilder):
|
|
64 |
def _split_generators(self, dl_manager):
|
65 |
data = dl_manager.download(f"{_DATA}{self.config.name}.tar.gz")
|
66 |
data = dl_manager.iter_archive(data)
|
|
|
67 |
return [
|
68 |
datasets.SplitGenerator(name=datasets.Split.TRAIN,
|
69 |
-
gen_kwargs={
|
|
|
|
|
|
|
70 |
]
|
71 |
|
72 |
-
def _generate_examples(self, data):
|
73 |
|
74 |
-
annotations =
|
75 |
images = {}
|
76 |
|
77 |
for idx, (file_path, file) in enumerate(data):
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
if len(annotations) > 1:
|
88 |
-
annotations_df = pd.concat(annotations)
|
89 |
-
else:
|
90 |
-
annotations_df = annotations[0]
|
91 |
-
|
92 |
-
annotations_df.drop(
|
93 |
-
columns=['license_plate.region', 'license_plate.color'],
|
94 |
-
inplace=True)
|
95 |
|
96 |
for row in annotations_df.itertuples(index=False):
|
97 |
image = images[row[0]]
|
|
|
27 |
class LicensePlates(datasets.GeneratorBasedBuilder):
|
28 |
|
29 |
BUILDER_CONFIGS = [
|
30 |
+
datasets.BuilderConfig(name="Brazil_youtube"),
|
31 |
+
datasets.BuilderConfig(name="Estonia_platesmania"),
|
32 |
+
datasets.BuilderConfig(name="Finland_platesmania"),
|
33 |
+
datasets.BuilderConfig(name="Kazakhstan_platesmania"),
|
34 |
+
datasets.BuilderConfig(name="Kazakhstan_youtube"),
|
35 |
+
datasets.BuilderConfig(name="Lithuania_platesmania"),
|
36 |
+
datasets.BuilderConfig(name="Serbia_platesmania"),
|
37 |
+
datasets.BuilderConfig(name="Serbia_youtube"),
|
38 |
+
datasets.BuilderConfig(name="UAE_platesmania"),
|
39 |
+
datasets.BuilderConfig(name="UAE_youtube")
|
40 |
]
|
41 |
|
42 |
DEFAULT_CONFIG_NAME = "Brazil"
|
|
|
67 |
def _split_generators(self, dl_manager):
|
68 |
data = dl_manager.download(f"{_DATA}{self.config.name}.tar.gz")
|
69 |
data = dl_manager.iter_archive(data)
|
70 |
+
annotations = dl_manager.download(f'{_DATA}{self.config.name}.csv')
|
71 |
return [
|
72 |
datasets.SplitGenerator(name=datasets.Split.TRAIN,
|
73 |
+
gen_kwargs={
|
74 |
+
"data": data,
|
75 |
+
'annotations': annotations
|
76 |
+
}),
|
77 |
]
|
78 |
|
79 |
+
def _generate_examples(self, data, annotations):
|
80 |
|
81 |
+
annotations_df = pd.read_csv(annotations, sep=',', index_col=0)
|
82 |
images = {}
|
83 |
|
84 |
for idx, (file_path, file) in enumerate(data):
|
85 |
+
file_name = file_path.split('/')[-1]
|
86 |
+
images[file_name] = (file_path, file.read())
|
87 |
+
|
88 |
+
annotations_df.drop(columns=['license_plate.region', 'license_plate.color'],
|
89 |
+
inplace=True,
|
90 |
+
errors='ignore')
|
91 |
+
|
92 |
+
annotations_df.fillna(0, inplace=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
for row in annotations_df.itertuples(index=False):
|
95 |
image = images[row[0]]
|