Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawars committed Nov 23, 2024
1 parent e83db3b commit 3cf2a68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions hloc/extractors/dedode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

import torch
import torchvision.transforms as transforms
from kornia import feature as KF

from hloc import MODEL_REPO_ID, logger

from ..utils.base_model import BaseModel
from kornia import feature as KF

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

Expand All @@ -27,7 +27,10 @@ class DeDoDe(BaseModel):

# Initialize the line matcher
def _init(self, conf):
self.model = KF.DeDoDe.from_pretrained(detector_weights=conf["detector_model"], descriptor_weights=conf["descriptor_model"])
self.model = KF.DeDoDe.from_pretrained(
detector_weights=conf["detector_model"],
descriptor_weights=conf["descriptor_model"],
)
logger.info("Load DeDoDe model done.")

def _forward(self, data):
Expand All @@ -38,7 +41,9 @@ def _forward(self, data):
"""
img0 = data["image"].float()

coords, scores, descriptions = self.model(img0, n=self.conf["max_keypoints"])
coords, scores, descriptions = self.model(
img0, n=self.conf["max_keypoints"]
)

return {
"keypoints": coords, # 1 x N x 2
Expand Down
3 changes: 2 additions & 1 deletion hloc/matchers/lightglue.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import torch
import kornia.feature as KF
import torch

from .. import MODEL_REPO_ID, logger
from ..utils.base_model import BaseModel


class LightGlue(BaseModel):
default_conf = {
"match_threshold": 0.2,
Expand Down

0 comments on commit 3cf2a68

Please sign in to comment.