Skip to content

Commit

Permalink
add: extract
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincentqyw committed Sep 25, 2024
1 parent 0e244d3 commit 0f1f0fd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,25 @@ def _forward(self, img0, img1):
pred = match_features.match_images(self.matcher, pred0, pred1)
return pred

@torch.inference_mode()
def extract(
self,
img0: np.ndarray,
) -> Dict[str, np.ndarray]:
"""Extract features from a single image.
Args:
img0 (np.ndarray): image
Returns:
Dict[str, np.ndarray]: feature dict
"""

pred = extract_features.extract(
self.extractor, img0, self.extract_conf["preprocessing"]
)
return pred

@torch.inference_mode()
def forward(
self,
Expand Down

0 comments on commit 0f1f0fd

Please sign in to comment.