0
$\begingroup$

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

$\endgroup$
1
$\begingroup$

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) >= 0.5
  • FP += 1 for each image where iou(ground_truth, predicted) < 0.5 and predicted != empty
  • FN += 1 for each image where iou(ground_truth, predicted) < 0.5 and gt != empty

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

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.