Spaces:
Sleeping
Sleeping
xinghaochen
commited on
Commit
•
0a9c5d5
1
Parent(s):
5521308
fix bug
Browse files
app.py
CHANGED
@@ -141,12 +141,12 @@ def segment_with_points(
|
|
141 |
)
|
142 |
image = session_state['image_with_prompt']
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
print(f'scores: {scores}')
|
151 |
area = masks.sum(axis=(1, 2))
|
152 |
print(f'area: {area}')
|
@@ -208,13 +208,12 @@ def segment_with_box(
|
|
208 |
)
|
209 |
|
210 |
box_np = np.array(xy)
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
|
219 |
seg = fast_process(
|
220 |
annotations=annotations,
|
|
|
141 |
)
|
142 |
image = session_state['image_with_prompt']
|
143 |
|
144 |
+
coord_np = np.array(session_state['coord_list'])
|
145 |
+
label_np = np.array(session_state['label_list'])
|
146 |
+
masks, scores, logits = predictor.predict(
|
147 |
+
point_coords=coord_np,
|
148 |
+
point_labels=label_np,
|
149 |
+
)
|
150 |
print(f'scores: {scores}')
|
151 |
area = masks.sum(axis=(1, 2))
|
152 |
print(f'area: {area}')
|
|
|
208 |
)
|
209 |
|
210 |
box_np = np.array(xy)
|
211 |
+
masks, scores, _ = predictor.predict(
|
212 |
+
point_coords=None,
|
213 |
+
point_labels=None,
|
214 |
+
box=box_np[None, :],
|
215 |
+
)
|
216 |
+
annotations = np.expand_dims(masks[scores.argmax()], axis=0)
|
|
|
217 |
|
218 |
seg = fast_process(
|
219 |
annotations=annotations,
|