detection-and-zones
Use supervision Detections, model adapters, compact masks, filtering, zones, slicing, smoothing, and CSV/JSON sinks.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- detection-and-zones
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use supervision Detections, model adapters, compact masks, filtering, zones, slicing, smoothing, and CSV/JSON sinks.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/api-reference.md16.8 KB
- 参考文档references/troubleshooting.md12.5 KB
- 参考文档references/workflows.md12.9 KB
03 SKILL.md 正文
Detection And Zones
Use this sub-skill when the task centers on detection data, model-result normalization, segmentation mask containers, filtering, overlap suppression/merging, zones, tiled inference, smoothing, or saving detections.
Natural triggers
Route here for prompts mentioning:
sv.Detections,Detections.empty, indexing/filtering,data,metadata,tracker_id,class_name.from_ultralytics,from_inference,from_transformers,from_vlm,from_lmm,from_sam,from_sam3,from_tensorflow,from_mmdetection,from_detectron2,from_yolov5,from_yolo_nas,from_easyocr,from_ncnn, or otherDetections.from_*adapters.CompactMask,compact_masks=True, dense vs compact masks, mask/box/OBB geometry,ORIENTED_BOX_COORDINATES.with_nms,with_soft_nms,with_nmm,OverlapFilter,OverlapMetric, IoU/IoS, duplicate detections.PolygonZone,LineZone, count in zone, line crossing, zone trigger masks,Positionanchors.InferenceSlicer, small object detection, tiled inference, overlap windows, GeoTIFF/windowed raster slicing.DetectionsSmoother,CSVSink,JSONSink, save detections, custom detection data serialization.
First response routing
- Identify the raw input type: already a
Detections, a framework result object, a VLM response, manual NumPy arrays, or persisted rows. - Open API reference for exact container fields, adapter signatures, constants, and tool parameters.
- Open workflows for common recipes: normalization, filtering, zones, slicing, compact masks, smoothing, and CSV/JSON export.
- Open troubleshooting before changing code when shapes, optional dependencies, missing metadata, tracker IDs, masks, zones, or slicer behavior are unclear.
Boundaries
Handle:
- Detection containers and aligned per-detection arrays.
- Adapter normalization from model/framework/VLM outputs into
sv.Detections. - Detection utility functions that transform boxes, masks, polygons, overlaps, or VLM label matching.
- Zone trigger logic and counts, including tracker-dependent line crossing.
- Slicer, smoother, CSV sink, and JSON sink behaviors.
Route elsewhere:
- Pure drawing, color styling, label layout, and annotator composition belong to the annotators sub-skill.
- Tracking identity persistence, tracker configuration, keypoint containers, and keypoint deprecations belong to the tracking-keypoints sub-skill; return here once
tracker_idis present forLineZoneor smoothing. - Image/video I/O, OpenCV backend selection, media helpers, assets, and low-level geometry primitives belong to the media-utils sub-skill unless they directly affect detection boxes/masks/zones.
- Dataset format conversion and dataset splitting/merging belong to the datasets sub-skill.
- mAP/MAR/precision/recall/F1/confusion-matrix evaluation belongs to the metrics sub-skill.
Operating defaults
- Target package facts:
supervision0.31.0.dev0, Python >=3.10, base install viapip install supervision. - Optional model frameworks are caller-managed; Supervision adapters normalize results but do not install or download model packages.
- Optional GeoTIFF/windowed raster support needs the geotiff extra or
rasterio. - OpenCV native wheels are optional for the package; do not assume native OpenCV is installed when writing detection-only code.
- Prefer constants from
supervision.config(CLASS_NAME_DATA_FIELD,ORIENTED_BOX_COORDINATES) over string literals in code that writesdetections.data. - Treat all detection-level fields as aligned length-
Ndata; filtering must preserve alignment by indexing theDetectionsobject, not by slicing only one array.
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).