Spaces:
Runtime error
Runtime error
s194649
commited on
Commit
Β·
76993d9
1
Parent(s):
ba6989b
uint8 makss
Browse files- app.py +1 -2
- inference.py +2 -2
app.py
CHANGED
@@ -35,8 +35,7 @@ with block:
|
|
35 |
with gr.Column():
|
36 |
gr.Markdown(
|
37 |
'''# Segment Anything!π
|
38 |
-
The Segment Anything Model (SAM) produces high quality object masks from input prompts such as points or boxes, and it can be used to generate masks for all objects in an image.
|
39 |
-
[](https://huggingface.co/spaces/AIBoy1993/segment_anything_webui?duplicate=true)
|
40 |
'''
|
41 |
)
|
42 |
with gr.Row():
|
|
|
35 |
with gr.Column():
|
36 |
gr.Markdown(
|
37 |
'''# Segment Anything!π
|
38 |
+
The Segment Anything Model (SAM) produces high quality object masks from input prompts such as points or boxes, and it can be used to generate masks for all objects in an image. [**Official Project**](https://segment-anything.com/) [**Code**](https://github.com/facebookresearch/segment-anything).
|
|
|
39 |
'''
|
40 |
)
|
41 |
with gr.Row():
|
inference.py
CHANGED
@@ -17,8 +17,8 @@ def PCL(mask, depth):
|
|
17 |
assert mask.shape == depth.shape
|
18 |
assert type(mask) == np.ndarray
|
19 |
assert type(depth) == np.ndarray
|
20 |
-
rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3))
|
21 |
-
rgb_mask[mask] = (
|
22 |
depth_o3d = o3d.geometry.Image(depth)
|
23 |
image_o3d = o3d.geometry.Image(mask)
|
24 |
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
|
|
|
17 |
assert mask.shape == depth.shape
|
18 |
assert type(mask) == np.ndarray
|
19 |
assert type(depth) == np.ndarray
|
20 |
+
rgb_mask = np.zeros((mask.shape[0], mask.shape[1], 3)).astype("uint8")
|
21 |
+
rgb_mask[mask] = (255, 0, 0)
|
22 |
depth_o3d = o3d.geometry.Image(depth)
|
23 |
image_o3d = o3d.geometry.Image(mask)
|
24 |
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(image_o3d, depth_o3d, convert_rgb_to_intensity=False)
|