Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yocabon committed Jul 19, 2024
1 parent 050f8f9 commit 158c0ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dust3r
Submodule dust3r updated 1 files
+2 −1 dust3r/training.py
10 changes: 8 additions & 2 deletions mast3r/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def __init__(self, sparse_ga, should_delete=False, cache_dir=None, outfile_name=
self.should_delete = should_delete

def __del__(self):
if not self.should_delete:
return
if self.cache_dir is not None and os.path.isdir(self.cache_dir):
shutil.rmtree(self.cache_dir)
self.cache_dir = None
Expand Down Expand Up @@ -160,7 +162,9 @@ def get_reconstructed_scene(outdir, gradio_delete_cache, model, device, silent,
if optim_level == 'coarse':
niter2 = 0
# Sparse GA (forward mast3r -> matching -> 3D optim -> 2D refinement -> triangulation)
if current_scene_state is not None and current_scene_state.cache_dir is not None:
if current_scene_state is not None and \
not current_scene_state.should_delete and \
current_scene_state.cache_dir is not None:
cache_dir = current_scene_state.cache_dir
elif gradio_delete_cache:
cache_dir = tempfile.mkdtemp(suffix='_cache', dir=outdir)
Expand All @@ -170,7 +174,9 @@ def get_reconstructed_scene(outdir, gradio_delete_cache, model, device, silent,
model, lr1=lr1, niter1=niter1, lr2=lr2, niter2=niter2, device=device,
opt_depth='depth' in optim_level, shared_intrinsics=shared_intrinsics,
matching_conf_thr=matching_conf_thr, **kw)
if current_scene_state is not None and current_scene_state.outfile_name is not None:
if current_scene_state is not None and \
not current_scene_state.should_delete and \
current_scene_state.outfile_name is not None:
outfile_name = current_scene_state.outfile_name
else:
outfile_name = tempfile.mktemp(suffix='_scene.glb', dir=outdir)
Expand Down

0 comments on commit 158c0ce

Please sign in to comment.