RoMa
RoMa copied to clipboard
dedode or Dad + Roma match_keypoint
I want to use dad and dedode for feature extraction, and then use roma for feature point matching to achieve more robust matching and help downstream sfm tasks.
Now I integrated dedode + dual_softmax_match into my sfm framework and verified its correctness. Then I used roma instead of dualsoftmax to obtain the matching relationship between the two images. My code:
imA_path, imB_path = data['image_path0'][0], data['image_path1'][0]
x_A, x_B = data['keypoints0'], data['keypoints1']
H_A, W_A = data["image0"].shape[2:]
H_B, W_B = data["image1"].shape[2:]
# to normlize
x_A, x_B = self.net.to_normalized_coordinates((x_A, x_B), H_A, W_A, H_B, W_B)
# Match
warp, certainty = self.net.match(imA_path, imB_path)
# Sample matches for estimation
# matches, _ = self.net.sample(warp, certainty, num=1000)
# Convert to pixel coordinates (RoMa produces matches in [-1,1]x[-1,1])
# kptsA, kptsB = self.net.to_pixel_coordinates(matches, H_A, W_A, H_B, W_B)
# draw_matches_from_path(imA_path, imB_path, kptsA.cpu().numpy(), kptsB.cpu().numpy(), './a.jpg')
inds_A, inds_B = self.net.match_keypoints(x_A[0], x_B[0], warp, certainty, return_inds = True)
I use match_keypoints to match directly, but I find the result is very wrong
keypoint map:
keypoints matching map:
self.net.match map:
What I have done:
- Looked at the relevant isues discussion and noted possible problems
- Normalized the left side of the key point to -1 - 1
Now how do I proceed?