fix: annotations and script
Browse files- data/annotations.xml +30 -30
- race-numbers-detection-and-ocr.py +155 -0
data/annotations.xml
CHANGED
@@ -35,7 +35,7 @@
|
|
35 |
</task>
|
36 |
<dumped>2023-09-04 06:26:42.695828+00:00</dumped>
|
37 |
</meta>
|
38 |
-
<image id="0" name="
|
39 |
<box label="number" source="manual" occluded="0" xtl="766.66" ytl="491.26" xbr="813.76" ybr="511.28" rotation="5.50" z_order="0">
|
40 |
<attribute name="text">349</attribute>
|
41 |
</box>
|
@@ -49,7 +49,7 @@
|
|
49 |
<attribute name="text">100</attribute>
|
50 |
</box>
|
51 |
</image>
|
52 |
-
<image id="1" name="
|
53 |
<box label="number" source="manual" occluded="0" xtl="2692.87" ytl="1453.80" xbr="2971.57" ybr="1584.97" z_order="0">
|
54 |
<attribute name="text">1651</attribute>
|
55 |
</box>
|
@@ -57,7 +57,7 @@
|
|
57 |
<attribute name="text">279</attribute>
|
58 |
</box>
|
59 |
</image>
|
60 |
-
<image id="10" name="
|
61 |
<box label="number" source="manual" occluded="0" xtl="584.70" ytl="397.95" xbr="642.02" ybr="435.70" z_order="0">
|
62 |
<attribute name="text">45</attribute>
|
63 |
</box>
|
@@ -71,7 +71,7 @@
|
|
71 |
<attribute name="text">137</attribute>
|
72 |
</box>
|
73 |
</image>
|
74 |
-
<image id="11" name="
|
75 |
<box label="number" source="manual" occluded="0" xtl="1366.93" ytl="505.87" xbr="1421.70" ybr="535.12" rotation="349.50" z_order="0">
|
76 |
<attribute name="text">3885</attribute>
|
77 |
</box>
|
@@ -91,7 +91,7 @@
|
|
91 |
<attribute name="text">3411</attribute>
|
92 |
</box>
|
93 |
</image>
|
94 |
-
<image id="12" name="
|
95 |
<box label="number" source="manual" occluded="0" xtl="68.24" ytl="448.10" xbr="103.58" ybr="463.40" rotation="4.30" z_order="0">
|
96 |
<attribute name="text">2650</attribute>
|
97 |
</box>
|
@@ -123,7 +123,7 @@
|
|
123 |
<attribute name="text">2862</attribute>
|
124 |
</box>
|
125 |
</image>
|
126 |
-
<image id="13" name="
|
127 |
<box label="number" source="manual" occluded="0" xtl="606.30" ytl="448.69" xbr="656.20" ybr="470.78" rotation="353.90" z_order="0">
|
128 |
<attribute name="text">3261</attribute>
|
129 |
</box>
|
@@ -134,7 +134,7 @@
|
|
134 |
<attribute name="text">3268</attribute>
|
135 |
</box>
|
136 |
</image>
|
137 |
-
<image id="14" name="
|
138 |
<box label="number" source="manual" occluded="0" xtl="99.58" ytl="522.22" xbr="179.58" ybr="551.30" rotation="356.70" z_order="0">
|
139 |
<attribute name="text">25753</attribute>
|
140 |
</box>
|
@@ -145,7 +145,7 @@
|
|
145 |
<attribute name="text">17512</attribute>
|
146 |
</box>
|
147 |
</image>
|
148 |
-
<image id="15" name="
|
149 |
<box label="number" source="manual" occluded="0" xtl="2267.19" ytl="1186.42" xbr="2392.96" ybr="1239.71" rotation="348.90" z_order="0">
|
150 |
<attribute name="text">365</attribute>
|
151 |
</box>
|
@@ -159,7 +159,7 @@
|
|
159 |
<attribute name="text">366</attribute>
|
160 |
</box>
|
161 |
</image>
|
162 |
-
<image id="16" name="
|
163 |
<box label="number" source="manual" occluded="0" xtl="872.32" ytl="330.20" xbr="902.92" ybr="340.70" z_order="0">
|
164 |
<attribute name="text">6216</attribute>
|
165 |
</box>
|
@@ -176,7 +176,7 @@
|
|
176 |
<attribute name="text">6251</attribute>
|
177 |
</box>
|
178 |
</image>
|
179 |
-
<image id="17" name="
|
180 |
<box label="number" source="manual" occluded="0" xtl="370.67" ytl="349.40" xbr="398.24" ybr="363.81" z_order="0">
|
181 |
<attribute name="text">200</attribute>
|
182 |
</box>
|
@@ -184,7 +184,7 @@
|
|
184 |
<attribute name="text">2224</attribute>
|
185 |
</box>
|
186 |
</image>
|
187 |
-
<image id="18" name="
|
188 |
<box label="number" source="manual" occluded="0" xtl="1199.81" ytl="862.11" xbr="1257.72" ybr="884.57" rotation="352.60" z_order="0">
|
189 |
<attribute name="text">62233</attribute>
|
190 |
</box>
|
@@ -219,7 +219,7 @@
|
|
219 |
<attribute name="text">36676</attribute>
|
220 |
</box>
|
221 |
</image>
|
222 |
-
<image id="19" name="
|
223 |
<box label="number" source="manual" occluded="0" xtl="292.27" ytl="600.19" xbr="339.70" ybr="616.40" z_order="0">
|
224 |
<attribute name="text">3723</attribute>
|
225 |
</box>
|
@@ -236,7 +236,7 @@
|
|
236 |
<attribute name="text">4277</attribute>
|
237 |
</box>
|
238 |
</image>
|
239 |
-
<image id="2" name="
|
240 |
<box label="number" source="manual" occluded="0" xtl="368.62" ytl="331.89" xbr="417.33" ybr="348.59" z_order="0">
|
241 |
<attribute name="text">2333</attribute>
|
242 |
</box>
|
@@ -262,7 +262,7 @@
|
|
262 |
<attribute name="text">2297</attribute>
|
263 |
</box>
|
264 |
</image>
|
265 |
-
<image id="20" name="
|
266 |
<box label="number" source="manual" occluded="0" xtl="539.10" ytl="349.03" xbr="589.00" ybr="366.23" rotation="355.90" z_order="0">
|
267 |
<attribute name="text">3529</attribute>
|
268 |
</box>
|
@@ -285,7 +285,7 @@
|
|
285 |
<attribute name="text">3038</attribute>
|
286 |
</box>
|
287 |
</image>
|
288 |
-
<image id="21" name="
|
289 |
<box label="number" source="manual" occluded="0" xtl="859.74" ytl="451.78" xbr="931.72" ybr="483.56" rotation="354.30" z_order="0">
|
290 |
<attribute name="text">18372</attribute>
|
291 |
</box>
|
@@ -296,7 +296,7 @@
|
|
296 |
<attribute name="text">16204</attribute>
|
297 |
</box>
|
298 |
</image>
|
299 |
-
<image id="22" name="
|
300 |
<box label="number" source="manual" occluded="0" xtl="703.48" ytl="480.33" xbr="740.26" ybr="500.24" rotation="355.90" z_order="0">
|
301 |
<attribute name="text">973</attribute>
|
302 |
</box>
|
@@ -313,7 +313,7 @@
|
|
313 |
<attribute name="text">2178</attribute>
|
314 |
</box>
|
315 |
</image>
|
316 |
-
<image id="23" name="
|
317 |
<box label="number" source="manual" occluded="0" xtl="1009.50" ytl="506.71" xbr="1055.07" ybr="523.50" rotation="353.90" z_order="0">
|
318 |
<attribute name="text">1514</attribute>
|
319 |
</box>
|
@@ -330,7 +330,7 @@
|
|
330 |
<attribute name="text">1541</attribute>
|
331 |
</box>
|
332 |
</image>
|
333 |
-
<image id="24" name="
|
334 |
<box label="number" source="manual" occluded="0" xtl="475.10" ytl="508.57" xbr="545.50" ybr="532.70" z_order="0">
|
335 |
<attribute name="text">11499</attribute>
|
336 |
</box>
|
@@ -341,7 +341,7 @@
|
|
341 |
<attribute name="text">12839</attribute>
|
342 |
</box>
|
343 |
</image>
|
344 |
-
<image id="25" name="
|
345 |
<box label="number" source="manual" occluded="0" xtl="23.37" ytl="575.20" xbr="133.21" ybr="621.80" z_order="0">
|
346 |
<attribute name="text">8622</attribute>
|
347 |
</box>
|
@@ -352,7 +352,7 @@
|
|
352 |
<attribute name="text">7671</attribute>
|
353 |
</box>
|
354 |
</image>
|
355 |
-
<image id="26" name="
|
356 |
<box label="number" source="manual" occluded="0" xtl="234.51" ytl="711.77" xbr="312.78" ybr="740.30" rotation="3.70" z_order="0">
|
357 |
<attribute name="text">1897</attribute>
|
358 |
</box>
|
@@ -363,7 +363,7 @@
|
|
363 |
<attribute name="text">1480</attribute>
|
364 |
</box>
|
365 |
</image>
|
366 |
-
<image id="27" name="
|
367 |
<box label="number" source="manual" occluded="0" xtl="196.08" ytl="318.90" xbr="222.52" ybr="328.24" rotation="1.20" z_order="0">
|
368 |
<attribute name="text">4759</attribute>
|
369 |
</box>
|
@@ -383,7 +383,7 @@
|
|
383 |
<attribute name="text">1145</attribute>
|
384 |
</box>
|
385 |
</image>
|
386 |
-
<image id="28" name="
|
387 |
<box label="number" source="manual" occluded="0" xtl="1142.60" ytl="478.86" xbr="1223.15" ybr="508.37" rotation="6.60" z_order="0">
|
388 |
<attribute name="text">3799</attribute>
|
389 |
</box>
|
@@ -400,7 +400,7 @@
|
|
400 |
<attribute name="text">3653</attribute>
|
401 |
</box>
|
402 |
</image>
|
403 |
-
<image id="29" name="
|
404 |
<box label="number" source="manual" occluded="0" xtl="1100.08" ytl="660.00" xbr="1186.22" ybr="687.50" rotation="2.00" z_order="0">
|
405 |
<attribute name="text">12214</attribute>
|
406 |
</box>
|
@@ -423,7 +423,7 @@
|
|
423 |
<attribute name="text">12167</attribute>
|
424 |
</box>
|
425 |
</image>
|
426 |
-
<image id="3" name="
|
427 |
<box label="number" source="manual" occluded="0" xtl="777.00" ytl="225.99" xbr="858.20" ybr="256.37" rotation="1.10" z_order="0">
|
428 |
<attribute name="text">5505</attribute>
|
429 |
</box>
|
@@ -437,7 +437,7 @@
|
|
437 |
<attribute name="text">473</attribute>
|
438 |
</box>
|
439 |
</image>
|
440 |
-
<image id="4" name="
|
441 |
<box label="number" source="manual" occluded="0" xtl="398.94" ytl="896.80" xbr="728.01" ybr="1002.12" rotation="5.10" z_order="0">
|
442 |
<attribute name="text">26251</attribute>
|
443 |
</box>
|
@@ -445,7 +445,7 @@
|
|
445 |
<attribute name="text">21431</attribute>
|
446 |
</box>
|
447 |
</image>
|
448 |
-
<image id="5" name="
|
449 |
<box label="number" source="manual" occluded="0" xtl="666.87" ytl="398.60" xbr="685.77" ybr="407.70" rotation="2.80" z_order="0">
|
450 |
<attribute name="text">866</attribute>
|
451 |
</box>
|
@@ -465,7 +465,7 @@
|
|
465 |
<attribute name="text">4234</attribute>
|
466 |
</box>
|
467 |
</image>
|
468 |
-
<image id="6" name="
|
469 |
<box label="number" source="manual" occluded="0" xtl="1471.12" ytl="1237.70" xbr="1577.17" ybr="1283.11" rotation="11.60" z_order="0">
|
470 |
<attribute name="text">54233</attribute>
|
471 |
</box>
|
@@ -488,7 +488,7 @@
|
|
488 |
<attribute name="text">49333</attribute>
|
489 |
</box>
|
490 |
</image>
|
491 |
-
<image id="7" name="
|
492 |
<box label="number" source="manual" occluded="0" xtl="592.26" ytl="554.17" xbr="637.60" ybr="569.87" rotation="7.90" z_order="0">
|
493 |
<attribute name="text">40637</attribute>
|
494 |
</box>
|
@@ -508,7 +508,7 @@
|
|
508 |
<attribute name="text">40011</attribute>
|
509 |
</box>
|
510 |
</image>
|
511 |
-
<image id="8" name="
|
512 |
<box label="number" source="manual" occluded="0" xtl="-1.51" ytl="610.67" xbr="69.40" ybr="650.67" rotation="2.30" z_order="0">
|
513 |
<attribute name="text">821</attribute>
|
514 |
</box>
|
@@ -522,7 +522,7 @@
|
|
522 |
<attribute name="text">690</attribute>
|
523 |
</box>
|
524 |
</image>
|
525 |
-
<image id="9" name="
|
526 |
<box label="number" source="manual" occluded="0" xtl="386.38" ytl="516.89" xbr="437.28" ybr="544.34" z_order="0">
|
527 |
<attribute name="text">849</attribute>
|
528 |
</box>
|
|
|
35 |
</task>
|
36 |
<dumped>2023-09-04 06:26:42.695828+00:00</dumped>
|
37 |
</meta>
|
38 |
+
<image id="0" name="0.png" width="1080" height="856">
|
39 |
<box label="number" source="manual" occluded="0" xtl="766.66" ytl="491.26" xbr="813.76" ybr="511.28" rotation="5.50" z_order="0">
|
40 |
<attribute name="text">349</attribute>
|
41 |
</box>
|
|
|
49 |
<attribute name="text">100</attribute>
|
50 |
</box>
|
51 |
</image>
|
52 |
+
<image id="1" name="1.png" width="3504" height="2336">
|
53 |
<box label="number" source="manual" occluded="0" xtl="2692.87" ytl="1453.80" xbr="2971.57" ybr="1584.97" z_order="0">
|
54 |
<attribute name="text">1651</attribute>
|
55 |
</box>
|
|
|
57 |
<attribute name="text">279</attribute>
|
58 |
</box>
|
59 |
</image>
|
60 |
+
<image id="10" name="10.png" width="1280" height="720">
|
61 |
<box label="number" source="manual" occluded="0" xtl="584.70" ytl="397.95" xbr="642.02" ybr="435.70" z_order="0">
|
62 |
<attribute name="text">45</attribute>
|
63 |
</box>
|
|
|
71 |
<attribute name="text">137</attribute>
|
72 |
</box>
|
73 |
</image>
|
74 |
+
<image id="11" name="11.png" width="1600" height="1200">
|
75 |
<box label="number" source="manual" occluded="0" xtl="1366.93" ytl="505.87" xbr="1421.70" ybr="535.12" rotation="349.50" z_order="0">
|
76 |
<attribute name="text">3885</attribute>
|
77 |
</box>
|
|
|
91 |
<attribute name="text">3411</attribute>
|
92 |
</box>
|
93 |
</image>
|
94 |
+
<image id="12" name="12.png" width="1280" height="720">
|
95 |
<box label="number" source="manual" occluded="0" xtl="68.24" ytl="448.10" xbr="103.58" ybr="463.40" rotation="4.30" z_order="0">
|
96 |
<attribute name="text">2650</attribute>
|
97 |
</box>
|
|
|
123 |
<attribute name="text">2862</attribute>
|
124 |
</box>
|
125 |
</image>
|
126 |
+
<image id="13" name="13.png" width="1080" height="720">
|
127 |
<box label="number" source="manual" occluded="0" xtl="606.30" ytl="448.69" xbr="656.20" ybr="470.78" rotation="353.90" z_order="0">
|
128 |
<attribute name="text">3261</attribute>
|
129 |
</box>
|
|
|
134 |
<attribute name="text">3268</attribute>
|
135 |
</box>
|
136 |
</image>
|
137 |
+
<image id="14" name="14.png" width="1280" height="960">
|
138 |
<box label="number" source="manual" occluded="0" xtl="99.58" ytl="522.22" xbr="179.58" ybr="551.30" rotation="356.70" z_order="0">
|
139 |
<attribute name="text">25753</attribute>
|
140 |
</box>
|
|
|
145 |
<attribute name="text">17512</attribute>
|
146 |
</box>
|
147 |
</image>
|
148 |
+
<image id="15" name="15.png" width="3000" height="2000">
|
149 |
<box label="number" source="manual" occluded="0" xtl="2267.19" ytl="1186.42" xbr="2392.96" ybr="1239.71" rotation="348.90" z_order="0">
|
150 |
<attribute name="text">365</attribute>
|
151 |
</box>
|
|
|
159 |
<attribute name="text">366</attribute>
|
160 |
</box>
|
161 |
</image>
|
162 |
+
<image id="16" name="16.png" width="1600" height="637">
|
163 |
<box label="number" source="manual" occluded="0" xtl="872.32" ytl="330.20" xbr="902.92" ybr="340.70" z_order="0">
|
164 |
<attribute name="text">6216</attribute>
|
165 |
</box>
|
|
|
176 |
<attribute name="text">6251</attribute>
|
177 |
</box>
|
178 |
</image>
|
179 |
+
<image id="17" name="17.png" width="1024" height="683">
|
180 |
<box label="number" source="manual" occluded="0" xtl="370.67" ytl="349.40" xbr="398.24" ybr="363.81" z_order="0">
|
181 |
<attribute name="text">200</attribute>
|
182 |
</box>
|
|
|
184 |
<attribute name="text">2224</attribute>
|
185 |
</box>
|
186 |
</image>
|
187 |
+
<image id="18" name="18.png" width="2560" height="1701">
|
188 |
<box label="number" source="manual" occluded="0" xtl="1199.81" ytl="862.11" xbr="1257.72" ybr="884.57" rotation="352.60" z_order="0">
|
189 |
<attribute name="text">62233</attribute>
|
190 |
</box>
|
|
|
219 |
<attribute name="text">36676</attribute>
|
220 |
</box>
|
221 |
</image>
|
222 |
+
<image id="19" name="19.png" width="1600" height="1066">
|
223 |
<box label="number" source="manual" occluded="0" xtl="292.27" ytl="600.19" xbr="339.70" ybr="616.40" z_order="0">
|
224 |
<attribute name="text">3723</attribute>
|
225 |
</box>
|
|
|
236 |
<attribute name="text">4277</attribute>
|
237 |
</box>
|
238 |
</image>
|
239 |
+
<image id="2" name="2.png" width="1280" height="569">
|
240 |
<box label="number" source="manual" occluded="0" xtl="368.62" ytl="331.89" xbr="417.33" ybr="348.59" z_order="0">
|
241 |
<attribute name="text">2333</attribute>
|
242 |
</box>
|
|
|
262 |
<attribute name="text">2297</attribute>
|
263 |
</box>
|
264 |
</image>
|
265 |
+
<image id="20" name="20.png" width="1280" height="720">
|
266 |
<box label="number" source="manual" occluded="0" xtl="539.10" ytl="349.03" xbr="589.00" ybr="366.23" rotation="355.90" z_order="0">
|
267 |
<attribute name="text">3529</attribute>
|
268 |
</box>
|
|
|
285 |
<attribute name="text">3038</attribute>
|
286 |
</box>
|
287 |
</image>
|
288 |
+
<image id="21" name="21.png" width="1000" height="666">
|
289 |
<box label="number" source="manual" occluded="0" xtl="859.74" ytl="451.78" xbr="931.72" ybr="483.56" rotation="354.30" z_order="0">
|
290 |
<attribute name="text">18372</attribute>
|
291 |
</box>
|
|
|
296 |
<attribute name="text">16204</attribute>
|
297 |
</box>
|
298 |
</image>
|
299 |
+
<image id="22" name="22.png" width="766" height="1080">
|
300 |
<box label="number" source="manual" occluded="0" xtl="703.48" ytl="480.33" xbr="740.26" ybr="500.24" rotation="355.90" z_order="0">
|
301 |
<attribute name="text">973</attribute>
|
302 |
</box>
|
|
|
313 |
<attribute name="text">2178</attribute>
|
314 |
</box>
|
315 |
</image>
|
316 |
+
<image id="23" name="23.png" width="1296" height="864">
|
317 |
<box label="number" source="manual" occluded="0" xtl="1009.50" ytl="506.71" xbr="1055.07" ybr="523.50" rotation="353.90" z_order="0">
|
318 |
<attribute name="text">1514</attribute>
|
319 |
</box>
|
|
|
330 |
<attribute name="text">1541</attribute>
|
331 |
</box>
|
332 |
</image>
|
333 |
+
<image id="24" name="24.png" width="1000" height="665">
|
334 |
<box label="number" source="manual" occluded="0" xtl="475.10" ytl="508.57" xbr="545.50" ybr="532.70" z_order="0">
|
335 |
<attribute name="text">11499</attribute>
|
336 |
</box>
|
|
|
341 |
<attribute name="text">12839</attribute>
|
342 |
</box>
|
343 |
</image>
|
344 |
+
<image id="25" name="25.png" width="940" height="627">
|
345 |
<box label="number" source="manual" occluded="0" xtl="23.37" ytl="575.20" xbr="133.21" ybr="621.80" z_order="0">
|
346 |
<attribute name="text">8622</attribute>
|
347 |
</box>
|
|
|
352 |
<attribute name="text">7671</attribute>
|
353 |
</box>
|
354 |
</image>
|
355 |
+
<image id="26" name="26.png" width="1080" height="1080">
|
356 |
<box label="number" source="manual" occluded="0" xtl="234.51" ytl="711.77" xbr="312.78" ybr="740.30" rotation="3.70" z_order="0">
|
357 |
<attribute name="text">1897</attribute>
|
358 |
</box>
|
|
|
363 |
<attribute name="text">1480</attribute>
|
364 |
</box>
|
365 |
</image>
|
366 |
+
<image id="27" name="27.png" width="960" height="639">
|
367 |
<box label="number" source="manual" occluded="0" xtl="196.08" ytl="318.90" xbr="222.52" ybr="328.24" rotation="1.20" z_order="0">
|
368 |
<attribute name="text">4759</attribute>
|
369 |
</box>
|
|
|
383 |
<attribute name="text">1145</attribute>
|
384 |
</box>
|
385 |
</image>
|
386 |
+
<image id="28" name="28.png" width="1499" height="1000">
|
387 |
<box label="number" source="manual" occluded="0" xtl="1142.60" ytl="478.86" xbr="1223.15" ybr="508.37" rotation="6.60" z_order="0">
|
388 |
<attribute name="text">3799</attribute>
|
389 |
</box>
|
|
|
400 |
<attribute name="text">3653</attribute>
|
401 |
</box>
|
402 |
</image>
|
403 |
+
<image id="29" name="29.png" width="1280" height="720">
|
404 |
<box label="number" source="manual" occluded="0" xtl="1100.08" ytl="660.00" xbr="1186.22" ybr="687.50" rotation="2.00" z_order="0">
|
405 |
<attribute name="text">12214</attribute>
|
406 |
</box>
|
|
|
423 |
<attribute name="text">12167</attribute>
|
424 |
</box>
|
425 |
</image>
|
426 |
+
<image id="3" name="3.png" width="900" height="600">
|
427 |
<box label="number" source="manual" occluded="0" xtl="777.00" ytl="225.99" xbr="858.20" ybr="256.37" rotation="1.10" z_order="0">
|
428 |
<attribute name="text">5505</attribute>
|
429 |
</box>
|
|
|
437 |
<attribute name="text">473</attribute>
|
438 |
</box>
|
439 |
</image>
|
440 |
+
<image id="4" name="4.png" width="2560" height="1707">
|
441 |
<box label="number" source="manual" occluded="0" xtl="398.94" ytl="896.80" xbr="728.01" ybr="1002.12" rotation="5.10" z_order="0">
|
442 |
<attribute name="text">26251</attribute>
|
443 |
</box>
|
|
|
445 |
<attribute name="text">21431</attribute>
|
446 |
</box>
|
447 |
</image>
|
448 |
+
<image id="5" name="5.png" width="1080" height="719">
|
449 |
<box label="number" source="manual" occluded="0" xtl="666.87" ytl="398.60" xbr="685.77" ybr="407.70" rotation="2.80" z_order="0">
|
450 |
<attribute name="text">866</attribute>
|
451 |
</box>
|
|
|
465 |
<attribute name="text">4234</attribute>
|
466 |
</box>
|
467 |
</image>
|
468 |
+
<image id="6" name="6.png" width="2560" height="1707">
|
469 |
<box label="number" source="manual" occluded="0" xtl="1471.12" ytl="1237.70" xbr="1577.17" ybr="1283.11" rotation="11.60" z_order="0">
|
470 |
<attribute name="text">54233</attribute>
|
471 |
</box>
|
|
|
488 |
<attribute name="text">49333</attribute>
|
489 |
</box>
|
490 |
</image>
|
491 |
+
<image id="7" name="7.png" width="1160" height="770">
|
492 |
<box label="number" source="manual" occluded="0" xtl="592.26" ytl="554.17" xbr="637.60" ybr="569.87" rotation="7.90" z_order="0">
|
493 |
<attribute name="text">40637</attribute>
|
494 |
</box>
|
|
|
508 |
<attribute name="text">40011</attribute>
|
509 |
</box>
|
510 |
</image>
|
511 |
+
<image id="8" name="8.png" width="1080" height="1350">
|
512 |
<box label="number" source="manual" occluded="0" xtl="-1.51" ytl="610.67" xbr="69.40" ybr="650.67" rotation="2.30" z_order="0">
|
513 |
<attribute name="text">821</attribute>
|
514 |
</box>
|
|
|
522 |
<attribute name="text">690</attribute>
|
523 |
</box>
|
524 |
</image>
|
525 |
+
<image id="9" name="9.png" width="1280" height="615">
|
526 |
<box label="number" source="manual" occluded="0" xtl="386.38" ytl="516.89" xbr="437.28" ybr="544.34" z_order="0">
|
527 |
<attribute name="text">849</attribute>
|
528 |
</box>
|
race-numbers-detection-and-ocr.py
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from xml.etree import ElementTree as ET
|
2 |
+
|
3 |
+
import datasets
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
_CITATION = """\
|
7 |
+
@InProceedings{huggingface:dataset,
|
8 |
+
title = {race-numbers-detection-and-ocr},
|
9 |
+
author = {TrainingDataPro},
|
10 |
+
year = {2023}
|
11 |
+
}
|
12 |
+
"""
|
13 |
+
|
14 |
+
_DESCRIPTION = """\
|
15 |
+
The dataset consists of photos of runners, participating in various races. Each photo
|
16 |
+
captures a runner wearing a race number on their attire.
|
17 |
+
The dataset provides **bounding boxes** annotations indicating the location of the race
|
18 |
+
number in each photo and includes corresponding OCR annotations, where the digit
|
19 |
+
sequences on the race numbers are transcribed.
|
20 |
+
This dataset combines the domains of sports, computer vision, and OCR technology,
|
21 |
+
providing a valuable resource for advancing the field of race number detection and OCR
|
22 |
+
in the context of athletic events.
|
23 |
+
"""
|
24 |
+
_NAME = "race-numbers-detection-and-ocr"
|
25 |
+
|
26 |
+
_HOMEPAGE = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}"
|
27 |
+
|
28 |
+
_LICENSE = ""
|
29 |
+
|
30 |
+
_DATA = f"https://huggingface.co/datasets/TrainingDataPro/{_NAME}/resolve/main/data/"
|
31 |
+
|
32 |
+
_LABELS = ["number"]
|
33 |
+
|
34 |
+
|
35 |
+
class BotoxInjectionsBeforeAndAfter(datasets.GeneratorBasedBuilder):
|
36 |
+
def _info(self):
|
37 |
+
return datasets.DatasetInfo(
|
38 |
+
description=_DESCRIPTION,
|
39 |
+
features=datasets.Features(
|
40 |
+
{
|
41 |
+
"id": datasets.Value("int32"),
|
42 |
+
"name": datasets.Value("string"),
|
43 |
+
"image": datasets.Image(),
|
44 |
+
"mask": datasets.Image(),
|
45 |
+
"width": datasets.Value("uint16"),
|
46 |
+
"height": datasets.Value("uint16"),
|
47 |
+
"shapes": datasets.Sequence(
|
48 |
+
{
|
49 |
+
"label": datasets.ClassLabel(
|
50 |
+
num_classes=len(_LABELS),
|
51 |
+
names=_LABELS,
|
52 |
+
),
|
53 |
+
"type": datasets.Value("string"),
|
54 |
+
"points": datasets.Sequence(
|
55 |
+
datasets.Value("float"),
|
56 |
+
),
|
57 |
+
"rotation": datasets.Value("float"),
|
58 |
+
"attributes": datasets.Sequence(
|
59 |
+
{
|
60 |
+
"name": datasets.Value("string"),
|
61 |
+
"text": datasets.Value("string"),
|
62 |
+
}
|
63 |
+
),
|
64 |
+
}
|
65 |
+
),
|
66 |
+
}
|
67 |
+
),
|
68 |
+
supervised_keys=None,
|
69 |
+
homepage=_HOMEPAGE,
|
70 |
+
citation=_CITATION,
|
71 |
+
)
|
72 |
+
|
73 |
+
def _split_generators(self, dl_manager):
|
74 |
+
images = dl_manager.download(f"{_DATA}images.tar.gz")
|
75 |
+
masks = dl_manager.download(f"{_DATA}boxes.tar.gz")
|
76 |
+
annotations = dl_manager.download(f"{_DATA}annotations.xml")
|
77 |
+
images = dl_manager.iter_archive(images)
|
78 |
+
masks = dl_manager.iter_archive(masks)
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(
|
81 |
+
name=datasets.Split.TRAIN,
|
82 |
+
gen_kwargs={
|
83 |
+
"images": images,
|
84 |
+
"masks": masks,
|
85 |
+
"annotations": annotations,
|
86 |
+
},
|
87 |
+
),
|
88 |
+
]
|
89 |
+
|
90 |
+
@staticmethod
|
91 |
+
def parse_shape(shape: ET.Element) -> dict:
|
92 |
+
label = shape.get("label")
|
93 |
+
shape_type = shape.tag
|
94 |
+
rotation = shape.get("rotation", 0.0)
|
95 |
+
|
96 |
+
points = None
|
97 |
+
|
98 |
+
if shape_type == "points":
|
99 |
+
points = tuple(map(float, shape.get("points").split(",")))
|
100 |
+
|
101 |
+
elif shape_type == "box":
|
102 |
+
points = [
|
103 |
+
(float(shape.get("xtl")), float(shape.get("ytl"))),
|
104 |
+
(float(shape.get("xbr")), float(shape.get("ybr"))),
|
105 |
+
]
|
106 |
+
|
107 |
+
elif shape_type == "polygon":
|
108 |
+
points = [
|
109 |
+
tuple(map(float, point.split(",")))
|
110 |
+
for point in shape.get("points").split(";")
|
111 |
+
]
|
112 |
+
|
113 |
+
attributes = []
|
114 |
+
|
115 |
+
for attr in shape:
|
116 |
+
attr_name = attr.get("name")
|
117 |
+
attr_text = attr.text
|
118 |
+
attributes.append({"name": attr_name, "text": attr_text})
|
119 |
+
|
120 |
+
shape_data = {
|
121 |
+
"label": label,
|
122 |
+
"type": shape_type,
|
123 |
+
"points": points,
|
124 |
+
"rotation": rotation,
|
125 |
+
"attributes": attributes,
|
126 |
+
}
|
127 |
+
|
128 |
+
return shape_data
|
129 |
+
|
130 |
+
def _generate_examples(self, images, masks, annotations):
|
131 |
+
tree = ET.parse(annotations)
|
132 |
+
root = tree.getroot()
|
133 |
+
|
134 |
+
for idx, (
|
135 |
+
(image_path, image),
|
136 |
+
(mask_path, mask),
|
137 |
+
) in enumerate(zip(images, masks)):
|
138 |
+
image_name = image_path.split("/")[-1]
|
139 |
+
img = root.find(f".//image.[@name='{image_name}']")
|
140 |
+
print(img)
|
141 |
+
image_id = img.get("id")
|
142 |
+
name = img.get("name")
|
143 |
+
width = img.get("width")
|
144 |
+
height = img.get("height")
|
145 |
+
shapes = [self.parse_shape(shape) for shape in img]
|
146 |
+
|
147 |
+
yield idx, {
|
148 |
+
"id": image_id,
|
149 |
+
"name": name,
|
150 |
+
"image": {"path": image_path, "bytes": image.read()},
|
151 |
+
"mask": {"path": mask_path, "bytes": mask.read()},
|
152 |
+
"width": width,
|
153 |
+
"height": height,
|
154 |
+
"shapes": shapes,
|
155 |
+
}
|