Spaces:
Runtime error
Runtime error
Niv Sardi
commited on
Commit
·
f934e8e
1
Parent(s):
4e1c07d
types and better debug
Browse filesSigned-off-by: Niv Sardi <xaiki@evilgiggle.com>
- python/imtool.py +6 -6
python/imtool.py
CHANGED
|
@@ -183,12 +183,12 @@ def _mix_alpha(a, b, ba, fx, fy):
|
|
| 183 |
|
| 184 |
return a, BoundingBox(x, y, bw, bh), (aw, ah)
|
| 185 |
|
| 186 |
-
def crop(id, fn, logos):
|
| 187 |
basename = os.path.basename(fn).replace('.png', '')
|
| 188 |
-
img_out = f"
|
| 189 |
-
txt_out = f"
|
| 190 |
-
debug_out = f"
|
| 191 |
-
mkdir.make_dirs[debug_out, img_out, txt_out]
|
| 192 |
|
| 193 |
im = cv2.imread(fn)
|
| 194 |
rim = cv2.imread(fn)
|
|
@@ -200,7 +200,7 @@ def crop(id, fn, logos):
|
|
| 200 |
math.ceil(h/(th*TILE_OVERLAP))
|
| 201 |
)
|
| 202 |
|
| 203 |
-
print('shape', basename, tx, ty, w, h
|
| 204 |
for x in range(tx):
|
| 205 |
for y in range(ty):
|
| 206 |
color = (0,x*(255/tx),y*(255/ty))
|
|
|
|
| 183 |
|
| 184 |
return a, BoundingBox(x, y, bw, bh), (aw, ah)
|
| 185 |
|
| 186 |
+
def crop(id, fn, logos: List[Centroid], out = './data/squares'):
|
| 187 |
basename = os.path.basename(fn).replace('.png', '')
|
| 188 |
+
img_out = f"{out}/images"
|
| 189 |
+
txt_out = f"{out}/labels"
|
| 190 |
+
debug_out = f"{out}/debug"
|
| 191 |
+
mkdir.make_dirs([debug_out, img_out, txt_out])
|
| 192 |
|
| 193 |
im = cv2.imread(fn)
|
| 194 |
rim = cv2.imread(fn)
|
|
|
|
| 200 |
math.ceil(h/(th*TILE_OVERLAP))
|
| 201 |
)
|
| 202 |
|
| 203 |
+
print('shape', basename, tx, ty, w, h)
|
| 204 |
for x in range(tx):
|
| 205 |
for y in range(ty):
|
| 206 |
color = (0,x*(255/tx),y*(255/ty))
|