예제 #1
0
 def __init__(
     self,
     num_features: int = 500,
     mr_size: float = 6.0,
     scale_pyr_module: nn.Module = ScalePyramid(3, 1.6, 15),
     resp_module: nn.Module = BlobHessian(),
     nms_module: nn.Module = ConvSoftArgmax3d((3, 3, 3), (1, 1, 1),
                                              (1, 1, 1),
                                              normalized_coordinates=False,
                                              output_value=True),
     ori_module: nn.Module = PassLAF(),
     aff_module: nn.Module = PassLAF(),
     minima_are_also_good: bool = False,
     scale_space_response=False,
 ):
     super(ScaleSpaceDetector, self).__init__()
     self.mr_size = mr_size
     self.num_features = num_features
     self.scale_pyr = scale_pyr_module
     self.resp = resp_module
     self.nms = nms_module
     self.ori = ori_module
     self.aff = aff_module
     self.minima_are_also_good = minima_are_also_good
     # scale_space_response should be True if the response function works on scale space
     # like Difference-of-Gaussians
     self.scale_space_response = scale_space_response
예제 #2
0
 def __init__(self, criterion, geom_weight=1, level_nb=1):
     self.level_nb = level_nb
     self.SP = ScalePyramid()
     if criterion == "l2":
         self.criterion = torch.nn.MSELoss(reduction="none")
     elif criterion == "l1":
         self.criterion = torch.nn.L1Loss(reduction="none")
     elif criterion == "ssim":
         self.criterion = klosses.SSIM(reduction="none")
     else:
         raise ValueError(f"{criterion} not in [l2, l1, ssim]")
     self.geom_weight = geom_weight
예제 #3
0
 def __init__(self,
              num_features: int = 8000,
              upright: bool = False,
              device: torch.device = torch.device('cpu')):
     detector = ScaleSpaceDetector(
         num_features,
         resp_module=CornerGFTT(),
         nms_module=ConvQuadInterp3d(10, 1e-5),
         scale_pyr_module=ScalePyramid(3, 1.6, 32, double_image=False),
         ori_module=PassLAF() if upright else LAFOrienter(19),
         aff_module=LAFAffNetShapeEstimator(True).eval(),
         mr_size=6.0).to(device)
     descriptor = LAFDescriptor(None,
                                patch_size=32,
                                grayscale_descriptor=True).to(device)
     super().__init__(detector, descriptor)
예제 #4
0
 def __init__(self,
              num_features: int = 500,
              mr_size: float = 6.0,
              scale_pyr_module: nn.Module = ScalePyramid(3, 1.6, 10),
              resp_module: nn.Module = BlobHessian(),
              nms_module: nn.Module = ConvSoftArgmax3d(
                  (3, 3, 3), (1, 1, 1), (1, 1, 1),
                  normalized_coordinates=False,
                  output_value=True),
              ori_module: nn.Module = PassLAF(),
              aff_module: nn.Module = PassLAF()):
     super(ScaleSpaceDetector, self).__init__()
     self.mr_size = mr_size
     self.num_features = num_features
     self.scale_pyr = scale_pyr_module
     self.resp = resp_module
     self.nms = nms_module
     self.ori = ori_module
     self.aff = aff_module
     return
예제 #5
0
 def __init__(self,
              num_features: int = 8000,
              upright: bool = False,
              rootsift: bool = True,
              device: torch.device = torch.device('cpu')):
     patch_size: int = 41
     detector = ScaleSpaceDetector(
         num_features,
         resp_module=BlobDoG(),
         nms_module=ConvQuadInterp3d(10),
         scale_pyr_module=ScalePyramid(3, 1.6, 32, double_image=True),
         ori_module=PassLAF() if upright else LAFOrienter(19),
         scale_space_response=True,
         minima_are_also_good=True,
         mr_size=6.0).to(device)
     descriptor = LAFDescriptor(SIFTDescriptor(patch_size=patch_size,
                                               rootsift=rootsift),
                                patch_size=patch_size,
                                grayscale_descriptor=True).to(device)
     super().__init__(detector, descriptor)