LViT

HUANGLIZIMIT活跃维护

LViT 把文本描述引入视觉 Transformer,做医学图像分割,用语言信息弥补标注数据不足,提升分割精度。

[IEEE Transactions on Medical Imaging/TMI 2023] This repo is the official implementation of "LViT: Language meets Vision Transformer in Medical Image Segmentation"

暂无版本394star39fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -r requirements.txt
python train_model.py
硬件要求按 README 说明

README 未说明显存要求;实验使用 2 卡 NVIDIA V100(32G),CUDA 版本 11.2。

多卡 / 张量并行
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

TMI 2023 官方实现,用文本描述引导视觉 Transformer 做医学图像分割

LViT 把文本描述引入视觉 Transformer,做医学图像分割,用语言信息弥补标注数据不足,提升分割精度。

核心能力

  • 融合语言与视觉 Transformer 做医学图像分割
  • 提供 QaTa-COV19、MosMedData+、MoNuSeg 训练与测试流程
  • 支持 U-Net 预训练后再训练 LViT 提升效果
  • 测试脚本输出 Dice、IoU 并可视化分割结果
  • 公开 QaTa-COV19 与 MosMedData+ 的文本标注

容易踩的坑

需 Python 3.7,NumPy 用 1.17.5,建议先装 bert-embedding 再装 NumPy 以避免版本冲突;数据集和文本标注需从外部链接自行下载并按 README 目录结构摆放;测试前需先在 Config.py 中把 session name 改成训练阶段的名字。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    LViT

    This repo is the official implementation of "LViT: Language meets Vision Transformer in Medical Image Segmentation" Arxiv, ResearchGate, IEEEXplore

    image

    Requirements

    Python == 3.7 and install from the requirements.txt using:

    pip install -r requirements.txt
    

    Questions about NumPy version conflict. The NumPy version we use is 1.17.5. We can install bert-embedding first, and install NumPy then.

    Usage

    1. Data Preparation

    1.1. QaTa-COV19, MosMedData+ and MoNuSeg Datasets (demo dataset)

    The original data can be downloaded in following links:

    [1] Jin, Dakai, et al. "DeepTarget: Gross tumor and clinical target volume segmentation in esophageal cancer radiotherapy." Medical Image Analysis 68 (2021): 101909.

    [2] Ye, Xianghua, et al. "Multi-institutional validation of two-streamed deep learning method for automated delineation of esophageal gross tumor volume using planning CT and FDG-PET/CT." Frontiers in Oncology 11 (2022): 785788.

    The text annotation of QaTa-COV19 has been released!

    (Note: The text annotation of QaTa-COV19 train and val datasets download link. The partition of train set and val set of QaTa-COV19 dataset download link. The text annotation of QaTa-COV19 test dataset download link.)

    (Note: The contrastive label is available in the repo.)

    (Note: The text annotation of MosMedData+ train dataset download link. The text annotation of MosMedData+ val dataset download link. The text annotation of MosMedData+ test dataset download link.)

    Google Drive for the above datasets download link

    If you use the datasets provided by us, please cite the LViT.

    1.2. Format Preparation

    Then prepare the datasets in the following format for easy use of the code:

    ├── datasets
        ├── QaTa-Covid19
        │   ├── Test_Folder
        |   |   ├── Test_text.xlsx
        │   │   ├── img
        │   │   └── labelcol
        │   ├── Train_Folder
        |   |   ├── Train_text.xlsx
        │   │   ├── img
        │   │   └── labelcol
        │   └── Val_Folder
        |	    ├── Val_text.xlsx
        │       ├── img
        │       └── labelcol
        └── MosMedDataPlus
            ├── Test_Folder
            |   ├── Test_text.xlsx
            │   ├── img
            │   └── labelcol
            ├── Train_Folder
            |   ├── Train_text.xlsx
            │   ├── img
            │   └── labelcol
            └── Val_Folder
                ├── Val_text.xlsx
                ├── img
                └── labelcol
    

    2. Training

    2.1. Pre-training

    You can replace LVIT with U-Net for pre training and run:

    python train_model.py
    
    2.2. Training

    You can train to get your own model. It should be noted that using the pre-trained model in the step 2.1 will get better performance or you can simply change the model_name from LViT to LViT_pretrain in config.

    python train_model.py
    

    3. Evaluation

    3.1. Test the Model and Visualize the Segmentation Results

    First, change the session name in Config.py as the training phase. Then run:

    python test_model.py
    

    You can get the Dice and IoU scores and the visualization results.

    4. Results

    DatasetModel NameDice (%)IoU (%)
    QaTa-COV19U-Net79.0269.46
    QaTa-COV19LViT-T83.6675.11
    MosMedData+U-Net64.6050.73
    MosMedData+LViT-T74.5761.33
    MoNuSegU-Net76.4562.86
    MoNuSegLViT-T80.3667.31
    MoNuSegLViT-T w/o pretrain79.9866.83
    4.1. More Results on other datasets
    DatasetModel NameDice (%)IoU (%)
    BKAI-PolyLViT-TW92.0780.93
    ESO-CTLViT-TW68.2757.02

    5. Reproducibility

    In our code, we carefully set the random seed and set cudnn as 'deterministic' mode to eliminate the randomness. However, there still exsist some factors which may cause different training results, e.g., the cuda version, GPU types, the number of GPUs and etc. The GPU used in our experiments is 2-card NVIDIA V100 (32G) and the cuda version is 11.2. And the upsampling operation has big problems with randomness for multi-GPU cases. See https://pytorch.org/docs/stable/notes/randomness.html for more details.

    Reference

    Citation

    @article{li2023lvit,
      title={Lvit: language meets vision transformer in medical image segmentation},
      author={Li, Zihan and Li, Yunxiang and Li, Qingde and Wang, Puyang and Guo, Dazhou and Lu, Le and Jin, Dakai and Zhang, You and Hong, Qingqi},
      journal={IEEE Transactions on Medical Imaging},
      year={2023},
      publisher={IEEE}
    }
    

    Stargazers repo roster for @HUANGLIZI/LViT

    Forkers repo roster for @HUANGLIZI/LViT