waxnkw / IETrans-SGG.pytorch

This is the code of ECCV 2022 (Oral) paper "Fine-Grained Scene Graph Generation with Data Transfer".
Other
89 stars 6 forks source link

Is there lack of one line code? #18

Closed Git-oNmE closed 1 year ago

Git-oNmE commented 1 year ago

It's IETrans-SGG.pytorch/maskrcnn_benchmark/modeling/roi_heads/relation_head/sampling.py, in which the WRelationSampling.gtbox_relsample() has a problem.

rel_possibility = torch.ones((num_prp, num_prp), device=device).long() - torch.eye(num_prp,
                                                                                   device=device).long()
rel_possibility[tgt_head_idxs, tgt_tail_idxs] = 0
# I think the code below should be added.
# rel_possibility[tgt_tail_idxs, tgt_head_idxs] = 0
tmp=rel_possibility > 0
tgt_bg_idxs = tmp.nonzero()

It seems this part of code is to creat a list of no-relation object pairs.

The 'rel_possibility', in my understanding, is a reverse mask of 'binary_rel'. So maybe we need to deal with both conditions of non-relationship.

Is my understanding right ? If not, maybe there is something I haven't got. Please correct me if possible, thanks :).

waxnkw commented 1 year ago

I think your understanding is correct. If A has a relationship with B, there must be another relationship between B and A. For example, when (man, sitting on, ground), the ground should be under the man. Thanks for pointing it out!