Awesome
<div align="center"> <h1> UNet Zoo for Medical Image Segmentation </h1> <h2> CNN vs ViT vs Mamba vs KAN </h2> </div>Introduction
The Exploration of CNN-, ViT-, Mamba-, and KAN-based UNet for Medical Image Segmentation.
Over 10 Segmentation Networks, 7 public benchmark datasets, 6 evaluation metrics are public available!
Contents
- Segmentation Network List
- Segmentation Dataset List
- Segmentation Metrics List
- Environment
- Usage
- Reference
Networks
Architecture | Name | Reference | Availability |
---|---|---|---|
CNN | U-net | Ronneberger et al. (2015) | ✅ |
CNN | Attention U-net | Oktay et al. (2018) | ✅ |
CNN | ResUnet | Diakogiannis et al. (2020) | ✅ |
CNN | DenseUnet | Li et al. (2020) | ✅ |
CNN | ConvUNeXT | Han et al. (2022) | ✅ |
CNN | CMUNeXt | Tang et al. (2023) | ⏳ |
CNN | AMSUnet | Yin et al. (2023) | ⏳ |
CNN | MBSNet | Jin et al. (2023) | ⏳ |
CNN | TriConvUNeXT | Ma et al. (2024) | ⏳ |
ViT | TransUNET | Chen et al. (2021) | ✅ |
ViT | Swin-UNET | Hu et al. (2021) | ✅ |
ViT | H2Former | He et al. (2023) | ⏳ |
ViT | UDTransNet | Wang et al. (2024) | ⏳ |
Mamba | Mamba-UNet | Wang et al. (2024) | ✅ |
Mamba | VM-UNet | Ruan et al. (2024) | ⏳ |
KAN | U-KAN | Li et al. (2024) | ⏳ |
KAN | KAN-UNet | Wang et al. (2024) | ✅ |
Datasets
Dataset | Reference | Google Drive | Baidu Netdisk | Status |
---|---|---|---|---|
GLAS | Official | Link | Link (Passcode: fp42 ) | ✅ |
BUSI | Official | Link | Link (Passcode: 5m5m ) | ✅ |
2018DSB | Official | Link | Link (Passcode: yavx ) | ✅ |
CVC-ClinicDB | Official | Link | Link (Passcode: 3tpy ) | ✅ |
Kvasir-SEG | Official | Link | Link (Passcode: 6fgs ) | ✅ |
ISIC2016 | Official | Link | Link (Passcode: m2fw ) | ✅ |
PH2 | Official | Link | Link (Passcode: aiax ) | ✅ |
Metrics
Metric | Description | Formula | Status |
---|---|---|---|
Dice | Measures overlap between predicted and ground truth masks | $\frac{2TP}{2TP + FP + FN}$ | ✅ |
IoU | Intersection over Union, also known as Jaccard Index | $\frac{TP}{TP + FP + FN}$ | ✅ |
Accuracy | Proportion of correctly classified elements | $\frac{TP + TN}{TP + FP + FN + TN}$ | ✅ |
Precision | Proportion of true positive predictions | $\frac{TP}{TP + FP}$ | ✅ |
Sensitivity | True positive rate (Recall) | $\frac{TP}{TP + FN}$ | ✅ |
Specificity | True negative rate | $\frac{TN}{TN + FP}$ | ✅ |
Environment
- Pytorch
- Some basic python packages: Torchio, Numpy, Scikit-image, SimpleITK, Scipy, Medpy, nibabel, tqdm ......
- For Mamba-related packages, please see [PyPI (mamba-ssm)], [Official GitHub (mamba)], [PyPI (causal-conv1d)] , [GitHub (causal-conv1d)].
- For KAN-related packages, please see [PyPI (pykan)], [Official GitHub (ConvKAN)], [PyPI (convkan)], [Official GitHub (ConvKAN)].
Usage
- Download the Code.
git clone https://github.com/ziyangwang007/UNet-Seg.git
cd UNet-Seg
-
Download the Dataset via Google Drive or Baidu Netdisk to
UNet-Seg/data
folder. -
Download Pretrained Model
Download through Google Drive for SwinUNet, and [Google Drive] for Mamba-UNet, and save in UNet-Seg/pretrained_ckpt
.
- Train the model.
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network UNet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network DenseUnet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network AttU_Net --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network ConvUNeXt --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network SwinUnet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network TransUNet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u train.py --network KANUSeg --datasets 2018DSB
- Test the model.
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network UNet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network DenseUnet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network AttU_Net --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network ConvUNeXt --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network SwinUnet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network TransUNet --datasets 2018DSB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets PH2 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets isic16 && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets BUSI && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets GLAS && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets CVC-ClinicDB && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets Kvasir-SEG && \
CUDA_VISIBLE_DEVICES=0 python -u test.py --network KANUSeg --datasets 2018DSB
- You can check the evaluation metrics directly after testing, and find prediction images in
UNet-Seg/output
.
Reference
If you find this repository useful for your research, please consider citing the following papers.
@article{wang2024mamba,
title={Mamba-unet: Unet-like pure visual mamba for medical image segmentation},
author={Wang, Ziyang and Zheng, Jian-Qing and Zhang, Yichi and Cui, Ge and Li, Lei},
journal={arXiv preprint arXiv:2402.05079},
year={2024}
}
@article{zhang2024survey,
title={A survey on visual mamba},
author={Zhang, Hanwei and Zhu, Ying and Wang, Dan and Zhang, Lijun and Chen, Tianxiang and Wang, Ziyang and Ye, Zi},
journal={Applied Sciences},
volume={14},
number={13},
pages={5683},
year={2024},
publisher={MDPI}
}