JeffLiang commited on
Commit
092977e
1 Parent(s): da442e3
Files changed (2) hide show
  1. app.py +5 -4
  2. sam_3d.py +2 -0
app.py CHANGED
@@ -49,14 +49,15 @@ for scene_name in ['scene0000_00', 'scene0001_00', 'scene0002_00']:
49
 
50
  examples = [['scene0000_00', 0, [0, -2.5, 0.7], pc_to_plot(plydatas[0])],
51
  ['scene0001_00', 0, [1.9, 1.1, 0.5], pc_to_plot(plydatas[1])],
52
- ['scene0002_00', 0, [-0.7, -0.3, 1.9], pc_to_plot(plydatas[2])],]
53
 
54
  title = 'Segment_Anything on 3D in-door point clouds'
55
 
56
  description = """
57
- Gradio Demo for Segment Anything on 3D indoor scenes (ScanNet supported). \n
58
- The logic is straighforward: 1) Find a point in 3D; 2) project the 3D point to valid images; 3) perform 2D SAM on valid images; 4) reproject 2D results back to 3D; 5) Visualization.
59
- Unfortunatly, it does not support click the point cloud to generate coordinates automatically. You may want to write down the coordinates and put it manually. \n
 
60
  """
61
 
62
  article = """
 
49
 
50
  examples = [['scene0000_00', 0, [0, -2.5, 0.7], pc_to_plot(plydatas[0])],
51
  ['scene0001_00', 0, [1.9, 1.1, 0.5], pc_to_plot(plydatas[1])],
52
+ ['scene0002_00', 0, [0.58, 0.47, 0.25], pc_to_plot(plydatas[2])],]
53
 
54
  title = 'Segment_Anything on 3D in-door point clouds'
55
 
56
  description = """
57
+ Gradio Demo for Segmenting Anything on 3D Indoor Scenes (ScanNet supported). \n
58
+ The logic is straightforward: 1) Find a point in 3D. 2) Project the 3D point onto valid images. 3) Perform 2D SAM on the valid images. 4) Reproject the 2D results back to 3D. 5) Visualize the results. \n
59
+ Unfortunately, this demo does not support automatically generating coordinates by clicking on the point cloud. You may need to manually write down the coordinates and input them. \n
60
+ Play with the examples below first and try to modify the coordinates and mask granularity. \n
61
  """
62
 
63
  article = """
sam_3d.py CHANGED
@@ -152,6 +152,8 @@ class SAM3DDemo(object):
152
  m = masks[granularity]
153
  msk_color[m] = [0, 0, 1.0]
154
  mask_colors.append(msk_color)
 
 
155
  fig, axs = plt.subplots(nrows=1, ncols=3, figsize=(24, 8))
156
  for i in range(3):
157
  mask_img = masks[i][:,:,None] * rgb_img
 
152
  m = masks[granularity]
153
  msk_color[m] = [0, 0, 1.0]
154
  mask_colors.append(msk_color)
155
+ show_id = valid_img_ids[-1]
156
+ rgb_img = self.rgb_images[show_id]
157
  fig, axs = plt.subplots(nrows=1, ncols=3, figsize=(24, 8))
158
  for i in range(3):
159
  mask_img = masks[i][:,:,None] * rgb_img