MIC-DKFZ / nnUNet

Apache License 2.0
5.79k stars 1.74k forks source link

nnUNet dataset with precomputed skeletonizations #1888

Closed luisdavid64 closed 8 months ago

luisdavid64 commented 9 months ago

Hello!

I wish to use nnUNet for segmentation and use the results for a skeletonization task. Since I will be computing clDice scores, I wanted to load some precomputed GT skeletonizations on the fly during training, so as to save on this computation. Do you have some pointers on how I can add this feature?

Regards, Luis

Lars-Kraemer commented 8 months ago

Hey @luisdavid64,

It appears that the workflow you're describing doesn't have a straightforward solution. Implementing it would necessitate significant modifications to the data processing, data loading and augmentation pipelines. One potential workaround could be to integrate the skeleton computation directly within your Dice loss function. The feasibility of this largely depends on the efficiency of your skeletonization algorithm, but it might have a manageable impact on runtime. Alternatively, you could incorporate the skeletonization process into the data loading phase itself, e.g. as a transformation appended at the end of the augmentation pipeline. This transformation could add an additional key (such as 'skel' or 'skeleton') to the batch dictionary, making it accessible during the training and validation steps. Unfortunately, there isn't an immediate and direct solution to this challenge and for both workarounds, the skeleton has to be calculated dynamically.

Best, Lars

luisdavid64 commented 8 months ago

Hi @Lars-Kraemer, Thank you for the reply! This is more or less what I concluded. I will see what I can do :)