Skip to content
New issue

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

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

Already on GitHub? # to your account

Question about your attention module #3

Open
sta105 opened this issue Mar 14, 2022 · 1 comment
Open

Question about your attention module #3

sta105 opened this issue Mar 14, 2022 · 1 comment

Comments

@sta105
Copy link

sta105 commented Mar 14, 2022

Hi,

In DMCNet, You firstly use Hourglass to extract multi-level features, then you fuse these features from differnt views by attention module.

However, the code shows below indicates you discard all the low level features and only uses the last level. Which is different from the original implentation of PIFu. Is it right?

def attention(self, feat, feature_fusion):
    att_feat = torch.zeros_like(feat[-1:])
    num_views = self.num_views
    
    for view in range(num_views):
        att_feat[-1, :, view] = feat[-1, :, view]  ## Only use the last level ?
    att_feat = att_feat.permute(0, 1, 4, 2, 3).contiguous().reshape(-1, num_views, feat.shape[3])
    att_feat, = feature_fusion(att_feat)
    _, B, V, D, N = feat.shape
    att_feat = att_feat.reshape(-1, B, N, V, D).permute(0, 1, 3, 4, 2)
    return att_feat
@DSaurus
Copy link
Owner

DSaurus commented Mar 16, 2022

Hi,

Thanks for your advice. We take the last level feature since we only have one attention module. It may be more efficient to build several attention modules on features of each level. You can have a try.

Hi,

In DMCNet, You firstly use Hourglass to extract multi-level features, then you fuse these features from differnt views by attention module.

However, the code shows below indicates you discard all the low level features and only uses the last level. Which is different from the original implentation of PIFu. Is it right?

def attention(self, feat, feature_fusion):
    att_feat = torch.zeros_like(feat[-1:])
    num_views = self.num_views
    
    for view in range(num_views):
        att_feat[-1, :, view] = feat[-1, :, view]  ## Only use the last level ?
    att_feat = att_feat.permute(0, 1, 4, 2, 3).contiguous().reshape(-1, num_views, feat.shape[3])
    att_feat, = feature_fusion(att_feat)
    _, B, V, D, N = feat.shape
    att_feat = att_feat.reshape(-1, B, N, V, D).permute(0, 1, 3, 4, 2)
    return att_feat

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

No branches or pull requests

2 participants