This repository contains code for a image segmentation model based on UNet++: A Nested U-Net Architecture for Medical Image Segmentation implemented in PyTorch.
- PyTorch 1.x or 0.41
- Create an anaconda environment.
conda create -n=<env_name> python=3.6 anaconda
conda activate <env_name>
- Install PyTorch.
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
- Install pip packages.
pip install -r requirements.txt
Make sure to put the files as the following structure (e.g. the number of classes is 2):
inputs
└── <dataset name>
├── images
| ├── 0a7e06.jpg
│ ├── 0aab0a.jpg
│ ├── 0b1761.jpg
│ ├── ...
|
└── masks
├── 0
| ├── 0a7e06.png
| ├── 0aab0a.png
| ├── 0b1761.png
| ├── ...
|
└── 1
├── 0a7e06.png
├── 0aab0a.png
├── 0b1761.png
├── ...
- Train the model.
python train.py --dataset <dataset name> --arch NestedUNet --img_ext .jpg --mask_ext .png
- Evaluate.
python val.py --name <dataset name>_NestedUNet_woDS