medical-zoo-pytorch
Operate MedicalZooPytorch 3D medical image segmentation, data loading, losses, training, inference, and COVID 2D classification workflows.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- medical-zoo-pytorch
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Operate MedicalZooPytorch 3D medical image segmentation, data loading, losses, training, inference, and COVID 2D classification workflows.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/repo-provenance.md2.0 KB
- 参考文档references/repo-routing-metadata.json518 B
- 参考文档references/troubleshooting.md3.9 KB
- 参考文档references/workflows.md3.9 KB
- 脚本scripts/smoke_repo_imports.py4.2 KB
03 SKILL.md 正文
MedicalZooPytorch
Use this repo skill when a task involves MedicalZooPytorch, its lib.* modules, 3D medical image segmentation in PyTorch, medical-image dataset loaders, segmentation losses, training/inference loops, or the repository's small 2D COVID classification branch.
First checks
- Confirm the MedicalZooPytorch code is available as importable Python modules. This repository exposes
lib.*directly and may not provide package metadata, so a local checkout often needs its repository root onPYTHONPATHor another explicit import path. - Install a PyTorch build appropriate for the user's CPU/CUDA environment, then install the non-torch runtime dependencies used by selected workflows:
nibabel,scipy,matplotlib,Pillow,tensorboard,torchsummary,torchsummaryX, andtorchvisionfor the COVID branch. - Run the root smoke check before using deeper routes:
python scripts/smoke_repo_imports.py
python scripts/smoke_repo_imports.py --cuda
Use --package-root /path/to/MedicalZooPytorch if the modules are not already importable. Do not run full training or the original examples until dataset folders and checkpoint/output paths are confirmed.
Route by task
- 3D model selection, training, checkpoints, TensorBoard, inference, or visualization: open sub-skills/segmentation-workflows/SKILL.md.
- Dataset folder layout, loader arguments, image preprocessing, subvolume generation, normalization, resampling, coordinate transforms, or augmentation: open sub-skills/data-loading-preprocessing/SKILL.md.
- Loss selection, Dice/CE/weighted/contrastive/angular losses, one-hot expansion, shape contracts, or trainer criterion return types: open sub-skills/losses-and-metrics/SKILL.md.
- 2D COVID X-ray/CT classification, COVIDx/CovidCT manifests, COVID model caveats, or COVID metric tracking: open sub-skills/covid-2d-classification/SKILL.md.
Shared references
- references/workflows.md summarizes the end-to-end route map and how the sub-skills combine.
- references/troubleshooting.md covers cross-cutting install, data, CUDA, path, and package-import failures.
- references/repo-provenance.md records the source baseline and evidence paths used to build this skill.
- references/repo-routing-metadata.json is structured routing metadata for the managed repo-skills router.
Repository operating model
MedicalZooPytorch is source-tree-oriented rather than packaged like a modern PyPI project. Its public import surface is mostly:
lib.medzoo: model classes pluscreate_model(args).lib.medloaders: dataset loader classes plusgenerate_datasets(args, path=...).lib.losses3D: factory and concrete loss classes.lib.train: trainer loops.lib.visual3D_temp: TensorBoard writer and visualization helpers.lib.utils: reproducibility, input preparation, checkpoint-era helpers, and COVID metrics.
The old example launchers are valuable evidence, but this skill distills them into bundled references and smoke scripts. Do not point a future user at source examples as required runtime documentation; use the sub-skill workflows instead.
Backend and data expectations
- CPU is enough for import checks, loss checks, preprocessing checks, and tiny model forward passes.
- CUDA is needed to truthfully exercise paths that move models/tensors with
.cuda()or that mirror the historical GPU-oriented training/inference examples. - Real dataset loader runs require the actual ISEG/BraTS/MRBRAINS/IXI/MICCAI/COVID files in the documented folder structure; the repository includes mostly placeholder readmes and some COVID manifest text files, not the full image data.
- Full training and inference are data-heavy and long-running. Use bundled smoke scripts first, then run full experiments only after data paths, output directories, model class, loss return contract, and device placement are confirmed.
Safe bundled scripts
scripts/smoke_repo_imports.pychecks cross-cutting imports and optional CUDA availability.- Each sub-skill has smaller scripts for its owned workflow. Prefer those before running a complete training job.
Avoid this skill when
- The task is about another medical-imaging framework such as MONAI, nnU-Net, or TorchIO and does not name MedicalZooPytorch or its APIs.
- The user wants general medical-imaging theory rather than operating this package.
- The task is repository maintenance or code editing rather than package usage; then use normal repo-development context and tests instead of this runtime operating graph.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).