Closed ShunchiZhang closed 2 years ago
Hi Shunchi, thanks for your question! We will fix this bug as soon as possible.
BTW, if you want to see the bounding box triplet results, you can still set use_mask=True
and switch eval_pan_rels=True
here
https://github.com/Jingkang50/OpenPSG/blob/bdd3c548257b99468e7adddfac7f1fd41a4321a7/openpsg/models/frameworks/psgtr.py#L16
to eval_pan_rels=False
.
Under this condition, the model also outputs the bounding box triplets(but deduplicated ones, compared with setting use_mask=True
).
Hi Shunchi, thanks for your question! We will fix this bug as soon as possible.
BTW, if you want to see the bounding box triplet results, you can still set
use_mask=True
and switcheval_pan_rels=True
hereto
eval_pan_rels=False
.Under this condition, the model also outputs the bounding box triplets(but deduplicated ones, compared with setting
use_mask=True
).
Hi Dr. Guo @GSeanCDAT, thanks for your kind reply!
I'm kind of confused here: will I get the non-deduplicated or deduplicated results with use_mask=True
and eval_pan_rels=False
?
Thank you so much!
UPD: This will yield evaluation results that all numericals are zero
I guess it is because the model doesn't predict panoptic heads at all, since use_mask
is False when training.
Also, I have additional 2 questions as follows:
If I'd only like to get the bboxes instead of panoptic masks, would use_mask=True
If the above 2 questions are both true, is it possible and correct to
use_mask=False
use_mask=True
and eval_pan_rels=False
as a workaround?
Hi Shunchi, Here are my answers to your questions:
use_mask=True
and eval_pan_rels=False
as their settings during inference will give you non-duplicated triplets. However, as our deduplication operation is based on masks, the models have to contain mask heads.use_mask=True
will decelerate your training process as mask heads are also optimized in training and yes, the model will thus focus on mask predictions too.Since our competition and demos are all meant to get good mask predictions, code for bbox-only models may not be updated instantly. If you want to train and evaluate bbox-only models, you can try to substitute following lines: https://github.com/Jingkang50/OpenPSG/blob/bdd3c548257b99468e7adddfac7f1fd41a4321a7/openpsg/models/relation_heads/psgtr_head.py#1173-1177
if self.use_mask:
return det_bboxes, complete_labels, rel_pairs, output_masks, pan_rel_pairs, \
pan_img, complete_r_labels, complete_r_dists, r_labels, r_dists, pan_masks, rels, pan_labels
else:
return det_bboxes, labels, rel_pairs, r_labels, r_dists
with
if self.use_mask:
det_bboxes = torch.cat((s_det_bboxes[keep_tri], o_det_bboxes[keep_tri]), 0)
return det_bboxes, complete_labels, rel_pairs, output_masks, pan_rel_pairs, \
pan_img, complete_r_labels, complete_r_dists, r_labels, r_dists, pan_masks, rels, pan_labels
else:
labels = torch.cat((s_labels, o_labels), 0)
rel_pairs = torch.arange(len(labels),
dtype=torch.int).reshape(2, -1).T
det_bboxes = torch.cat((s_det_bboxes, o_det_bboxes), 0)
return det_bboxes, labels, rel_pairs, r_labels, r_dists
https://github.com/Jingkang50/OpenPSG/blob/bdd3c548257b99468e7adddfac7f1fd41a4321a7/configs/psgtr/psgtr_r50_psg.py#L108
I changed the above line into
use_mask=False
to try to only get the bounding box predictions rather than panoptic masks, but got this errorlocal variable 'keep_tri' referenced before assignment
on the following line at inference time after training the first epoch.https://github.com/Jingkang50/OpenPSG/blob/bdd3c548257b99468e7adddfac7f1fd41a4321a7/openpsg/models/relation_heads/psgtr_head.py#L1171
I noticed
keep_tri
is defined on line 992, only whenuse_mask==True
.https://github.com/Jingkang50/OpenPSG/blob/bdd3c548257b99468e7adddfac7f1fd41a4321a7/openpsg/models/relation_heads/psgtr_head.py#L992
Could you kindly help me to resolve this issue or give any suggestions? Thank you so much :)
[Click Here for Full Error Log]
```python Traceback (most recent call last): File "tools/train.py", line 196, in