Code associated with these tutorials can be downloaded from here: https://github.com/bnsreenu/python_fo...
This video explains intersection over union as a metric to quantify the quality of semantic segmentation.
It uses builtin IoU methods from Keras library.
from keras.metrics import MeanIoU
Please 'pip install keras' to use this module.