Confusion matrix of UNET image sgemenation model I have used Unet model for image segmentation. I have used RGB images and corresponding image masks and at output i got corresponding region of interest. Now i want to find confusion matrix of this model and from this i want to evaluate other parameters. Can some help? I could not get what are predicted and actual values which are required to build confusion matrix. Thanks
If your masks have only one channel and in the case of binary segmentation, you can easily compute a confusion matrix from one image thanks to:

TP: ground truth and predicted pixel are of class 1 (object)
TN: ground truth and predicted pixel are of class 0 (background)
FP: ground truth pixel=0 while predicted pixel=1
FN: ground truth pixel=1 while predicted pixel=0

On a dataset, you can get the confusion matrix from chosen iou thresholds.
For example if your iou threshold is 0.5:

TP += 1 for each image where iou(ground_truth, predicted) &gt;= 0.5
FP += 1 for each image where iou(ground_truth, predicted) &lt; 0.5 and predicted != empty
FN += 1 for each image where iou(ground_truth, predicted) &lt; 0.5 and gt != empty

It is just a suggestion, there is maybe better ways to deal with that.