Spaces:
Running
on
Zero
Running
on
Zero
debug
Browse files
examples/blobctrl/blobctrl_app.py
CHANGED
@@ -1030,10 +1030,12 @@ def segmentation(img, sel_pix):
|
|
1030 |
mobile_predictor.set_image(img if isinstance(img, np.ndarray) else np.array(img))
|
1031 |
with torch.no_grad():
|
1032 |
masks, _, _ = mobile_predictor.predict(point_coords=np.array(points), point_labels=np.array(labels), multimask_output=False)
|
1033 |
-
|
|
|
|
|
1034 |
output_mask = np.ones((masks.shape[1], masks.shape[2], 3))*255
|
1035 |
for i in range(3):
|
1036 |
-
|
1037 |
|
1038 |
mask_all = np.ones((masks.shape[1], masks.shape[2], 3))
|
1039 |
color_mask = np.random.random((1, 3)).tolist()[0]
|
@@ -1056,6 +1058,8 @@ def get_point(img, sel_pix, evt: gr.SelectData):
|
|
1056 |
print(output_mask.shape)
|
1057 |
print(masked_img)
|
1058 |
print(output_mask)
|
|
|
|
|
1059 |
return masked_img.astype(np.uint8), output_mask
|
1060 |
|
1061 |
|
|
|
1030 |
mobile_predictor.set_image(img if isinstance(img, np.ndarray) else np.array(img))
|
1031 |
with torch.no_grad():
|
1032 |
masks, _, _ = mobile_predictor.predict(point_coords=np.array(points), point_labels=np.array(labels), multimask_output=False)
|
1033 |
+
print("================")
|
1034 |
+
print(masks)
|
1035 |
+
print("================")
|
1036 |
output_mask = np.ones((masks.shape[1], masks.shape[2], 3))*255
|
1037 |
for i in range(3):
|
1038 |
+
output_mask[masks[0] == True, i] = 0.0
|
1039 |
|
1040 |
mask_all = np.ones((masks.shape[1], masks.shape[2], 3))
|
1041 |
color_mask = np.random.random((1, 3)).tolist()[0]
|
|
|
1058 |
print(output_mask.shape)
|
1059 |
print(masked_img)
|
1060 |
print(output_mask)
|
1061 |
+
print(np.unique(output_mask))
|
1062 |
+
|
1063 |
return masked_img.astype(np.uint8), output_mask
|
1064 |
|
1065 |
|