AGENT SKILL

medsegdiff

Guide MedSegDiff medical-image segmentation workflows for dataset preparation, diffusion-model training, checkpoint sampling, ensemble aggregation, and evaluation.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
medsegdiff
license
MIT
metadata
{ "disco-role": "operating" }
description
Guide MedSegDiff medical-image segmentation workflows for dataset preparation, diffusion-model training, checkpoint sampling, ensemble aggregation, and evaluation.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

MedSegDiff

MedSegDiff is a repository-level PyTorch diffusion framework for medical-image segmentation. Use this skill when a task mentions MedSegDiff, its ISIC or BRATS examples, diffusion-based segmentation, the guided_diffusion modules, or the repository's segmentation train/sample/evaluation workflows.

First route

  • Prepare or validate data: read sub-skills/data-preparation/SKILL.md. It covers ISIC CSV/image/mask trees, BRATS NIfTI modalities and slices, and custom 2D/3D layouts.
  • Configure or plan training: read sub-skills/training/SKILL.md. It covers the training CLI contract, model/diffusion factories, schedules, checkpoints, mixed precision, and multi-GPU behavior.
  • Sample or score predictions: read sub-skills/inference-evaluation/SKILL.md. It covers checkpoint compatibility, DDIM/DPM-Solver options, ensembles, STAPLE aggregation, output naming, IoU/Dice, and per-class metrics.

For a task spanning multiple routes, prepare and validate the data first, then train or provide a compatible checkpoint, then sample and evaluate. Preserve the dataset branch, effective input channels, image size, model version, diffusion schedule, and checkpoint settings across every stage.

Installation and runtime gate

The upstream repository has no pyproject.toml, setup.py, console entry point, or formal package metadata. Its documented dependency source is requirement.txt. In a fresh isolated environment, install the public runtime dependencies and make the checkout importable before using its Python modules:

python -m pip install -r requirement.txt
PYTHONDONTWRITEBYTECODE=1 python -c "import guided_diffusion.script_util as s; print(s.model_and_diffusion_defaults())"

Use a CUDA-enabled PyTorch build for actual training or sampling. CPU checks are appropriate for data loaders, metric helpers, and small factory/API smokes, but CPU is not a truthful substitute for the full training/sampling path: the runtime uses CUDA device placement and, during sampling, CUDA timing events and synchronization.

Before a real run, use the bundled safe inspectors and environment reference:

Keep medical data, checkpoints, predictions, and generated results outside the skill directory. Do not assume the repository's example data is complete; use the data-preparation validator and fetch data only through an approved, user-controlled source.

Shared invariants

  • The model factory's default image_size is 64, while the documented example recipes commonly use 256; only 64, 128, 256, and 512 have automatic channel multipliers in the inspected source.
  • Boolean options use an explicit value such as True or False, not a bare store_true switch.
  • data_name=ISIC and data_name=BRATS select dedicated branches; other values select the custom branch, whose 2D/3D detection has source-specific behavior.
  • Keep batch_size=1 for the unpatched sampler because several output-ID paths use the first item of a batch.
  • Treat version, effective input channels, architecture flags, diffusion steps/schedule, and checkpoint state as one compatibility tuple.

This skill is guidance for operating the public repository; it does not claim medical validity, reproduce paper metrics without the required data/checkpoint, or replace clinical review.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351