Spaces:
Running
on
Zero
Running
on
Zero
update mast3r module
Browse files
app.py
CHANGED
@@ -59,9 +59,9 @@ def local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr,
|
|
59 |
as_pointcloud, cam_size,
|
60 |
shared_intrinsics, **kw):
|
61 |
lr1 = 0.07
|
62 |
-
niter1 =
|
63 |
-
lr2 = 0.
|
64 |
-
niter2 =
|
65 |
optim_level = 'refine'
|
66 |
mask_sky, clean_depth, transparent_cams = False, True, False
|
67 |
if len(filelist) < 5:
|
@@ -74,7 +74,7 @@ def local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr,
|
|
74 |
winsize = min(5, max_winsize)
|
75 |
refid = 0
|
76 |
win_cyclic = False
|
77 |
-
scene_state, outfile = get_reconstructed_scene(tmpdirname, gradio_delete_cache, model, device, silent, image_size, None,
|
78 |
filelist, optim_level, lr1, niter1, lr2, niter2, min_conf_thr, matching_conf_thr,
|
79 |
as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size, scenegraph_type, winsize,
|
80 |
win_cyclic, refid, TSDF_thresh=0, shared_intrinsics=shared_intrinsics, **kw)
|
@@ -87,11 +87,13 @@ def local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr,
|
|
87 |
def run_example(snapshot, matching_conf_thr, min_conf_thr, cam_size, as_pointcloud, shared_intrinsics, filelist, **kw):
|
88 |
return local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr, as_pointcloud, cam_size, shared_intrinsics, **kw)
|
89 |
|
|
|
90 |
css = """.gradio-container {margin: 0 !important; min-width: 100%};"""
|
91 |
title = "MASt3R Demo"
|
92 |
with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, gradio_delete_cache)) as demo:
|
93 |
filestate = gradio.State(None)
|
94 |
-
gradio.HTML(
|
|
|
95 |
gradio.HTML('<p>Upload one or multiple images (wait for them to be fully uploaded before hitting the run button). '
|
96 |
'We tested with up to 18 images before running into the allocation timeout - set at 3 minutes but your mileage may vary. '
|
97 |
'At the very bottom of this page, you will find an example. If you click on it, it will pull the 3D reconstruction from 7 images of the small Naver Labs Europe tower from cache. '
|
@@ -102,13 +104,15 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
|
|
102 |
inputfiles = gradio.File(file_count="multiple")
|
103 |
snapshot = gradio.Image(None, visible=False)
|
104 |
with gradio.Row():
|
105 |
-
matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=
|
106 |
minimum=0., maximum=30., step=0.1,
|
107 |
info="Before Fallback to Regr3D!")
|
108 |
# adjust the confidence threshold
|
109 |
-
min_conf_thr = gradio.Slider(
|
|
|
110 |
# adjust the camera size in the output pointcloud
|
111 |
-
cam_size = gradio.Slider(
|
|
|
112 |
with gradio.Row():
|
113 |
as_pointcloud = gradio.Checkbox(value=True, label="As pointcloud")
|
114 |
shared_intrinsics = gradio.Checkbox(value=False, label="Shared intrinsics",
|
@@ -119,7 +123,8 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
|
|
119 |
examples = gradio.Examples(
|
120 |
examples=[
|
121 |
[
|
122 |
-
os.path.join(
|
|
|
123 |
0.0, 1.5, 0.2, True, False,
|
124 |
[os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg'),
|
125 |
os.path.join(
|
@@ -135,7 +140,8 @@ with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, grad
|
|
135 |
os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg')]
|
136 |
]
|
137 |
],
|
138 |
-
inputs=[snapshot, matching_conf_thr, min_conf_thr,
|
|
|
139 |
outputs=[filestate, outmodel],
|
140 |
fn=run_example,
|
141 |
cache_examples="lazy",
|
|
|
59 |
as_pointcloud, cam_size,
|
60 |
shared_intrinsics, **kw):
|
61 |
lr1 = 0.07
|
62 |
+
niter1 = 300
|
63 |
+
lr2 = 0.01
|
64 |
+
niter2 = 300
|
65 |
optim_level = 'refine'
|
66 |
mask_sky, clean_depth, transparent_cams = False, True, False
|
67 |
if len(filelist) < 5:
|
|
|
74 |
winsize = min(5, max_winsize)
|
75 |
refid = 0
|
76 |
win_cyclic = False
|
77 |
+
scene_state, outfile = get_reconstructed_scene(tmpdirname, gradio_delete_cache, model, None, device, silent, image_size, None,
|
78 |
filelist, optim_level, lr1, niter1, lr2, niter2, min_conf_thr, matching_conf_thr,
|
79 |
as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size, scenegraph_type, winsize,
|
80 |
win_cyclic, refid, TSDF_thresh=0, shared_intrinsics=shared_intrinsics, **kw)
|
|
|
87 |
def run_example(snapshot, matching_conf_thr, min_conf_thr, cam_size, as_pointcloud, shared_intrinsics, filelist, **kw):
|
88 |
return local_get_reconstructed_scene(filelist, min_conf_thr, matching_conf_thr, as_pointcloud, cam_size, shared_intrinsics, **kw)
|
89 |
|
90 |
+
|
91 |
css = """.gradio-container {margin: 0 !important; min-width: 100%};"""
|
92 |
title = "MASt3R Demo"
|
93 |
with gradio.Blocks(css=css, title=title, delete_cache=(gradio_delete_cache, gradio_delete_cache)) as demo:
|
94 |
filestate = gradio.State(None)
|
95 |
+
gradio.HTML(
|
96 |
+
'<h2 style="text-align: center;">3D Reconstruction with MASt3R</h2>')
|
97 |
gradio.HTML('<p>Upload one or multiple images (wait for them to be fully uploaded before hitting the run button). '
|
98 |
'We tested with up to 18 images before running into the allocation timeout - set at 3 minutes but your mileage may vary. '
|
99 |
'At the very bottom of this page, you will find an example. If you click on it, it will pull the 3D reconstruction from 7 images of the small Naver Labs Europe tower from cache. '
|
|
|
104 |
inputfiles = gradio.File(file_count="multiple")
|
105 |
snapshot = gradio.Image(None, visible=False)
|
106 |
with gradio.Row():
|
107 |
+
matching_conf_thr = gradio.Slider(label="Matching Confidence Thr", value=0.,
|
108 |
minimum=0., maximum=30., step=0.1,
|
109 |
info="Before Fallback to Regr3D!")
|
110 |
# adjust the confidence threshold
|
111 |
+
min_conf_thr = gradio.Slider(
|
112 |
+
label="min_conf_thr", value=1.5, minimum=0.0, maximum=10, step=0.1)
|
113 |
# adjust the camera size in the output pointcloud
|
114 |
+
cam_size = gradio.Slider(
|
115 |
+
label="cam_size", value=0.2, minimum=0.001, maximum=1.0, step=0.001)
|
116 |
with gradio.Row():
|
117 |
as_pointcloud = gradio.Checkbox(value=True, label="As pointcloud")
|
118 |
shared_intrinsics = gradio.Checkbox(value=False, label="Shared intrinsics",
|
|
|
123 |
examples = gradio.Examples(
|
124 |
examples=[
|
125 |
[
|
126 |
+
os.path.join(
|
127 |
+
HERE_PATH, 'mast3r/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg'),
|
128 |
0.0, 1.5, 0.2, True, False,
|
129 |
[os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/01D90321-69C8-439F-B0B0-E87E7634741C-83120-000041DAE419D7AE.jpg'),
|
130 |
os.path.join(
|
|
|
140 |
os.path.join(HERE_PATH, 'mast3r/assets/NLE_tower/FF5599FD-768B-431A-AB83-BDA5FB44CB9D-83120-000041DADDE35483.jpg')]
|
141 |
]
|
142 |
],
|
143 |
+
inputs=[snapshot, matching_conf_thr, min_conf_thr,
|
144 |
+
cam_size, as_pointcloud, shared_intrinsics, inputfiles],
|
145 |
outputs=[filestate, outmodel],
|
146 |
fn=run_example,
|
147 |
cache_examples="lazy",
|
mast3r
CHANGED
@@ -1 +1 @@
|
|
1 |
-
Subproject commit
|
|
|
1 |
+
Subproject commit fb8dfe783043764f6ad78dd021bfcd88bc1d73a2
|