MIC-DKFZ / nnUNet

Apache License 2.0
5.59k stars 1.71k forks source link

Using my new trained model in a python file #2454

Open tedi14 opened 3 weeks ago

tedi14 commented 3 weeks ago

Hello,

I have my own trained model on nnunet and it does predictions, how can I view the predictions themselves? Also how would I go about integrating my model into a bigger piece of code where my model output gets converted into a dicom. I already have the code for the converting the nii.gz into dicom. My main question is, is there a way to"load" my model into the code that I already have. Is there specific loading functions I need to write out into the code to call upon my model so it does predictions like that. For example to take the directory to my checkpoint.pth model and then do a prediction from it in the code and then its proceeds with its conversion.

Thank you

JackRio commented 3 weeks ago

Take a look here

You can use this codebase to run inference on new datasets and also integrate the codebase to the new bigger codebase.

Shrajan commented 3 weeks ago

Hi @tedi14,

You cannot use nnUNet to view any images (MR, CT, etc.) or segmentations. For that, you need to use a third-party software, such as 3D Slicer, MITK or napari. Each one of them has detailed documentation to load and view images, and their corresponding segmentation labels. I like to use Slicer for 3D volumes.

Adding on to what @JackRio mentioned, you can follow these instructions, and adapt your python code as required.