Spaces:
Sleeping
Sleeping
franchesoni
commited on
Commit
•
6f7e482
1
Parent(s):
e9906c5
make click depend on image size
Browse files
app.py
CHANGED
@@ -123,8 +123,9 @@ def one_click_segmentation(img, row, col, threshold):
|
|
123 |
row, col = int(row), int(col)
|
124 |
img = np.array(img[:, :, :3])
|
125 |
click_map = np.zeros(img.shape[:2], dtype=bool)
|
126 |
-
|
127 |
-
click_map[row, max(0, col-5):min(img.shape[
|
|
|
128 |
print("Getting features...")
|
129 |
pred, size = busam.process_image(img, do_activate=True)
|
130 |
print("Getting mask...")
|
|
|
123 |
row, col = int(row), int(col)
|
124 |
img = np.array(img[:, :, :3])
|
125 |
click_map = np.zeros(img.shape[:2], dtype=bool)
|
126 |
+
side = min(img.shape[:2]) // 100
|
127 |
+
click_map[max(0, row-side):min(img.shape[0], row+side), max(0, col-side//5):min(img.shape[0], col+side//5)] = True
|
128 |
+
click_map[max(0, row-side//5):min(img.shape[0], row+side//5), max(0, col-side):min(img.shape[0], col+side)] = True
|
129 |
print("Getting features...")
|
130 |
pred, size = busam.process_image(img, do_activate=True)
|
131 |
print("Getting mask...")
|