Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
root 4466f69843 | 1 year ago | |
---|---|---|
img | 1 year ago | |
lib | 1 year ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
cmd.txt | 1 year ago | |
environment.yml | 1 year ago | |
extractors.py | 1 year ago | |
metrics.py | 1 year ago | |
performancemetrics_ax.m | 1 year ago | |
performancemetrics_glas.m | 1 year ago | |
performancemetrics_monuseg.m | 1 year ago | |
requirements.txt | 1 year ago | |
test.py | 1 year ago | |
train.py | 1 year ago | |
utils.py | 1 year ago | |
utils_gray.py | 1 year ago |
Pytorch code for the paper
"Medical Transformer: Gated Axial-Attention for
Medical Image Segmentation", MICCAI 2021
🚀 : Checkout our latest work UNeXt, a faster and more efficient segmentation architecture which is also easy to train and implement! Code is available here.
This repo hosts the code for the following networks:
Majority of existing Transformer-based network architectures proposed for vision applications require large-scale
datasets to train properly. However, compared to the datasets for vision
applications, for medical imaging the number of data samples is relatively
low, making it difficult to efficiently train transformers for medical appli-
cations. To this end, we propose a Gated Axial-Attention model which
extends the existing architectures by introducing an additional control
mechanism in the self-attention module. Furthermore, to train the model
effectively on medical images, we propose a Local-Global training strat-
egy (LoGo) which further improves the performance. Specifically, we op-
erate on the whole image and patches to learn global and local features,
respectively. The proposed Medical Transformer (MedT) uses LoGo training strategy on Gated Axial Attention U-Net.
git clone https://github.com/jeya-maria-jose/Medical-Transformer
cd Medical-Transformer
The code is stable using Python 3.6.10, Pytorch 1.4.0
To install all the dependencies using conda:
conda env create -f environment.yml
conda activate medt
To install all the dependencies using pip:
pip install -r requirements.txt
Prepare the dataset in the following format for easy use of the code. The train and test folders should contain two subfolders each: img and label. Make sure the images their corresponding segmentation masks are placed under these folders and have the same name for easy correspondance. Please change the data loaders to your need if you prefer not preparing the dataset in this format.
Train Folder-----
img----
0001.png
0002.png
.......
labelcol---
0001.png
0002.png
.......
Validation Folder-----
img----
0001.png
0002.png
.......
labelcol---
0001.png
0002.png
.......
Test Folder-----
img----
0001.png
0002.png
.......
labelcol---
0001.png
0002.png
.......
python train.py --train_dataset "enter train directory" --val_dataset "enter validation directory" --direc 'path for results to be saved' --batch_size 4 --epoch 400 --save_freq 10 --modelname "gatedaxialunet" --learning_rate 0.001 --imgsize 128 --gray "no"
Change modelname to MedT or logo to train them
python test.py --loaddirec "./saved_model_path/model_name.pth" --val_dataset "test dataset directory" --direc 'path for results to be saved' --batch_size 1 --modelname "gatedaxialunet" --imgsize 128 --gray "no"
The results including predicted segmentations maps will be placed in the results folder along with the model weights. Run the performance metrics code in MATLAB for calculating F1 Score and mIoU.
1)Note that these experiments were conducted in Nvidia Quadro 8000 with 48 GB memory.
2)Google Colab Code is an unofficial implementation for quick train/test. Please follow original code for proper training.
The dataloader code is inspired from pytorch-UNet . The axial attention code is developed from axial-deeplab.
@InProceedings{jose2021medical,
author="Valanarasu, Jeya Maria Jose
and Oza, Poojan
and Hacihaliloglu, Ilker
and Patel, Vishal M.",
title="Medical Transformer: Gated Axial-Attention for Medical Image Segmentation",
booktitle="Medical Image Computing and Computer Assisted Intervention -- MICCAI 2021",
year="2021",
publisher="Springer International Publishing",
address="Cham",
pages="36--46",
isbn="978-3-030-87193-2"
}
Open an issue or mail me directly in case of any queries or suggestions.
No Description
Python MATLAB Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》