Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

supervision

БесплатноБез исполняемых скриптовНе проверен

Supervision is a Python library of reusable computer-vision utilities: it wraps detection results in one Detections object, draws boxes, labels, masks and…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

Supervision — model-agnostic utilities for detection, annotation, zones and datasets

Overview

Supervision (PyPI supervision, Apache-2.0, by Roboflow) sits after the model. Whatever produces boxes, masks or keypoints (Ultralytics YOLO, Hugging Face Transformers, Roboflow Inference, your own code), you convert the output to sv.Detections once and reuse the same filtering, drawing, counting, video and dataset code. This skill was verified against release 0.31.5.

What it does: Detections (NumPy-backed, sliceable and filterable), annotators, PolygonZone and LineZone counters, InferenceSlicer (tiled inference), video helpers, DetectionDataset (YOLO, COCO, Pascal VOC), CSV and JSON sinks.

What it does not do: it is not a model and not a tracker. sv.ByteTrack was removed in 0.31.0; tracking now lives in the separate trackers package (pip install trackers, verified with 2.7.0: from trackers import ByteTrackTracker, then tracked = tracker.update(detections) returns sv.Detections with tracker_id set). LineZone and TraceAnnotator need that field.

Instructions

Installation

Use a virtual environment so the pinned version is reproducible.

python3 -m venv .venv
.venv/bin/pip install "supervision==0.31.5"
.venv/bin/python -c "import supervision as sv; print(sv.__version__)"

OpenCV is not a dependency. Without it supervision warns and uses a slower pure NumPy fallback. For full speed and behavior install opencv-python (or opencv-python-headless on servers without display libraries; never both).

Build Detections

Directly from arrays (the same shape every connector produces):

import numpy as np
import supervision as sv

detections = sv.Detections(
    xyxy=np.array([[50, 60, 200, 300], [300, 100, 420, 260], [450, 50, 600, 400]], dtype=float),
    confidence=np.array([0.91, 0.78, 0.45]),
    class_id=np.array([0, 2, 0]),
    data={"class_name": np.array(["car", "truck", "car"])},
)
confident = detections[detections.confidence > 0.5]   # boolean-mask filtering
print(len(confident), detections.area)                # 2 and per-box pixel areas
nms = detections.with_nms(threshold=0.5)              # class_agnostic=False by default

From a model (connectors exist in 0.31.5; these need the model package and weights, which this skill does not install):

detections = sv.Detections.from_ultralytics(results)      # Ultralytics result object
detections = sv.Detections.from_transformers(transformers_results, id2label=id2label)
detections = sv.Detections.from_inference(inference_result)  # Roboflow Inference

Check the connector's parameters with help(sv.Detections.from_transformers) before use; they differ per library.

Annotate frames

Annotators take a BGR NumPy image (what OpenCV reads), draw on it in place and return the same array. Always pass a copy if you need the original.

labels = [f"{name} {conf:.2f}" for name, conf in zip(detections["class_name"], detections.confidence)]
frame = image.copy()
frame = sv.BoxAnnotator().annotate(frame, detections)
frame = sv.LabelAnnotator().annotate(frame, detections, labels=labels)

Other annotators that exist in 0.31.5 include MaskAnnotator, PolygonAnnotator, HaloAnnotator, BlurAnnotator, PixelateAnnotator, CropAnnotator, HeatMapAnnotator, TraceAnnotator (needs tracker_id) and EdgeAnnotator/VertexAnnotator for keypoints. Masks need detections.mask.

Count in a zone

polygon = np.array([[0, 0], [320, 0], [320, 480], [0, 480]])
zone = sv.PolygonZone(polygon=polygon)       # default anchor: bottom center of each box
inside = zone.trigger(detections)            # boolean array, one entry per detection
print(zone.current_count)                    # detections inside right now
frame = sv.PolygonZoneAnnotator(zone=zone, color=sv.Color.RED).annotate(frame)

Count line crossings (needs tracker ids)

line = sv.LineZone(start=sv.Point(0, 540), end=sv.Point(1920, 540))
crossed_in, crossed_out = line.trigger(detections)   # detections must have tracker_id
print(line.in_count, line.out_count)
frame = sv.LineZoneAnnotator().annotate(frame, line_counter=line)

Run trigger once per frame, in order. A box that moves down through a horizontal line counts as out; moving up counts as in.

Process a whole video

process_video reads frames, calls your function with (frame, frame_index), and writes the result.

box = sv.BoxAnnotator()

def callback(frame: np.ndarray, index: int) -> np.ndarray:
    detections = detect(frame)           # your model call returning sv.Detections
    return box.annotate(frame.copy(), detections)

sv.process_video(source_path="lot.mp4", target_path="lot-annotated.mp4", callback=callback)

For custom loops: sv.get_video_frames_generator("lot.mp4", stride=5) yields every fifth frame, sv.VideoInfo.from_video_path("lot.mp4") returns width, height, fps and total frames, and `sv.VideoS

Полный SKILL.md на GitHub

Установить supervision в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл supervision?

Supervision is a Python library of reusable computer-vision utilities: it wraps detection results in one Detections object, draws boxes, labels, masks and heat maps on frames, counts objects in zones or across lines, runs video through a callback, and converts datasets between YOLO and COCO formats. Use when a user says "annotate detections on a video", "count people crossing a line", "count objects in a polygon zone", "slice a large image for small-object detection", or "convert my COCO dataset to YOLO". It does not ship a model or a tracker.

Как установить скилл supervision?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл supervision запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить supervision с