Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hloc/extract_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ def main(conf: Dict,
size = np.array(data['image'].shape[-2:][::-1])
scales = (original_size / size).astype(np.float32)
pred['keypoints'] = (pred['keypoints'] + .5) * scales[None] - .5
# add keypoint uncertainties scaled to the original resolution
uncertainty = getattr(model, 'detection_noise', 1) * scales.mean()

if as_half:
for k in pred:
Expand All @@ -255,6 +257,8 @@ def main(conf: Dict,
grp = fd.create_group(name)
for k, v in pred.items():
grp.create_dataset(k, data=v)
if 'keypoints' in pred:
grp['keypoints'].attrs['uncertainty'] = uncertainty
except OSError as error:
if 'No space left on device' in error.args[0]:
logger.error(
Expand Down
1 change: 1 addition & 0 deletions hloc/extractors/sift.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SIFT(BaseModel):
'max_keypoints': -1
}
required_inputs = ['image']
detection_noise = 1.0

def _init(self, conf):
self.root = conf['root']
Expand Down
1 change: 1 addition & 0 deletions hloc/extractors/superpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class SuperPoint(BaseModel):
'fix_sampling': False,
}
required_inputs = ['image']
detection_noise = 2.0

def _init(self, conf):
if conf['fix_sampling']:
Expand Down