SpadeLiu / Lac-GwcNet

Local Similarity Pattern and Cost Self-Reassembling for Deep Stereo Matching Networks
MIT License
44 stars 9 forks source link

About code question #1

Open cocowy opened 2 years ago

cocowy commented 2 years ago

hi, congratulations! Nice work! I have a question about /networks/deformable_refine.py/class GetValueV2(nn.Module)/line 72 :

        # clip p
        p_y = torch.clamp(p[..., :N], 0, h-1) / (h-1) * 2 - 1
        p_x = torch.clamp(p[..., N:], 0, w-1) / (w-1) * 2 - 1

According to the context of the code, the p_y and p_x shoud be

        # clip p
        p_x = torch.clamp(p[..., :N], 0, w-1) / (w-1) * 2 - 1
        p_y= torch.clamp(p[..., N:], 0, h-1) / (h-1) * 2 - 1

to achieve bilinear sample operation. Am I right? THx!

SpadeLiu commented 2 years ago

hi, congratulations! Nice work! I have a question about /networks/deformable_refine.py/class GetValueV2(nn.Module)/line 72 :

        # clip p
        p_y = torch.clamp(p[..., :N], 0, h-1) / (h-1) * 2 - 1
        p_x = torch.clamp(p[..., N:], 0, w-1) / (w-1) * 2 - 1

According to the context of the code, the p_y and p_x shoud be

        # clip p
        p_x = torch.clamp(p[..., :N], 0, w-1) / (w-1) * 2 - 1
        p_y= torch.clamp(p[..., N:], 0, h-1) / (h-1) * 2 - 1

to achieve bilinear sample operation. Am I right? THx!

Hi, thanks for your suggestion.

Actually, it doesn't matter whether the first N points are 'x' or 'y', the model learns to regress the coordinates by itself.