MIC-DKFZ / nnUNet

Apache License 2.0
5.58k stars 1.7k forks source link

Issue with Prediction Using Single Numpy Array: RuntimeError in nnUNetPredictor #2377

Open RewaaHummedi opened 1 month ago

RewaaHummedi commented 1 month ago

Description: I encountered an issue while attempting to perform prediction using a single Numpy array with nnUNetPredictor. Here are the details of the problem along with the steps to reproduce it:

Code Snippet: image

Output: image image

Error: image image

Issue Details:

Request for Assistance:

Thank you for your guidance on resolving this issue.

Lars-Kraemer commented 1 month ago

Hey @RewaaHummedi,

when using the nnUNetPredictor you should load the data in the same way as it was done during training. If you are using SimpleITKIO take a look here:

https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunetv2/imageio/simpleitk_reader_writer.py#L30

at first glance, the following line is missing from your script: npy_image = npy_image[None]

If this is not working please ensure your data has the same format as your train data and share your dataset.json and the plans file.

Best, Lars