Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit aec9e28

Browse files
authored
DOC: Add hippocampus docs (#756)
Add documentation on evaluating the trained Hippocampus model.
1 parent 48a6332 commit aec9e28

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ Further detailed instructions, including setup in Azure, are here:
8989
1. [Working with FastMRI models](docs/fastmri.md)
9090
1. [Active label cleaning and noise robust learning toolbox](https://github.com/microsoft/InnerEye-DeepLearning/blob/1606729c7a16e1bfeb269694314212b6e2737939/InnerEye-DataQuality/README.md)
9191
1. [Using InnerEye as a git submodule](docs/innereye_as_submodule.md)
92+
1. [Evaluating pre-trained models](docs/hippocampus_model.md)
9293

9394
## Deployment
9495

docs/building_models.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ python Inner/ML/runner.py --azureml --model=Prostate --cluster=my_cluster_name \
189189
--no-train --model_id=Prostate:1
190190
```
191191

192+
To evaluate the model on your own Azure ML Dataset, you can override the default dataset by adding the flag
193+
`--azure_dataset_id=<my dataset id>`. To specify more than one dataset, you can additionally add the flag `--extra_azure_dataset_ids` to specify the rest.
194+
195+
192196
### From local checkpoints
193197

194198
To evaluate a model using one or more local checkpoints, use the `local_weights_path` argument to specify the path(s) to the

docs/hippocampus_metrics_boxplot.png

Lines changed: 3 additions & 0 deletions
Loading

docs/hippocampus_model.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
2+
# Trained model for hippocampal segmentation
3+
4+
## Purpose
5+
6+
This documentation describes how to use our pre-trained model to segment the left and right hippocampi from brain MRI scans. The model was trained on data from the [ADNI](https://adni.loni.usc.edu/) dataset (for more information see the model card below). This data is publicly available via their website, but users must sign a Data Use Agreement in order to gain access. We do not provide access to the data. The following description assumes the user has their own dataset to evaluate/ retrain the model on.
7+
8+
## Terms of use
9+
10+
Please note that this model is intended for research purposes only. You are responsible for the performance, the necessary testing, and if needed any regulatory clearance for any of the models produced by this toolbox.
11+
12+
---
13+
14+
## Usage
15+
16+
The following instructions assume you have completed the preceding setup steps in the [InnerEye README](https://github.com/microsoft/InnerEye-DeepLearning/), in particular, [Setting up Azure Machine Learning](https://github.com/microsoft/InnerEye-DeepLearning/blob/main/docs/setting_up_aml.md).
17+
18+
### Create an Azure ML Dataset
19+
20+
To evaluate this model on your own data, you will first need to register an [Azure ML Dataset](https://docs.microsoft.com/en-us/azure/machine-learning/v1/how-to-create-register-datasets). You can follow the instructions in the InnerEye repo for [creating datasets](https://github.com/microsoft/InnerEye-DeepLearning/blob/main/docs/creating_dataset.md) in order to do this.
21+
22+
## Downloading the model
23+
24+
The saved weights from the trained Hippocampus model can be downloaded along with the source code used to train it from [our github releases page](https://github.com/microsoft/InnerEye-DeepLearning/releases).
25+
26+
### Registering a model in Azure ML
27+
28+
To evaluate the model in Azure ML, you must first [resgister an Azure ML Model](https://docs.microsoft.com/en-us/python/api/azureml-core/azureml.core.model.model?view=azure-ml-py#remarks). To register the Hippocampus model in your AML Workspace, unpack the source code downloaded in the previous step and follow InnerEye's [instructions to upload models to Azure ML](https://github.com/microsoft/InnerEye-DeepLearning/blob/main/docs/move_model.md).
29+
30+
```shell
31+
WORKSPACE="fill with your workspace name"
32+
GROUP="fill with your resource group name"
33+
SUBSCRIPTION="fill with your subscription ID"
34+
35+
python InnerEye/Scripts/move_model.py \
36+
--action upload \
37+
--path . \
38+
--workspace_name $WORKSPACE \
39+
--resource_group $GROUP \
40+
--subscription_id $SUBSCRIPTION \
41+
--model_id Hippocampus:118
42+
```
43+
44+
### Evaluating the model
45+
46+
You can evaluate the model either in Azure ML or locally using the downloaded checkpoint files. These 2 scenarios are described in more detail, along with instructions in [testing an existing model](https://github.com/microsoft/InnerEye-DeepLearning/blob/main/docs/building_models.md#testing-an-existing-model).
47+
48+
For example, to evalute the model on your Dataset in Azure ML:
49+
50+
```shell
51+
CLUSTER="fill with your cluster name"
52+
DATASET_ID="fill with your dataset name"
53+
54+
python InnerEye/ML/runner.py \
55+
--azure_dataset_id $DATASET_ID \
56+
--model Hippocampus \
57+
--model_id Hippocampus:111 \
58+
--experiment_name evaluate_hippocampus_model \
59+
--azureml \
60+
--no-train \
61+
--cluster $CLUSTER
62+
--restrict_subjects=0,0,+
63+
```
64+
65+
### Connected components
66+
67+
It is possible to apply connected compoents as a post-processing step, although by default this is disabled. To enable, update the property `largest_connected_component_foreground_classes` of the Hippocampus class in `InnerEye/ML/configs/segmentation/Hippocampus.py`
68+
69+
### Deploy with InnerEye Gateway
70+
71+
To deploy this model, see the instructions in the [InnerEye README](https://github.com/microsoft/InnerEye-DeepLearning/).
72+
73+
---
74+
75+
# Hippocampal Segmentation Model Card
76+
77+
## Model details
78+
79+
- Organiation: Biomedical Imaging Team at Micrsoft Research, Cambridge UK.
80+
- Model date: 5th July 2022.
81+
- Model version: 0.1 . Currently only one version of the model has been released. We do not expect to update the model frequently.
82+
- Model type: 3d UNET ensemble of 3d UNet. Training details are as described in [this paper](https://jamanetwork.com/journals/jamanetworkopen/fullarticle/2773292).
83+
- Training details: 5 fold ensemble model. Trained on a subsection of the ADNI dataset (described in detail below)
84+
- License: The model is released under MIT license as described [here](https://github.com/microsoft/InnerEye-DeepLearning/blob/main/LICENSE).
85+
- Contect: [email protected].
86+
87+
## Limitations
88+
89+
This model has been trained on a subset of the ADNI dataset. There have been various phases of ADNI spanning different time periods. In this Model Card we refer to the original, or ADNI 1, stud.y This dataset comprises scans and metadata from patients between the ages of 55-90 from 57 different sites across the US and Canada [source](https://adni.loni.usc.edu/study-design/#background-container). Therefore a major limitation of this model would be the ability to generalise to patients outside of this demographic. Another limitation is that The MRI protocol for ADNI1 (which was collected between 2004-2009) focused on imaging on 1.5T scanners [source](https://adni.loni.usc.edu/methods/mri-tool/mri-analysis/). Modern scanners may have higher field strengths and therefore different levels of contrast which could lead to different performance from the results we report.
90+
91+
The results of this model have not been validated by clinical experts. We expect the user to evaluate the result
92+
93+
## Intended Uses
94+
95+
This model is for research purposes only. It is intended to be used for the task of segmentating hippocampi from brain MRI scans. Any other task is out of scope for this model.
96+
97+
## About the data
98+
99+
The model was trained on 998 pairs of MRI segmentation + segmentation. The model was further validated on 127 pairs of images and tested on 125 pairs. A further 317 pairs were retained as a held-out test set for the final evaluation of the model, which is what we report performance on.
100+
101+
All of this data comes from the Alzheimers Disease Neuroimaging Initiative study [link to website](https://adni.loni.usc.edu/). The data is publicly available, but requires signing a Data Use Agreement before access is granted.
102+
103+
## About the ground-truth segmentations
104+
105+
The segmentations were also downloaded from the ADNI dataset. They were created semi-automatically using software from [Medtronic Surgical Navigation Technologies](https://www.medtronic.com/us-en/healthcare-professionals/products/neurological/surgical-navigation-systems.html). Further information is available on the [ADNI website](https://adni.loni.usc.edu/).
106+
107+
## Metrics
108+
109+
Note that due to the ADNI Data Usage Agreement we are only able to share aggregate-level metrics from our evaluation. Evaluation is performed on a heldout test set of 252 pairs of MRI + segmentation pairs from the ADNI dataset.
110+
111+
Dice Score for Left and Right hippocampus respectively on a held-out test set of :
112+
113+
![hippocampus_metrics_boxplot.png](hippocampus_metrics_boxplot.png)
114+
| Structure | count | DiceNumeric_mean | DiceNumeric_std | DiceNumeric_min | DiceNumeric_max | HausdorffDistance_mm_mean | HausdorffDistance_mm_std | HausdorffDistance_mm_min | HausdorffDistance_mm_max | MeanDistance_mm_mean | MeanDistance_mm_std | MeanDistance_mm_min | MeanDistance_mm_max |
115+
|---------------|---------|------------------|-----------------|-----------------|-----------------|---------------------------|--------------------------|--------------------------|--------------------------|----------------------|---------------------|---------------------|---------------------|
116+
| hippocampus_L | 252 | 0.918 | 0.022 | 0.819 | 0.953 | 2.206 | 0.812 | 1.206 | 6.964 | 0.168 | 0.054 | 0.096 | 0.399 |
117+
| hippocampus_R | 252 | 0.918 | 0.024 | 0.816 | 0.954 | 2.185 | 0.706 | 1.206 | 4.966 | 0.168 | 0.055 | 0.094 | 0.433 |
118+
| | | | | | | | | | | | | | |
119+
---

0 commit comments

Comments
 (0)