コード例 #1
0
    def __init__(self,
                 num_scales=4,
                 ssim_loss_weight=0.85,
                 occ_reg_weight=0.1,
                 smooth_loss_weight=0.1,
                 C1=1e-4,
                 C2=9e-4,
                 photometric_reduce_op='mean',
                 disp_norm=True,
                 clip_loss=0.5,
                 progressive_scaling=0.0,
                 padding_mode='zeros',
                 automask_loss=False,
                 **kwargs):
        super().__init__()
        self.n = num_scales
        self.progressive_scaling = progressive_scaling
        self.ssim_loss_weight = ssim_loss_weight
        self.occ_reg_weight = occ_reg_weight
        self.smooth_loss_weight = smooth_loss_weight
        self.C1 = C1
        self.C2 = C2
        self.photometric_reduce_op = photometric_reduce_op
        self.disp_norm = disp_norm
        self.clip_loss = clip_loss
        self.padding_mode = padding_mode
        self.automask_loss = automask_loss
        self.progressive_scaling = ProgressiveScaling(progressive_scaling,
                                                      self.n)

        # Asserts
        if self.automask_loss:
            assert self.photometric_reduce_op == 'min', \
                'For automasking only the min photometric_reduce_op is supported.'
コード例 #2
0
    def __init__(self, num_scales=1, ssim_loss_weight=0.85, occ_reg_weight=0.1, smooth_loss_weight=0.1,
                 C1=1e-4, C2=9e-4, photometric_reduce_op='mean', disp_norm=True, clip_loss=0.5,
                 progressive_scaling=0.0, padding_mode='zeros',
                 automask_loss=False, **kwargs):
        super().__init__()
        self.n = num_scales
        self.progressive_scaling = progressive_scaling
        self.ssim_loss_weight = ssim_loss_weight
        self.occ_reg_weight = occ_reg_weight
        self.smooth_loss_weight = smooth_loss_weight
        self.C1 = C1
        self.C2 = C2
        self.photometric_reduce_op = photometric_reduce_op
        self.disp_norm = disp_norm
        self.clip_loss = clip_loss
        self.padding_mode = padding_mode
        self.automask_loss = automask_loss
        self.progressive_scaling = ProgressiveScaling(
            progressive_scaling, self.n)
        self.canonical_ray_surface = torch.tensor(
            #np.load("kitti_ray_template.npy"))
            #np.load("omnicam_ray_template.npy"))
            #np.load("dummy_ray_template_240_384.npy"))
            #np.load("dummy_ray_template_224_384.npy"))
            np.load("dummy_ray_template_512_320.npy"))

        # Asserts
        if self.automask_loss:
            assert self.photometric_reduce_op == 'min', \
                'For automasking only the min photometric_reduce_op is supported.'
 def __init__(self, num_scales=4,
              progressive_scaling=0.0, mask_ego=True, mask_out_of_bounds_reprojected=True, **kwargs):
     super().__init__()
     self.n = num_scales
     self.progressive_scaling = progressive_scaling
     self.mask_ego = mask_ego
     self.mask_out_of_bounds_reprojected = mask_out_of_bounds_reprojected
     self.progressive_scaling = ProgressiveScaling(
         progressive_scaling, self.n)
コード例 #4
0
 def __init__(self,
              supervised_method='sparse-l1',
              supervised_num_scales=4,
              progressive_scaling=0.0,
              **kwargs):
     super().__init__()
     self.loss_func = get_loss_func(supervised_method)
     self.supervised_method = supervised_method
     self.n = supervised_num_scales
     self.progressive_scaling = ProgressiveScaling(progressive_scaling,
                                                   self.n)
コード例 #5
0
    def __init__(self,
                 num_scales=4,
                 ssim_loss_weight=0.85,
                 occ_reg_weight=0.1,
                 smooth_loss_weight=0.1,
                 depth_consistency_loss_weight=0.1,
                 scene_flow_consistency_loss_weight=0.1,
                 C1=1e-4,
                 C2=9e-4,
                 photometric_reduce_op='mean',
                 disp_norm=True,
                 sort_cameras=False,
                 sort_swap=[],
                 clip_loss=0.5,
                 progressive_scaling=0.0,
                 padding_mode='zeros',
                 temporal_loss_weight=1.0,
                 spatial_loss_weight=0.1,
                 temporal_spatial_loss_weight=0.1,
                 automask_loss=True,
                 cameras=None,
                 **kwargs):
        super().__init__()
        self.n = num_scales
        self.progressive_scaling = progressive_scaling
        self.ssim_loss_weight = ssim_loss_weight
        self.occ_reg_weight = occ_reg_weight
        self.smooth_loss_weight = smooth_loss_weight
        self.depth_consistency_loss_weight = depth_consistency_loss_weight
        self.scene_flow_consistency_loss_weight = scene_flow_consistency_loss_weight
        self.C1 = C1
        self.C2 = C2
        self.photometric_reduce_op = photometric_reduce_op
        self.disp_norm = disp_norm
        self.clip_loss = clip_loss
        self.padding_mode = padding_mode
        self.automask_loss = automask_loss
        self.temporal_loss_weight = temporal_loss_weight
        self.spatial_loss_weight = spatial_loss_weight
        self.temporal_spatial_loss_weight = temporal_spatial_loss_weight
        self.progressive_scaling = ProgressiveScaling(progressive_scaling,
                                                      self.n)
        self.sort_cameras = sort_cameras
        self.sort_swap = sort_swap
        self.cameras = cameras

        # Asserts
        if self.automask_loss:
            assert self.photometric_reduce_op == 'min', \
                'For automasking only the min photometric_reduce_op is supported.'
コード例 #6
0
    def __init__(self, num_scales=4, ssim_loss_weight=0.85, occ_reg_weight=0.1, smooth_loss_weight=0.1,
                 C1=1e-4, C2=9e-4, photometric_reduce_op='min', disp_norm=True, clip_loss=0.5,
                 progressive_scaling=0.0, padding_mode='zeros',
                 automask_loss=False,
                 mask_ego=True,
                 mask_occlusion=False, mask_disocclusion=False, mask_spatial_context=False, mask_temporal_context=False,
                 depth_consistency_weight=0.2,
                 mult_margin_occlusion=1.5, add_margin_occlusion=1.5,
                 allow_context_rotation=False,
                 **kwargs):
        super().__init__()
        self.n = num_scales
        self.progressive_scaling = progressive_scaling
        self.ssim_loss_weight = ssim_loss_weight
        self.occ_reg_weight = occ_reg_weight
        self.smooth_loss_weight = smooth_loss_weight
        self.C1 = C1
        self.C2 = C2
        self.photometric_reduce_op = photometric_reduce_op
        self.disp_norm = disp_norm
        self.clip_loss = clip_loss
        self.padding_mode = padding_mode
        self.automask_loss = automask_loss
        self.mask_ego = mask_ego
        self.mask_occlusion = mask_occlusion
        self.mask_disocclusion = mask_disocclusion
        self.mask_spatial_context = mask_spatial_context
        self.mask_temporal_context = mask_temporal_context
        self.mult_margin_occlusion = mult_margin_occlusion
        self.add_margin_occlusion = add_margin_occlusion
        self.depth_consistency_weight = depth_consistency_weight
        self.allow_context_rotation = allow_context_rotation
        self.use_ref_depth = ((self.mask_occlusion or self.mask_disocclusion) and (self.mask_spatial_context or self.mask_temporal_context)) or (self.depth_consistency_weight > 0)
        self.progressive_scaling = ProgressiveScaling(
            progressive_scaling, self.n)

        # Asserts
        if self.automask_loss:
            assert self.photometric_reduce_op == 'min', \
                'For automasking only the min photometric_reduce_op is supported.'