pytorch / vision

Datasets, Transforms and Models specific to Computer Vision
https://pytorch.org/vision
BSD 3-Clause "New" or "Revised" License
16.31k stars 6.97k forks source link

How to look at bbox predictions after training? #1892

Closed alareza619 closed 4 years ago

alareza619 commented 4 years ago

Hi, I finetuned a pretrained Faster RCNN model. I used the instance segmentation Mask RCNN pytorch tutorial as a guide.

I finished training and can't figure out how to look at bbox predictions.

For segmentation prediction, the guide used the following to display the mask Image.fromarray(prediction[0]['masks'][0, 0].mul(255).byte().cpu().numpy())

I tried Image.fromarray(prediction[0]['boxes'].mul(255).byte().cpu().numpy()) But this doesn't work.

link to tutorial I followed : https://colab.research.google.com/github/pytorch/vision/blob/temp-tutorial/tutorials/torchvision_finetuning_instance_segmentation.ipynb#scrollTo=5v5S3bm07SO1

I used the following to train on a custom dataset.

fmassa commented 4 years ago

Hi,

I hope you have found how to visualize the boxes. The prediction[0]['boxes'] corresponds to the [x0, y0, x1, y1] coordinates of the pixels in the image, so you can use matplotlib.pyplot.Rectangle to plot it