Vincentqyw
commited on
Commit
•
7bff0e4
1
Parent(s):
74659e4
reformat
Browse files
hloc/extractors/dedode.py
CHANGED
@@ -64,8 +64,8 @@ class DeDoDe(BaseModel):
|
|
64 |
# load the model
|
65 |
weights_detector = torch.load(model_detector_path, map_location="cpu")
|
66 |
weights_descriptor = torch.load(model_descriptor_path, map_location="cpu")
|
67 |
-
self.detector = dedode_detector_L(weights=weights_detector, device
|
68 |
-
self.descriptor = dedode_descriptor_B(weights=weights_descriptor, device
|
69 |
logger.info(f"Load DeDoDe model done.")
|
70 |
|
71 |
def _forward(self, data):
|
|
|
64 |
# load the model
|
65 |
weights_detector = torch.load(model_detector_path, map_location="cpu")
|
66 |
weights_descriptor = torch.load(model_descriptor_path, map_location="cpu")
|
67 |
+
self.detector = dedode_detector_L(weights=weights_detector, device=device)
|
68 |
+
self.descriptor = dedode_descriptor_B(weights=weights_descriptor, device=device)
|
69 |
logger.info(f"Load DeDoDe model done.")
|
70 |
|
71 |
def _forward(self, data):
|
third_party/ASpanFormer/src/ASpanFormer/aspan_module/transformer.py
CHANGED
@@ -6,6 +6,7 @@ from .attention import FullAttention, HierachicalAttention, layernorm2d
|
|
6 |
|
7 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
|
|
|
9 |
class messageLayer_ini(nn.Module):
|
10 |
def __init__(self, d_model, d_flow, d_value, nhead):
|
11 |
super().__init__()
|
|
|
6 |
|
7 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
8 |
|
9 |
+
|
10 |
class messageLayer_ini(nn.Module):
|
11 |
def __init__(self, d_model, d_flow, d_value, nhead):
|
12 |
super().__init__()
|
third_party/ASpanFormer/src/ASpanFormer/aspanformer.py
CHANGED
@@ -15,6 +15,7 @@ from .utils.fine_matching import FineMatching
|
|
15 |
|
16 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
17 |
|
|
|
18 |
class ASpanFormer(nn.Module):
|
19 |
def __init__(self, config):
|
20 |
super().__init__()
|
@@ -160,7 +161,7 @@ class ASpanFormer(nn.Module):
|
|
160 |
train_res_h / data["image1"].shape[2],
|
161 |
train_res_w / data["image1"].shape[3],
|
162 |
]
|
163 |
-
|
164 |
data["online_resize_scale0"], data["online_resize_scale1"] = (
|
165 |
torch.tensor([w0 / data["image0"].shape[3], h0 / data["image0"].shape[2]])[
|
166 |
None
|
|
|
15 |
|
16 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
17 |
|
18 |
+
|
19 |
class ASpanFormer(nn.Module):
|
20 |
def __init__(self, config):
|
21 |
super().__init__()
|
|
|
161 |
train_res_h / data["image1"].shape[2],
|
162 |
train_res_w / data["image1"].shape[3],
|
163 |
]
|
164 |
+
|
165 |
data["online_resize_scale0"], data["online_resize_scale1"] = (
|
166 |
torch.tensor([w0 / data["image0"].shape[3], h0 / data["image0"].shape[2]])[
|
167 |
None
|
third_party/SGMNet/sgmnet/match_model.py
CHANGED
@@ -5,6 +5,7 @@ eps = 1e-8
|
|
5 |
|
6 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
7 |
|
|
|
8 |
def sinkhorn(M, r, c, iteration):
|
9 |
p = torch.softmax(M, dim=-1)
|
10 |
u = torch.ones_like(r)
|
|
|
5 |
|
6 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
7 |
|
8 |
+
|
9 |
def sinkhorn(M, r, c, iteration):
|
10 |
p = torch.softmax(M, dim=-1)
|
11 |
u = torch.ones_like(r)
|