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.

69 lines
1.2 KiB

快速开始
=========
环境安装
--------
1. 克隆项目仓库
.. code-block:: bash
git clone https://github.com/your-repo/EMCAD.git
cd EMCAD
2. 安装依赖
.. code-block:: bash
pip install -r requirements.txt
pip install -e .
3. 数据准备
按照数据集说明准备 Synapse 或 ACDC 数据集,并将路径配置到 ``configs/default.yaml`` 中。
模型训练
--------
使用 Makefile 运行训练:
.. code-block:: bash
make train
或者直接运行训练脚本:
.. code-block:: bash
python scripts/train_synapse.py --cfg configs/default.yaml
模型推理
--------
.. code-block:: python
import torch
from src.core.networks import EMCADNet
from src.utils.config import Config
config = Config.from_yaml("configs/default.yaml")
model = EMCADNet(num_classes=config.model.num_classes)
checkpoint = torch.load("experiments/latest.pth")
model.load_state_dict(checkpoint["state_dict"])
model.eval()
with torch.no_grad():
output = model(input_tensor)
配置修改
--------
编辑 ``configs/default.yaml`` 文件来调整训练参数:
.. code-block:: yaml
training:
max_epochs: 300
batch_size: 6
base_lr: 0.0001