MIC-DKFZ / nnUNet

Apache License 2.0
5.95k stars 1.77k forks source link

Troubleshooting inference for 2D #2515

Open themantalope opened 2 months ago

themantalope commented 2 months ago

Hi all,

Hope you can help me troubleshoot an issue. I trained a nnUNet v2 model for 2D segmentation with the totalsegmentor dataset.

Now what I want to do is run inference on bolus tracking images on CT. I'm not sure if the metadata isn't formatted properly. Here is an example:

Image (0x492eb70) RTTI typeinfo: itk::Image<short, 3u> Reference Count: 1 Modified Time: 5618 Debug: Off Object Name: Observers: none Source: (none) Source output name: (none) Release Data: Off Data Released: False Global Release Data: Off PipelineMTime: 5599 UpdateMTime: 5614 RealTimeStamp: 0 seconds LargestPossibleRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 1] BufferedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 1] RequestedRegion: Dimension: 3 Index: [0, 0, 0] Size: [512, 512, 1] Spacing: [0.585938, 0.585938, 1] Origin: [-147.707, -299.707, -76.5] Direction: 1 0 0 0 1 0 0 0 1

IndexToPointMatrix: 0.585938 0 0 0 0.585938 0 0 0 1

PointToIndexMatrix: 1.70667 0 0 0 1.70667 0 0 0 1

Inverse Direction: 1 0 0 0 1 0 0 0 1

PixelContainer: ImportImageContainer (0x43bbc30) RTTI typeinfo: itk::ImportImageContainer<unsigned long, short> Reference Count: 1 Modified Time: 5611 Debug: Off Object Name: Observers: none Pointer: 0x4a924f0 Container manages memory: true Size: 262144 Capacity: 262144

Here is an example of what the image looks like: image

When i run inference on the image (after saving as nii.gz etc) Here is what the prediction map looks like: image

In this task I'm segmenting vessels so I expect to see the aorta. During training, the dice score for the validation folds on the aorta was over 90%, so I expect to see good segmentation results. Not convinced it is working here. Also when running inference the model is taking 512 steps. It could be because the model is making predictions over many crops (?) and then putting the inferences together, but seems like a lot of steps for a single slice.

Please take a look and let me know if this looks alright, or if I need to insert some dummy data in the metadata for the 2D slices. Do I need to cast the data to a specific type? Any suggestions appreciated.