示例#1
0
 def __init__(self,
              use_cuda=False,
              border=16,
              num_features=500,
              patch_size=32,
              mrSize=3.0,
              nlevels=8,
              num_Baum_iters=0,
              init_sigma=1.6):
     super(HessianAffinePatchExtractor, self).__init__()
     self.mrSize = mrSize
     self.PS = patch_size
     self.b = border
     self.num = num_features
     self.use_cuda = use_cuda
     self.nlevels = nlevels
     self.num_Baum_iters = num_Baum_iters
     self.init_sigma = init_sigma
     self.Hes = HessianResp()
     self.OriDet = OrientationDetector(patch_size=19)
     self.AffShape = AffineShapeEstimator(patch_size=19)
     self.ScalePyrGen = ScalePyramid(nScales=self.nlevels,
                                     init_sigma=self.init_sigma,
                                     border=self.b)
     return
 def __init__(self, 
              border = 16,
              num_features = 500,
              patch_size = 32,
              mrSize = 3.0,
              nlevels = 3,
              num_Baum_iters = 0,
              init_sigma = 1.6,
              RespNet = None, OriNet = None, AffNet = None):
     super(ScaleSpaceAffinePatchExtractor, self).__init__()
     self.mrSize = mrSize
     self.PS = patch_size
     self.b = border;
     self.num = num_features
     self.nlevels = nlevels
     self.num_Baum_iters = num_Baum_iters
     self.init_sigma = init_sigma
     if RespNet is not None:
         self.RespNet = RespNet
     else:
         self.RespNet = HessianResp()
     if OriNet is not None:
         self.OriNet = OriNet
     else:
         self.OriNet= OrientationDetector(patch_size = 19);
     if AffNet is not None:
         self.AffNet = AffNet
     else:
         self.AffNet = AffineShapeEstimator(patch_size = 19)
     self.ScalePyrGen = ScalePyramid(nLevels = self.nlevels, init_sigma = self.init_sigma, border = self.b)
     return
示例#3
0
 def __init__(self,
              descriptors_list,
              names_list,
              loss_fn=loss_HardNegC,
              cuda=False,
              lr=1e-0,
              loss_name='HardNegC'):
     assert len(descriptors_list) == len(names_list)
     self.desc_list = descriptors_list
     self.names_list = names_list
     self.colors = ['r', 'g', 'b', 'y', 'm', 'k', 'c']
     self.cuda = cuda
     self.out_lafs1 = {}
     self.out_lafs2 = {}
     self.loss_func = loss_fn
     self.loss_name = loss_name
     self.save_dir = self.loss_name + '_saves'
     self.out_loss_mean = {}
     self.cent_diff = {}
     self.shape_diff = {}
     self.snn = {}
     self.lr = lr
     for dn in names_list:
         self.out_lafs1[dn] = []
         self.out_lafs2[dn] = []
         self.out_loss_mean[dn] = []
         self.cent_diff[dn] = []
         self.shape_diff[dn] = []
         self.snn[dn] = []
     self.ScalePyrGen = ScalePyramid(nLevels=1, init_sigma=1.6, border=32)
     return
示例#4
0
 def __init__(self, 
              border = 16,
              num_features = 500,
              patch_size = 32,
              mrSize = 3.0,
              nlevels = 3,
              threshold = 0,
              num_Baum_iters = 0,
              init_sigma = 1.6,
              RespNet = None, OriNet = None, AffNet = None):
     super(ScaleSpaceAffinePatchExtractor, self).__init__()
     self.mrSize = mrSize
     self.PS = patch_size
     self.b = border;
     self.num = num_features
     self.th = threshold
     if threshold > 0:
         print('Threshold is set to ', threshold, 'num_features is ignored')
         self.num = -1
     else:
         print('Threshold is not set, max num_features = ', self.num, ' will be outputed')
     self.nlevels = nlevels
     self.num_Baum_iters = num_Baum_iters
     self.init_sigma = init_sigma
     if RespNet is not None:
         self.RespNet = RespNet
     else:
         self.RespNet = HessianResp()
     if OriNet is not None:
         self.OriNet = OriNet
     else:
         self.OriNet= OrientationDetector(patch_size = 19);
     if AffNet is not None:
         self.AffNet = AffNet
     else:
         self.AffNet = AffineShapeEstimator(patch_size = 19)
     self.ScalePyrGen = ScalePyramid(nLevels = self.nlevels, init_sigma = self.init_sigma, border = self.b)
     return