def DPT_Hybrid_NYU(pretrained=True, **kwargs): """ # This docstring shows up in hub.help() MiDaS DPT-Hybrid model for monocular depth estimation pretrained (bool): load pretrained weights into model """ model = DPTDepthModel( path=None, scale=0.000305, shift=0.1378, invert=True, backbone="vitb_rn50_384", non_negative=True, ) if pretrained: checkpoint = ( "https://github.com/intel-isl/DPT/releases/download/1_0/dpt_hybrid_nyu-2ce69ec7.pt" ) state_dict = torch.hub.load_state_dict_from_url( checkpoint, map_location=torch.device('cpu'), progress=True, check_hash=True ) model.load_state_dict(state_dict) return model
def DPT_Large(pretrained=True, **kwargs): """ # This docstring shows up in hub.help() MiDaS DPT-Large model for monocular depth estimation pretrained (bool): load pretrained weights into model """ model = DPTDepthModel( path=None, backbone="vitl16_384", non_negative=True, ) if pretrained: checkpoint = ( "https://github.com/intel-isl/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt" ) state_dict = torch.hub.load_state_dict_from_url( checkpoint, map_location=torch.device('cpu'), progress=True, check_hash=True ) model.load_state_dict(state_dict) return model