Tan_pytorch_segmentation/pytorch_segmentation/PV_TransUNet-main
L_J 63abdae2a9 “提交项目” 2025-05-19 20:48:24 +08:00
..
.idea “提交项目” 2025-05-19 20:48:24 +08:00
datasets “提交项目” 2025-05-19 20:48:24 +08:00
lists/lists_Synapse “提交项目” 2025-05-19 20:48:24 +08:00
networks “提交项目” 2025-05-19 20:48:24 +08:00
LICENSE “提交项目” 2025-05-19 20:48:24 +08:00
README.md “提交项目” 2025-05-19 20:48:24 +08:00
requirements.txt “提交项目” 2025-05-19 20:48:24 +08:00
test.py “提交项目” 2025-05-19 20:48:24 +08:00
train.py “提交项目” 2025-05-19 20:48:24 +08:00
trainer.py “提交项目” 2025-05-19 20:48:24 +08:00
utils.py “提交项目” 2025-05-19 20:48:24 +08:00

README.md

TransUNet

This repo holds code for TransUNet: Transformers Make Strong Encoders for Medical Image Segmentation

📰 News

  • [10/15/2023] 🔥 3D version of TransUNet is out! Our 3D TransUNet surpasses nn-UNet with 88.11% Dice score on the BTCV dataset and outperforms the top-1 solution in the BraTs 2021 challenge. Please take a look at the code and paper.

Usage

1. Download Google pre-trained ViT models

wget https://storage.googleapis.com/vit_models/imagenet21k/{MODEL_NAME}.npz &&
mkdir ../model/vit_checkpoint/imagenet21k &&
mv {MODEL_NAME}.npz ../model/vit_checkpoint/imagenet21k/{MODEL_NAME}.npz

2. Prepare data

Please go to "./datasets/README.md" for details, or use the preprocessed data and data2 for research purposes.

3. Environment

Please prepare an environment with python=3.7, and then use the command "pip install -r requirements.txt" for the dependencies.

4. Train/Test

  • Run the train script on synapse dataset. The batch size can be reduced to 12 or 6 to save memory (please also decrease the base_lr linearly), and both can reach similar performance.
CUDA_VISIBLE_DEVICES=0 python train.py --dataset Synapse --vit_name R50-ViT-B_16
  • Run the test script on synapse dataset. It supports testing for both 2D images and 3D volumes.
python test.py --dataset Synapse --vit_name R50-ViT-B_16

Reference

Citations

@article{chen2021transunet,
  title={TransUNet: Transformers Make Strong Encoders for Medical Image Segmentation},
  author={Chen, Jieneng and Lu, Yongyi and Yu, Qihang and Luo, Xiangde and Adeli, Ehsan and Wang, Yan and Lu, Le and Yuille, Alan L., and Zhou, Yuyin},
  journal={arXiv preprint arXiv:2102.04306},
  year={2021}
}