• Stars
    star
    709
  • Rank 63,423 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PyTorch implementation of UNet++ (Nested U-Net).

PyTorch implementation of UNet++ (Nested U-Net)

MIT License

This repository contains code for a image segmentation model based on UNet++: A Nested U-Net Architecture for Medical Image Segmentation implemented in PyTorch.

[NEW] Add support for multi-class segmentation dataset.

[NEW] Add support for PyTorch 1.x.

Requirements

  • PyTorch 1.x or 0.41

Installation

  1. Create an anaconda environment.
conda create -n=<env_name> python=3.6 anaconda
conda activate <env_name>
  1. Install PyTorch.
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
  1. Install pip packages.
pip install -r requirements.txt

Training on 2018 Data Science Bowl dataset

  1. Download dataset from here to inputs/ and unzip. The file structure is the following:
inputs
└── data-science-bowl-2018
    ├── stage1_train
    |   ├── 00ae65...
    │   │   ├── images
    │   │   │   └── 00ae65...
    │   │   └── masks
    │   │       └── 00ae65...            
    │   ├── ...
    |
    ...
  1. Preprocess.
python preprocess_dsb2018.py
  1. Train the model.
python train.py --dataset dsb2018_96 --arch NestedUNet
  1. Evaluate.
python val.py --name dsb2018_96_NestedUNet_woDS

(Optional) Using LovaszHingeLoss

  1. Clone LovaszSoftmax from bermanmaxim/LovaszSoftmax.
git clone https://github.com/bermanmaxim/LovaszSoftmax.git
  1. Train the model with LovaszHingeLoss.
python train.py --dataset dsb2018_96 --arch NestedUNet --loss LovaszHingeLoss

Training on original dataset

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
            ├── ...
  1. Train the model.
python train.py --dataset <dataset name> --arch NestedUNet --img_ext .jpg --mask_ext .png
  1. Evaluate.
python val.py --name <dataset name>_NestedUNet_woDS

Results

DSB2018 (96x96)

Here is the results on DSB2018 dataset (96x96) with LovaszHingeLoss.

Model IoU Loss
U-Net 0.839 0.365
Nested U-Net 0.842 0.354
Nested U-Net w/ Deepsupervision 0.843 0.362

More Repositories

1

pytorch-deform-conv-v2

PyTorch implementation of Deformable ConvNets v2 (Modulated Deformable Convolution)
Python
654
star
2

keras-arcface

Keras implementation of ArcFace, CosFace, and SphereFace
Python
271
star
3

pytorch-adacos

PyTorch implementation of AdaCos
Python
204
star
4

pytorch-auto-augment

PyTorch implementation of AutoAugment.
Python
148
star
5

pytorch-res2net

PyTorch implementation of Res2Net
Python
105
star
6

kaggle-aptos2019-blindness-detection

11th place solution for APTOS 2019 Blindness Detection on Kaggle (https://www.kaggle.com/c/aptos2019-blindness-detection).
Python
42
star
7

keras-cosine-annealing

Keras implementation of Cosine Annealing Scheduler
Python
41
star
8

pytorch-ricap

PyTorch implementation of RICAP (Random Image Cropping And Patching)
Python
37
star
9

keras-auto-augment

Keras implementation of AutoAugment.
Python
34
star
10

kaggle-pku-autonomous-driving

Part of 5th place solution for Peking University/Baidu - Autonomous Driving on Kaggle (https://www.kaggle.com/c/pku-autonomous-driving).
Python
21
star
11

pytorch-lars

PyTorch implementation of LARS (Layer-wise Adaptive Rate Scaling)
Python
16
star
12

tf-dark-pose

This is an unofficial TensorFlow implementation of DARK Pose (Distribution Aware Coordinate Representation for Human Pose Estimation).
Python
2
star
13

pytorch-scale-aware-triplet

PyTorch implementation of Scale-Aware Triplet Networks
Python
2
star
14

kaggle-carvana-image-masking-challenge

48th solution for Carvana image masking challenge on Kaggle (https://www.kaggle.com/c/carvana-image-masking-challenge).
Python
1
star
15

chainer-m2det

Chainer implementation of M2Det.
Python
1
star