4uiiurz1 / pytorch-deform-conv-v2

PyTorch implementation of Deformable ConvNets v2 (Modulated Deformable Convolution)
MIT License
743 stars 141 forks source link

bilinear kernel is wrong? #21

Open jszgz opened 4 years ago

jszgz commented 4 years ago
        g_lt = (1 + (q_lt[..., :N].type_as(p) - p[..., :N])) * (1 + (q_lt[..., N:].type_as(p) - p[..., N:]))
        g_rb = (1 - (q_rb[..., :N].type_as(p) - p[..., :N])) * (1 - (q_rb[..., N:].type_as(p) - p[..., N:]))
        g_lb = (1 + (q_lb[..., :N].type_as(p) - p[..., :N])) * (1 - (q_lb[..., N:].type_as(p) - p[..., N:]))
        g_rt = (1 - (q_rt[..., :N].type_as(p) - p[..., :N])) * (1 + (q_rt[..., N:].type_as(p) - p[..., N:]))

This computation is different from standard bilinear algorithm, is it wrong or another algorithm?

jszgz commented 4 years ago

image

jszgz commented 4 years ago

For example, when you compute g_lt , 1 + (q_lt[..., :N].type_as(p) - p[..., :N]) is right, but 1 + (q_lt[..., N:].type_as(p) - p[..., N:]) should be 1 + ( p[..., N:] - q_lt[..., N:].type_as(p)) , which is P12(X0,y1) in my figure

xiab3369 commented 4 years ago

It's right