I am using Detectron2 for object detection. I have registered pascalvoc dataset and trained a model for detection. How can I calculate Mean IOU of my test dataset ? I know that detection2 has a predefined function for calculating IOU i.e. detectron2.structures.pairwise_iou
I have the ground truth bounding boxes for test images in a csv file. The csv file contains (filename,width,height,class,xmin,ymin,xmax,ymax). How can I parse both the bounding boxes in IOU function and display it in google colab.
This is my code where I am generating a prediction bounding box
from detectron2.utils.visualizer import ColorMode
import random
dataset_dicts = DatasetCatalog.get('/content/test')
for d in random.sample(dataset_dicts, 5):
im = cv2.imread(d["file_name"])
outputs = predictor(im)
v = Visualizer(im[:, :, ::-1], metadata=microcontroller_metadata, scale=0.8)
v = v.draw_instance_predictions(outputs["instances"].to("cpu"))
plt.figure(figsize = (14, 10))
plt.imshow(cv2.cvtColor(v.get_image()[:, :, ::-1], cv2.COLOR_BGR2RGB))
plt.show()