diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..127d7809fcd02b9ef935b70960497dad112c1fd3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "BoostingMonocularDepth"] + path = BoostingMonocularDepth + url = https://github.com/compphoto/BoostingMonocularDepth diff --git a/BoostingMonocularDepth b/BoostingMonocularDepth new file mode 160000 index 0000000000000000000000000000000000000000..ecedd0c0cf5e1807cdab1c5154351a97168e710d --- /dev/null +++ b/BoostingMonocularDepth @@ -0,0 +1 @@ +Subproject commit ecedd0c0cf5e1807cdab1c5154351a97168e710d diff --git a/code/python/src/main.py b/code/python/src/main.py index 928bc5d0a08bbcef00b97c8ff0f4c992f5fee46e..a59c1f4763f5c36d2ebe398ad17663a4a6c13ea4 100644 --- a/code/python/src/main.py +++ b/code/python/src/main.py @@ -97,7 +97,7 @@ class Options(): parser.add_argument("--padding", type=float, default="0.3") parser.add_argument("--multires_levels", type=int, default=1, help="Levels of multi-resolution pyramid. If > 1" "then --grid_size is the lowest resolution") - parser.add_argument("--persp_monodepth", type=str, default="midas2", choices=["midas2", "midas3"]) + parser.add_argument("--persp_monodepth", type=str, default="boost", choices=["midas2", "midas3", "boost"]) parser.add_argument('--depthalignstep', type=int, nargs='+', default=[1, 2, 3, 4]) parser.add_argument("--rm_debug_folder", default=True, action='store_false') parser.add_argument("--intermediate_data", default=False, action='store_true', help="save intermediate data" @@ -207,7 +207,7 @@ def depthmap_estimation(erp_rgb_image_data, fnc, opt, blendIt, idx=1): tic = time.perf_counter() subimage_depthmap_persp_list = [] # estimate disparity map - subimage_dispmap_persp_list = depthmap_utils.MiDaS_torch_hub_data(subimage_rgb_list, opt.persp_monodepth) + subimage_dispmap_persp_list = depthmap_utils.run_persp_monodepth(subimage_rgb_list, opt.persp_monodepth) # convert disparity map to depth map for dispmap_persp in subimage_dispmap_persp_list: subimage_depthmap_persp_list.append(depthmap_utils.disparity2depth(dispmap_persp)) diff --git a/code/python/src/utility/depthmap_utils.py b/code/python/src/utility/depthmap_utils.py index e5402fbbcf07f84dbe9244ea5791bd7da31d21b3..90fa719849cf02ab9ca9a7a3ff2020aff10a641a 100644 --- a/code/python/src/utility/depthmap_utils.py +++ b/code/python/src/utility/depthmap_utils.py @@ -166,6 +166,13 @@ def rgb2dispmap(image_filepath, pytorch_hub=True): return depthmap_data +def run_persp_monodepth(rgb_image_data_list, persp_monodepth, use_large_model=True): + if (persp_monodepth == "midas2") or (persp_monodepth == "midas3"): + MiDaS_torch_hub_data(rgb_image_data_list, persp_monodepth, use_large_model=use_large_model) + if persp_monodepth == "boost": + boosting_monodepth(rgb_image_data_list) + + def MiDaS_torch_hub_data(rgb_image_data_list, persp_monodepth, use_large_model=True): """Estimation the single RGB image's depth with MiDaS downloading from Torch Hub. reference: https://pytorch.org/hub/intelisl_midas_v2/