Skip to content

Commit 99e16a7

Browse files
dongyang0122dongypre-commit-ci[bot]heyufan1995Dong Yang
authored
initial dints tutorials (#449)
* initialize dints tutorials Signed-off-by: dongy <dongy@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update scripts Signed-off-by: dongy <dongy@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update scripts Signed-off-by: dongy <dongy@nvidia.com> * Update README.md * Update README.md * update scripts Signed-off-by: dongy <dongy@nvidia.com> * Change Dints interface * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Modify scripts for new Dints interface * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update scripts Signed-off-by: dongy <dongy@nvidia.com> * Test push * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update scripts Signed-off-by: dongy <dongy@nvidia.com> * update readme Signed-off-by: Dong Yang <dongy@dongy-mlt.client.nvidia.com> * Add readme * Update readme * Change lr in search * update readme Signed-off-by: Dong Yang <dongy@dongy-mlt.client.nvidia.com> * Enable single GPU * update readme Signed-off-by: Dong Yang <dongy@dongy-mlt.client.nvidia.com> * Add visualization tutorial transform image (#448) * [DLMED] add visualization tutorial Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] add image Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] update notebook Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] update notebook Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] add reference image Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] fix PEP error Signed-off-by: Nic Ma <nma@nvidia.com> * Update spleen_segmentation_3d.ipynb (#455) The `pip install` statement is missing pytorch-ignite. Changing: `!python -c "import monai" || pip install -q "monai-weekly[gdown, nibabel, tqdm]"` to `!python -c "import monai" || pip install -q "monai-weekly[gdown, nibabel, tqdm, ignite]"` * Figures added, pretrained weights link added, minor fixes (#456) * Figures added, pretrained weights link added, minor fixes Signed-off-by: vnath <vnath@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: vnath <vnath@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Add itkwidgets example in notebook (#454) * [DLMED] add itkwidgets Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] add reference screenshot Signed-off-by: Nic Ma <nma@nvidia.com> * [DLMED] update to PLS orientation Signed-off-by: Nic Ma <nma@nvidia.com> * MIL example (#431) * MIL example Signed-off-by: myron <amyronenko@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * mil tutorial update Signed-off-by: myron <amyronenko@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * mil tutorial update Signed-off-by: myron <amyronenko@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * small updates Signed-off-by: myron <amyronenko@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updated images Signed-off-by: myron <amyronenko@nvidia.com> * gdown for json Signed-off-by: myron <amyronenko@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> * Fix formatting and typos Signed-off-by: Behrooz <3968947+drbeh@users.noreply.github.com> * small fixes Signed-off-by: myron <amyronenko@nvidia.com> * stats Signed-off-by: myron <amyronenko@nvidia.com> * pip install Signed-off-by: myron <amyronenko@nvidia.com> * README fixes Signed-off-by: myron <amyronenko@nvidia.com> Co-authored-by: am <am> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Behrooz <3968947+drbeh@users.noreply.github.com> Co-authored-by: Nic Ma <nma@nvidia.com> * 450 update AsDiscrete (#451) * update asdiscrete Signed-off-by: Yiheng Wang <vennw@nvidia.com> * update postprocessing figures Signed-off-by: Yiheng Wang <vennw@nvidia.com> * fix version error of mutual info Signed-off-by: Yiheng Wang <vennw@nvidia.com> * update to use include in torchin Signed-off-by: Yiheng Wang <vennw@nvidia.com> * 459 update nvidia flare 2.0 example (#460) * update nvidia flare 2.0 example Signed-off-by: Yiheng Wang <vennw@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * enhance code format Signed-off-by: Yiheng Wang <vennw@nvidia.com> * update folder and readme Signed-off-by: Yiheng Wang <vennw@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Weights Link Updated (#465) Signed-off-by: vnath <vnath@nvidia.com> Co-authored-by: vnath <vnath@nvidia.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes readme typos Signed-off-by: Wenqi Li <wenqil@nvidia.com> * update readmes Signed-off-by: Wenqi Li <wenqil@nvidia.com> * update readme Signed-off-by: Wenqi Li <wenqil@nvidia.com> * qa commit Signed-off-by: Wenqi Li <wenqil@nvidia.com> * link Signed-off-by: Wenqi Li <wenqil@nvidia.com> Co-authored-by: dongy <dongy@nvidia.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: heyufan1995 <heyufan1995@gmail.com> Co-authored-by: Dong Yang <dongy@dongy-mlt.client.nvidia.com> Co-authored-by: Nic Ma <nma@nvidia.com> Co-authored-by: nvahmadi <85887144+nvahmadi@users.noreply.github.com> Co-authored-by: Vishwesh <vishwesh.nath@gmail.com> Co-authored-by: vnath <vnath@nvidia.com> Co-authored-by: myron <myron@users.noreply.github.com> Co-authored-by: Behrooz <3968947+drbeh@users.noreply.github.com> Co-authored-by: Yiheng Wang <68361391+yiheng-wang-nv@users.noreply.github.com> Co-authored-by: Wenqi Li <wenqil@nvidia.com>
1 parent 2349f52 commit 99e16a7

File tree

13 files changed

+1514
-3
lines changed

13 files changed

+1514
-3
lines changed
111 KB
Loading

automl/DiNTS/Figures/search_space.png

251 KB
Loading
139 KB
Loading
185 KB
Loading

automl/DiNTS/README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Examples of DiNTS: Differentiable neural network topology search
2+
3+
In this tutorial, we present a novel neural architecture search algorithm for 3D medical image segmentation. The datasets used in this tutorial are Task07 Pancreas (CT images) and Task09 Spleen (CT images) from [Medical Segmentation Decathlon](http://medicaldecathlon.com/). The implementation is based on:
4+
5+
Yufan He, Dong Yang, Holger Roth, Can Zhao, Daguang Xu: "[DiNTS: Differentiable Neural Network Topology Search for 3D Medical Image Segmentation.](https://openaccess.thecvf.com/content/CVPR2021/papers/He_DiNTS_Differentiable_Neural_Network_Topology_Search_for_3D_Medical_Image_CVPR_2021_paper.pdf)" In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5841-5850. 2021.
6+
7+
![0.8](./Figures/arch_ram-cost-0.8.png)
8+
![space](./Figures/search_space.png)
9+
10+
## Requirements
11+
The script is tested with:
12+
- `Ubuntu 20.04` and `CUDA 11`
13+
- The searching and training stage requires at least two 16GB GPUs.
14+
15+
## Dependencies and installation
16+
### Download and install Nvidia PyTorch Docker
17+
```bash
18+
docker pull nvcr.io/nvidia/pytorch:21.10-py3
19+
```
20+
### Download the repository
21+
```bash
22+
git clone https://github.com/Project-MONAI/tutorials.git
23+
```
24+
### Run into Docker
25+
```
26+
sudo docker run -it --gpus all --pid=host --shm-size 16G -v /location/to/tutorials/automl/DiNTS/:/workspace/DiNTS/ nvcr.io/nvidia/pytorch:21.10-py3
27+
```
28+
### Install MONAI and dependencies
29+
```bash
30+
bash install.sh
31+
```
32+
33+
## Data
34+
[Spleen CT dataset](https://drive.google.com/drive/folders/1HqEgzS8BV2c7xYNrZdEAnrHk7osJJ--2) and [Pancreas MRI dataset](https://drive.google.com/drive/folders/1HqEgzS8BV2c7xYNrZdEAnrHk7osJJ--2)
35+
from [Medical Segmentation Decathlon](http://medicaldecathlon.com/) is used. You can manually download it and save it to args.root. Otherwise, the script will automatic
36+
download the dataset.
37+
38+
## Examples
39+
The tutorial contains two stages: searching stage and training stage. An architecture is searched and saved into a `.pth` file using `search_dints.py`.
40+
The searched architecture will be loaded by `train_dints.py` and re-trained for spleen segmentation.
41+
42+
Check all possible options:
43+
```bash
44+
cd ./DiNTS/
45+
python search_dints.py -h
46+
python train_dints.py -h
47+
```
48+
49+
### Searching
50+
- Add the following script to the commands of running into docker (optional)
51+
```
52+
-v /your_downloaded_data_root/Task07_Pancreas/:/workspace/data_msd/Task07_Pancreas/
53+
```
54+
- Change ``NUM_GPUS_PER_NODE`` to your number of GPUs.
55+
- Run `bash search_dints.sh`
56+
57+
### Training
58+
- Add the following script to the commands of running into docker (Optional)
59+
```
60+
-v /your_downloaded_data_root/Task09_Spleen/:/workspace/data_msd/Task09_Spleen/
61+
```
62+
- Change ``ARCH_CKPT`` to point to the architecture file (.pth) from the searching stage.
63+
- Change ``NUM_GPUS_PER_NODE`` to your number of GPUs.
64+
- Run `bash train_dints.sh`
65+
66+
Training loss and validation metric curves are shown as follows. The experiments utilized 8 NVIDIA A100 GPUs.
67+
68+
![training_loss](./Figures/training_loss.png)
69+
70+
![validation_metric](./Figures/validation_metric.png)
71+
72+
## Questions and bugs
73+
74+
- For questions relating to the use of MONAI, please use our [Discussions tab](https://github.com/Project-MONAI/MONAI/discussions) on the main repository of MONAI.
75+
- For bugs relating to MONAI functionality, please create an issue on the [main repository](https://github.com/Project-MONAI/MONAI/issues).
76+
- For bugs relating to the running of a tutorial, please create an issue in [this repository](https://github.com/Project-MONAI/Tutorials/issues).

automl/DiNTS/arch_code.pth

2.91 KB
Binary file not shown.

automl/DiNTS/install.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
clear
3+
4+
pip install nibabel
5+
pip install pandas
6+
7+
# Update pip
8+
python -m pip install -U pip
9+
# Install scikit-image
10+
python -m pip install -U scikit-image
11+
12+
pip install git+https://github.com/Project-MONAI/MONAI#egg=monai

0 commit comments

Comments
 (0)