|
| 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 | + |
| 8 | + |
| 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 | + |
| 69 | + |
| 70 | + |
| 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). |
0 commit comments