RElbers / region-mutual-information-pytorch

PyTorch implementation of the Region Mutual Information Loss for Semantic Segmentation.
MIT License
25 stars 1 forks source link

Support for multi-class segmentation #3

Closed rose-jinyang closed 2 years ago

rose-jinyang commented 2 years ago

Hello How are you? Thanks for contributing to this project. I have a question. Does this repo support the multi-class segmentation? That's because you used ONLY binary cross entropy & sigmoid in calculating the RMI loss.

RElbers commented 2 years ago

Yes, this loss can do multi-class segmentation. The authors deliberately use sigmoid:

We adopt the sigmoid operation rather than softmax operation to get predicted probabilities. This is because RMI is calculated channel-wise, we do not want to introduce interference between channels. Experimental results demonstrate the performance of models trained with softmax and sigmoid cross entropy losses is roughly the same

rose-jinyang commented 2 years ago

Thanks

rose-jinyang commented 2 years ago

Hello How are you? Thanks for contribution to this project. I'm NOT sure if this RMI loss would work well in case that we resize the image & mask to input size(NxN in pixels) without keeping width-height ratio in the data augmentation step. I am working on image segmentation project. There are many images & masks with different sizes in my dataset. The data by dataloader are resized to input size(ex: 256x256) and feed into the model. So the original width-height ratio of image & mask are NOT kept. Even in such case, does this RMI loss work well?