Exemplo n.º 1
0
 def getOrientation(self, LAFs, final_pyr_idxs, final_level_idxs):
     pyr_inv_idxs = get_inverted_pyr_index(self.scale_pyr, final_pyr_idxs, final_level_idxs)
     patches_small =  extract_patches_from_pyramid_with_inv_index(self.scale_pyr, pyr_inv_idxs, LAFs, PS = self.OriNet.PS)
     max_iters = 1
     ### Detect orientation
     for i in range(max_iters):
         angles = self.OriNet(patches_small)
         LAFs = torch.cat([torch.bmm( LAFs[:,:,:2], angles2A(angles)), LAFs[:,:,2:]], dim = 2)
         if i != max_iters:
             patches_small = extract_patches_from_pyramid_with_inv_index(self.scale_pyr, pyr_inv_idxs, LAFs, PS = self.OriNet.PS)        
     return LAFs
 def getOrientation(self,scale_pyr, LAFs, final_pyr_idxs, final_level_idxs):
     pyr_inv_idxs = get_inverted_pyr_index(scale_pyr, final_pyr_idxs, final_level_idxs)
     patches_small =  extract_patches_from_pyramid_with_inv_index(scale_pyr, pyr_inv_idxs, LAFs, PS = self.OriNet.PS)
     max_iters = 1
     ### Detect orientation
     for i in range(max_iters):
         angles = self.OriNet(patches_small)
         #print np.degrees(ori.data.cpu().numpy().ravel()[1])
         LAFs = torch.cat([torch.bmm(angles2A(angles), LAFs[:,:,:2]), LAFs[:,:,2:]], dim = 2)
         if i != max_iters:
             patches_small = extract_patches_from_pyramid_with_inv_index(scale_pyr, pyr_inv_idxs, LAFs, PS = self.OriNet.PS)        
     return LAFs