Contextual Attention Network: Transformer Meets U-Net
Contexual attention network for medical image segmentation with state of the art results on skin lesion segmentation, multiple myeloma cell segmentation. This method incorpotrates the transformer module into a U-Net structure so as to concomitantly capture long-range dependency along with resplendent local informations. If this code helps with your research please consider citing the following paper:
R. Azad, Moein Heidari, Yuli Wu and Dorit Merhof , "Contextual Attention Network: Transformer Meets U-Net", download link.
@article{reza2022contextual,
title={Contextual Attention Network: Transformer Meets U-Net},
author={Reza, Azad and Moein, Heidari and Yuli, Wu and Dorit, Merhof},
journal={arXiv preprint arXiv:2203.01932},
year={2022}
}
This code has been implemented in python language using Pytorch library and tested in ubuntu OS, though should be compatible with related environment. following Environement and Library needed to run the code:
For training deep model and evaluating on each data set follow the bellow steps:
1- Download the ISIC 2018 train dataset from this link and extract both training dataset and ground truth folders inside the dataset_isic18
.
2- Run Prepare_ISIC2018.py
for data preperation and dividing data to train,validation and test sets.
3- Run train_skin.py
for training the model using trainng and validation sets. The model will be train for 100 epochs and it will save the best weights for the valiation set.
4- For performance calculation and producing segmentation result, run evaluate_skin.py
. It will represent performance measures and will saves related results in results
folder.
Notice: For training and evaluating on ISIC 2017 and ph2 follow the bellow steps :
ISIC 2017- Download the ISIC 2017 train dataset from this link and extract both training dataset and ground truth folders inside the dataset_isic18\7
. then Run Prepare_ISIC2017.py
for data preperation and dividing data to train,validation and test sets.
ph2- Download the ph2 dataset from this link and extract it then Run Prepare_ph2.py
for data preperation and dividing data to train,validation and test sets.
Follow step 3 and 4 for model traing and performance estimation. For ph2 dataset you need to first train the model with ISIC 2017 data set and then fine-tune the trained model using ph2 dataset.
For evaluating the performance of the proposed method, Two challenging task in medical image segmentaion has been considered. In bellow, results of the proposed approach illustrated.
In order to compare the proposed method with state of the art appraoches on SKin Lesion Segmentation, we considered Drive dataset.
Methods (On ISIC 2017) | Dice-Score | Sensivity | Specificaty | Accuracy |
---|---|---|---|---|
Ronneberger and et. all U-net | 0.8159 | 0.8172 | 0.9680 | 0.9164 |
Oktay et. all Attention U-net | 0.8082 | 0.7998 | 0.9776 | 0.9145 |
Lei et. all DAGAN | 0.8425 | 0.8363 | 0.9716 | 0.9304 |
Chen et. all TransU-net | 0.8123 | 0.8263 | 0.9577 | 0.9207 |
Asadi et. all MCGU-Net | 0.8927 | 0.8502 | 0.9855 | 0.9570 |
Valanarasu et. all MedT | 0.8037 | 0.8064 | 0.9546 | 0.9090 |
Wu et. all FAT-Net | 0.8500 | 0.8392 | 0.9725 | 0.9326 |
Azad et. all Proposed TMUnet | 0.9164 | 0.9128 | 0.9789 | 0.9660 |
(a) Input images. (b) Ground truth. (c) U-net. (d) Gated Axial-Attention. (e) Proposed method without a contextual attention module and (f) Proposed method.
Methods | mIOU |
---|---|
Frequency recalibration U-Net | 0.9392 |
XLAB Insights | 0.9360 |
DSC-IITISM | 0.9356 |
Multi-scale attention deeplabv3+ | 0.9065 |
U-Net | 0.7665 |
Baseline | 0.9172 |
Proposed | 0.9395 |
You can download the learned weights for each dataset in the following table.
Dataset | Learned weights |
---|---|
ISIC 2018 | TMUnet |
ISIC 2017 | TMUnet |
Ph2 | TMUnet |
All implementations are done by Reza Azad and Moein Heidari. For any query please contact us for more information.
[email protected]
[email protected]