MONAI Label with nnUNet-MONAI Bundle#
This notebook demonstrates how to use the MONAI Label with nnUNet-MONAI Bundle to perform active learning and Auto-Segmentation with the nnUNet-MONAI Bundle.
Start MONAI Label#
To start MONAI Label with the nnUNet-MONAI Bundle App, run the following command:
monailabel start_server --app nnunetmonaibundle --studies /home/maia-user/Tutorials/MAIA/Task09_Spleen/imagesTr --conf models Task09_Spleen_Bundle
and access the MONAI Label App at http://localhost:8000
Train Task#
The Train Task requires the following parameters:
max_epochs: Total number of epochs to runtracking_uri: MLFlow Tracking URI to monitor the trainingnnunet_plans_identifier: nnUNet plans identifier, specific for the experiment (e.g. nnUNetPlans, nnUNetResEncUNetLPlans, nnUNetResEncUNetPlans)nnunet_planner_name: nnUNet planner name, specific for the experiment (e.g. nnUNetPlanner, nnUNetPlannerResEnc, nnUNetPlannerResEncL)nnunet_root_folder: Root folder where the nnUNet experiments are storedtask_name: nnUNet Task Nametask_id: nnUNet Task IDpymaia_config_file: PyMaia configuration file (see Prepare nnUNet ResEnc Training)
Internally, the nnUNetBundle Train Task will run the following steps:
Inference Task#
The Auto-Segmentation action can be performed when a valid model is available in the MONAI Bundle models folder.
A valid model_folder parameter should be specified in the inference.yamlfile, referring to the nnUNet model folder directory (<TRAINER_CLASS__PLANS_IDENTIFIER__3d_fullres>), inside which the folds subdirectories with the model checkpoint are located:
model_folder/
├── fold_0/
│ ├── checkpoint_final.pth
│ └── checkpoint_best.pth
├── fold_1/
│ ├── checkpoint_final.pth
│ └── checkpoint_best.pth
├── plans.json
└── dataset.json
Load existing nnUNet Model into nnUNet-MONAI Bundle#
To load an existing nnUNet trained model into the nnUNet-MONAI Bundle:
nnUNetv2_install_pretrained_model_from_zip --zip /path/to/nnUNet_pretrained_model.zip
and modify the corresponding model_folder parameter in the inference.yaml file.
By default, the pretrained model will be extracted under the $nnUNet_results directory.