This repository contains the official Pytorch implementation of training & evaluation code for ColonFormer.
- Creating a virtual environment in terminal:
conda create -n ColonFormer
- Install
CUDA 11.1
andpytorch 1.7.1
- Install other requirements:
pip install -r requirements.txt
Downloading necessary data:
- For
Experiment 1
in our paper:- Download testing dataset and move it into
./data/TestDataset/
, which can be found in this download link (Google Drive). - Download training dataset and move it into
./data/TrainDataset/
, which can be found in this download link (Google Drive).
- Download testing dataset and move it into
- For
Experiment 2
andExperiment 3
:- All datasets we use in this experiments can be found in this download link (Google Drive)
Download MiT's pretrained weights
(
google drive |
onedrive
) on ImageNet-1K, and put them in a folder pretrained/
.
Config hyper-parameters and run train.py
for training. For example:
python train.py --backbone b3 --train_path ./data/TrainDataset --train_save ColonFormerB3
Here is an example in Google Colab
For evaluation, specific your backbone version, weight's path and dataset and run test.py
. For example:
python test.py --backbone b3 --weight ./snapshots/ColonFormerB3/last.pth --test_path ./data/TestDataset
We provide some pretrained weights in case you need.
If you find this code useful in your research, please consider citing:
@article{duc2022colonformer,
title={Colonformer: An efficient transformer based method for colon polyp segmentation},
author={Duc, Nguyen Thanh and Oanh, Nguyen Thi and Thuy, Nguyen Thi and Triet, Tran Minh and Dinh, Viet Sang},
journal={IEEE Access},
volume={10},
pages={80575--80586},
year={2022},
publisher={IEEE}
}
@inproceedings{ngoc2021neounet,
title={NeoUNet: Towards accurate colon polyp segmentation and neoplasm detection},
author={Ngoc Lan, Phan and An, Nguyen Sy and Hang, Dao Viet and Long, Dao Van and Trung, Tran Quang and Thuy, Nguyen Thi and Sang, Dinh Viet},
booktitle={Advances in Visual Computing: 16th International Symposium, ISVC 2021, Virtual Event, October 4-6, 2021, Proceedings, Part II},
pages={15--28},
year={2021},
organization={Springer}
}
@article{thuan2023rabit,
title={RaBiT: An Efficient Transformer using Bidirectional Feature Pyramid Network with Reverse Attention for Colon Polyp Segmentation},
author={Thuan, Nguyen Hoang and Oanh, Nguyen Thi and Thuy, Nguyen Thi and Perry, Stuart and Sang, Dinh Viet},
journal={arXiv preprint arXiv:2307.06420},
year={2023}
}