Spaces:
Sleeping
Sleeping
winfred2027
commited on
Commit
•
4429214
1
Parent(s):
daed59e
Update app.py
Browse files
app.py
CHANGED
@@ -101,7 +101,7 @@ def demo_retrieval():
|
|
101 |
ref_dev = next(model_g14.parameters()).device
|
102 |
enc = model_g14(torch.tensor(pc[:, [0, 2, 1, 3, 4, 5]].T[None], device=ref_dev)).cpu()
|
103 |
|
104 |
-
sim = torch.matmul(
|
105 |
argsort = torch.argsort(sim, descending=True)
|
106 |
pred = OrderedDict((lvis.categories[i], sim[i]) for i in argsort if i < len(lvis.categories))
|
107 |
with col2:
|
|
|
101 |
ref_dev = next(model_g14.parameters()).device
|
102 |
enc = model_g14(torch.tensor(pc[:, [0, 2, 1, 3, 4, 5]].T[None], device=ref_dev)).cpu()
|
103 |
|
104 |
+
sim = torch.matmul(torch.nn.functional.normalize(lvis.feats, dim=-1), torch.nn.functional.normalize(enc, dim=-1).squeeze())
|
105 |
argsort = torch.argsort(sim, descending=True)
|
106 |
pred = OrderedDict((lvis.categories[i], sim[i]) for i in argsort if i < len(lvis.categories))
|
107 |
with col2:
|