supervision-0.21.0
π Timeline
The supervision-0.21.0
release is around the corner. Here is the timeline:
5 Jun 2024 08:00 PM CEST (UTC +2) / 5 Jun 2024 11:00 AM PDT (UTC -7)
- mergedevelop
intomain
- closing listsupervision-0.21.0
features6 Jun 2024 11:00 AM CEST (UTC +2) / 6 Jun 2024 02:00 AM PDT (UTC -7)
- releasesupervision-0.21.0
πͺ΅ Changelog
π Added
sv.Detections.with_nmm
to perform non-maximum merging on the current set of object detections. (#500)
sv.Detections.from_lmm
allowing to parse Large Multimodal Model (LMM) text result intosv.Detections
object. For nowfrom_lmm
supports only PaliGemma result parsing. (#1221)
import supervision as sv
paligemma_result = "<loc0256><loc0256><loc0768><loc0768> cat"
detections = sv.Detections.from_lmm(
sv.LMM.PALIGEMMA,
paligemma_result,
resolution_wh=(1000, 1000),
classes=['cat', 'dog']
)
detections.xyxy
# array([[250., 250., 750., 750.]])
detections.class_id
# array([0])
sv.VertexLabelAnnotator
allowing to annotate every vertex of a keypoint skeleton with custom text and color. (#1236)
import supervision as sv
image = ...
key_points = sv.KeyPoints(...)
LABELS = [
"nose", "left eye", "right eye", "left ear",
"right ear", "left shoulder", "right shoulder", "left elbow",
"right elbow", "left wrist", "right wrist", "left hip",
"right hip", "left knee", "right knee", "left ankle",
"right ankle"
]
COLORS = [
"#FF6347", "#FF6347", "#FF6347", "#FF6347",
"#FF6347", "#FF1493", "#00FF00", "#FF1493",
"#00FF00", "#FF1493", "#00FF00", "#FFD700",
"#00BFFF", "#FFD700", "#00BFFF", "#FFD700",
"#00BFFF"
]
COLORS = [sv.Color.from_hex(color_hex=c) for c in COLORS]
vertex_label_annotator = sv.VertexLabelAnnotator(
color=COLORS,
text_color=sv.Color.BLACK,
border_radius=5
)
annotated_frame = vertex_label_annotator.annotate(
scene=image.copy(),
key_points=key_points,
labels=labels
)
-
sv.KeyPoints.from_inference
andsv.KeyPoints.from_yolo_nas
allowing to createsv.KeyPoints
from Inference and YOLO-NAS result. (#1147 and #1138) -
sv.mask_to_rle
andsv.rle_to_mask
allowing for easy conversion between mask and rle formats. (#1163)
π± Changed
-
sv.InferenceSlicer
allowing to select overlap filtering strategy (NONE
,NON_MAX_SUPPRESSION
andNON_MAX_MERGE
). (#1236) -
sv.InferenceSlicer
adding instance segmentation model support. (#1178)
import cv2
import numpy as np
import supervision as sv
from inference import get_model
model = get_model(model_id="yolov8x-seg-640")
image = cv2.imread(<SOURCE_IMAGE_PATH>)
def callback(image_slice: np.ndarray) -> sv.Detections:
results = model.infer(image_slice)[0]
return sv.Detections.from_inference(results)
slicer = sv.InferenceSlicer(callback = callback)
detections = slicer(image)
mask_annotator = sv.MaskAnnotator()
label_annotator = sv.LabelAnnotator()
annotated_image = mask_annotator.annotate(
scene=image, detections=detections)
annotated_image = label_annotator.annotate(
scene=annotated_image, detections=detections)
sv.LineZone
making it 10-20 times faster, depending on the use case. (#1228)
sv.DetectionDataset.from_coco
andsv.DetectionDataset.as_coco
adding support for run-length encoding (RLE) mask format. (#1163)
π Contributors
@onuralpszr (Onuralp SEZER), @LinasKo (Linas Kondrackis), @rolson24 (Raif Olson), @mario-dg (Mario da Graca), @xaristeidou (Christoforos Aristeidou), @ManzarIMalik (Manzar Iqbal Malik), @tc360950 (Tomasz CΔ kaΕa), @emsko, @SkalskiP (Piotr Skalski)