Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/roboflow/supervision
/ functions
Functions
1,714 in github.com/roboflow/supervision
⨍
Functions
1,714
◇
Types & classes
220
↳
Endpoints
53
↓ 278 callers
Method
append
Append detection data to the CSV file. Args: detections: The detection data. custom_data: Custom data to inc
src/supervision/detection/tools/csv_sink.py:196
↓ 164 callers
Method
empty
Create an empty Detections object with no bounding boxes, confidences, or class IDs. Returns: An empty Detec
src/supervision/detection/core.py:2065
↓ 72 callers
Function
_create_detections
Create a Detections object from list-based inputs. This is a helper function primarily used for testing purposes to quickly instantiate
tests/helpers.py:19
↓ 68 callers
Method
sum
NumPy-compatible sum with a fast path for per-mask area. When ``axis=(1, 2)``, returns the per-mask True-pixel count via :attr:`area`
src/supervision/detection/compact_mask.py:766
↓ 56 callers
Method
get
(self, tracker_id: int)
src/supervision/annotators/utils.py:377
↓ 51 callers
Method
from_dense
Create a :class:`CompactMask` from a dense ``(N, H, W)`` bool array. Bounding boxes are clipped to image bounds and interpreted in the
src/supervision/detection/compact_mask.py:476
↓ 50 callers
Method
as_bgr
Returns the color as a BGR tuple. Returns: BGR tuple. Example: ```pycon >>> import supe
src/supervision/draw/color.py:304
↓ 49 callers
Method
from_hex
Create a Color instance from a hex string. Args: color_hex: The hex string representing the color. This string can
src/supervision/draw/color.py:106
↓ 48 callers
Method
annotate
Annotates the given scene with bounding boxes based on the provided detections. Args: scene: The image where bounding bo
src/supervision/annotators/core.py:214
↓ 44 callers
Method
compute
Compute the metric from the internal state and return the result.
src/supervision/metrics/core.py:29
↓ 44 callers
Method
numpy
(self)
tests/helpers.py:257
↓ 42 callers
Method
cpu
(self)
tests/helpers.py:254
↓ 32 callers
Method
to_dense
Materialise all masks as a dense ``(N, H, W)`` boolean array. Returns: Boolean array of shape ``(N, H, W)``. Examples:
src/supervision/detection/compact_mask.py:555
↓ 31 callers
Function
mask_iou_batch
Compute Intersection over Union (IoU) of two sets of masks - `masks_true` and `masks_detection`. Accepts both dense ``(N, H, W)`` bo
src/supervision/detection/utils/iou_and_nms.py:736
↓ 31 callers
Method
resize
Return a new CompactMask scaled to a different image resolution. Each crop mask is resized with nearest-neighbour interpolation. Spar
src/supervision/detection/compact_mask.py:1192
↓ 30 callers
Function
_mask_to_rle_counts
Encode a 2D boolean mask as COCO F-order run lengths (int32 array). Pixels are scanned column-by-column (Fortran order), matching the COCO /
src/supervision/detection/utils/converters.py:497
↓ 28 callers
Function
_create_key_points
Create a KeyPoints object from list-based inputs. This is a helper function primarily used for testing purposes to quickly instantiate a
tests/helpers.py:79
↓ 26 callers
Function
_cm_from_masks
Build a CompactMask using full-image bounding boxes (lossless).
tests/detection/test_compact_mask_iou.py:30
↓ 26 callers
Method
update
Add new predictions and targets to the metric, but do not compute the result. Args: predictions: The predicted detection
src/supervision/metrics/mean_average_precision.py:1295
↓ 25 callers
Function
_make_cm
Build a CompactMask whose crops equal the full bounding-box extents.
tests/detection/test_compact_mask.py:28
↓ 24 callers
Function
oriented_box_iou_batch
Compute pairwise overlap scores between two sets of oriented bounding boxes using the configured `overlap_metric`. Overlap areas are com
src/supervision/detection/utils/iou_and_nms.py:426
↓ 24 callers
Method
trigger
Update the `in_count` and `out_count` based on the objects that cross the line. Args: detections: A Detections object fo
src/supervision/detection/line_zone.py:145
↓ 23 callers
Method
is_empty
Check whether the `Detections` object has zero bounding boxes. Returns: `True` if there are no detections, `False` other
src/supervision/detection/core.py:2086
↓ 23 callers
Function
time_reps
Run *func* *reps* times and return mean wall-clock seconds per call. When ``parallel > 1``, up to ``parallel`` calls run simultaneously in th
examples/compact_mask/benchmark.py:276
↓ 22 callers
Function
_rotated_rect
Return the 4 corners of a rotated rectangle as a (4, 2) float32 array.
tests/detection/utils/test_iou_and_nms.py:24
↓ 22 callers
Function
mask_to_xyxy
Converts a 3D `np.array` of 2D bool masks into a 2D `np.array` of bounding boxes. Args: masks: A 3D `np.array` of shape `(N, H, W)`
src/supervision/detection/utils/converters.py:202
↓ 22 callers
Method
split
( self, split_ratio: float = 0.8, random_state: int | None = None, shuffle: bo
src/supervision/dataset/core.py:47
↓ 21 callers
Function
_rle_counts_to_mask
Decode COCO F-order run lengths back to a 2D boolean mask. This is the shared low-level decoder used by both :func:`rle_to_mask` and :class:`
src/supervision/detection/utils/converters.py:538
↓ 20 callers
Function
_normalize_color_input
(color: Color | str)
src/supervision/annotators/core.py:58
↓ 20 callers
Function
assert_image_mostly_same
Assert that the annotated image is mostly the same as the original. Args: original: Original image annotated: Annotated imag
tests/helpers.py:218
↓ 20 callers
Function
resolve_color
( color: Color | ColorPalette, detections: Detections, detection_idx: int, color_lookup: Color
src/supervision/annotators/utils.py:139
↓ 19 callers
Method
update
Add new predictions and targets to the metric, but do not compute the result. Args: predictions: The predicted detection
src/supervision/metrics/f1_score.py:92
↓ 19 callers
Method
update_with_detections
Updates the tracker with the provided detections and returns the updated detection results. Args: detections: Th
src/supervision/tracker/byte_tracker/core.py:83
↓ 18 callers
Function
_get_logger
Creates and configures a logger with stdout and stderr handlers. This function creates a logger that sends INFO and DEBUG level logs to stdout,
src/supervision/utils/logger.py:8
↓ 18 callers
Method
merge
Merge a list of Detections objects into a single Detections object. This method takes a list of Detections objects and combines thei
src/supervision/detection/core.py:2111
↓ 17 callers
Method
by_idx
Return the color at a given index in the palette. Args: idx: Index of the color in the palette. Returns:
src/supervision/draw/color.py:512
↓ 16 callers
Function
box_iou_batch
Compute pairwise overlap scores between batches of bounding boxes. Supports standard IOU (intersection-over-union) and IOS (intersection
src/supervision/detection/utils/iou_and_nms.py:162
↓ 16 callers
Method
from_video_path
(cls, video_path: str)
src/supervision/utils/video.py:59
↓ 15 callers
Method
as_xy_int_tuple
Returns the point as a tuple of integers. Returns: The point as (x, y) integers.
src/supervision/geometry/core.py:53
↓ 15 callers
Function
detections_to_coco_annotations
Convert `Detections` to COCO ``annotations`` entries. The internal 0-indexed ``Detections.class_id`` is serialized as a 1-indexed COCO ``cate
src/supervision/dataset/formats/coco.py:217
↓ 15 callers
Method
get_anchors_coordinates
Calculates and returns the coordinates of a specific anchor point within the bounding boxes defined by the `xyxy` attribute. The anch
src/supervision/detection/core.py:2217
↓ 15 callers
Method
update
Add new predictions and targets to the metric, but do not compute the result. Args: predictions: The predicted detection
src/supervision/metrics/precision.py:95
↓ 14 callers
Function
assert_almost_equal
Assert that two values are equal within a specified tolerance. Args: actual: The value to check. expected: The expected valu
tests/helpers.py:197
↓ 14 callers
Function
compact_mask_iou_batch
Compute pairwise overlap between two :class:`CompactMask` collections. Avoids materialising full ``(N, H, W)`` arrays by: 1. Vectorised boun
src/supervision/detection/utils/iou_and_nms.py:569
↓ 14 callers
Method
empty
(cls)
src/supervision/metrics/mean_average_precision.py:281
↓ 14 callers
Method
update
Add new predictions and targets to the metric, but do not compute the result. Args: predictions: The predicted detection
src/supervision/metrics/recall.py:95
↓ 13 callers
Function
_aabb_of
Axis-aligned bounding box of a (4, 2) OBB corner array.
tests/detection/utils/test_iou_and_nms.py:37
↓ 13 callers
Method
annotate
Annotates the given scene with masks based on the provided detections. Args: scene: The image where masks will be drawn.
src/supervision/annotators/core.py:451
↓ 12 callers
Function
_rle_resize
Resize an F-order RLE-encoded crop via nearest-neighbour resampling. Manipulates run lengths directly without decoding to a full 2D boolean a
src/supervision/detection/compact_mask.py:249
↓ 12 callers
Method
compute
Calculate Mean Average Precision based on predicted and ground-truth detections at different thresholds using the COCO evaluation met
src/supervision/metrics/mean_average_precision.py:1450
↓ 12 callers
Method
from_detections
Calculate confusion matrix based on predicted and ground-truth detections. Args: targets: Detections objects from ground
src/supervision/metrics/detection.py:238
↓ 12 callers
Method
from_inference
Create a `sv.Detections` object from the [Roboflow](https://roboflow.com/) API inference result or the [Inference](https://inference.
src/supervision/detection/core.py:620
↓ 12 callers
Method
tick
Processes the current frame, updating time durations for each tracker. Args: detections: The detections for the current frame, in
examples/time_in_zone/utils/timers.py:31
↓ 11 callers
Method
annotate
Draws trace paths on the frame based on the detection coordinates provided. Args: scene: The image on which the traces w
src/supervision/annotators/core.py:2017
↓ 11 callers
Method
detach
(self)
tests/classification/test_core.py:21
↓ 11 callers
Function
warn_deprecated
Issue a warning that a function is deprecated. Args: message: The message to display when the function is called.
src/supervision/utils/internal.py:43
↓ 11 callers
Method
write_frame
Writes a single video frame to the target video file. Args: frame: The video frame to be written to the file. The frame
src/supervision/utils/video.py:119
↓ 10 callers
Function
_make_compact_detections
Detections with a CompactMask backed by full-image bounding boxes. Using full-image xyxy means all True pixels are within the crop region, so
tests/detection/test_compact_mask_integration.py:20
↓ 10 callers
Function
_random_masks_and_xyxy
Generate *num_masks* random boolean masks with matching tight xyxy boxes. Each mask is built by filling a random sub-rectangle with Bernoulli noi
tests/detection/test_compact_mask.py:767
↓ 10 callers
Method
crop
Decode a single mask crop without allocating the full image array. This is an O(crop_area) operation — ideal for annotators that only
src/supervision/detection/compact_mask.py:587
↓ 10 callers
Method
empty
Create an empty KeyPoints object with no key points. Returns: An empty `sv.KeyPoints` object. Examples:
src/supervision/key_points/core.py:1098
↓ 10 callers
Method
from_ultralytics
Creates a `sv.Detections` instance from a [YOLOv8](https://github.com/ultralytics/ultralytics) inference result. !!! Note
src/supervision/detection/core.py:254
↓ 9 callers
Function
_fmt_speedup
(dense_s: float, compact_s: float)
examples/compact_mask/benchmark.py:941
↓ 9 callers
Function
_timing_line
(label: str, dense_s: float, compact_s: float)
examples/compact_mask/benchmark.py:743
↓ 9 callers
Function
calculate_masks_centroids
Calculate the centroids of binary masks in a tensor. Args: masks: A 3D NumPy array of shape (num_masks, height, width).
src/supervision/detection/utils/masks.py:90
↓ 9 callers
Function
download_assets
Download a specified asset if it doesn't already exist or is corrupted. Args: asset_name: The name or type of the asset to be downlo
src/supervision/assets/downloader.py:41
↓ 9 callers
Function
find_in_list
Determines if elements of a numpy array are present in a list. Args: array (np.ndarray): The numpy array of integers to check. se
examples/time_in_zone/utils/general.py:27
↓ 9 callers
Function
load_coco_annotations
Load COCO annotations and convert them to `Detections`. If `force_masks` is `False`, masks are still loaded for images whose annotations
src/supervision/dataset/formats/coco.py:396
↓ 9 callers
Function
load_zones_config
Load polygon zone configurations from a JSON file. This function reads a JSON file which contains polygon coordinates, and converts them
examples/time_in_zone/utils/general.py:8
↓ 9 callers
Function
polygon_to_mask
Generate a mask from a polygon. Args: polygon: The polygon for which the mask should be generated, given as a list of vertice
src/supervision/detection/utils/converters.py:31
↓ 8 callers
Function
_full_xyxy
N boxes covering the whole image (ensures crop == full mask).
tests/detection/test_compact_mask_integration.py:15
↓ 8 callers
Function
_make_obb_detections
Build OBB Detections from a list of (4, 2) corner arrays.
tests/detection/test_core.py:1007
↓ 8 callers
Function
_paint_masks_by_area
Paint each detection's mask into `canvas` in descending-area order. Smaller masks are drawn on top of larger ones. `CompactMask` detections a
src/supervision/annotators/core.py:365
↓ 8 callers
Function
_rotated_rect
( cx: float, cy: float, w: float, h: float, angle_deg: float )
tests/detection/test_core.py:995
↓ 8 callers
Function
_tiny_detection_dataset
Build a DetectionDataset of ``num_images`` 10x10 RGB images on disk, each holding ``dets_per_image`` 1x1 detections of class 0. Image content
tests/dataset/formats/test_coco.py:1625
↓ 8 callers
Function
_validate_resolution
(resolution: Any)
src/supervision/validators/__init__.py:334
↓ 8 callers
Method
annotate
Annotates the given scene with labels based on the provided detections. Args: scene: The image where labels will be draw
src/supervision/annotators/core.py:1252
↓ 8 callers
Method
as_detections
Convert a KeyPoints object to a Detections object. This approximates the bounding box of the detected object by taking the bo
src/supervision/key_points/core.py:1224
↓ 8 callers
Function
detections_to_yolo_annotations
Convert detections to YOLO annotation lines. Args: detections: The detections to serialize. Each detection must have a valid
src/supervision/dataset/formats/yolo.py:296
↓ 8 callers
Function
mask_non_max_suppression
Perform Non-Maximum Suppression (NMS) on segmentation predictions. IoU is computed exactly on the full-resolution masks for both dense and
src/supervision/detection/utils/iou_and_nms.py:832
↓ 8 callers
Function
oriented_box_non_max_suppression
Perform Non-Maximum Suppression on oriented bounding box predictions. Overlap is computed via :func:`oriented_box_iou_batch` on the four
src/supervision/detection/utils/iou_and_nms.py:1238
↓ 8 callers
Method
update_with_detections
Updates the smoother with a new set of detections from a frame. Args: detections: The detections to add to the smoother.
src/supervision/detection/tools/smoother.py:100
↓ 8 callers
Method
with_offset
Return a new :class:`CompactMask` with adjusted offsets and image shape. Used by :class:`~supervision.detection.tools.inference_slicer.Infere
src/supervision/detection/compact_mask.py:1067
↓ 7 callers
Function
_dense_iou
Reference pairwise IoU using the existing dense implementation.
tests/detection/test_compact_mask_iou.py:48
↓ 7 callers
Method
annotate
Annotates the scene with a heatmap based on the provided detections. Args: scene: The image where the heatmap will be dr
src/supervision/annotators/core.py:2155
↓ 7 callers
Method
as_coco
Exports the dataset to COCO format. This method saves the images and their corresponding annotations in COCO format. !!! tip
src/supervision/dataset/core.py:626
↓ 7 callers
Method
from_yolo
Creates a Dataset instance from YOLO formatted data. Args: images_directory_path: The path to the direct
src/supervision/dataset/core.py:442
↓ 7 callers
Method
open
Open the CSV file for writing.
src/supervision/detection/tools/csv_sink.py:100
↓ 7 callers
Function
pillow_to_cv2
Converts Pillow image into OpenCV image, handling RGB -> BGR conversion. Args: image: Pillow image (in RGB format). Returns
src/supervision/utils/conversion.py:148
↓ 7 callers
Function
process_video
Process video frames asynchronously using a threaded pipeline. This function orchestrates a three-stage pipeline to optimize video processin
src/supervision/utils/video.py:283
↓ 7 callers
Function
save_coco_annotations
Save a DetectionDataset to a COCO-format ``annotations.json`` file. Args: dataset: The DetectionDataset to write. annotation_path
src/supervision/dataset/formats/coco.py:507
↓ 7 callers
Method
with_nms
Performs non-max suppression on detection set. Dispatch order: (1) if mask data present, IoU mask is used; (2) else if oriented-box c
src/supervision/detection/core.py:2463
↓ 6 callers
Function
_fmt_ratio
Format a speedup/compression ratio with colour coding. ≥10 → green (large win), 1-10 → yellow (modest win), <1 → red (regression). Integer fo
examples/compact_mask/benchmark.py:926
↓ 6 callers
Method
annotate
Annotates the given scene by pixelating regions based on the provided detections. Args: scene: The image whe
src/supervision/annotators/core.py:2250
↓ 6 callers
Method
annotate
Annotates the given scene with skeleton vertices based on the provided key points. It draws circles at each key point location. Ancho
src/supervision/key_points/annotators.py:51
↓ 6 callers
Method
annotate
Annotates the given scene by drawing lines between specified key points to form edges. Edges where either endpoint is marked as not v
src/supervision/key_points/annotators.py:141
↓ 6 callers
Function
draw_text
Draw text with background on a scene. Args: scene: A numpy ndarray representing the image, typically of shape (H, W, 3)
src/supervision/draw/utils.py:218
↓ 6 callers
Method
from_coco
Creates a Dataset instance from COCO formatted data. Args: images_directory_path: The path to the direct
src/supervision/dataset/core.py:578
↓ 6 callers
Method
from_tensors
Calculate confusion matrix based on predicted and ground-truth detections. Args: predictions: Each element of the list d
src/supervision/metrics/detection.py:322
↓ 6 callers
Function
get_data_item
Retrieve a subset of the data dictionary based on the given index. Args: data: The data dictionary of the Detections object.
src/supervision/detection/utils/internal.py:356
next →
1–100 of 1,714, ranked by callers