-
Notifications
You must be signed in to change notification settings - Fork 739
Create deepedit tutorial #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
78c0f47
Create deepedit tutorial
diazandr3s ea2f91a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9cf5de8
Merge branch 'master' into deepeditTutorial
diazandr3s 14d21c9
Update train file
diazandr3s 2c94c40
Merge branch 'master' into deepeditTutorial
diazandr3s 5c72942
Merge branch 'master' into deepeditTutorial
diazandr3s fa4772b
Move custom transforms and interaction to MONAI core
diazandr3s 4053460
Update imports from MONAI
diazandr3s 60ceda1
Update Notebook and Readme
diazandr3s 738a929
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 168b9ed
Fix static errors in Notebook
diazandr3s de30dc6
Merge branch 'deepeditTutorial' of https://github.com/diazandr3s/tuto…
diazandr3s 28d9c65
Fix spaces autofix
diazandr3s 3c0661b
Merge branch 'master' into deepeditTutorial
diazandr3s 0fb3ebe
Update DeepEdit transform names
diazandr3s d0258df
Update Readme
diazandr3s 74a288c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fbfd44e
Address first round of comments
diazandr3s f75c82b
Merge branch 'deepeditTutorial' of https://github.com/diazandr3s/tuto…
diazandr3s 4c738b1
Fix static issues
diazandr3s 00246f4
Fix static
diazandr3s f7518c8
Fix static erros
diazandr3s 198ff3b
Address second round of comments
diazandr3s e3872ea
Merge branch 'master' into deepeditTutorial
diazandr3s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# DeepEdit | ||
|
||
|
||
DeepEdit is a method that combines an automatic and a semi-automatic approach for 3D medical images into a | ||
single deep learning-based model. DeepEdit has three working modes: first, it can be used in click-free | ||
inference mode (similar to a regular segmentation network), providing fully-automatic segmentation predictions which | ||
can be used as a form of initialisation; second, it allows users to provide clicks to initialise and guide | ||
a semi-automatic segmentation model; lastly, given an initial segmentation, DeepEdit can be used to refine | ||
and improve the initial prediction by providing editing clicks. DeepEdit training process is similar to the algorithm | ||
proposed by **_Sakinis et al._** [DeepGrow](../../deepgrow/ignite) - Gaussian-smoothed clicks for all labels and background | ||
are generated and added as input to the backbone CNN, but removes the minimum-click limitation of DeepGrow. | ||
Contrary to DeepGrow, DeepEdit model allows the prediction of an automatic segmentation-based | ||
initialisation without user-provided clicks, which can then be further edited by providing clicks. Additionally, | ||
DeepEdit can also be used for multi-label segmentation problems, allowing the user to generate/segment | ||
all labels simultaneously instead of one label at a time. | ||
|
||
This tutorial contains an example to train a DeepEdit model and a notebook to run inference | ||
over a pre-trained model. The train file reads images and labels folders (imagesTr, labelsTr) as they come in the | ||
[Medical Segmentation Decathlon](https://msd-for-monai.s3-us-west-2.amazonaws.com/Task09_Spleen.tar). | ||
|
||
More information about the transforms used in DeepEdit are also in the Notebook. | ||
|
||
**_Important note:_** | ||
|
||
This tutorial is intended to show how to train and test a DeepEdit model in MONAI Core library. Users may also find interesting | ||
DeepEdit model working in [MONAI Label](https://github.com/Project-MONAI/MONAILabel/tree/main/sample-apps/radiology#deepedit) | ||
platform. There you can find how DeepEdit works along with 3D Slicer and/or OHIF. | ||
|
||
<p align="center"> | ||
<img src="../../figures/general_schema_deepedit.png" alt="deepedit scheme"> | ||
</p> | ||
|
||
**_Sakinis et al.,_** Interactive segmentation of medical images through | ||
fully convolutional neural networks. (2019) https://arxiv.org/abs/1903.08205 | ||
|
||
### 1. Data | ||
|
||
A DeepEdit model could be trained on any 3D medical image dataset. | ||
|
||
For this tutorial we used the public available dataset (Task09_Spleen) that can be downloaded from [Medical Segmentation Decathlon](https://drive.google.com/drive/folders/1HqEgzS8BV2c7xYNrZdEAnrHk7osJJ--2) | ||
|
||
### 2. Questions and bugs | ||
Nic-Ma marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- For questions relating to the use of MONAI, please us our [Discussions tab](https://github.com/Project-MONAI/MONAI/discussions) on the main repository of MONAI. | ||
|
||
- For bugs relating to MONAI functionality, please create an issue on the [main repository](https://github.com/Project-MONAI/MONAI/issues). | ||
|
||
- For bugs relating to the running of a tutorial, please create an issue in [this repository](https://github.com/Project-MONAI/Tutorials/issues). | ||
|
||
### 3. List of notebooks and examples | ||
|
||
#### Prepare Your Data | ||
|
||
- Download the Task09_Spleen zip file | ||
- Decompressed the file | ||
- Write the full path in the **input** flag in the [train file](./train.py) | ||
|
||
|
||
#### [DeepEdit Training](./train.py) | ||
|
||
This is an extension for [train.py](./train.py) that redefines basic default arguments to run 3D training. | ||
|
||
```bash | ||
# Run to know all possible options | ||
python ./train.py -h | ||
|
||
# Train a DeepEdit model | ||
python ./train_3d.py | ||
--input deepedit/Task09_Spleen \ | ||
--output deepedit_model/ \ | ||
--epochs 100 | ||
|
||
# After training to export/save as torch script model | ||
python ./train.py | ||
--input deepedit_model/model.pt \ | ||
--output deepedit_model/model.ts \ | ||
--export true | ||
``` | ||
|
||
#### [DeepEdit Inference](./inference.ipynb) | ||
|
||
This notebook helps to run any pre-transforms before running inference over a DeepEdit single label model. | ||
It also helps to run post-transforms to get the final label mask. | ||
|
||
|
||
#### DeepEdit Stats | ||
|
||
By-default Tensorboard handlers are added as part of training/validation steps. |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.