The output of the model after prediction is this
{'instances': Instances(num_instances=1, image_height=512, image_width=512, fields=[pred_boxes = Boxes(tensor([[313.2812, 442.1698, 335.4926, 464.1849]], device='cuda:0')), scores = tensor([0.9625], device='cuda:0'), pred_classes = tensor([0], device='cuda:0'), pred_masks = tensor([[[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
...,
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False],
[False, False, False, ..., False, False, False]]], device='cuda:0'), ])}
I want to get the pred_boxes which I can do with outputs["instances"].pred_boxes but it is a Boxes object rather than a tensor object How can I convert it into numpy array.
pred_boxes.tensor.numpy()
You can find documentation in https://detectron2.readthedocs.io/modules/structures.html#detectron2.structures.Boxes.
Thanks
Most helpful comment
pred_boxes.tensor.numpy()You can find documentation in https://detectron2.readthedocs.io/modules/structures.html#detectron2.structures.Boxes.