metrics
Use supervision metrics for detection evaluation, benchmarking, and result interpretation.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- metrics
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use supervision metrics for detection evaluation, benchmarking, and result interpretation.
- disable-model-invocation
- true
02 资源文件 3
- 参考文档references/metrics-reference.md10.2 KB
- 参考文档references/troubleshooting.md10.2 KB
- 参考文档references/workflows.md11.4 KB
03 SKILL.md 正文
Metrics
Use this sub-skill when a task asks to evaluate object detection, instance
segmentation, or oriented-box predictions with supervision metrics in version
0.31.0.dev0 on Python >=3.10.
Route here for
MeanAveragePrecision,MeanAverageRecall,Precision,Recall,F1Score, result objects,.update(...),.compute(),.reset(),.to_pandas(), or.plot().MetricTarget.BOXES,MetricTarget.MASKS,MetricTarget.ORIENTED_BOUNDING_BOXES, andAveragingMethodchoices.sv.ConfusionMatrix, confusion-matrix plots, confidence/IoU thresholds, and per-image validation grids fromConfusionMatrix.benchmark(...).- Dataset-backed benchmark loops that already have or can obtain pairs of
prediction and target
Detections. - Diagnosing mAP, mAR, precision, recall, F1, per-class rows, weighted versus
macro/micro averaging, empty inputs, class-id mapping, masks, OBB metrics,
COCO-style
area,iscrowd, andignorebehavior.
Route away
- Dataset loading, splitting, merging, or format conversion: use
datasets, then return here with
DetectionDatasetsamples orDetectionstarget lists. - Model inference, framework adapters, VLM parsing, detection filtering, NMS,
masks/OBB container construction, zones, slicers, or sinks: use
detection-and-zones, then return here with
prediction
Detections. - High-level false-positive/false-negative drawing or side-by-side visual style: use annotators after metrics identify the detections to display.
- Low-level image/video I/O, plotting grids, or OpenCV backend diagnosis: use media-utils when the task is not metric-specific.
Start with these references
- Metrics reference for metric classes,
required
Detectionsfields, result attributes, targets, averaging, and COCO-style metadata. - Workflows for update/compute patterns, dataset-backed benchmark loops, class remapping, mask/OBB evaluation, confusion matrices, pandas export, and plotting.
- Troubleshooting for metrics extra/pandas,
missing
confidenceorclass_id, wrongMetricTarget, mask/OBB metadata, class mappings, empty inputs, and visualization issues.
Operating defaults
- Install the metrics extra before metric work:
pip install "supervision[metrics]". The base install ispip install supervision, but.to_pandas()needs pandas from the metrics extra. - Prefer the newer metrics package imports:
from supervision.metrics import MeanAveragePrecision, MeanAverageRecall, Precision, Recall, F1Score, MetricTarget, AveragingMethod. Do not use the legacy top-levelsv.MeanAveragePrecisionfor new mAP code. - Predictions must normally include
xyxy,class_id, andconfidence. Targets must includexyxyandclass_id; targetconfidenceis not required. - Choose the metric target deliberately.
BOXESusesdetections.xyxy,MASKSusesdetections.mask, andORIENTED_BOUNDING_BOXESusesdetections.data[ORIENTED_BOX_COORDINATES]. - Keep class ids aligned with the dataset class list before computing metrics.
ConfusionMatrixrequires ids in[0, len(classes) - 1]; new metric result rows are keyed bymatched_classesrather than by row position alone. - Do not promise network/model benchmark execution unless the user already provides a runnable model and local dataset. This skill owns evaluation logic, not model acquisition or data download.
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).