Closed ShunchiZhang closed 1 year ago
That seems weird to me. use_sigmoid
should not affect the out channels. Did you change other stuff?
Sorry for the late reply.
use_sigmoid
will affect the value of *_out_channels
. https://github.com/Jingkang50/OpenPSG/blob/23f9c89d43eeaa6e4ee57895d11ac9fb3546fd47/openpsg/models/relation_heads/psgtr_head.py#L187-L200I guess a potential bug is that class labels in gt_rel
starts from 1 rather than 0, therefore the reduction of cls_out_channels
could lead to IndexError
s (as it doesn't happen on subject and object, but only relation). However I am not sure about the associated codes with this special setting, much appreciated if you could point them out.
I am not quite sure too. The code is written by mmdet. To avoid this, what I would suggest is to write a loss function by your own.
Thanks. I'll try to figure it out by myself.
@GSeanCDAT You could also comment here.
@ShunchiZhang Hi there, I think the possible solution might be to turn the gt_rels into one-hot before calculating the loss. (make sure you set the first element of one-hot as the background class).
When add line
rel_loss_cls = dict(use_sigmoid=True)
in PSGTr config file, the following error occurs:RuntimeError: The size of tensor a (57) must match the size of tensor b (56) at non-singleton dimension 1
Full Log
``` Traceback (most recent call last): File "tools/train.py", line 225, inI wonder whether it's because the
rel_cls_out_channels
becomesnum_relations
instead ofnum_relations + 1
. So, what is the difference betweenuse_sigmoid = True
anduse_sigmoid = False
and why it influencesrel_cls_out_channels
?Thank you so much!