Skip to content

Commit

Permalink
Add HardNet (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
skydes authored Sep 20, 2022
1 parent e566a8f commit 25750cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hloc/extractors/dog.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class DoG(BaseModel):
def _init(self, conf):
if conf['descriptor'] == 'sosnet':
self.describe = kornia.feature.SOSNet(pretrained=True)
elif conf['descriptor'] == 'hardnet':
self.describe = kornia.feature.HardNet(pretrained=True)
elif conf['descriptor'] not in ['sift', 'rootsift']:
raise ValueError(f'Unknown descriptor: {conf["descriptor"]}')

Expand Down Expand Up @@ -79,7 +81,7 @@ def _forward(self, data):
if self.conf['descriptor'] == 'rootsift':
descriptors = sift_to_rootsift(descriptors)
descriptors = torch.from_numpy(descriptors)
elif self.conf['descriptor'] == 'sosnet':
elif self.conf['descriptor'] in ('sosnet', 'hardnet'):
center = keypoints[:, :2] + 0.5
laf_scale = scales * self.conf['mr_size'] / 2
laf_ori = -oris
Expand Down

0 comments on commit 25750cb

Please sign in to comment.