SALMON is a computational toolbox for segmentation using neural networks (3D patches-based segmentation) SALMON is based on MONAI: a PyTorch-based, open-source framework for deep learning in healthcare imaging. (https://github.com/Project-MONAI/MONAI)
See requirements.txt list. We use "nvcr.io/nvidia/pytorch:19.03-py3" docker and we install all the requirements with: "pip install -r requirements.txt"
-
organize_folder_structure.py: Organize the data in the folder structure for the network
-
init.py: List of options used to train the network.
-
check_loader_patches: Shows example of patches fed to the network during the training
-
networks.py: The architectures available for segmentation.
-
train.py: Runs the training
-
predict_single_image.py: It launches the inference on a single input image chosen by the user.
Use first "organize_folder_structure.py" to create organize the data in the following folder structure:
.
├── Data_folder
| ├── images
| | ├── train
| | | ├── image1.nii
| | | └── image2.nii
| | └── val
| | | ├── image3.nii
| | | └── image4.nii
| | └── test
| | | ├── image5.nii
| | | └── image6.nii
| ├── labels
| | ├── train
| | | ├── label1.nii
| | | └── label2.nii
| | └── val
| | | ├── label3.nii
| | | └── label4.nii
| | └── test
| | | ├── label5.nii
| | | └── label6.nii
Modify the "init.py" to set the parameters and start the training/testing on the data. Afterwards launch the train.py for training. Tensorboard is available to monitor the training:
Sample images: on the left side the image, in the middle the result of the segmentation and on the right side the true label The following images show the segmentation of carotid artery from MR sequence
Launch "predict_single_image.py" to test the network. Modify the parameters in the parse section to select the path of the weights, images to infer and result.
Use and modify "check_loader_patches.py" to check the patches fed during training. Use and modify "networks.py" to modify the network and check the number of parameters.
python predict_single_image.py --image './Data_folder/images/train/image13.nii' --label './Data_folder/labels/train/label13.nii' --result './Data_folder/results/train/prova.nii' --weights './best_metric_model.pth'
- Add more networks structures in networks.py
- Implement it for multilabel segmentation in the same script. (call multilabel losses)