Detectron2: How to convert Boxes(tensor()) into Numpy array

Created on 1 Jan 2020  ยท  2Comments  ยท  Source: facebookresearch/detectron2

โ“ How to use Detectron2

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.

Most helpful comment

pred_boxes.tensor.numpy()
You can find documentation in https://detectron2.readthedocs.io/modules/structures.html#detectron2.structures.Boxes.

All 2 comments

pred_boxes.tensor.numpy()
You can find documentation in https://detectron2.readthedocs.io/modules/structures.html#detectron2.structures.Boxes.

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kl720 picture kl720  ยท  3Comments

joeythegod picture joeythegod  ยท  4Comments

limsijie93 picture limsijie93  ยท  3Comments

soumik12345 picture soumik12345  ยท  3Comments

invisprints picture invisprints  ยท  4Comments