diff --git a/code/python/src/main.py b/code/python/src/main.py index a59c1f4763f5c36d2ebe398ad17663a4a6c13ea4..5852afb5c6bce7da9648a024e38638febed046b8 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="boost", choices=["midas2", "midas3", "boost"]) + parser.add_argument("--persp_monodepth", type=str, default="midas2", 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" diff --git a/code/python/src/utility/depthmap_utils.py b/code/python/src/utility/depthmap_utils.py index b26f7902c9ec008af224026656f7d88b564b0b4c..8e9185f9b3d0420cb83be4062d22a92acd3a32ad 100644 --- a/code/python/src/utility/depthmap_utils.py +++ b/code/python/src/utility/depthmap_utils.py @@ -297,30 +297,21 @@ def MiDaS_torch_hub_file(rgb_image_path, use_large_model=True): def boosting_monodepth(rgb_image_data_list): # Load merge network import cv2 - import torch import argparse + import torch import warnings warnings.simplefilter('ignore', np.RankWarning) - parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument('--savepatchs', type=int, default=0, required=False, - help='Activate to save the patch estimations') - parser.add_argument('--savewholeest', type=int, default=0, required=False, - help='Activate to save the base estimations') - parser.add_argument('--output_resolution', type=int, default=1, required=False, - help='0 for results in maximum resolution 1 for resize to input size') - parser.add_argument('--net_receptive_field_size', type=int, required=False) # Do not set the value here - parser.add_argument('--pix2pixsize', type=int, default=1024, required=False) # Do not change it - parser.add_argument('--depthNet', type=int, default=0, required=False, - help='use to select different base depth networks 0:midas 1:strurturedRL 2:LeRes') - parser.add_argument('--colorize_results', action='store_true') - parser.add_argument('--R0', action='store_true') - parser.add_argument('--R20', action='store_true') - parser.add_argument('--Final', action='store_true') - parser.add_argument('--max_res', type=float, default=np.inf) - - # Check for required input - option, _ = parser.parse_known_args() + class Object(object): + pass + + option = Object() + option.R0 = False + option.R20 = False + option.output_resolution = 1 + option.pix2pixsize = 1024 + option.depthNet = 0 + option.max_res = np.Inf currfile_dir = os.path.dirname(__file__) boost_path = f"{os.path.join(currfile_dir, os.pardir, os.pardir, os.pardir, os.pardir, 'BoostingMonocularDepth')}" @@ -349,7 +340,18 @@ def boosting_monodepth(rgb_image_data_list): whole_size_threshold = 3000 # R_max from the paper GPU_threshold = 1600 - 32 # Limit for the GPU (NVIDIA RTX 2080), can be adjusted - opt = TestOptions().parse() + opt_pix2pix = Object() + opt_pix2pix.input_nc = 2 + opt_pix2pix.output_nc = 1 + + # Handle pix2pix parser + opt = TestOptions() + parser_pix2pix = argparse.ArgumentParser() + parser_pix2pix = opt.initialize(parser_pix2pix) + opt = parser_pix2pix.parse_known_args()[0] + opt.isTrain = False + opt.gpu_ids = [0] + BoostingMonocularDepth.run.pix2pixmodel = Pix2Pix4DepthModel(opt) BoostingMonocularDepth.run.pix2pixmodel.save_dir = os.path.join(boost_path, "pix2pix", "checkpoints", "mergemodel") BoostingMonocularDepth.run.pix2pixmodel.load_networks('latest')