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

Can't simply replace nn.Conv2d with PSConv2d #6

Open
quantumsquirrel opened this issue Oct 20, 2020 · 2 comments
Open

Can't simply replace nn.Conv2d with PSConv2d #6

quantumsquirrel opened this issue Oct 20, 2020 · 2 comments

Comments

@quantumsquirrel
Copy link

quantumsquirrel commented Oct 20, 2020

Thanks to the compact characteristic of PSConv, just replace nn.Conv2d with PSConv2d. Note that there exists another hyperparameter named parts you may set in our PSConv operator.

Originally posted by @d-li14 in #3 (comment)

Hi, I'm reading your paper and there comes some problems, hope you could help me figer it out!
Origin Conv2d was
Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
PSConv2D are
PSGConv2d( (gwconv): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=4, bias=False) (gwconv_shift): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(2, 2), dilation=(2, 2), groups=4, bias=False) (conv): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) )
And I add
self.weight = self.conv.weight self.bias = self.conv.bias
To solve the problem
" 'PSGConv2d' object has no attribute 'weight' " during building Resnet,
I don't know I'm right or wrong but it works temporarily.
After that ,durning training part,in PSConv2d.forward
self.gwconv(x).shape:
torch.Size([6, 256, 202, 274])
self.conv(x).shape
torch.Size([6, 256, 202, 274])
but x_shift.shape:
torch.Size([6, 256, 204, 276])

So....The size of tensor a (274) must match the size of tensor b (276) at non-singleton dimension 3

I'm using FCOS original code from tianzhi0549,thanks for the contribution, and add "psconv.py | conv_module.py | conv_ws.py " norm.py" from this respository.

Thank you for your time!

@quantumsquirrel quantumsquirrel changed the title Can't simply replace nn.Conv2d with PSConv2d. Can't simply replace nn.Conv2d with PSConv2d Oct 20, 2020
@zhangyuxuann
Copy link

I think there is few mistake in the code, try to change 'dilation' to 'padding'!
image

@zyxjtu
Copy link

zyxjtu commented Jan 10, 2022

I think there is few mistake in the code, try to change 'dilation' to 'padding'! image

你好,请问图片中的这段核心代码怎么理解呢?方便解释一下吗?
image

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

No branches or pull requests

3 participants