yocabon commited on
Commit
158c0ce
·
1 Parent(s): 050f8f9
Files changed (2) hide show
  1. dust3r +1 -1
  2. mast3r/demo.py +8 -2
dust3r CHANGED
@@ -1 +1 @@
1
- Subproject commit 8cc725dd11a9b7371bfca37994f8585ca78b42e5
 
1
+ Subproject commit d99800a2d1d33f000c6f0d1c307dfb5a7a34fd53
mast3r/demo.py CHANGED
@@ -37,6 +37,8 @@ class SparseGAState():
37
  self.should_delete = should_delete
38
 
39
  def __del__(self):
 
 
40
  if self.cache_dir is not None and os.path.isdir(self.cache_dir):
41
  shutil.rmtree(self.cache_dir)
42
  self.cache_dir = None
@@ -160,7 +162,9 @@ def get_reconstructed_scene(outdir, gradio_delete_cache, model, device, silent,
160
  if optim_level == 'coarse':
161
  niter2 = 0
162
  # Sparse GA (forward mast3r -> matching -> 3D optim -> 2D refinement -> triangulation)
163
- if current_scene_state is not None and current_scene_state.cache_dir is not None:
 
 
164
  cache_dir = current_scene_state.cache_dir
165
  elif gradio_delete_cache:
166
  cache_dir = tempfile.mkdtemp(suffix='_cache', dir=outdir)
@@ -170,7 +174,9 @@ def get_reconstructed_scene(outdir, gradio_delete_cache, model, device, silent,
170
  model, lr1=lr1, niter1=niter1, lr2=lr2, niter2=niter2, device=device,
171
  opt_depth='depth' in optim_level, shared_intrinsics=shared_intrinsics,
172
  matching_conf_thr=matching_conf_thr, **kw)
173
- if current_scene_state is not None and current_scene_state.outfile_name is not None:
 
 
174
  outfile_name = current_scene_state.outfile_name
175
  else:
176
  outfile_name = tempfile.mktemp(suffix='_scene.glb', dir=outdir)
 
37
  self.should_delete = should_delete
38
 
39
  def __del__(self):
40
+ if not self.should_delete:
41
+ return
42
  if self.cache_dir is not None and os.path.isdir(self.cache_dir):
43
  shutil.rmtree(self.cache_dir)
44
  self.cache_dir = None
 
162
  if optim_level == 'coarse':
163
  niter2 = 0
164
  # Sparse GA (forward mast3r -> matching -> 3D optim -> 2D refinement -> triangulation)
165
+ if current_scene_state is not None and \
166
+ not current_scene_state.should_delete and \
167
+ current_scene_state.cache_dir is not None:
168
  cache_dir = current_scene_state.cache_dir
169
  elif gradio_delete_cache:
170
  cache_dir = tempfile.mkdtemp(suffix='_cache', dir=outdir)
 
174
  model, lr1=lr1, niter1=niter1, lr2=lr2, niter2=niter2, device=device,
175
  opt_depth='depth' in optim_level, shared_intrinsics=shared_intrinsics,
176
  matching_conf_thr=matching_conf_thr, **kw)
177
+ if current_scene_state is not None and \
178
+ not current_scene_state.should_delete and \
179
+ current_scene_state.outfile_name is not None:
180
  outfile_name = current_scene_state.outfile_name
181
  else:
182
  outfile_name = tempfile.mktemp(suffix='_scene.glb', dir=outdir)