sliced-inference
Guide SAHI standard and sliced prediction APIs, CLI commands, slicing choices, batching, exports, progress callbacks, and video visualization.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- sliced-inference
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Guide SAHI standard and sliced prediction APIs, CLI commands, slicing choices, batching, exports, progress callbacks, and video visualization.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/cli-and-python.md10.4 KB
- 参考文档references/slicing-parameters.md8.6 KB
- 参考文档references/troubleshooting.md9.6 KB
- 脚本scripts/sliced_prediction_smoke.py10.8 KB
03 SKILL.md 正文
sliced-inference
Use this sub-skill when the task is to build or debug SAHI prediction calls: AutoDetectionModel, get_prediction, get_sliced_prediction, high-level predict, predict-fiftyone, sahi predict, folder or video inference, slicing parameters, progress reporting, batching, and prediction export routing.
Do not use it as the owner for detector-specific installation or weights. Route those questions to ../model-integrations/SKILL.md. Route COCO conversion/evaluation to ../dataset-tools/SKILL.md, postprocess backend internals to ../postprocess-backends/SKILL.md, and result object serialization details to ../annotations-and-results/SKILL.md.
Start here
- Choose the API surface in CLI and Python workflows:
get_predictionfor one standard full-image call.get_sliced_predictionfor one image with tiles and optional standard+slice aggregation.predict/sahi predictfor files, folders, videos, and automatic exports.predict-fiftyonefor interactive FiftyOne review when that optional dependency is installed.
- Choose the inference mode:
- Standard only: disable sliced prediction.
- Sliced only: disable standard prediction.
- Standard+sliced: default for sliced workflows; useful when small and large objects both matter.
- Tune
slice_height,slice_width, overlap, batching, progress, and duplicate handling with Slicing parameters. - If behavior is wrong, use Troubleshooting before changing model code.
- To validate that base SAHI prediction plumbing works without model weights or downloads, run the bundled synthetic smoke script.
Safe local smoke
From this sub-skill directory, run:
python scripts/sliced_prediction_smoke.py --mode sliced --slice-size 128 --batch-size 2
The smoke script constructs a deterministic in-memory DetectionModel subclass, creates a synthetic image, exercises the selected prediction path, asserts expected result structure, and prints success. It does not download weights, contact a network service, train a model, or write outputs by default.
Boundaries and assumptions
- A real detector still needs a supported
model_type, installed optional backend packages, and accessible local weights or model objects; this sub-skill only shows how those model objects are used by prediction APIs. - Optional detector frameworks were not assumed to be installed or runtime-verified here.
- COCO result JSON export is covered only as prediction-output routing. Dataset conversion, slicing, evaluation, and error analysis belong to
../dataset-tools/SKILL.md. - NMS/NMM/GreedyNMM parameter placement is covered here; algorithm details and backend acceleration belong to
../postprocess-backends/SKILL.md.
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).