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

batchformer的实现问题 #21

Open
Yjhan2 opened this issue Jun 8, 2023 · 1 comment
Open

batchformer的实现问题 #21

Yjhan2 opened this issue Jun 8, 2023 · 1 comment

Comments

@Yjhan2
Copy link

Yjhan2 commented Jun 8, 2023

作者你好,我想将batchformer用于我的人体解析任务,主要对backbone所提取的特征进行batchformer操作,batchformer的输入为(N,C,H,W)的特征请问我这样实现是否有问题?
image

@zhihou7
Copy link
Owner

zhihou7 commented Jun 8, 2023

Hi,

I think the dimension is right. But you did not include the shared strategy or the two-stream strategy (您好,我觉得维度是没问题的,但是你没有加共享分类或者双流的策略). The forward should be

if not self.training:
     return x
old_x = x
bt, c. h, W= x.size()
x = x. view(bt, c, -1) . permute(2,0,1)
x = self.bf(x) .permute(1,2,0)
x = x.view(bt, c, h,w)
# sharing the modules for stream with and without batchformer
x = torch.cat([old_x, x], dim=0)

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

2 participants