Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ def exclude_scaling_box(
|
|
118 |
bbox: np.ndarray,
|
119 |
orig_size: tuple,
|
120 |
processed_size: tuple,
|
121 |
-
expansion_factor: float = 1.
|
122 |
) -> np.ndarray:
|
123 |
# Unpack the bounding box
|
124 |
x_min, y_min, x_max, y_max = map(int, bbox)
|
@@ -324,7 +324,7 @@ def resize_img(img: np.ndarray, resize_dim):
|
|
324 |
def predict(image, offset_inches):
|
325 |
try:
|
326 |
drawer_img = yolo_detect(image, ["box"])
|
327 |
-
shrunked_img = make_square(shrink_bbox(drawer_img, 0.
|
328 |
except:
|
329 |
raise gr.Error("Unable to DETECT DRAWER, please take another picture with different magnification level!")
|
330 |
|
@@ -374,7 +374,7 @@ def predict(image, offset_inches):
|
|
374 |
scaling_box_coords,
|
375 |
orig_size,
|
376 |
processed_size,
|
377 |
-
expansion_factor=1.
|
378 |
)
|
379 |
objects_mask = resize_img(
|
380 |
objects_mask, (shrunked_img.shape[1], shrunked_img.shape[0])
|
|
|
118 |
bbox: np.ndarray,
|
119 |
orig_size: tuple,
|
120 |
processed_size: tuple,
|
121 |
+
expansion_factor: float = 1.2,
|
122 |
) -> np.ndarray:
|
123 |
# Unpack the bounding box
|
124 |
x_min, y_min, x_max, y_max = map(int, bbox)
|
|
|
324 |
def predict(image, offset_inches):
|
325 |
try:
|
326 |
drawer_img = yolo_detect(image, ["box"])
|
327 |
+
shrunked_img = make_square(shrink_bbox(drawer_img, 0.85))
|
328 |
except:
|
329 |
raise gr.Error("Unable to DETECT DRAWER, please take another picture with different magnification level!")
|
330 |
|
|
|
374 |
scaling_box_coords,
|
375 |
orig_size,
|
376 |
processed_size,
|
377 |
+
expansion_factor=1.2,
|
378 |
)
|
379 |
objects_mask = resize_img(
|
380 |
objects_mask, (shrunked_img.shape[1], shrunked_img.shape[0])
|