@@ -58,10 +58,10 @@ class PoseNode(Node):
58
58
finding matching keypoints and solving the PnP problem.
59
59
"""
60
60
61
- CONFIDENCE_THRESHOLD = 0.3
61
+ CONFIDENCE_THRESHOLD = 0.5
62
62
"""Confidence threshold for filtering out bad keypoint matches"""
63
63
64
- MIN_MATCHES = 30
64
+ MIN_MATCHES = 15
65
65
"""Minimum number of keypoint matches before attempting pose estimation"""
66
66
67
67
MAX_KEYPOINTS = 1024
@@ -83,29 +83,43 @@ def __init__(self, *args, **kwargs):
83
83
84
84
self ._cv_bridge = CvBridge ()
85
85
86
- # Initialize DL model for map matching
87
- self ._matcher = (
88
- LightGlueMatcher (
89
- "sift" ,
90
- params = {
91
- "n_layers" : 6 ,
92
- "filter_threshold" : self .CONFIDENCE_THRESHOLD ,
93
- "depth_confidence" : 0.8 ,
94
- "width_confidence" : - 1 ,
95
- },
96
- )
97
- .to (self ._device )
98
- .eval ()
99
- )
100
-
86
+ # TODO: adjust dynamically based on runtime matching speed, not statically
87
+ # depending on whether we are running on cpu or gpu (even though it is a good
88
+ # proxy for slow vs fast matching).
101
89
if self ._device == "cpu" :
102
90
self .get_logger ().warning (
103
91
"Using CPU instead of GPU for matching - limiting"
104
- "max number of keypoints to improve matching speed. "
105
- "Performance may be negatively affected."
92
+ "max number of keypoints and enabling adaptive mechanisms to improve "
93
+ "matching speed. Accuracy may be negatively affected."
94
+ )
95
+ self ._matcher = (
96
+ LightGlueMatcher (
97
+ "sift" ,
98
+ params = {
99
+ "n_layers" : 5 ,
100
+ "filter_threshold" : self .CONFIDENCE_THRESHOLD ,
101
+ "depth_confidence" : 0.99 ,
102
+ "width_confidence" : 0.99 ,
103
+ },
104
+ )
105
+ .to (self ._device )
106
+ .eval ()
106
107
)
107
108
self ._extractor = cv2 .SIFT_create (self .MAX_KEYPOINTS )
108
109
else :
110
+ self ._matcher = (
111
+ LightGlueMatcher (
112
+ "sift" ,
113
+ params = {
114
+ "n_layers" : 9 ,
115
+ "filter_threshold" : self .CONFIDENCE_THRESHOLD ,
116
+ "depth_confidence" : - 1 ,
117
+ "width_confidence" : - 1 ,
118
+ },
119
+ )
120
+ .to (self ._device )
121
+ .eval ()
122
+ )
109
123
self ._extractor = cv2 .SIFT_create ()
110
124
111
125
self ._cached_stamp_kps_desc : Optional [
0 commit comments