计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
segmentation【效率与协作】Guides Attention-Gated Networks medical image segmentation workflows, including 3D U-Net training, validation, NIfTI layouts, and attention or feature-map export.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill for medical image segmentation tasks in Attention-Gated Networks. It covers 2D/3D U-Net variants, CT deep-supervision networks, attention-gated U-Nets, non-local blocks, NIfTI datasets, segmentation training/validation scripts, and feature or attention map exports.
../../scripts/check_env.py --repo-root /path/to/Attention-Gated-Networks --mode segmentation.Use this route when the user asks to:
acdc_sax, ukbb_sax, rvsc_sax, or test_sax;Route ultrasound scan-plane classification and 2D attention overlays to
../classification/SKILL.md instead.
Install the repository with CUDA-enabled PyTorch, torchsample, NIfTI, and visualization dependencies. Then run:
python ../../scripts/check_env.py --repo-root /path/to/Attention-Gated-Networks --mode segmentation
Arrange NIfTI files under split directories with paired image/ and
label/ subfolders. See data-layout.md.
Copy a CT config and replace data_path.acdc_sax with the current dataset
root. The stock configs use output_nc=4, tensor_dim='3D', and
gpu_ids=[0].
Relative config paths are resolved from the explicit --repo-root; relative
data_path values are resolved from the config file's parent. NIfTI data and
model weights/checkpoints must exist externally. The bundled runner and
check_env.py --config ... fail fast on missing or private /vol/... paths;
they never fabricate data.
4. Train with the bundled replacement:
python scripts/run_segmentation.py --repo-root /path/to/Attention-Gated-Networks --config path/to/config.json
Validate a checkpoint or export maps with the bundled helper:
python scripts/validate_and_export_maps.py --repo-root /path/to/Attention-Gated-Networks --config path/to/config.json --checkpoint path/to/checkpoint.pth --output-dir /tmp/ag-net-validation --mode validate
For safe smoke validation or map export without private paths, use:
python scripts/validate_and_export_maps.py \
--repo-root /path/to/Attention-Gated-Networks \
--config configs/config_unet_ct_multi_att_dsv.json \
--output-dir /tmp/ag-net-segmentation \
--mode both
unet_ct_dsv is the simpler CT deep-supervision route; use
unet_ct_multi_att_dsv when attention maps are a first-class goal.160 x 160 x 96 patches). The generated
helper's 16 x 16 x 16 synthetic volume is only a wiring smoke.Training writes checkpoints and logs below the configured checkpoint directory
and experiment name. Validation writes NIfTI predictions and CSV metrics. The
bundled helper writes synthetic or fixture NIfTI outputs, metrics.json,
feature/attention-map NIfTI files, and middle-slice preview PNGs to the selected
output directory.