Spaces:
Running
Running
Commit
·
adeecb5
1
Parent(s):
1eb268b
Update
Browse files- common/utils.py +2 -82
- common/viz.py +7 -4
common/utils.py
CHANGED
|
@@ -468,20 +468,7 @@ ransac_zoo = {
|
|
| 468 |
# Matchers collections
|
| 469 |
matcher_zoo = {
|
| 470 |
"gim": {"config": match_dense.confs["gim"], "dense": True},
|
| 471 |
-
"gluestick": {"config": match_dense.confs["gluestick"], "dense": True},
|
| 472 |
-
"sold2": {"config": match_dense.confs["sold2"], "dense": True},
|
| 473 |
-
# 'dedode-sparse': {
|
| 474 |
-
# 'config': match_dense.confs['dedode_sparse'],
|
| 475 |
-
# 'dense': True # dense mode, we need 2 images
|
| 476 |
-
# },
|
| 477 |
"loftr": {"config": match_dense.confs["loftr"], "dense": True},
|
| 478 |
-
"topicfm": {"config": match_dense.confs["topicfm"], "dense": True},
|
| 479 |
-
"aspanformer": {"config": match_dense.confs["aspanformer"], "dense": True},
|
| 480 |
-
"dedode": {
|
| 481 |
-
"config": match_features.confs["Dual-Softmax"],
|
| 482 |
-
"config_feature": extract_features.confs["dedode"],
|
| 483 |
-
"dense": False,
|
| 484 |
-
},
|
| 485 |
"superpoint+superglue": {
|
| 486 |
"config": match_features.confs["superglue"],
|
| 487 |
"config_feature": extract_features.confs["superpoint_max"],
|
|
@@ -492,79 +479,14 @@ matcher_zoo = {
|
|
| 492 |
"config_feature": extract_features.confs["superpoint_max"],
|
| 493 |
"dense": False,
|
| 494 |
},
|
| 495 |
-
"disk": {
|
| 496 |
-
"config": match_features.confs["NN-mutual"],
|
| 497 |
-
"config_feature": extract_features.confs["disk"],
|
| 498 |
-
"dense": False,
|
| 499 |
-
},
|
| 500 |
-
"disk+dualsoftmax": {
|
| 501 |
-
"config": match_features.confs["Dual-Softmax"],
|
| 502 |
-
"config_feature": extract_features.confs["disk"],
|
| 503 |
-
"dense": False,
|
| 504 |
-
},
|
| 505 |
-
"superpoint+dualsoftmax": {
|
| 506 |
-
"config": match_features.confs["Dual-Softmax"],
|
| 507 |
-
"config_feature": extract_features.confs["superpoint_max"],
|
| 508 |
-
"dense": False,
|
| 509 |
-
},
|
| 510 |
-
"disk+lightglue": {
|
| 511 |
-
"config": match_features.confs["disk-lightglue"],
|
| 512 |
-
"config_feature": extract_features.confs["disk"],
|
| 513 |
-
"dense": False,
|
| 514 |
-
},
|
| 515 |
-
"superpoint+mnn": {
|
| 516 |
-
"config": match_features.confs["NN-mutual"],
|
| 517 |
-
"config_feature": extract_features.confs["superpoint_max"],
|
| 518 |
-
"dense": False,
|
| 519 |
-
},
|
| 520 |
-
"sift+sgmnet": {
|
| 521 |
-
"config": match_features.confs["sgmnet"],
|
| 522 |
-
"config_feature": extract_features.confs["sift"],
|
| 523 |
-
"dense": False,
|
| 524 |
-
},
|
| 525 |
-
"sosnet": {
|
| 526 |
-
"config": match_features.confs["NN-mutual"],
|
| 527 |
-
"config_feature": extract_features.confs["sosnet"],
|
| 528 |
-
"dense": False,
|
| 529 |
-
},
|
| 530 |
-
"hardnet": {
|
| 531 |
-
"config": match_features.confs["NN-mutual"],
|
| 532 |
-
"config_feature": extract_features.confs["hardnet"],
|
| 533 |
-
"dense": False,
|
| 534 |
-
},
|
| 535 |
"d2net": {
|
| 536 |
"config": match_features.confs["NN-mutual"],
|
| 537 |
"config_feature": extract_features.confs["d2net-ss"],
|
| 538 |
"dense": False,
|
| 539 |
},
|
| 540 |
-
"
|
| 541 |
-
"config": match_features.confs["NN-mutual"],
|
| 542 |
-
"config_feature": extract_features.confs["rord"],
|
| 543 |
-
"dense": False,
|
| 544 |
-
},
|
| 545 |
-
# "d2net-ms": {
|
| 546 |
-
# "config": match_features.confs["NN-mutual"],
|
| 547 |
-
# "config_feature": extract_features.confs["d2net-ms"],
|
| 548 |
-
# "dense": False,
|
| 549 |
-
# },
|
| 550 |
-
"alike": {
|
| 551 |
-
"config": match_features.confs["NN-mutual"],
|
| 552 |
-
"config_feature": extract_features.confs["alike"],
|
| 553 |
-
"dense": False,
|
| 554 |
-
},
|
| 555 |
-
"lanet": {
|
| 556 |
-
"config": match_features.confs["NN-mutual"],
|
| 557 |
-
"config_feature": extract_features.confs["lanet"],
|
| 558 |
-
"dense": False,
|
| 559 |
-
},
|
| 560 |
-
"r2d2": {
|
| 561 |
-
"config": match_features.confs["NN-mutual"],
|
| 562 |
-
"config_feature": extract_features.confs["r2d2"],
|
| 563 |
-
"dense": False,
|
| 564 |
-
},
|
| 565 |
-
"darkfeat": {
|
| 566 |
"config": match_features.confs["NN-mutual"],
|
| 567 |
-
"config_feature": extract_features.confs["
|
| 568 |
"dense": False,
|
| 569 |
},
|
| 570 |
"sift": {
|
|
@@ -572,6 +494,4 @@ matcher_zoo = {
|
|
| 572 |
"config_feature": extract_features.confs["sift"],
|
| 573 |
"dense": False,
|
| 574 |
},
|
| 575 |
-
# "roma": {"config": match_dense.confs["roma"], "dense": True},
|
| 576 |
-
# "DKMv3": {"config": match_dense.confs["dkm"], "dense": True},
|
| 577 |
}
|
|
|
|
| 468 |
# Matchers collections
|
| 469 |
matcher_zoo = {
|
| 470 |
"gim": {"config": match_dense.confs["gim"], "dense": True},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 471 |
"loftr": {"config": match_dense.confs["loftr"], "dense": True},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 472 |
"superpoint+superglue": {
|
| 473 |
"config": match_features.confs["superglue"],
|
| 474 |
"config_feature": extract_features.confs["superpoint_max"],
|
|
|
|
| 479 |
"config_feature": extract_features.confs["superpoint_max"],
|
| 480 |
"dense": False,
|
| 481 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 482 |
"d2net": {
|
| 483 |
"config": match_features.confs["NN-mutual"],
|
| 484 |
"config_feature": extract_features.confs["d2net-ss"],
|
| 485 |
"dense": False,
|
| 486 |
},
|
| 487 |
+
"hardnet": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
"config": match_features.confs["NN-mutual"],
|
| 489 |
+
"config_feature": extract_features.confs["hardnet"],
|
| 490 |
"dense": False,
|
| 491 |
},
|
| 492 |
"sift": {
|
|
|
|
| 494 |
"config_feature": extract_features.confs["sift"],
|
| 495 |
"dense": False,
|
| 496 |
},
|
|
|
|
|
|
|
| 497 |
}
|
common/viz.py
CHANGED
|
@@ -91,6 +91,8 @@ def make_matching_figure(
|
|
| 91 |
path=None,
|
| 92 |
pad=0,
|
| 93 |
):
|
|
|
|
|
|
|
| 94 |
# draw image pair
|
| 95 |
# assert mkpts0.shape[0] == mkpts1.shape[0], f'mkpts0: {mkpts0.shape[0]} v.s. mkpts1: {mkpts1.shape[0]}'
|
| 96 |
fig, axes = plt.subplots(1, 2, figsize=(10, 6), dpi=dpi)
|
|
@@ -122,8 +124,9 @@ def make_matching_figure(
|
|
| 122 |
(fkpts0[i, 0], fkpts1[i, 0]),
|
| 123 |
(fkpts0[i, 1], fkpts1[i, 1]),
|
| 124 |
transform=fig.transFigure,
|
| 125 |
-
c=
|
| 126 |
-
|
|
|
|
| 127 |
)
|
| 128 |
for i in range(len(mkpts0))
|
| 129 |
]
|
|
@@ -132,8 +135,8 @@ def make_matching_figure(
|
|
| 132 |
axes[0].autoscale(enable=False)
|
| 133 |
axes[1].autoscale(enable=False)
|
| 134 |
|
| 135 |
-
axes[0].scatter(mkpts0[:, 0], mkpts0[:, 1], c=
|
| 136 |
-
axes[1].scatter(mkpts1[:, 0], mkpts1[:, 1], c=
|
| 137 |
|
| 138 |
# put txts
|
| 139 |
txt_color = "k" if img0[:100, :200].mean() > 200 else "w"
|
|
|
|
| 91 |
path=None,
|
| 92 |
pad=0,
|
| 93 |
):
|
| 94 |
+
# color = np.random.rand(len(mkpts0), 3)
|
| 95 |
+
|
| 96 |
# draw image pair
|
| 97 |
# assert mkpts0.shape[0] == mkpts1.shape[0], f'mkpts0: {mkpts0.shape[0]} v.s. mkpts1: {mkpts1.shape[0]}'
|
| 98 |
fig, axes = plt.subplots(1, 2, figsize=(10, 6), dpi=dpi)
|
|
|
|
| 124 |
(fkpts0[i, 0], fkpts1[i, 0]),
|
| 125 |
(fkpts0[i, 1], fkpts1[i, 1]),
|
| 126 |
transform=fig.transFigure,
|
| 127 |
+
c='lime',
|
| 128 |
+
# c=(233 / 255, 50 / 255, 35 / 255),
|
| 129 |
+
linewidth=1,
|
| 130 |
)
|
| 131 |
for i in range(len(mkpts0))
|
| 132 |
]
|
|
|
|
| 135 |
axes[0].autoscale(enable=False)
|
| 136 |
axes[1].autoscale(enable=False)
|
| 137 |
|
| 138 |
+
axes[0].scatter(mkpts0[:, 0], mkpts0[:, 1], c='lime', s=4)
|
| 139 |
+
axes[1].scatter(mkpts1[:, 0], mkpts1[:, 1], c='lime', s=4)
|
| 140 |
|
| 141 |
# put txts
|
| 142 |
txt_color = "k" if img0[:100, :200].mean() > 200 else "w"
|