In the simplest case, segmentation is the process of dividing a digital image into several segments. The result of instance segmentation using Mask R-CNN is a mask applied to the desired object and a bounding box around this object.

In a practical task that I was solving, it was necessary to determine the buildings in the Google Earth photos. This task was successfully accomplished using Mask R-CNN for instance segmentation. After training the model, it was necessary to evaluate it quality for prediction the bounding boxes around buildings. I would like to acquaint readers with the approach (with code) I have used to evaluate the quality of predicting the coordinates of bounding boxes.

Intersection over union (IoU) is known to be a good metric for measuring overlap between two bounding boxes or masks.

Image for post

Image is created by Oleksii Sheremet with Microsoft Visio

If the prediction is completely correct, IoU = 1. The lower the IoU, the worse the prediction result.

Image for post

Image is created by Oleksii Sheremet with Microsoft Visio

#intersection-over-union #ipython #image-segmentation #opencv #python

Intersection over union (IoU) calculation for evaluating
50.10 GEEK