diff --git a/automl/DiNTS/README.md b/automl/DiNTS/README.md index 043388a3c9..3bd8a7d751 100644 --- a/automl/DiNTS/README.md +++ b/automl/DiNTS/README.md @@ -15,7 +15,7 @@ You can use nvidia docker or conda environments to install the dependencies. - ### Using Docker Image 1. #### Download and install Nvidia PyTorch Docker ```bash -docker pull nvcr.io/nvidia/pytorch:21.10-py3 +docker pull projectmonai/monai:0.8.0 ``` 2. #### Download the repository ```bash @@ -23,7 +23,7 @@ git clone https://github.com/Project-MONAI/tutorials.git ``` 3. #### Run into Docker ``` -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 +sudo docker run -it --gpus all --pid=host --shm-size 16G -v /location/to/tutorials/automl/DiNTS/:/workspace/DiNTS/ projectmonai/monai:0.8.0 ``` 4. #### Install required package in docker ```bash @@ -37,6 +37,7 @@ conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch ``` 2. #### Install MONAI and dependencies ```bash +pip install monai==0.8.0 bash install.sh ``` - ### Install [Graphviz](https://graphviz.org/download/) for visualization (needed in decode_plot.py) @@ -68,7 +69,7 @@ python train_dints.py -h - Change ``NUM_GPUS_PER_NODE`` to your number of GPUs. - Run `bash search_dints.sh` - Call the function in `decode_plot.py` to visualize the searched model in a vector image (graphvis needs to be installed). -The searched archtecture with ram cost 0.2 and 0.8 are shown below: +The searched architecture with ram cost 0.2 and 0.8 are shown below: ![0.2 search](./Figures/search_0.2.png) ![0.8 search](./Figures/search_0.8.png) @@ -77,7 +78,7 @@ The searched archtecture with ram cost 0.2 and 0.8 are shown below: ``` -v /your_downloaded_data_root/Task09_Spleen/:/workspace/data_msd/Task09_Spleen/ ``` -- Change ``ARCH_CKPT`` to point to the architecture file (.pth) from the searching stage. +- Change ``ARCH_CKPT`` to point to the architecture file (.pth) from the searching stage. 'arch_code_cvpr.pth' is the searched architecture in DiNTS CVPR2021 paper. - Change ``NUM_GPUS_PER_NODE`` to your number of GPUs. - Run `bash train_dints.sh` diff --git a/automl/DiNTS/arch_code_cvpr.pth b/automl/DiNTS/arch_code_cvpr.pth new file mode 100644 index 0000000000..b952c45dfd Binary files /dev/null and b/automl/DiNTS/arch_code_cvpr.pth differ diff --git a/automl/DiNTS/install.sh b/automl/DiNTS/install.sh index 6a3fac43ee..10c931a7e1 100644 --- a/automl/DiNTS/install.sh +++ b/automl/DiNTS/install.sh @@ -6,7 +6,6 @@ pip install pandas # Update pip python -m pip install -U pip + # Install scikit-image python -m pip install -U scikit-image - -pip install git+https://github.com/Project-MONAI/MONAI#egg=monai diff --git a/automl/DiNTS/search_dints.sh b/automl/DiNTS/search_dints.sh index e4277869ce..c25ba3d5c2 100644 --- a/automl/DiNTS/search_dints.sh +++ b/automl/DiNTS/search_dints.sh @@ -3,8 +3,7 @@ clear TASK="Task07_Pancreas" -DATA_ROOT="/home/dongy/Data/MSD/${TASK}" -# DATA_ROOT="/workspace/data_msd/${TASK}" +DATA_ROOT="/workspace/data_msd/${TASK}" JSON_PATH="${DATA_ROOT}/dataset.json" FOLD=4 diff --git a/automl/DiNTS/train_dints.py b/automl/DiNTS/train_dints.py index 66947b8bd8..ead1d9ec1c 100644 --- a/automl/DiNTS/train_dints.py +++ b/automl/DiNTS/train_dints.py @@ -311,12 +311,13 @@ def main(): ] ) - # train_ds = monai.data.Dataset(data=train_files, transform=train_transforms) - # val_ds = monai.data.Dataset(data=val_files, transform=val_transforms) - train_ds = monai.data.CacheDataset(data=train_files, transform=train_transforms, cache_rate=1.0, num_workers=8) val_ds = monai.data.CacheDataset(data=val_files, transform=val_transforms, cache_rate=1.0, num_workers=2) + # monai.data.Dataset can be used as alternatives when debugging or RAM space is limited. + # train_ds = monai.data.Dataset(data=train_files, transform=train_transforms) + # val_ds = monai.data.Dataset(data=val_files, transform=val_transforms) + train_loader = ThreadDataLoader(train_ds, num_workers=0, batch_size=num_images_per_batch, shuffle=True) val_loader = ThreadDataLoader(val_ds, num_workers=0, batch_size=1, shuffle=False) diff --git a/automl/DiNTS/train_dints.sh b/automl/DiNTS/train_dints.sh index 3a3e4caa91..3094deee8d 100644 --- a/automl/DiNTS/train_dints.sh +++ b/automl/DiNTS/train_dints.sh @@ -4,7 +4,6 @@ clear TASK="Task09_Spleen" ARCH_CKPT="arch_code.pth" -# DATA_ROOT="/home/dongy/Data/MSD/${TASK}" DATA_ROOT="/workspace/data_msd/${TASK}" JSON_PATH="${DATA_ROOT}/dataset.json"