GithubHelp home page GithubHelp logo

xmindflow / deformablelka Goto Github PK

View Code? Open in Web Editor NEW
160.0 2.0 12.0 8.12 MB

[WACV 2024] Beyond Self-Attention: Deformable Large Kernel Attention for Medical Image Segmentation

Home Page: https://arxiv.org/abs/2309.00121

Python 81.69% Shell 0.02% Jupyter Notebook 17.03% Batchfile 0.01% C++ 0.20% Cuda 1.06%
2d-segmentation 3d-segmentation deep-learning pancreas segmentation skin-lesion-segmentation synapse transformers

deformablelka's Introduction

Beyond Self-Attention: Deformable Large Kernel Attention for Medical Image Segmentation
WACV 2024

arXiv

We have introduced a novel approach called Deformable Large Kernel Attention (D-LKA Attention) to enhance medical image segmentation. This method efficiently captures volumetric context using large convolution kernels, avoiding excessive computational demands. D-LKA Attention also benefits from deformable convolutions to adapt to diverse data patterns. We've created both 2D and 3D versions, with the 3D version excelling in cross-depth data understanding. This forms the basis of our new hierarchical Vision Transformer architecture, the D-LKA Net, which outperforms existing methods on popular medical segmentation datasets (Synapse, NIH Pancreas, and Skin lesion).

Reza Azad, Leon Niggemeier, Michael Hüttemann, Amirhossein Kazerouni, Ehsan Khodapanah Aghdam, Yury Velichko, Ulas Bagci and Dorit Merhof


💥 News 💥

  • 24.10.2023 | Accepted in WACV 2024! 🥳

  • 16.10.2023 | Release of 2D, 3D Synapse weights and 3D Pancreas weights.

Results

2D Synapse Dataset

State-of-the-art comparison on the abdominal multi-organ Synapse dataset for 2D methods. The model complexity and performance (DSC, HD95) are shown for all models. The proposed 2D D-LKA Net achieves superior segmentation performance. Abbreviations stand for: Spl: spleen, RKid: right kidney, LKid: left kidney, Gal: gallbladder, Liv: liver, Sto: stomach, Aor: aorta, Pan: pancreas. Best results are shown in blue, second best in red. Synapse Results 2D

3D Synapse Dataset

State-of-the-art comparison on the abdominal multi-organ Synapse dataset for 3D methods. The model complexity and performance (DSC, HD95) are shown for all models. The proposed 3D D-LKA Net achieves superior segmentation performance. Our model also is considerably small with the lowest number of parameters. Abbreviations stand for: Spl: spleen, RKid: right kidney, LKid: left kidney, Gal: gallbladder, Liv: liver, Sto: stomach, Aor: aorta, Pan: pancreas. Best results are shown in blue, second best in red. Synapse Results 3D

Qualitative Results

While the 2D version achieves great segmentation results in comparison to other 2D models, the main limitation is the lack of inter-slice connections. Here, the 3D models achieve favorable segmentations.

2D Instructions

For detailed instructions for the 2D methods, please refer to the Readme in the 2D folder.

3D Instructions

For detailed instructions for the 3D methods, please refer to the Readme in the 3D folder.

Acknowledgement

This repository is built based on nnFormer, UNETR++, transnorm, MCF, D3D. We thank the authors for their code repositories.

Query

All implementations were done by Leon Niggemeier. For any query please contact us for more information.

leon.niggemeier@rwth-aachen.de

Citation

@article{azad2023beyond,
  title={Beyond Self-Attention: Deformable Large Kernel Attention for Medical Image Segmentation},
  author={Azad, Reza and Niggemeier, Leon and Huttemann, Michael and Kazerouni, Amirhossein and Aghdam, Ehsan Khodapanah and Velichko, Yury and Bagci, Ulas and Merhof, Dorit},
  journal={arXiv preprint arXiv:2309.00121},
  year={2023}
}

deformablelka's People

Contributors

amirhossein-kz avatar dependabot[bot] avatar leonngm avatar rezazad68 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

deformablelka's Issues

I encounter when i reproduce to test 3d synpase

I find the code finally output 13 classes' results, but in inference_synpase.py, you wanna 8 classes like other papers. i wonder is the final result save in "summary.json"? and when i reproduce the code, i find inference_synpase.py didnt work , as well as write in the text. Then my final result is different from your paper, the result is in the image
图片1

Problem encountered during reproduction

Hello author, I noticed a strange phenomenon while reproducing the results of DAEFormer on the ISIC2018 dataset. After starting training on the preprocessed dataset, I noticed a gradient explosion in the loss value section. May I ask if this is caused by some issues with the code of the processed dataset
5eaf3fa7038d7c9b93bd80146179c78
a6dbd2a6b0df1868f1c716150a08810

processing 12% and then error

When training synapse data in 2D, processing 12% and then error:

Traceback (most recent call last):
File "train_MaxViT_deform_LKA.py", line 134, in
trainer[dataset_name](args, net, args.output_dir)
File "/home/sjh/mydisk/project/deformableLKA/2D/trainer_MaxViT_deform_LKA.py", line 168, in trainer_synapse
image = image_batch[1, 0:1, :, :]
IndexError: index 1 is out of bounds for dimension 0 with size 1

Who can handle this problem?

can not find ./config_skin.yml

Hello! Thank you for resolving my issue earlier. I now realize that I ran it first but couldn't find the file. Where does it exist? Thank you very much!

can not find the file

Dear author:
When I run train_MaxViT_deform_LKA.py
the result:FileNotFoundError: [Errno 2] No such file or directory: './pretrained_pth/maxvit/maxvit_rmlp_small_rw_224_sw-6ef0ae4f.pth'

can not find best_model.pth and best_model.pth.txt

Dear author:
Due to the poor performance of my computer, it is difficult to finish running the train_MaxViT_deform_LKA.py file.
When I run the test.py file it shows that I don't have best_model.pth and best_model.pth.txt
Do I need to run train_MaxViT_deform_LKA.py completely to obtain these two files? Or can these two files be downloaded directly?

Deformable LKA module

Hello, I would like to know where the complete code flow of the Deformable LKA module in Figure 2 in your paper is, but I didn't find it

About 3D deformable convolution

what is the role of 2D/deformable_LKA/deformable_2dconvolution.py and 2D/deformable_LKA/deformable_3dconvolution.py ?
Are they python implementation of dcn? If that's the case, why you need to use D3D?

Futhermore, as far as I konwn, D3D process THW data, they don't deform at T. I can't see the any modifications to D3D's dcn library.

So how do you deform at three spatial dimension? I mean, D, H, W. Thank you very much.

maxvit_rmlp_small_rw_224_sw-6ef0ae4f.pth

Hello, while I was training the model, the system reminded me that it couldn't find the file “maxvit_rmlp_small_rw_224_sw-6ef0ae4f.pth”. How can I solve it? thanks ( :

i cant visit 3d synpase dataset

because i dont have an identification of the from identity provider 'live.com' does not exist in tenant 'Mohamed Bin Zayed University of Artificial Intelligence' and cannot access the application '00000003-0000-0ff1-ce00-000000000000'(Office 365 SharePoint Online) in that tenant. The account needs to be added as an external user in the tenant first. Sign out and sign in again with a different Azure Active Directory user account. can you change the source? thank u!

RuntimeError: The size of tensor a (71680) must match the size of tensor b (32768) at non-singleton dimension 1

Dear author, When I want to use synapse code to train kipa22 dataset, I meet this problem. But I don't know what's wrong with this. I do not know whether there is a problem with the size format of my data, or the parameters in the code need to be modified? Thanks for your help, may be this is a easy problem, but I don't know how to dealt with it.
I processed the date just use the nnUnet's code, then I copy the processed data to this project's folder.

Traceback (most recent call last):
File "d_lka_former/run/run_training.py", line 211, in
main()
File "d_lka_former/run/run_training.py", line 195, in main
trainer.run_training()
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/training/network_training/d_lka_former_trainer_synapse.py", line 490, in run_training
ret = super().run_training()
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/training/network_training/Trainer_synapse.py", line 321, in run_training
super(Trainer_synapse, self).run_training()
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/training/network_training/network_trainer_synapse.py", line 485, in run_training
l = self.run_iteration(self.tr_gen, True)
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/training/network_training/d_lka_former_trainer_synapse.py", line 295, in run_iteration
output = self.network(data)
File "/home/javier/conda3/envs/d_lka_net_3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/network_architecture/synapse/d_lka_former_synapse.py", line 153, in forward
x_output, hidden_states = self.d_lka_former_encoder(x_in)
File "/home/javier/conda3/envs/d_lka_net_3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/network_architecture/synapse/model_components.py", line 69, in forward
x, hidden_states = self.forward_features(x)
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/network_architecture/synapse/model_components.py", line 56, in forward_features
x = self.stages0
File "/home/javier/conda3/envs/d_lka_net_3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/javier/conda3/envs/d_lka_net_3d/lib/python3.8/site-packages/torch/nn/modules/container.py", line 139, in forward
input = module(input)
File "/home/javier/conda3/envs/d_lka_net_3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/home/javier/Desktop/deformableLKA-main/3D/d_lka_former/network_architecture/synapse/transformerblock.py", line 60, in forward
x = x + self.pos_embed
RuntimeError: The size of tensor a (71680) must match the size of tensor b (32768) at non-singleton dimension 1

Pancreas code loading state_dict for D_LKA_Net error

I followed all the steps you have including downloading the same Python and PyTorch versions for running the pancreas code.

The train_pancreas.py ran well and the weights were saved as intended. However, I am getting an error when running the test_pancreas.py and I cannot seem to fix it.

image (1)
image (2)

Regarding the reproduction of ISIC2017 and ISIC2018

Hello author, while reproducing ISIC2018 and ISIC2018, I found a significant difference between the final results and those in your paper. May I ask if you have done any processing on the dataset, or could you upload the dataset you have processed.

Cannot find the pre-trained weight file

Hello, your work is excellent, and I'm eager to delve deeper into learning. However, I encountered an issue while running the training code, which indicates that the pre-training weight file is missing.

As shown below:
FileNotFoundError: [Errno 2] No such file or directory: './pretrained_pth/maxvit/maxvit_rmlp_small_rw_224_sw-6ef0ae4f.pth'

I couldn't find this particular pre-training weight file on the code homepage. Would you mind providing it? If possible, here's my email: [email protected].

Differences

what is the differences among DeformConv, DeformConvPack, DeformConvPack_experimental,
DeformConv_d, and DeformConvPack_d?

ERROR: Failed building wheel for D3D

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for D3D
ERROR: Could not build wheels for D3D, which is required to install pyproject.toml-based projects

OSError: [Errno 22] Invalid argument

Dear author:When I run the train_MaxViT_deform_LKA.py file, it shows OSError: [Errno 22] Invalid argument: '.\model_out\MaxViT_improved_deform_LKA_two_layer\MaxViT_improved_deform_LKA_2024-03-16 12:43:30.810350dice.png'. How can I solve it?

微信截图_20240316170856

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.