You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
2 weeks ago | |
|---|---|---|
| .. | ||
| API.md | 2 weeks ago | |
| QUICKSTART.md | 2 weeks ago | |
| README.md | 2 weeks ago | |
README.md
EMCAD项目文档
项目概述
EMCAD(Efficient Multi-scale Convolutional Attention Decoding)是一个用于医学图像分割的高效多尺度卷积注意力解码网络。本项目是CVPR 2024论文《EMCAD: Efficient Multi-scale Convolutional Attention Decoding for Medical Image Segmentation》的官方PyTorch实现。
项目结构
EMCAD/
├── 📁 src/ # 源代码目录
│ └── emcad/ # 主包
│ ├── __init__.py # 包初始化文件
│ ├── core/ # 核心模块
│ │ ├── __init__.py
│ │ ├── models.py # 数据模型定义
│ │ └── processors.py # 核心处理器
│ └── utils/ # 工具模块
│ ├── __init__.py
│ ├── data_utils.py # 数据处理工具
│ └── visualization.py # 可视化工具
├── 📁 tests/ # 测试代码
│ ├── __init__.py
│ ├── test_core/ # 核心模块测试
│ └── test_utils/ # 工具模块测试
├── 📁 docs/ # 项目文档
│ ├── README.md # 项目主文档
│ ├── API.md # API文档
│ └── QUICKSTART.md # 快速入门指南
├── 📁 configs/ # 配置文件
│ ├── default.yaml # 默认配置
│ ├── development.yaml # 开发环境配置
│ └── production.yaml # 生产环境配置
├── 📁 data/ # 数据目录
│ ├── raw/ # 原始数据
│ ├── processed/ # 处理后的数据
│ └── external/ # 外部数据
├── 📁 notebooks/ # Jupyter笔记本
├── 📁 scripts/ # 脚本文件
├── 📄 requirements.txt # 依赖列表
├── 📄 setup.py # 安装配置
├── 📄 pyproject.toml # 现代项目配置
├── 📄 README.md # 项目说明
├── 📄 .gitignore # Git忽略规则
├── 📄 .pre-commit-config.yaml # 预提交钩子配置
└── 📄 Makefile # 常用命令封装
安装指南
环境要求
- Python 3.8+
- PyTorch 1.11.0
- CUDA 11.3 (可选,用于GPU加速)
安装步骤
- 创建并激活虚拟环境:
conda create -n emcadenv python=3.8
conda activate emcadenv
- 安装PyTorch:
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
- 安装MMCV:
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.11.0/index.html
- 安装项目依赖:
pip install -r requirements.txt
使用指南
数据准备
Synapse多器官数据集
- 从Synapse官网注册并下载数据集
- 按照TransUNet的列表将'RawData'文件夹分割为'TrainSet'(18个扫描)和'TestSet'(12个扫描)
- 将数据放入'./data/synapse/Abdomen/RawData/'文件夹
- 运行预处理脚本:
python ./utils/preprocess_synapse_data.py
或下载预处理数据并保存到'./data/synapse/'文件夹
ACDC数据集
从MT-UNet的Google Drive下载预处理的ACDC数据集,并移动到'./data/ACDC/'文件夹
预训练模型
从Google Drive/PVT GitHub下载预训练的PVTv2模型,并放入'./pretrained_pth/pvt/'文件夹
训练模型
使用以下命令训练模型:
cd EMCAD
python train_synapse.py --root_path ./data/Synapse/train_npz --volume_path ./data/Synapse/test_vol_h5 --encoder pvt_v2_b2 --batch_size 2 --max_epochs 50 --max_iterations 2000
测试模型
使用以下命令测试模型:
cd EMCAD
python test_synapse.py --volume_path ./data/synapse/test_vol_h5 --encoder pvt_v2_b2
模型架构
EMCAD网络架构包含以下核心组件:
- 编码器:使用PVTv2作为骨干网络
- 多尺度卷积块(MSCB):通过不同大小的卷积核捕获多尺度特征
- 轻量级门控注意力(LGAG):高效地融合多尺度特征
- 解码器:逐步上采样并融合特征,生成分割结果
性能指标
在Synapse多器官数据集上,EMCAD取得了以下性能:
- 平均Dice系数:85.63%
- 参数量:仅24.6M
- 计算量(FLOPs):仅15.8G
贡献指南
我们欢迎社区贡献!请遵循以下步骤:
- Fork本项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 开启Pull Request
代码规范
本项目遵循以下代码规范:
- 代码风格:遵循PEP 8风格指南
- 命名规范:
- 变量和函数:使用小写字母,单词之间用下划线连接
- 常量:使用全大写字母,单词之间用下划线连接
- 类:使用驼峰命名法
- 注释和文档:
- 使用三重双引号编写文档字符串
- 函数和方法的文档字符串应说明其功能、参数、返回值和异常
- 类型注解:在Python 3.5+中使用类型提示
许可证
本项目采用MIT许可证。详情请参阅LICENSE文件。
引用
如果本项目对您的研究有帮助,请考虑引用我们的论文:
@inproceedings{rahman2024emcad,
title={Emcad: Efficient multi-scale convolutional attention decoding for medical image segmentation},
author={Rahman, Md Mostafijur and Munir, Mustafa and Marculescu, Radu},
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
pages={11769--11779},
year={2024}
}
致谢
我们感谢以下优秀工作为本项目提供了基础: