cvg / GlueStick

Joint Deep Matcher for Points and Lines 🖼️💥🖼️ (ICCV 2023)
https://iago-suarez.com/gluestick
MIT License
551 stars 43 forks source link

update new line scores in wireframe #30

Closed Golbstein closed 4 months ago

Golbstein commented 4 months ago

You update the junctions and the lines in the wf but not their scores

rpautrat commented 4 months ago

Hi, thank you for the proposal. However, I think that the wireframe construction does not need to update the line score: the new lines output by lines_to_wireframe are exactly the same as the previous ones, except that the endpoints have been slightly updated. So the line score should remain the same for every line.

Golbstein commented 4 months ago

Yes you're right However I think concatenating the scores here all_scores.append(torch.cat([line_pts_scores[bs], pred['keypoint_scores'][bs]], dim=0)) is incorrect since kp's scores are calculated in the extractor (and in the range of 0 to 1) while line_pts_scores are usually line's length and can be larger than 1.

We can use the dense scores from superpoint to estimate these endpoints scores

b = line_pts_scores.shape[0]
kps = line_pts_scores / line_pts_scores.new_tensor([w, h])
kps = kps * 2 - 1  # normalize to (-1, 1)
junc_scores = torch.nn.functional.grid_sample(pred['dense_score'].unsqueeze(1), 
                                              kps.view(b, 1, -1, 2), mode="bilinear", 
                                              align_corners=False).squeeze() * (line_pts_scores > 0).float()
all_scores = torch.concat((junc_scores, pred["keypoint_scores"]), dim=1)