• Stars
    star
    462
  • Rank 94,832 (Top 2 %)
  • Language
    Python
  • License
    MIT License
  • Created over 2 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

Official Pytorch Code base for "UNeXt: MLP-based Rapid Medical Image Segmentation Network", MICCAI 2022

UNeXt

Official Pytorch Code base for UNeXt: MLP-based Rapid Medical Image Segmentation Network, MICCAI 2022

Paper | Project

Introduction

UNet and its latest extensions like TransUNet have been the leading medical image segmentation methods in recent years. However, these networks cannot be effectively adopted for rapid image segmentation in point-of-care applications as they are parameter-heavy, computationally complex and slow to use. To this end, we propose UNeXt which is a Convolutional multilayer perceptron (MLP) based network for image segmentation. We design UNeXt in an effective way with an early convolutional stage and a MLP stage in the latent stage. We propose a tokenized MLP block where we efficiently tokenize and project the convolutional features and use MLPs to model the representation. To further boost the performance, we propose shifting the channels of the inputs while feeding in to MLPs so as to focus on learning local dependencies. Using tokenized MLPs in latent space reduces the number of parameters and computational complexity while being able to result in a better representation to help segmentation. The network also consists of skip connections between various levels of encoder and decoder. We test UNeXt on multiple medical image segmentation datasets and show that we reduce the number of parameters by 72x, decrease the computational complexity by 68x, and improve the inference speed by 10x while also obtaining better segmentation performance over the state-of-the-art medical image segmentation architectures.

Using the code:

The code is stable while using Python 3.6.13, CUDA >=10.1

  • Clone this repository:
git clone https://github.com/jeya-maria-jose/UNeXt-pytorch
cd UNeXt-pytorch

To install all the dependencies using conda:

conda env create -f environment.yml
conda activate unext

If you prefer pip, install following versions:

timm==0.3.2
mmcv-full==1.2.7
torch==1.7.1
torchvision==0.8.2
opencv-python==4.5.1.48

Datasets

  1. ISIC 2018 - Link
  2. BUSI - Link

Data Format

Make sure to put the files as the following structure (e.g. the number of classes is 2):

inputs
โ””โ”€โ”€ <dataset name>
    โ”œโ”€โ”€ images
    |   โ”œโ”€โ”€ 001.png
    โ”‚   โ”œโ”€โ”€ 002.png
    โ”‚   โ”œโ”€โ”€ 003.png
    โ”‚   โ”œโ”€โ”€ ...
    |
    โ””โ”€โ”€ masks
        โ”œโ”€โ”€ 0
        |   โ”œโ”€โ”€ 001.png
        |   โ”œโ”€โ”€ 002.png
        |   โ”œโ”€โ”€ 003.png
        |   โ”œโ”€โ”€ ...
        |
        โ””โ”€โ”€ 1
            โ”œโ”€โ”€ 001.png
            โ”œโ”€โ”€ 002.png
            โ”œโ”€โ”€ 003.png
            โ”œโ”€โ”€ ...

For binary segmentation problems, just use folder 0.

Training and Validation

  1. Train the model.
python train.py --dataset <dataset name> --arch UNext --name <exp name> --img_ext .png --mask_ext .png --lr 0.0001 --epochs 500 --input_w 512 --input_h 512 --b 8
  1. Evaluate.
python val.py --name <exp name>

Acknowledgements:

This code-base uses certain code-blocks and helper functions from UNet++, Segformer, and AS-MLP. Naming credits to Poojan.

Citation:

@article{valanarasu2022unext,
  title={UNeXt: MLP-based Rapid Medical Image Segmentation Network},
  author={Valanarasu, Jeya Maria Jose and Patel, Vishal M},
  journal={arXiv preprint arXiv:2203.04967},
  year={2022}
}

More Repositories

1

Medical-Transformer

Official Pytorch Code for "Medical Transformer: Gated Axial-Attention for Medical Image Segmentation" - MICCAI 2021
Python
797
star
2

KiU-Net-pytorch

Official Pytorch Code of KiU-Net for Image/3D Segmentation - MICCAI 2020 (Oral), IEEE TMI
Python
356
star
3

TransWeather

Pytorch Code for the paper TransWeather - CVPR 2022
Python
160
star
4

Cuff_less_BP_Prediction

Prediction of Blood Pressure from ECG and PPG signals using regression methods.
Python
146
star
5

Interactive-Portrait-Harmonization

Code Base for the work "Interactive Portrait Harmonization"
28
star
6

On-The-Fly-Adaptation

Code base for "On-the-Fly Test-time Adaptation for Medical Image Segmentation"
Python
26
star
7

Derain_OUCD_Net

Official Pytorch Code for "Exploring Overcomplete Representations for Single Image Deraining using CNNs" - IEEE Journal of STSP
Python
14
star
8

Overcomplete-Deep-Subspace-Clustering

Official Tensorflow Code for the paper "Overcomplete Deep Subspace Clustering Networks" - WACV 2021
Python
13
star
9

Image-Recovery-Using-Conditional-Adversarial-Networks

Analyzing Conditional Adversarial Networks to solve image recovery problems like shadow recovery, denoising and deblurring - CVIP 2019
Python
10
star
10

Unet_DWT

Unet based on Wavelet coefficients for segmentation
Python
8
star
11

essential_codes

Just a collection of essential set of codes that can be plugged in at needed places
Python
3
star
12

rebotnet-web

Website for Rebotnet
JavaScript
3
star
13

sparseSGD

Tweaking SGD by imposing sparsity to improve opimization for deep learning tasks.
Python
3
star
14

transweather-web

Website for TransWeather paper: https://jeya-maria-jose.github.io/transweather-web/
HTML
2
star
15

Vision-Based-Texting

Approach towards texting using eye gestures taken from a camera.
Python
1
star
16

Wind_LandArea_Aerial_Seg

Supporting Code for the paper "A novel application of deep learning to determine the actual land transformed by wind power"
Python
1
star
17

IPH-web

Website for "Interactive Portrait Harmonization"
JavaScript
1
star
18

quad-pid-control-

Python
1
star
19

Performance_Metrics

Python
1
star
20

rebot-net

Network architecture for ReBotNet, WACV 2025
Python
1
star