awesome-semantic-segmentation-pytorch icon indicating copy to clipboard operation
awesome-semantic-segmentation-pytorch copied to clipboard

About the per class IoU

Open pengjizhi opened this issue 5 years ago • 1 comments

Hello author! Thank you for your hard work. I have some questions about the calculation of per class IoU.

  1. In the core/utils/score.py, the mIoU = area_inter / area_union. In this calculation method, how should I calculate the IoU of per class?

  2. For the voc12-segmentation dataset, there are 21 classes. Should I remove the background class when calculating mIoU, does your calculation method take the background class into account?

  3. When training the voc12-segmentation dataset, the background class number is 0, should I set ingore index = 0 in loss function(default is -1)?

I will be very grateful if you could give me a favor.

pengjizhi avatar Oct 21 '19 09:10 pengjizhi

Hi, my opinion is as follows:

  1. The mean value was calculated in thie line, IoU contains the values of per class.
  2. Both are ok, I have seen some articles comparing two mIoU at the same time (such as DRN). If your dataset is class-imbalance, I suggest to remove the background.
  3. In most cases, the background is not necessary to ignore for VOC datasets.

Tramac avatar Oct 22 '19 11:10 Tramac