ostapagon commited on
Commit
011bafc
·
1 Parent(s): 0ae8172

Remove scene_state from updating

Browse files
Files changed (1) hide show
  1. demo/mast3r_demo.py +33 -33
demo/mast3r_demo.py CHANGED
@@ -110,7 +110,7 @@ def _convert_scene_output_to_glb(outfile, imgs, pts3d, mask, focals, cams2world,
110
  return outfile
111
 
112
 
113
- def get_3D_model_from_scene(scene_state, min_conf_thr=2, as_pointcloud=False, mask_sky=False,
114
  clean_depth=False, transparent_cams=False, cam_size=0.05, TSDF_thresh=0):
115
  """
116
  extract 3D_model (glb file) from a reconstructed scene
@@ -121,8 +121,8 @@ def get_3D_model_from_scene(scene_state, min_conf_thr=2, as_pointcloud=False, ma
121
  if outfile is None:
122
  return None
123
 
124
- # get optimized values from scene
125
- scene = scene_state.sparse_ga
126
  rgbimg = scene.imgs
127
  focals = scene.get_focals().cpu()
128
  cams2world = scene.get_im_poses().cpu()
@@ -232,7 +232,7 @@ def get_reconstructed_scene(image_size, current_scene_state,
232
  outfile_name = tempfile.mktemp(suffix='_scene.glb', dir=CACHE_PATH)
233
 
234
  scene_state = SparseGAState(cache_dir, outfile_name)
235
- outfile = get_3D_model_from_scene(scene_state, min_conf_thr, as_pointcloud, mask_sky,
236
  clean_depth, transparent_cams, cam_size, TSDF_thresh)
237
  print(f"colmap_data_dir: {colmap_data_dir}")
238
  print(f"outfile_name: {outfile_name}")
@@ -349,35 +349,35 @@ def mast3r_demo_tab():
349
  win_cyclic, refid, TSDF_thresh, shared_intrinsics],
350
  outputs=[scene, outmodel]
351
  )
352
- min_conf_thr.release(
353
- fn=get_3D_model_from_scene,
354
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size, TSDF_thresh],
355
- outputs=outmodel
356
- )
357
- cam_size.change(fn=get_3D_model_from_scene,
358
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
359
- clean_depth, transparent_cams, cam_size, TSDF_thresh],
360
- outputs=outmodel)
361
- TSDF_thresh.change(fn=get_3D_model_from_scene,
362
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
363
- clean_depth, transparent_cams, cam_size, TSDF_thresh],
364
- outputs=outmodel)
365
- as_pointcloud.change(fn=get_3D_model_from_scene,
366
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
367
- clean_depth, transparent_cams, cam_size, TSDF_thresh],
368
- outputs=outmodel)
369
- mask_sky.change(fn=get_3D_model_from_scene,
370
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
371
- clean_depth, transparent_cams, cam_size, TSDF_thresh],
372
- outputs=outmodel)
373
- clean_depth.change(fn=get_3D_model_from_scene,
374
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
375
- clean_depth, transparent_cams, cam_size, TSDF_thresh],
376
- outputs=outmodel)
377
- transparent_cams.change(fn=get_3D_model_from_scene,
378
- inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
379
- clean_depth, transparent_cams, cam_size, TSDF_thresh],
380
- outputs=outmodel)
381
 
382
  return demo
383
 
 
110
  return outfile
111
 
112
 
113
+ def get_3D_model_from_scene(scene, scene_state, min_conf_thr=2, as_pointcloud=False, mask_sky=False,
114
  clean_depth=False, transparent_cams=False, cam_size=0.05, TSDF_thresh=0):
115
  """
116
  extract 3D_model (glb file) from a reconstructed scene
 
121
  if outfile is None:
122
  return None
123
 
124
+ # # get optimized values from scene
125
+ # scene = scenescene_state.sparse_ga
126
  rgbimg = scene.imgs
127
  focals = scene.get_focals().cpu()
128
  cams2world = scene.get_im_poses().cpu()
 
232
  outfile_name = tempfile.mktemp(suffix='_scene.glb', dir=CACHE_PATH)
233
 
234
  scene_state = SparseGAState(cache_dir, outfile_name)
235
+ outfile = get_3D_model_from_scene(scene, scene_state, min_conf_thr, as_pointcloud, mask_sky,
236
  clean_depth, transparent_cams, cam_size, TSDF_thresh)
237
  print(f"colmap_data_dir: {colmap_data_dir}")
238
  print(f"outfile_name: {outfile_name}")
 
349
  win_cyclic, refid, TSDF_thresh, shared_intrinsics],
350
  outputs=[scene, outmodel]
351
  )
352
+ # min_conf_thr.release(
353
+ # fn=get_3D_model_from_scene,
354
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size, TSDF_thresh],
355
+ # outputs=outmodel
356
+ # )
357
+ # cam_size.change(fn=get_3D_model_from_scene,
358
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
359
+ # clean_depth, transparent_cams, cam_size, TSDF_thresh],
360
+ # outputs=outmodel)
361
+ # TSDF_thresh.change(fn=get_3D_model_from_scene,
362
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
363
+ # clean_depth, transparent_cams, cam_size, TSDF_thresh],
364
+ # outputs=outmodel)
365
+ # as_pointcloud.change(fn=get_3D_model_from_scene,
366
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
367
+ # clean_depth, transparent_cams, cam_size, TSDF_thresh],
368
+ # outputs=outmodel)
369
+ # mask_sky.change(fn=get_3D_model_from_scene,
370
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
371
+ # clean_depth, transparent_cams, cam_size, TSDF_thresh],
372
+ # outputs=outmodel)
373
+ # clean_depth.change(fn=get_3D_model_from_scene,
374
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
375
+ # clean_depth, transparent_cams, cam_size, TSDF_thresh],
376
+ # outputs=outmodel)
377
+ # transparent_cams.change(fn=get_3D_model_from_scene,
378
+ # inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
379
+ # clean_depth, transparent_cams, cam_size, TSDF_thresh],
380
+ # outputs=outmodel)
381
 
382
  return demo
383