pytorch-semseg
Use pytorch-semseg for PyTorch semantic segmentation model selection, config/data preparation, training and validation planning, single-image inference, and legacy compatibility troubleshooting.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pytorch-semseg
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use pytorch-semseg for PyTorch semantic segmentation model selection, config/data preparation, training and validation planning, single-image inference, and legacy compatibility troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/compatibility.md4.1 KB
- 参考文档references/repo-provenance.md1.8 KB
- 参考文档references/repo-routing-metadata.json329 B
- 参考文档references/troubleshooting.md3.9 KB
- 脚本scripts/check_environment.py5.8 KB
03 SKILL.md 正文
pytorch-semseg
Use this repo skill when a task involves the ptsemseg package or the historical pytorch-semseg semantic-segmentation workflows: FCN, U-Net, SegNet, PSPNet, ICNet, LinkNet, FRRN, dataset YAML configs, training/validation entry points, single-image mask inference, or legacy dependency errors.
Before acting
-
Confirm the user is working with pytorch-semseg or an equivalent checkout/package that exposes
ptsemseg. -
Read references/repo-provenance.md when deciding whether this skill matches the current repository snapshot or should be refreshed.
-
Read references/compatibility.md before installing dependencies, adapting old scripts, or promising exact legacy reproduction.
-
Run the bundled environment check when imports or backend support matter:
python scripts/check_environment.py python scripts/check_environment.py --smoke
The environment check is safe by default: it imports packages, reports torch/CUDA visibility, flags protobuf/SciPy/DenseCRF hazards, and optionally runs a tiny no-download FRRN CPU smoke.
Route map
| User task | Read this |
|---|---|
| Choose a model id, instantiate a model, inspect losses/optimizers/schedulers/augmentations/metrics, or debug registry/API failures. | sub-skills/model-zoo-and-apis/SKILL.md |
| Write or validate a YAML config, choose dataset loader keys/splits, check data layout, or explain config drift. | sub-skills/data-and-configs/SKILL.md |
| Plan training or validation commands, reason about checkpoints/logs/metrics, or avoid expensive data-bound runs. | sub-skills/training-and-evaluation/SKILL.md |
| Build or debug one-image segmentation inference commands, output mask writing, checkpoint filename parsing, or DenseCRF. | sub-skills/single-image-inference/SKILL.md |
| Diagnose install/import/backend issues that cut across workflows. | references/troubleshooting.md and references/compatibility.md |
Install and import baseline
This snapshot exposes ptsemseg but may not behave like a modern packaged project. A future agent should first make ptsemseg importable from the user's selected package or checkout, then verify:
python - <<'PY'
from ptsemseg.models import get_model
from ptsemseg.loader import get_loader
print(get_model)
print(get_loader('pascal'))
PY
If importing ptsemseg.models fails with a generated protobuf descriptor error, read references/compatibility.md before changing package versions. If tensorboardX, pydensecrf, or legacy SciPy image helpers are missing, route to the workflow-specific troubleshooting reference instead of installing broad extras blindly.
Key capabilities
- Model registry guidance for
fcn32s,fcn16s,fcn8s,unet,segnet,pspnet,icnet,icnetBN,linknet,frrnA, andfrrnB. - Dataset/config guidance for
pascal,camvid,ade20k,mit_sceneparsing_benchmark,cityscapes,nyuv2,sunrgbd, andvistas. - Static YAML validation that avoids dataset reads and catches unsupported keys, machine-specific paths, legacy
l_rate/l_schedule, unsafeimg_rows/img_cols: same, Pascal SBD pitfalls, and registry typos. - Dry-run command builders for training, validation, and single-image inference. These helpers print commands and warnings; they do not run long training, validation, image inference, downloads, or destructive writes.
- Troubleshooting for protobuf/caffe metadata, PyYAML loader behavior, FCN/SegNet pretrained VGG side effects, DenseCRF optional dependency, SciPy image helper removal, checkpoint
module.prefixes, and CPU/CUDA expectations.
Safety and backend notes
- CPU checks are sufficient for import, parser, config, registry, metrics, and a small FRRN smoke. CUDA is optional for performance and realistic full-size training/inference; do not use a CPU import check as proof of GPU performance.
- Real training and validation require user-supplied datasets and may write logs/checkpoints. Use the dry-run builders and obtain explicit approval before running expensive commands.
- Real single-image inference requires a trained checkpoint and input image; optional DenseCRF requires
pydensecrf. - FCN and SegNet instantiation through
get_modelmay request pretrained VGG weights. Use FRRN or other no-download checks for routine smoke tests unless weight downloads/cache access are allowed.
Bundled files
- references/repo-provenance.md — source snapshot and refresh baseline.
- references/repo-routing-metadata.json — structured router metadata for managed imports.
- references/compatibility.md — dependency, protobuf, SciPy, CUDA, and packaging constraints.
- references/troubleshooting.md — cross-cutting failure triage.
- scripts/check_environment.py — safe import/backend/API smoke helper.
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).