microsoft/X-Decoder

How to get pred bboxes

faiahmed1 opened this issue · 4 comments

Hi there,

I was playing with inference demo.
I was wondering from the output of the model how to get the predicted bboxes in addition to the segmentation.
The pred_boxes field is empty although it detects segments. Any help is much appreciated.

ipdb> outputs[-1].keys()
dict_keys(['sem_seg', 'panoptic_seg', 'instances', 'captions', 'masks'])
ipdb> outputs[-1]['instances']
Instances(num_instances=0, image_height=408, image_width=612, fields=[pred_masks: tensor([], device='cuda:0', size=(0, 408, 612)), pred_boxes: Boxes(tensor([], size=(0, 4))), scores: tensor([], device='cuda:0'), pred_classes: tensor([], device='cuda:0', dtype=torch.int64)])

Thanks

Please try to use get_box_from_mask from detectron2. The bbox result in our framework is not as good as mask as it is not trained toward the objective.

Please try to use get_box_from_mask from detectron2. The bbox result in our framework is not as good as mask as it is not trained toward the objective.

Thanks.
I could not find get_box_from_mask in detectron2.
Also are we supposed to use it on the outputs[-1]['masks'] ?

So detectron2 by itself does similar/better job than XDecoder at getting bbox as detectron2 is trained towards object detection. Correct?

Please look over this exact code : ) Thanks!

bbox = BitMasks(mask_pred_result > 0).get_bounding_boxes()