Code Monkey home page Code Monkey logo

swin-umamba's Introduction

Swin-UMamba: Mamba-based UNet with ImageNet-based pretraining

Official repository for: Swin-UMamba: Mamba-based UNet with ImageNet-based pretraining

network

Main Results

  • AbdomenMRI

  • Endoscopy

  • Microscopy

Installation

Step-1: Create a new conda environment & install requirements

conda create -n swin_umamba python=3.10
conda activate swin_umamba

pip install torch==2.0.1 torchvision==0.15.2
pip install causal-conv1d==1.1.1
pip install mamba-ssm
pip install torchinfo timm numba

Step-2: Install Swin-UMamba

git clone https://github.com/JiarunLiu/Swin-UMamba
cd Swin-UMamba/swin_umamba
pip install -e .

Prepare data & pretrained model

Dataset:

We use the same data & processing strategy following U-Mamba. Download dataset from U-Mamba and put them into the data folder. Then preprocess the dataset with following command:

nnUNetv2_plan_and_preprocess -d DATASET_ID --verify_dataset_integrity

ImageNet pretrained model:

We use the ImageNet pretrained VMamba-Tiny model from VMamba. You need to download the model checkpoint and put it into data/pretrained/vmamba/vmamba_tiny_e292.pth

wget https://github.com/MzeroMiko/VMamba/releases/download/%2320240218/vssmtiny_dp01_ckpt_epoch_292.pth
mv vssmtiny_dp01_ckpt_epoch_292.pth data/pretrained/vmamba/vmamba_tiny_e292.pth

Training

Using the following command to train & evaluate Swin-UMamba

# AbdomenMR dataset
bash scripts/train_AbdomenMR.sh MODEL_NAME
# Endoscopy dataset
bash scripts/train_Endoscopy.sh MODEL_NAME
# Microscopy dataset 
bash scripts/train_Microscopy.sh MODEL_NAME

Here MODEL_NAME can be:

  • nnUNetTrainerSwinUMamba: Swin-UMamba model with ImageNet pretraining
  • nnUNetTrainerSwinUMambaD: Swin-UMamba$\dagger$ model with ImageNet pretraining
  • nnUNetTrainerSwinUMambaScratch: Swin-UMamba model without ImageNet pretraining
  • nnUNetTrainerSwinUMambaDScratch: Swin-UMamba$\dagger$ model without ImageNet pretraining

You can download our model checkpoints here.

Acknowledgements

We thank the authors of nnU-Net, Mamba, UMamba, VMamba, and Swin-Unet for making their valuable code & data publicly available.

Citation

@article{Swin-UMamba,
    title={Swin-UMamba: Mamba-based UNet with ImageNet-based pretraining},
    author={Jiarun Liu and Hao Yang and Hong-Yu Zhou and Yan Xi and Lequan Yu and Yizhou Yu and Yong Liang and Guangming Shi and Shaoting Zhang and Hairong Zheng and Shanshan Wang},
    journal={arXiv preprint arXiv:2402.03302},
    year={2024}
}

swin-umamba's People

Contributors

jiarunliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

swin-umamba's Issues

where is the loss function?

Hello, I checked your training code, but I didn’t find where to set the loss function. Could you please explain where it is?

issues with installing causal-convd1 and mamba-ssm

Thank you for your hard work. I'm really interested in your model.
I hope this issue finds you well.
I'm currently struggling with installing causal-convd1 and mamba-SSM; the attached photos are respectively.
My nvidia-smi and nvcc-V are matching with cuda 11.7 but still have problem installing them.
스크린샷 2024-05-17 091131
스크린샷 2024-05-17 090821

Are these two mandatory to run Swin-UMamba model? If so, please let me know if you have any solution for this issue.
Thank you.

The GPU and Training time

Your innovation with Mamba is amazing. I would like to ask you about your equipment and the time of a training session.

How do you calculate FLOPs?

Please tell me where is the code used to calculate FLOPs? Or can you tell me what is the shape of the input used to calculate FLOPs?

Key error

Excellent work, very interesting.

While running the Swin-UMambaD from pre-trained weights, I faced the issue of key error in:

if "patch_embed" in k and ckpt["config"].MODEL.SWIN.IN_CHANS != num_input_channels:
.
Possibly the checkpoint doesn't have the "config" key?
It would be great to have your valuable feedback in this regard.

Best,
Atik

Why is 'Swin' included in the name of your model?

Thank you very much for your work!

I am a bit confused and don't understand why you wrote 'Swin' in the name of your model. I haven't found any aspects where it is connected to the original Swin model, or perhaps it is some sort of abbreviation?

模型结构问题

你好,为什么感觉nets目录下的SwinUMamba模型和文章中图1的定义不一样呢,decoder中好像没用到VSS?

Zero-shot Inference

Excuse me, is your model a large-scale model? Can the program be used for zero-shot inference?

AbdomenCT dataset

Hi!May I know why you didn't include the AbdomenCT dataset in you experiments?

模型架构

你好,请问这篇论文中所提出的模型架构
QQ截图20240524094301
与Vmunet中所提出的模型架构不同点是什么?
d

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.