Spaces:
Runtime error
Runtime error
kxhit
commited on
Commit
·
6cc584b
1
Parent(s):
c7d42db
pickle get_conf_trf
Browse files- app.py +45 -46
- dust3r/cloud_opt/commons.py +37 -37
app.py
CHANGED
|
@@ -693,49 +693,49 @@ with gr.Blocks() as demo:
|
|
| 693 |
clean_depth = gr.Checkbox(value=True, label="Clean-up depthmaps", visible=False)
|
| 694 |
transparent_cams = gr.Checkbox(value=False, label="Transparent cameras", visible=False)
|
| 695 |
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
| 703 |
-
|
| 704 |
-
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
|
| 733 |
-
|
| 734 |
-
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
|
| 739 |
|
| 740 |
|
| 741 |
# events
|
|
@@ -746,14 +746,13 @@ with gr.Blocks() as demo:
|
|
| 746 |
submit.click(fn=run_eschernet,
|
| 747 |
inputs=[eschernet_input, sample_steps, sample_seed,
|
| 748 |
nvs_num, nvs_mode],
|
| 749 |
-
outputs=[mv_images, output_video]
|
| 750 |
-
)
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
# demo.queue(max_size=10)
|
| 755 |
# demo.launch(share=True, server_name="0.0.0.0", server_port=None)
|
| 756 |
-
demo.launch()
|
| 757 |
|
| 758 |
# if __name__ == '__main__':
|
| 759 |
# main()
|
|
|
|
| 693 |
clean_depth = gr.Checkbox(value=True, label="Clean-up depthmaps", visible=False)
|
| 694 |
transparent_cams = gr.Checkbox(value=False, label="Transparent cameras", visible=False)
|
| 695 |
|
| 696 |
+
# events
|
| 697 |
+
# scenegraph_type.change(set_scenegraph_options,
|
| 698 |
+
# inputs=[input_image, winsize, refid, scenegraph_type],
|
| 699 |
+
# outputs=[winsize, refid])
|
| 700 |
+
# min_conf_thr.release(fn=model_from_scene_fun,
|
| 701 |
+
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 702 |
+
# clean_depth, transparent_cams, cam_size, same_focals],
|
| 703 |
+
# outputs=outmodel)
|
| 704 |
+
# cam_size.change(fn=model_from_scene_fun,
|
| 705 |
+
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 706 |
+
# clean_depth, transparent_cams, cam_size, same_focals],
|
| 707 |
+
# outputs=outmodel)
|
| 708 |
+
# as_pointcloud.change(fn=model_from_scene_fun,
|
| 709 |
+
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 710 |
+
# clean_depth, transparent_cams, cam_size, same_focals],
|
| 711 |
+
# outputs=outmodel)
|
| 712 |
+
# mask_sky.change(fn=model_from_scene_fun,
|
| 713 |
+
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 714 |
+
# clean_depth, transparent_cams, cam_size, same_focals],
|
| 715 |
+
# outputs=outmodel)
|
| 716 |
+
# clean_depth.change(fn=model_from_scene_fun,
|
| 717 |
+
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 718 |
+
# clean_depth, transparent_cams, cam_size, same_focals],
|
| 719 |
+
# outputs=outmodel)
|
| 720 |
+
# transparent_cams.change(model_from_scene_fun,
|
| 721 |
+
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
| 722 |
+
# clean_depth, transparent_cams, cam_size, same_focals],
|
| 723 |
+
# outputs=outmodel)
|
| 724 |
+
# run_dust3r.click(fn=recon_fun,
|
| 725 |
+
# inputs=[input_image, schedule, niter, min_conf_thr, as_pointcloud,
|
| 726 |
+
# mask_sky, clean_depth, transparent_cams, cam_size,
|
| 727 |
+
# scenegraph_type, winsize, refid, same_focals],
|
| 728 |
+
# outputs=[scene, outmodel, processed_image, eschernet_input])
|
| 729 |
+
|
| 730 |
+
# events
|
| 731 |
+
input_image.change(set_scenegraph_options,
|
| 732 |
+
inputs=[input_image, winsize, refid, scenegraph_type],
|
| 733 |
+
outputs=[winsize, refid])
|
| 734 |
+
run_dust3r.click(fn=get_reconstructed_scene,
|
| 735 |
+
inputs=[input_image, schedule, niter, min_conf_thr, as_pointcloud,
|
| 736 |
+
mask_sky, clean_depth, transparent_cams, cam_size,
|
| 737 |
+
scenegraph_type, winsize, refid, same_focals],
|
| 738 |
+
outputs=[scene, outmodel, processed_image, eschernet_input])
|
| 739 |
|
| 740 |
|
| 741 |
# events
|
|
|
|
| 746 |
submit.click(fn=run_eschernet,
|
| 747 |
inputs=[eschernet_input, sample_steps, sample_seed,
|
| 748 |
nvs_num, nvs_mode],
|
| 749 |
+
outputs=[mv_images, output_video])
|
|
|
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
# demo.queue(max_size=10)
|
| 754 |
# demo.launch(share=True, server_name="0.0.0.0", server_port=None)
|
| 755 |
+
demo.queue(max_size=10).launch()
|
| 756 |
|
| 757 |
# if __name__ == '__main__':
|
| 758 |
# main()
|
dust3r/cloud_opt/commons.py
CHANGED
|
@@ -47,45 +47,45 @@ def get_imshapes(edges, pred_i, pred_j):
|
|
| 47 |
return imshapes
|
| 48 |
|
| 49 |
|
| 50 |
-
def get_conf_trf(mode):
|
| 51 |
-
if mode == 'log':
|
| 52 |
-
def conf_trf(x): return x.log()
|
| 53 |
-
elif mode == 'sqrt':
|
| 54 |
-
def conf_trf(x): return x.sqrt()
|
| 55 |
-
elif mode == 'm1':
|
| 56 |
-
def conf_trf(x): return x-1
|
| 57 |
-
elif mode in ('id', 'none'):
|
| 58 |
-
def conf_trf(x): return x
|
| 59 |
-
else:
|
| 60 |
-
raise ValueError(f'bad mode for {mode=}')
|
| 61 |
-
return conf_trf
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
# def conf_trf_log(x):
|
| 65 |
-
# return x.log()
|
| 66 |
-
#
|
| 67 |
-
# def conf_trf_sqrt(x):
|
| 68 |
-
# return x.sqrt()
|
| 69 |
-
#
|
| 70 |
-
# def conf_trf_m1(x):
|
| 71 |
-
# return x - 1
|
| 72 |
-
#
|
| 73 |
-
# def conf_trf_id(x):
|
| 74 |
-
# return x
|
| 75 |
-
#
|
| 76 |
-
# # Mapping of modes to their corresponding functions
|
| 77 |
-
# conf_trf_map = {
|
| 78 |
-
# 'log': conf_trf_log,
|
| 79 |
-
# 'sqrt': conf_trf_sqrt,
|
| 80 |
-
# 'm1': conf_trf_m1,
|
| 81 |
-
# 'id': conf_trf_id,
|
| 82 |
-
# 'none': conf_trf_id
|
| 83 |
-
# }
|
| 84 |
-
#
|
| 85 |
# def get_conf_trf(mode):
|
| 86 |
-
# if mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
# raise ValueError(f'bad mode for {mode=}')
|
| 88 |
-
# return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
|
| 91 |
|
|
|
|
| 47 |
return imshapes
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
# def get_conf_trf(mode):
|
| 51 |
+
# if mode == 'log':
|
| 52 |
+
# def conf_trf(x): return x.log()
|
| 53 |
+
# elif mode == 'sqrt':
|
| 54 |
+
# def conf_trf(x): return x.sqrt()
|
| 55 |
+
# elif mode == 'm1':
|
| 56 |
+
# def conf_trf(x): return x-1
|
| 57 |
+
# elif mode in ('id', 'none'):
|
| 58 |
+
# def conf_trf(x): return x
|
| 59 |
+
# else:
|
| 60 |
# raise ValueError(f'bad mode for {mode=}')
|
| 61 |
+
# return conf_trf
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def conf_trf_log(x):
|
| 65 |
+
return x.log()
|
| 66 |
+
|
| 67 |
+
def conf_trf_sqrt(x):
|
| 68 |
+
return x.sqrt()
|
| 69 |
+
|
| 70 |
+
def conf_trf_m1(x):
|
| 71 |
+
return x - 1
|
| 72 |
+
|
| 73 |
+
def conf_trf_id(x):
|
| 74 |
+
return x
|
| 75 |
+
|
| 76 |
+
# Mapping of modes to their corresponding functions
|
| 77 |
+
conf_trf_map = {
|
| 78 |
+
'log': conf_trf_log,
|
| 79 |
+
'sqrt': conf_trf_sqrt,
|
| 80 |
+
'm1': conf_trf_m1,
|
| 81 |
+
'id': conf_trf_id,
|
| 82 |
+
'none': conf_trf_id
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
def get_conf_trf(mode):
|
| 86 |
+
if mode not in conf_trf_map:
|
| 87 |
+
raise ValueError(f'bad mode for {mode=}')
|
| 88 |
+
return conf_trf_map[mode]
|
| 89 |
|
| 90 |
|
| 91 |
|