-
Download and extract the TotalSegmentator dataset to
./training_data/total_segmentator
folder. -
Download and extract the FLARE21 training dataset to
./training_data/flare21
folder. You should have a./training_data/flare21/TrainingImg
folder and./training_data/flare21/TrainingMask
folder.
- Create a folder
./nnunet_data/nnUNet_raw_data_base
- Create a folder
./nnunet_data/nnUNet_preprocessed
- Create a folder
./nnunet_data/nnUNet_trained_nmodels
- Run
create_nnunet_dataset.ipynb
to setup the nnUnet dataset
- setup environtmnent variables
export nnUNet_raw_data_base="./nnunet_data/nnUNet_raw_data_base"
export nnUNet_preprocessed="./nnunet_data/nnUNet_preprocessed"
export RESULTS_FOLDER="./nnunet_data/nnUNet_trained_models"
- Run plan and preprocess
nnUNet_plan_and_preprocess -t 773 --verify_dataset_integrity
- Train folds 0-4, you can use the
train.sh
script. Specify the fold with the first arg, and the gpu to train on with the second arg
If you get errors like
ITK ERROR: ITK only supports orthonormal direction cosines. No orthonormal definition found!
The first option is to install SimpleITK=2.0.2
, however if you are using python >3.7, that version of SimpleITK is not available. The second option is to fix the dataset, using the steps below.
- build the docker image
docker build -t fix_total_segmentator:latest ./TotalSegFix
- run the docker image
docker run --rm -v $(pwd)/training_data/total_segmentator:/data -v $(pwd)/training_data/total_segmentator_fix:/out_data -u $(id -u ${USER}):$(id -g ${USER}) fix_total_segmentator:latest
- copy the fixed dataset back to the training_data folder, or used new
training_data/total_segmentator_fix
instead oftraining_data/total_segmentator
in the training instructions above.
You can use nnUNet_predict with your existing nnUNet envirionment. To use DICOM as input or as output instead of nifti, refer to the container/run.py
script for an example.