Sense-X / Co-DETR

[ICCV 2023] DETRs with Collaborative Hybrid Assignments Training
MIT License
968 stars 105 forks source link

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

Closed xiaoyangbenjiance closed 4 months ago

xiaoyangbenjiance commented 9 months ago

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 commented 9 months ago

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 commented 5 months ago

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进行逆操作得到的吗,还是说我的理解有问题,期待您的回复。