cfzd / FcaNet

FcaNet: Frequency Channel Attention Networks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

代码好像和论文里说的不太一样也?

XFR1998 opened this issue · comments

不是只要修改一行吗,怎么里面还要设置这么多参数

commented

@XFR1998
开源代码和论文里的代码是完全等价的,只不过为了大家使用方便,同时兼容更多的实验,我们开源的时候做了很多封装和脚手架代码。你可以对比一下以下代码和论文代码:

self.register_buffer('weight', self.get_dct_filter(height, width, mapper_x, mapper_y, channel))

FcaNet/model/layer.py

Lines 91 to 98 in aa5fb63

def forward(self, x):
assert len(x.shape) == 4, 'x must been 4 dimensions, but got ' + str(len(x.shape))
# n, c, h, w = x.shape
x = x * self.weight
result = torch.sum(x, dim=[2,3])
return result