Medical Imaging Deep Learning library to train and deploy 3D segmentation models on Azure Machine Learning
Перейти к файлу
pre-commit-ci[bot] 75d07b96e8
ENH: Autoupdate hooks [pre-commit.ci] (#737)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v4.3.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v4.3.0)
- [github.com/PyCQA/flake8: 3.9.2 → 4.0.1](https://github.com/PyCQA/flake8/compare/3.9.2...4.0.1)
- [github.com/pre-commit/mirrors-autopep8: v1.5.7 → v1.6.0](https://github.com/pre-commit/mirrors-autopep8/compare/v1.5.7...v1.6.0)

* Update .pre-commit-config.yaml

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Fernando Pérez-García <fperezgarcia@microsoft.com>
2022-07-07 16:03:39 +01:00
.github ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
.idea STYLE: Ensure line breaks at the end of all files (#717) 2022-04-04 15:08:43 +01:00
.vscode ENH: Customized VSCode Window Color (#712) 2022-04-13 14:47:05 +01:00
InnerEye BUG: Ensemble HeadAndNeck model encounters 'CUDA out of memory' (#754) 2022-06-30 17:00:59 +01:00
InnerEye-DataQuality STYLE: Ensure line breaks at the end of all files (#717) 2022-04-04 15:08:43 +01:00
RegressionTestResults STYLE: Ensure line breaks at the end of all files (#717) 2022-04-04 15:08:43 +01:00
TestSubmodule ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
Tests ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
TestsOutsidePackage ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
azure-pipelines Replace data quality folder with a link to the commit (#692) 2022-03-10 09:14:25 +00:00
docs DOC: Update environment documentation (#748) 2022-06-22 10:57:30 +00:00
sphinx-docs DOC: Add part of the API to the Sphinx docs (#718) 2022-04-19 15:04:17 +01:00
.amlignore Add histopathology module and add hi-ml as submodule (#603) 2021-12-06 17:23:17 +00:00
.coveragerc Fix error messages in test coverage reporting (#394) 2021-02-10 14:29:20 +00:00
.editorconfig Add source code 2020-07-29 00:30:35 +05:30
.flake8 STYLE: Fix pre-commit errors (#736) 2022-06-07 09:14:00 +01:00
.gitattributes Moving nii.gz from git lfs to git to simplify the HelloWorld test (#632) 2022-01-11 16:19:17 +00:00
.gitconfig Add source code 2020-07-29 00:30:35 +05:30
.gitignore DOC: Add a smoke-test model for AzureML setup (#708) 2022-04-13 14:05:09 +01:00
.gitmodules ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
.pre-commit-config.yaml ENH: Autoupdate hooks [pre-commit.ci] (#737) 2022-07-07 16:03:39 +01:00
CHANGELOG.md BUG: Fix missing channels dimension in normalization (#701) 2022-06-13 13:47:27 +01:00
CODE_OF_CONDUCT.md Add source code 2020-07-29 00:30:35 +05:30
GeoPol.xml STYLE: Ensure line breaks at the end of all files (#717) 2022-04-04 15:08:43 +01:00
LICENSE Add source code 2020-07-29 00:30:35 +05:30
README.md DOC: Update environment documentation (#748) 2022-06-22 10:57:30 +00:00
SECURITY.md STYLE: Ensure line breaks at the end of all files (#717) 2022-04-04 15:08:43 +01:00
THIRDPARTYNOTICES.md Remove unnecessary notices in THIRDPARTYNOTICES.md 2020-11-03 15:37:43 +00:00
conftest.py Moving InnerEye's Azure code to hi-ml package (#548) 2021-08-26 09:17:09 +01:00
create_and_lock_environment.sh ENH: Add Environment Locking (#735) 2022-06-01 10:05:54 +00:00
environment.yml ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
environment_win.yml ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
mypy.ini Add source code 2020-07-29 00:30:35 +05:30
mypy_runner.py Moving InnerEye's Azure code to hi-ml package (#548) 2021-08-26 09:17:09 +01:00
primary_deps.yml ENH: Move hi-ml and fastMRI to PyPI packages (#752) 2022-06-23 09:44:54 +01:00
pytest.ini Enable tiling non-PANDA WSI datasets (#621) 2021-12-16 16:11:55 +00:00
score.py Bug fix: deployed models and training code use different versions of hi-ml (#606) 2021-12-07 12:45:49 +00:00
setup.py Add accuracy at threshold 0.5 to classification report (#450) 2021-05-04 10:09:35 +00:00

README.md

InnerEye-DeepLearning

Build Status

Overview

This is a deep learning toolbox to train models on medical images (or more generally, 3D images). It integrates seamlessly with cloud computing in Azure.

On the modelling side, this toolbox supports

  • Segmentation models
  • Classification and regression models
  • Adding cloud support to any PyTorch Lightning model, via a bring-your-own-model setup

On the user side, this toolbox focusses on enabling machine learning teams to achieve more. It is cloud-first, and relies on Azure Machine Learning Services (AzureML) for execution, bookkeeping, and visualization. Taken together, this gives:

  • Traceability: AzureML keeps a full record of all experiments that were executed, including a snapshot of the code. Tags are added to the experiments automatically, that can later help filter and find old experiments.
  • Transparency: All team members have access to each other's experiments and results.
  • Reproducibility: Two model training runs using the same code and data will result in exactly the same metrics. All sources of randomness like multithreading are controlled for.
  • Cost reduction: Using AzureML, all compute (virtual machines, VMs) is requested at the time of starting the training job, and freed up at the end. Idle VMs will not incur costs. In addition, Azure low priority nodes can be used to further reduce costs (up to 80% cheaper).
  • Scale out: Large numbers of VMs can be requested easily to cope with a burst in jobs.

Despite the cloud focus, all training and model testing works just as well on local compute, which is important for model prototyping, debugging, and in cases where the cloud can't be used. In particular, if you already have GPU machines available, you will be able to utilize them with the InnerEye toolbox.

In addition, our toolbox supports:

  • Cross-validation using AzureML's built-in support, where the models for individual folds are trained in parallel. This is particularly important for the long-running training jobs often seen with medical images.
  • Hyperparameter tuning using Hyperdrive.
  • Building ensemble models.
  • Easy creation of new models via a configuration-based approach, and inheritance from an existing architecture.

Once training in AzureML is done, the models can be deployed from within AzureML.

Quick Setup

This quick setup assumes you are using a machine running Ubuntu with Git, Git LFS, Conda and Python 3.7+ installed. Please refer to the setup guide for more detailed instructions on getting InnerEye set up with other operating systems and installing the above prerequisites.

Instructions

  1. Clone the InnerEye-DeepLearning repo by running the following command:

    git clone --recursive https://github.com/microsoft/InnerEye-DeepLearning & cd InnerEye-DeepLearning
    
  2. Create and activate your conda environment:

    conda env create --file environment.yml && conda activate InnerEye
    
  3. Verify that your installation was successful by running the HelloWorld model (no GPU required):

    python InnerEye/ML/runner.py --model=HelloWorld
    

If the above runs with no errors: Congratulations! You have successfully built your first model using the InnerEye toolbox.

If it fails, please check the troubleshooting page on the Wiki.

Other Documentation

Further detailed instructions, including setup in Azure, are here:

  1. Setting up your environment
  2. Setting up Azure Machine Learning
  3. Training a simple segmentation model in Azure ML
  4. Creating a dataset
  5. Building models in Azure ML
  6. Sample Segmentation and Classification tasks
  7. Debugging and monitoring models
  8. Model diagnostics
  9. Move a model to a different workspace
  10. Working with FastMRI models
  11. Active label cleaning and noise robust learning toolbox
  12. Using InnerEye as a git submodule

Deployment

We offer a companion set of open-sourced tools that help to integrate trained CT segmentation models with clinical software systems:

  • The InnerEye-Gateway is a Windows service running in a DICOM network, that can route anonymized DICOM images to an inference service.
  • The InnerEye-Inference component offers a REST API that integrates with the InnnEye-Gateway, to run inference on InnerEye-DeepLearning models.

Details can be found here.

docs/deployment.png

More information

  1. Project InnerEye
  2. Releases
  3. Changelog
  4. Testing
  5. How to do pull requests
  6. Contributing

Licensing

MIT License

You are responsible for the performance, the necessary testing, and if needed any regulatory clearance for any of the models produced by this toolbox.

Acknowledging usage of Project InnerEye OSS tools

When using Project InnerEye open-source software (OSS) tools, please acknowledge with the following wording:

This project used Microsoft Research's Project InnerEye open-source software tools (https://aka.ms/InnerEyeOSS).

Contact

If you have any feature requests, or find issues in the code, please create an issue on GitHub.

Please send an email to InnerEyeInfo@microsoft.com if you would like further information about this project.

Publications

Oktay O., Nanavati J., Schwaighofer A., Carter D., Bristow M., Tanno R., Jena R., Barnett G., Noble D., Rimmer Y., Glocker B., OHara K., Bishop C., Alvarez-Valle J., Nori A.: Evaluation of Deep Learning to Augment Image-Guided Radiotherapy for Head and Neck and Prostate Cancers. JAMA Netw Open. 2020;3(11):e2027426. doi:10.1001/jamanetworkopen.2020.27426

Bannur S., Oktay O., Bernhardt M, Schwaighofer A., Jena R., Nushi B., Wadhwani S., Nori A., Natarajan K., Ashraf S., Alvarez-Valle J., Castro D. C.: Hierarchical Analysis of Visual COVID-19 Features from Chest Radiographs. ICML 2021 Workshop on Interpretable Machine Learning in Healthcare. https://arxiv.org/abs/2107.06618

Bernhardt M., Castro D. C., Tanno R., Schwaighofer A., Tezcan K. C., Monteiro M., Bannur S., Lungren M., Nori S., Glocker B., Alvarez-Valle J., Oktay. O: Active label cleaning for improved dataset quality under resource constraints. https://www.nature.com/articles/s41467-022-28818-3. Accompagnying code InnerEye-DataQuality

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Maintenance

This toolbox is maintained by the Microsoft Medical Image Analysis team.