nnUNet icon indicating copy to clipboard operation
nnUNet copied to clipboard

Voxel-wise importance weighting for training loss (eg, distance to boundary)

Open Thibescobar opened this issue 1 year ago • 2 comments

Hello, first of all thank you very much for your excellent work!

I'm wondering if there is an easy or not too tricky way to add a weight map to the data during training? To give more importance to some voxels than others, for example borders, small structures, or crucial regions in application cases.

In Ronneberger's original paper for example, high weights are assigned to pixels located in areas where objects touch, thanks to distance-transform-based weighting.

This would also be interesting in tractography, where large vessels are easier to segment than small ones, but also more present, which could induce a convergence favoring large over small vessels.

Thank you. Cheers.

image

Thibescobar avatar May 29 '23 13:05 Thibescobar

Hey,

Something like this is not implemented in nnU-Net. However, what you could do is to provide the weight map as another input channel to the nnU-Net during training. This way the nnU-Net will automatically learn how to best utilize the weights.

Best, Karol

Karol-G avatar Sep 27 '23 14:09 Karol-G

Hello, I see in another thread there was some development on this. Did this go anywhere? I don't see how providing a weight map as input will result in any improved performance on the boundaries. Rather a weight map must be fed into the loss function in some way. This issue comes up quite often even in the radiological space, as often we only care about the boundaries between things (for example, joint space width)

karllandheer avatar Feb 15 '24 16:02 karllandheer

Hey all,

Is this issue still relevant?

Best regards, Karol

Karol-G avatar Mar 20 '24 15:03 Karol-G

Hello, thank you very much for the update with masked loss.

This post is still relevant. I would appreciate a hint to change the masked loss to a weighted one. Instead of giving a mask for ignoring regions, I would like to give a map of importance to weight the loss more or less for the concerned voxels according to this map. I can modify some part of the code myself if needed and propose a request then if it works.

Thanks.

Best regards, have a good day. Thibault

Thibescobar avatar Mar 27 '24 12:03 Thibescobar

Hey,

It appears something like this is currently not supported and you would need to make quite some changes to nnU-Net to make it work. This probably needs to be computed on-the-fly as part of the data augmentation and be accounted for in the loss computation. Besides that I cannot give you any better suggestions.

Best regards, Karol

Karol-G avatar Apr 02 '24 08:04 Karol-G