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

May I ask how the visualization feature map of encoder discrimination score in the paper was obtained #95

Closed
xiaoyangbenjiance opened this issue Nov 22, 2023 · 2 comments

Comments

@xiaoyangbenjiance
Copy link

I would like to visualize the feature map of the feature differentiation score in my paper. I hope to receive a response. Thank you

@TempleX98
Copy link
Collaborator

We have provided the details to calculate the feature discriminability score in the paper. You can follow the implementation here:

# feats: multi-scale features. LxBxCxHxW
# The batch size is 1 (B=1)
attn_map = None
for i, feat in enumerate(feats):
    feat_map = torch.norm(feat[0], 2, dim=0).detach()
    feat_map = feat_map.cpu().numpy()
    feat_map = feat_map / np.max(feat_map)
    feat_map = cv2.resize(feat_map, (image.shape[1], image.shape[0]), interpolation=cv2.INTER_LINEAR)
    if i == 0:
        attn_map = feat_map
    else:
        attn_map += feat_map
attn_map /= len(feat)

@gaowenjie-star
Copy link

We have provided the details to calculate the feature discriminability score in the paper. You can follow the implementation here:

# feats: multi-scale features. LxBxCxHxW
# The batch size is 1 (B=1)
attn_map = None
for i, feat in enumerate(feats):
    feat_map = torch.norm(feat[0], 2, dim=0).detach()
    feat_map = feat_map.cpu().numpy()
    feat_map = feat_map / np.max(feat_map)
    feat_map = cv2.resize(feat_map, (image.shape[1], image.shape[0]), interpolation=cv2.INTER_LINEAR)
    if i == 0:
        attn_map = feat_map
    else:
        attn_map += feat_map
attn_map /= len(feat)

您好,很感谢您的工作,我有一个问题关于multi-scale features,据我所知,deformable detr,在encoder的操作之前,会将backbone出来的特征将H,W进行合并,然后将4维的多维特征进行铺平,然后再进行后续的操作得到feature,您这里的multi-scale feature的维度是LxBxCxHxW,请问您是将后续得到的的feature进行逆操作得到的吗,还是说我的理解有问题,期待您的回复。

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