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

使用FPNAtten时报错 #10

Open
chentp-1183 opened this issue Apr 13, 2023 · 0 comments
Open

使用FPNAtten时报错 #10

chentp-1183 opened this issue Apr 13, 2023 · 0 comments

Comments

@chentp-1183
Copy link

尊敬的作者:
您好!想问以下:mmdet/models/necks/fpn_atten.py该文件是不可用吗?我在使用FPNAtten替换FPN时,总是报出维度不匹配的问题(训练图片为8008003),但是我单独对该文件进行测试又没问题。如下:
File "/home/chenhuai/CTP/Study_CTP/mmrotate32/mmrotate/models/necks/cgfpn.py", line 358, in forward
p2_new = torch.cat([atten_p2 * p2, p2], dim=1)
RuntimeError: The size of tensor a (100) must match the size of tensor b (88) at non-singleton dimension 2
出错代码如下:
atten_p2 = out_mean[:, 0].unsqueeze(1).expand(m_batchsize, 256)
.unsqueeze(2).expand(m_batchsize, 256, 100)
.unsqueeze(3).expand(m_batchsize, 256, 100, 100)
atten_p3 = out_mean[:, 1].unsqueeze(1).expand(m_batchsize, 256)
.unsqueeze(2).expand(m_batchsize, 256, 50)
.unsqueeze(3).expand(m_batchsize, 256, 50, 50)
atten_p4 = out_mean[:, 2].unsqueeze(1).expand(m_batchsize, 256)
.unsqueeze(2).expand(m_batchsize, 256, 25)
.unsqueeze(3).expand(m_batchsize, 256, 25, 25)
atten_p5 = out_mean[:, 3].unsqueeze(1).expand(m_batchsize, 256)
.unsqueeze(2).expand(m_batchsize, 256, 13)
.unsqueeze(3).expand(m_batchsize, 256, 13, 13)
atten_p6 = out_mean[:, 4].unsqueeze(1).expand(m_batchsize, 256)
.unsqueeze(2).expand(m_batchsize, 256, 7)
.unsqueeze(3).expand(m_batchsize, 256, 7, 7)

    p2_new = torch.cat([atten_p2 * p2, p2], dim=1)
    p3_new = torch.cat([atten_p3 * p3, p3], dim=1)
    p4_new = torch.cat([atten_p4 * p4, p4], dim=1)
    p5_new = torch.cat([atten_p5 * p5, p5], dim=1)
    p6_new = torch.cat([atten_p6 * p6, p6], dim=1)
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

1 participant