Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deformable convolution best practice? #3678

Open
liyy201912 opened this issue Apr 16, 2021 · 1 comment
Open

Deformable convolution best practice? #3678

liyy201912 opened this issue Apr 16, 2021 · 1 comment

Comments

@liyy201912
Copy link

❓ Questions and Help

Would appreciate it if anyone has some insight on how to use deformable convolution correctly.

Deformable convolution is tricky as even the official implementation is different from what's described in the paper. The paper claims to use 2N offset size instead of 2 x ks x ks.

Anyway, we're using the 2 x ks x ks offset here, but I always got poor performance. Accuracy drops in CIFAR10 and YOLACT. Anything wrong with my usage?

from torchvision.ops import DeformConv2d

class DConv(nn.Module):
    def __init__(self, inplanes, planes, kernel_size=3, stride=1, padding=1, bias=False):
        super(DConv, self).__init__()
        self.conv1 = nn.Conv2d(inplanes, 2 * kernel_size * kernel_size, kernel_size=kernel_size,
                               stride=stride, padding=padding, bias=bias)
        self.conv2 = DeformConv2d(inplanes, planes, kernel_size=kernel_size, stride=stride, padding=padding, bias=bias)

    def forward(self, x):
        out = self.conv1(x)
        out = self.conv2(x, out)
        return out
@voldemortX
Copy link
Contributor

@liyy201912 A little insight here: a probable cause for deformable conv not working on CIFAR is low-resolution (32x32 is too small for deformable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants