JunMa11 / SegLossOdyssey

A collection of loss functions for medical image segmentation
Apache License 2.0
3.81k stars 602 forks source link

Boundary Loss for Multi Class #23

Closed daandres closed 3 years ago

daandres commented 3 years ago

The boundary loss and the sample for computing the distance map (input to boundary loss) both mentioned, that there are for binary masks.

How would I use the Boundary loss in a multi class scenario? How would I compute the sdf map for multi class?

Thank you!

JunMa11 commented 3 years ago

Hi @daandres ,

The boundary loss can be used to multi-class tasks. https://github.com/JunMa11/SegLoss/blob/71b14900e91ea9405d9705c95b451fc819f24c70/test/loss_functions/boundary_loss.py#L131

Following is the implementation of sdf for multi class https://github.com/JunMa11/SegLoss/blob/71b14900e91ea9405d9705c95b451fc819f24c70/test/loss_functions/boundary_loss.py#L102

I also notice that the official repo of boundary loss has supported the multi-class setting. https://github.com/LIVIAETS/boundary-loss

Hope the answer can help you.

Best, Jun

daandres commented 3 years ago

ok thanks. I noticed the original repo and just use its implementation.