supervision-0.22.0
π Added
sv.KeyPoints.from_mediapipe
adding support for Mediapipe keypoint models (both legacy and modern), along with default visualizers for face and body pose keypoints. (#1232, #1316)
import numpy as np
import mediapipe as mp
import supervision as sv
from PIL import Image
model = mp.solutions.face_mesh.FaceMesh()
edge_annotator = sv.EdgeAnnotator(color=sv.Color.BLACK, thickness=2)
image = Image.open(<PATH_TO_IMAGE>).convert('RGB')
results = model.process(np.array(image))
key_points = sv.KeyPoints.from_mediapipe(results, resolution_wh=image.size)
annotated_image = edge_annotator.annotate(scene=image, key_points=key_points)
IMG_1777-result-refined-optimized.mp4
-
sv.KeyPoints.from_detectron2
andsv.Detections.from_detectron2
extending support for Detectron2 models. (#1310, #1300) -
sv.RichLabelAnnotator
allowing to draw unicode characters (e.g. from non-latin languages), as long as you provide a compatible font. (#1277)
rich-label-annotator-2.mp4
π± Changed
sv.DetectionsDataset
andsv.ClassificationDataset
allowing to load the images into memory only when necessary (lazy loading). (#1326)
import roboflow
from roboflow import Roboflow
import supervision as sv
roboflow.login()
rf = Roboflow()
project = rf.workspace(<WORKSPACE_ID>).project(<PROJECT_ID>)
dataset = project.version(<PROJECT_VERSION>).download("coco")
ds_train = sv.DetectionDataset.from_coco(
images_directory_path=f"{dataset.location}/train",
annotations_path=f"{dataset.location}/train/_annotations.coco.json",
)
path, image, annotation = ds_train[0]
# loads image on demand
for path, image, annotation in ds_train:
# loads image on demand
sv.Detections.from_lmm
allowing to parse Florence-2 text result intosv.Detections
object. (#1296)
sv.DotAnnotator
andsv.TriangleAnnotator
allowing to add marker outlines. (#1294)
π οΈ Fixed
sv.ColorAnnotator
andsv.CropAnnotator
buggy behaviours. (#1277, #1312)
π§βπ³ Cookbooks
This release, @onuralpszr added two new Cookbooks to our collection. Check them out to learn how to save Detections
to a file and convert it back to Detections
!
π Contributors
@onuralpszr (Onuralp SEZER), @David-rn (David RedΓ³), @jeslinpjames (Jeslin P James), @Bhavay-2001 (Bhavay Malhotra), @hardikdava (Hardik Dava), @kirilman, @dsaha21 (Dripto Saha), @cdragos (Dragos Catarahia), @mqasim41 (Muhammad Qasim), @SkalskiP (Piotr Skalski), @LinasKo (Linas Kondrackis)
Special thanks to @rolson24 (Raif Olson) for helping the community with ByteTrack
!