Deep Learning Models#
nnUNET#
If you want to use nnU-Net to train your model, please use NeuroPolyβs nnU-Netβs fork (also available on PyPI), which contains custom trainers, inference, and other improvements, and most importantly, which ensures compatibility with SCT (consistent pytorch version between SCT and nnU-Net, more details here). Also check our nnU-Net quickstart guide.
Naming models#
Each model is saved in its own repository under the ivadomed organization. The convention for naming repositories is the following:
Syntax:
model_task_anatomy_animal_pathology_condition_contrast_architecture
Keys/Values:
- task = {seg, label, find}, default=None
- anatomy = {sc, gm, csf, brainstem, axon, myelin, ...}, default=sc
- animal = {human, dog, cat, rat, mouse, ...}, default=human
- pathology = {hc, ms, sci}, default=hc
- condition = {invivo, exvivo}, default=invivo
- contrast = {t1, t2, t2star, dwi, sem, tem, oi, ...}, default=None
- architecture = {unet2d, unet3d, filmCharley, hemisAndreanne}, default=unet2d
[!NOTE]
Default fields can be ommited to avoid long names.
Examples:
model_seg_monkey_sc_t1_unet3d
model_seg_sc-gm-lesion_human_ms_exvivo_t2star
model_seg_sc-gm_t1-t2_unet3d # multi-channel, multi-class
Packaging models#
Models to be used by 3rd party software (e.g. SCT) should be uploaded as βassetsβ to a release of the repository. The steps are:
Create a release of the repository. The tag and title of the release should be
rYYYYMMDD, example:r20240915.Prepare a folder with the model in the following format. Keep the nnUNet folder structure intact. To save space, include only
checkpoint_final.pth. Example:
$ tree model-spinal-rootlets-mp2rage-r20240915.zip
βββ nnUNetTrainer_2000epochs__nnUNetPlans__3d_fullres
βββ dataset.json
βββ dataset_fingerprint.json
βββ fold_0
β βββ checkpoint_final.pth
β βββ debug.json
β βββ progress.png
β βββ training_log_2024_9_3_14_06_03.png
β βββ training_log_2024_9_3_14_06_03.txt
βββ plans.json
Important
The dataset.json file should contain the image_orientation entry, for example: "image_orientation": "RPI". This
entry is used by SCT to determine the image orientation. But, it is also a good idea to document which orientation was
used during training (for the sake of reproducibility).
Zip the folder and upload it as an asset in the release
Publish the release.