The new better and stronger pre-trained transformers models (CTransPath) has been released
- 128GB of RAM
- 32*Nvidia V100 32G GPUs
1.Download all TCGA WSIs.
2.Download all PAIP WSI
New:So, there will be about 15,000,000 images.
Old:We crop these WSIs into patch images.we randomly select 100 images from each WSI.Finally,So, there will be about 2,700,521 unlabeled histopathological images.If you want these images, you can contact me.
Install the modified timm library
pip install timm-0.5.4.tar
The pre-trained models can be downloaded
python get_features_CTransPath.py
For linear classification on frozen features/weights
python ctrans_lincls.py
Usage: End-to-End Fine-tuning comming soon Downstream and evaluation code coming soon
We also trained MoCo v3 on these histopathological images. The pre-trained models can be downloaded as following:
Undated the latest weights have been uploaded (1/10/2022)
please see the instructions
python get_features_mocov3.py \
-a vit_small
To perform end-to-end fine-tuning for ViT, use our script to convert the pre-trained ViT checkpoint to DEiT format:
python convert_to_deit.py \
--input [your checkpoint path]/[your checkpoint file].pth.tar \
--output [target checkpoint file].pth
Then run the training (in the DeiT repo) with the converted checkpoint:
python $DEIT_DIR/main.py \
--resume [target checkpoint file].pth \
--epochs 150
The pre-trained models can be downloaded
These codes are partly based on byol and moco v2
python main_byol_transpath.py \
--lr 0.0001 \
--batch-size 256 \
--dist-url 'tcp://localhost:10001' --multiprocessing-distributed --world-size 1 --rank 0 --mlp --moco-t 0.2 --aug-plus --cos
python get_feature_transpath.py
use our script to convert the pre-trained ViT checkpoint to Transformers format:
python convert_to_transpath.py
Please use below to cite this paper if you find our work useful in your research.
@inproceedings{wang2021transpath,
title={TransPath: Transformer-Based Self-supervised Learning for Histopathological Image Classification},
author={Wang, Xiyue and Yang, Sen and Zhang, Jun and Wang, Minghui and Zhang, Jing and Huang, Junzhou and Yang, Wei and Han, Xiao},
booktitle={International Conference on Medical Image Computing and Computer-Assisted Intervention},
pages={186--195},
year={2021},
organization={Springer}
}