Autosomal dominant polycystic kidney disease (ADPKD) Segmentation in PyTorch
Project design, data management, and implementation for first version of polycystic kidney work by Akshay Goel, MD.
Follow-up work by researchers at Weill Cornell Medicine and Cornell University.
Goel A, Shih G, Riyahi S, Jeph S, Dev H, Hu R, et al. Deployed Deep Learning Kidney Segmentation for Polycystic Kidney Disease MRI. Radiology: Artificial Intelligence. p. e210205.
Published Online:Feb 16 2022 https://doi.org/10.1148/ryai.210205
Sharbatdaran A, Romano D, Teichman K, Dev H, Raza SI, Goel A, Moghadam MC, Blumenfeld JD, Chevalier JM, Shimonov D, Shih G, Wang Y, Prince MR. Deep Learning Automation of Kidney, Liver, and Spleen Segmentation for Organ Volume Measurements in Autosomal Dominant Polycystic Kidney Disease. Tomography. 2022; 8(4):1804-1819. https://doi.org/10.3390/tomography8040152. URL: https://www.mdpi.com/1723226
Inference was performed by checkpoints/inference.yml with checkpoint (checkpoints/best_val_checkpoint.pth)
requirements.txt
and adpkd-segmentation
package from source.pip install -e . -f https://download.pytorch.org/whl/torch_stable.html
requirements.txt
and adpkd-segmentation
is supported for python 3.8
python 3.8.4
and python 3.8.5
python 3.8
environment.python 3.8.4
or 3.8.5
is installed, create a virtual environment with virtualenv
(Windows)
working_dir>pip install virtualenv
working_dir>py -3.8.4 -m Drive:\path\to\environment_name\
Powershell Activation:
working_dir>Drive\path\to\environment_name\Scripts\activate.ps1
Windows Command Line:
working_dir>Drive\path\to\environment_name\Scripts\activate
working_dir>python setup.py install
(Unix/MacOS)
$pip install virtualenv
$python3.8.4 -m venv /path/to/environment_name
$source /path/to/environment_name/bin/activate
$python
$ python adpkd_segmentation/inference/inference.py -h
usage: inference.py [-h] [--config_path CONFIG_PATH] [-i INFERENCE_PATH] [-o OUTPUT_PATH]
optional arguments:
-h, --help show this help message and exit
--config_path CONFIG_PATH
path to config file for inference pipeline
-i INFERENCE_PATH, --inference_path INFERENCE_PATH
path to input dicom data (replaces path in config file)
-o OUTPUT_PATH, --output_path OUTPUT_PATH
path to output location
Install from requirements.txt
(inside some virtual env):
pip install -e . -f https://download.pytorch.org/whl/torch_stable.html
Note: Depending on the dataloader you may need to create a train / validation / test json file to indicate splits.
$ python -m adpkd_segmentation.train --config path_to_config_yaml --makelinks
$ CUDA_VISIBLE_DEVICES=2 python -m adpkd_segmentation.train --config path_to_config_yaml --makelinks
The makelinks
flag is optional and needed only once to create symbolic links to the data.
$ python -m adpkd_segmentation.evaluate --config path_to_config_yaml --makelinks
If using a specific GPU (e.g. device 2):
$ CUDA_VISIBLE_DEVICES=2 python -m adpkd_segmentation.evaluate --config path_to_config_yaml --makelinks
For generating TKV calculations:
$ python -m adpkd_segmentation.evaluate_patients --config path_to_config_yaml --makelinks --out_path output_csv_path
multi_train.py
can be used to run multiple training runs in a sequence.create_eval_configs.py
is a utility script to create evaluation configs from the starting training config.train.py
.For questions or comments please feel free to email me at akshay.k.goel@gmail.com.
@misc{Goel:2021,
Author = {Akshay Goel},
Title = {ADPKD Segmentation in PyTorch},
Year = {2021},
Publisher = {GitHub},
Journal = {GitHub repository},
Howpublished = {\url{https://github.com/aksg87/adpkd-segmentation-pytorch}}
}
Project is distributed under MIT License
Model architecture utilized from Segmentation Models Pytorch by Pavel Yakubovskiy.
Please apply these prior to any PRs to this repository.
- Linter flake8
link
- Formatter black --line-length 79
link
If you use VSCode you can add these to your settings as follows:
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"python.formatting.blackArgs": [
"--experimental-string-processing",
"--line-length",
"79",
],