ostapagon commited on
Commit
2956ec7
·
1 Parent(s): fdac090

FIx torch.save error. Add 3dgs tab.

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. demo/mast3r_demo.py +3 -1
app.py CHANGED
@@ -9,7 +9,7 @@ import torch
9
  from mast3r.demo import get_args_parser
10
  from mast3r.utils.misc import hash_md5
11
  from mast3r_demo import mast3r_demo_tab
12
- # from gs_demo import gs_demo_tab
13
 
14
  if __name__ == '__main__':
15
  # parser = get_args_parser()
@@ -32,8 +32,8 @@ if __name__ == '__main__':
32
  with gr.Tabs():
33
  with gr.Tab("MASt3R Demo"):
34
  mast3r_demo_tab(cache_path, weights_path, device)
35
- # with gr.Tab("Gaussian Splatting Demo"):
36
- # gs_demo_tab(cache_path)
37
 
38
  demo.launch(show_error=True, share=None, server_name=None, server_port=None)
39
 
 
9
  from mast3r.demo import get_args_parser
10
  from mast3r.utils.misc import hash_md5
11
  from mast3r_demo import mast3r_demo_tab
12
+ from gs_demo import gs_demo_tab
13
 
14
  if __name__ == '__main__':
15
  # parser = get_args_parser()
 
32
  with gr.Tabs():
33
  with gr.Tab("MASt3R Demo"):
34
  mast3r_demo_tab(cache_path, weights_path, device)
35
+ with gr.Tab("Gaussian Splatting Demo"):
36
+ gs_demo_tab(cache_path)
37
 
38
  demo.launch(show_error=True, share=None, server_name=None, server_port=None)
39
 
demo/mast3r_demo.py CHANGED
@@ -6,6 +6,7 @@
6
  # sparse gradio demo functions
7
  # --------------------------------------------------------
8
  import sys
 
9
 
10
  import math
11
  import gradio
@@ -145,7 +146,7 @@ def get_3D_model_from_scene(silent, scene_state, min_conf_thr=2, as_pointcloud=F
145
  else:
146
  pts3d, _, confs = to_numpy(scene.get_dense_pts3d(clean_depth=clean_depth))
147
 
148
- torch.save(confs, '/app/data/confs.pt')
149
  msk = to_numpy([c > min_conf_thr for c in confs])
150
  return _convert_scene_output_to_glb(outfile, rgbimg, pts3d, msk, focals, cams2world, as_pointcloud=as_pointcloud,
151
  transparent_cams=transparent_cams, cam_size=cam_size, silent=silent)
@@ -172,6 +173,7 @@ def get_3D_model_from_scene(silent, scene_state, min_conf_thr=2, as_pointcloud=F
172
  # save_pointcloud_with_normals(imgs, pts3d, masks, sparse_path)
173
  # return save_path
174
 
 
175
  def get_reconstructed_scene(outdir, model, device, silent, image_size, current_scene_state,
176
  filelist, optim_level, lr1, niter1, lr2, niter2, min_conf_thr, matching_conf_thr,
177
  as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size, scenegraph_type, winsize,
 
6
  # sparse gradio demo functions
7
  # --------------------------------------------------------
8
  import sys
9
+ import spaces
10
 
11
  import math
12
  import gradio
 
146
  else:
147
  pts3d, _, confs = to_numpy(scene.get_dense_pts3d(clean_depth=clean_depth))
148
 
149
+ # torch.save(confs, '/app/data/confs.pt')
150
  msk = to_numpy([c > min_conf_thr for c in confs])
151
  return _convert_scene_output_to_glb(outfile, rgbimg, pts3d, msk, focals, cams2world, as_pointcloud=as_pointcloud,
152
  transparent_cams=transparent_cams, cam_size=cam_size, silent=silent)
 
173
  # save_pointcloud_with_normals(imgs, pts3d, masks, sparse_path)
174
  # return save_path
175
 
176
+ @spaces.GPU(duration=300)
177
  def get_reconstructed_scene(outdir, model, device, silent, image_size, current_scene_state,
178
  filelist, optim_level, lr1, niter1, lr2, niter2, min_conf_thr, matching_conf_thr,
179
  as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size, scenegraph_type, winsize,