Spaces:
Runtime error
Runtime error
Niv Sardi
commited on
Commit
·
eb762cb
1
Parent(s):
4b0ef46
imtool: bugfix actually read all logos
Browse filesSigned-off-by: Niv Sardi <xaiki@evilgiggle.com>
- crawler/imtool.py +7 -4
crawler/imtool.py
CHANGED
|
@@ -39,8 +39,11 @@ class Centroid(BoundingBox):
|
|
| 39 |
def read_bounding_boxes(filename):
|
| 40 |
boxes = []
|
| 41 |
with open(filename, 'r') as f:
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
| 44 |
return boxes
|
| 45 |
|
| 46 |
def floor_point(a, b):
|
|
@@ -70,8 +73,8 @@ def crop(fn, logos):
|
|
| 70 |
|
| 71 |
(h, w, c) = im.shape
|
| 72 |
(tx, ty)= (
|
| 73 |
-
math.
|
| 74 |
-
math.
|
| 75 |
)
|
| 76 |
|
| 77 |
print('shape', basename, tx, ty, h, w, logos)
|
|
|
|
| 39 |
def read_bounding_boxes(filename):
|
| 40 |
boxes = []
|
| 41 |
with open(filename, 'r') as f:
|
| 42 |
+
lines = f.readlines()
|
| 43 |
+
for l in lines:
|
| 44 |
+
(x,y,w,h) = [float(i) for i in l.split(' ')[1:]]
|
| 45 |
+
print(x, y, 'box')
|
| 46 |
+
boxes.append(BoundingBox(x,y,w,h))
|
| 47 |
return boxes
|
| 48 |
|
| 49 |
def floor_point(a, b):
|
|
|
|
| 73 |
|
| 74 |
(h, w, c) = im.shape
|
| 75 |
(tx, ty)= (
|
| 76 |
+
math.floor(w/(TILE_SIZE*TILE_OVERLAP)),
|
| 77 |
+
math.floor(h/(TILE_SIZE*TILE_OVERLAP))
|
| 78 |
)
|
| 79 |
|
| 80 |
print('shape', basename, tx, ty, h, w, logos)
|