|
| 1 | +### 0.23.0 <small>Aug 28, 2024</small> |
| 2 | + |
| 3 | +- Added [#930](https://github.com/roboflow/supervision/pull/930): `IconAnnotator`, a [new annotator](https://supervision.roboflow.com/latest/detection/annotators/#supervision.annotators.core.IconAnnotator) that allows drawing icons on each detection. Useful if you want to draw a specific icon for each class. |
| 4 | + |
| 5 | +```python |
| 6 | +import supervision as sv |
| 7 | +from inference import get_model |
| 8 | + |
| 9 | +image = <SOURCE_IMAGE_PATH> |
| 10 | +icon_dog = <DOG_PNG_PATH> |
| 11 | +icon_cat = <CAT_PNG_PATH> |
| 12 | + |
| 13 | +model = get_model(model_id="yolov8n-640") |
| 14 | +results = model.infer(image)[0] |
| 15 | +detections = sv.Detections.from_inference(results) |
| 16 | + |
| 17 | +icon_paths = [] |
| 18 | +for class_name in detections.data["class_name"]: |
| 19 | + if class_name == "dog": |
| 20 | + icon_paths.append(icon_dog) |
| 21 | + elif class_name == "cat": |
| 22 | + icon_paths.append(icon_cat) |
| 23 | + else: |
| 24 | + icon_paths.append("") |
| 25 | + |
| 26 | +icon_annotator = sv.IconAnnotator() |
| 27 | +annotated_frame = icon_annotator.annotate( |
| 28 | + scene=image.copy(), |
| 29 | + detections=detections, |
| 30 | + icon_path=icon_paths |
| 31 | +) |
| 32 | +``` |
| 33 | + |
| 34 | +- Added [#1385](https://github.com/roboflow/supervision/pull/1385): [`BackgroundColorAnnotator`](https://supervision.roboflow.com/latest/detection/annotators/#supervision.annotators.core.BackgroundColorAnnotator), that draws an overlay on the background images of the detections. |
| 35 | + |
| 36 | +```python |
| 37 | +import supervision as sv |
| 38 | +from inference import get_model |
| 39 | + |
| 40 | +image = <SOURCE_IMAGE_PATH> |
| 41 | + |
| 42 | +model = get_model(model_id="yolov8n-640") |
| 43 | +results = model.infer(image)[0] |
| 44 | +detections = sv.Detections.from_inference(results) |
| 45 | + |
| 46 | +background_overlay_annotator = sv.BackgroundOverlayAnnotator() |
| 47 | +annotated_frame = background_overlay_annotator.annotate( |
| 48 | + scene=image.copy(), |
| 49 | + detections=detections |
| 50 | +) |
| 51 | +``` |
| 52 | + |
| 53 | +- Added [#1386](https://github.com/roboflow/supervision/pull/1386): Support for Transformers v5 functions in [`sv.Detections.from_transformers`](https://supervision.roboflow.com/latest/detection/core/#supervision.detection.core.Detections.from_transformers). This includes the `DetrImageProcessor` methods `post_process_object_detection`, `post_process_panoptic_segmentation`, `post_process_semantic_segmentation`, and `post_process_instance_segmentation`. |
| 54 | + |
| 55 | +```python |
| 56 | +import torch |
| 57 | +import supervision as sv |
| 58 | +from PIL import Image |
| 59 | +from transformers import DetrImageProcessor, DetrForObjectDetection |
| 60 | + |
| 61 | +processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50") |
| 62 | +model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50") |
| 63 | + |
| 64 | +image = Image.open(<SOURCE_IMAGE_PATH>) |
| 65 | +inputs = processor(images=image, return_tensors="pt") |
| 66 | + |
| 67 | +with torch.no_grad(): |
| 68 | + outputs = model(**inputs) |
| 69 | + |
| 70 | +width, height = image.size |
| 71 | +target_size = torch.tensor([[height, width]]) |
| 72 | +results = processor.post_process_object_detection( |
| 73 | + outputs=outputs, target_sizes=target_size)[0] |
| 74 | +detections = sv.Detections.from_transformers( |
| 75 | + transformers_results=results, |
| 76 | + id2label=model.config.id2label) |
| 77 | +``` |
| 78 | + |
| 79 | +- Added [#1354](https://github.com/roboflow/supervision/pull/1354): Ultralytics SAM (Segment Anything Model) support in [`sv.Detections.from_ultralytics`](https://supervision.roboflow.com/latest/detection/core/#supervision.detection.core.Detections.from_ultralytics). [SAM2](https://sam2.metademolab.com/) was released during this update, and is already supported via [`sv.Detections.from_sam`](https://supervision.roboflow.com/latest/detection/core/#supervision.detection.core.Detections.from_sam). |
| 80 | + |
| 81 | +```python |
| 82 | +import supervision as sv |
| 83 | +from segment_anything import ( |
| 84 | + sam_model_registry, |
| 85 | + SamAutomaticMaskGenerator |
| 86 | +) |
| 87 | + |
| 88 | +sam_model_reg = sam_model_registry[MODEL_TYPE] |
| 89 | +sam = sam_model_reg(checkpoint=CHECKPOINT_PATH).to(device=DEVICE) |
| 90 | +mask_generator = SamAutomaticMaskGenerator(sam) |
| 91 | +sam_result = mask_generator.generate(IMAGE) |
| 92 | +detections = sv.Detections.from_sam(sam_result=sam_result) |
| 93 | +``` |
| 94 | + |
| 95 | +- Added [#1458](https://github.com/roboflow/supervision/pull/1458): `outline_color` options for [`TriangleAnnotator`](https://supervision.roboflow.com/latest/detection/annotators/#supervision.annotators.core.TriangleAnnotator) and [`DotAnnotator`](https://supervision.roboflow.com/latest/detection/annotators/#supervision.annotators.core.DotAnnotator). |
| 96 | + |
| 97 | +- Added [#1409](https://github.com/roboflow/supervision/pull/1409): `text_color` option for [`VertexLabelAnnotator`](https://supervision.roboflow.com/latest/keypoint/annotators/#supervision.keypoint.annotators.VertexLabelAnnotator) keypoint annotator. |
| 98 | + |
| 99 | +- Changed [#1434](https://github.com/roboflow/supervision/pull/1434): [`InferenceSlicer`](https://supervision.roboflow.com/latest/detection/tools/inference_slicer/) now features an `overlap_ratio_wh` parameter, making it easier to compute slice sizes when handling overlapping slices. |
| 100 | + |
| 101 | +- Fix [#1448](https://github.com/roboflow/supervision/pull/1448): Various annotator type issues have been resolved, supporting expanded error handling. |
| 102 | + |
| 103 | +- Fix [#1348](https://github.com/roboflow/supervision/pull/1348): Introduced a new method for [seeking to a specific video frame](https://supervision.roboflow.com/latest/utils/video/#supervision.utils.video.get_video_frames_generator), addressing cases where traditional seek methods were failing. It can be enabled with `iterative_seek=True`. |
| 104 | + |
| 105 | +```python |
| 106 | +import supervision as sv |
| 107 | + |
| 108 | +for frame in sv.get_video_frames_generator( |
| 109 | + source_path=<SOURCE_VIDEO_PATH>, |
| 110 | + start=60, |
| 111 | + iterative_seek=True |
| 112 | +): |
| 113 | + ... |
| 114 | +``` |
| 115 | + |
| 116 | +- Fix [#1424](https://github.com/roboflow/supervision/pull/1424): `plot_image` function now clearly indicates that the size is in inches. |
| 117 | + |
| 118 | +!!! failure "Removed" |
| 119 | + |
| 120 | + The `track_buffer`, `track_thresh`, and `match_thresh` parameters in [`ByteTrack`](trackers.md/#supervision.tracker.byte_tracker.core.ByteTrack) are deprecated and were removed as of `supervision-0.23.0`. Use `lost_track_buffer,` `track_activation_threshold`, and `minimum_matching_threshold` instead. |
| 121 | + |
| 122 | +!!! failure "Removed" |
| 123 | + |
| 124 | + The `triggering_position ` parameter in [`sv.PolygonZone`](detection/tools/polygon_zone.md/#supervision.detection.tools.polygon_zone.PolygonZone) was removed as of `supervision-0.23.0`. Use `triggering_anchors ` instead. |
| 125 | + |
| 126 | +!!! failure "Deprecated" |
| 127 | + |
| 128 | + `overlap_filter_strategy` in `InferenceSlicer.__init__` is deprecated and will be removed in `supervision-0.27.0`. Use `overlap_strategy` instead. |
| 129 | + |
| 130 | +!!! failure "Deprecated" |
| 131 | + |
| 132 | + `overlap_ratio_wh` in `InferenceSlicer.__init__` is deprecated and will be removed in `supervision-0.27.0`. Use `overlap_wh` instead. |
| 133 | + |
1 | 134 | ### 0.22.0 <small>Jul 12, 2024</small>
|
2 | 135 |
|
3 | 136 | - Added [#1326](https://github.com/roboflow/supervision/pull/1326): [`sv.DetectionsDataset`](https://supervision.roboflow.com/latest/datasets/core/#supervision.dataset.core.DetectionDataset) and [`sv.ClassificationDataset`](https://supervision.roboflow.com/latest/datasets/core/#supervision.dataset.core.ClassificationDataset) allowing to load the images into memory only when necessary (lazy loading).
|
@@ -360,7 +493,7 @@ annotated_frame = crop_annotator.annotate(
|
360 | 493 |
|
361 | 494 | !!! failure "Deprecated"
|
362 | 495 |
|
363 |
| - The `track_buffer`, `track_thresh`, and `match_thresh` parameters in `sv.ByterTrack` are deprecated and will be removed in `supervision-0.23.0`. Use `lost_track_buffer,` `track_activation_threshold`, and `minimum_matching_threshold` instead. |
| 496 | + The `track_buffer`, `track_thresh`, and `match_thresh` parameters in `sv.ByteTrack` are deprecated and will be removed in `supervision-0.23.0`. Use `lost_track_buffer,` `track_activation_threshold`, and `minimum_matching_threshold` instead. |
364 | 497 |
|
365 | 498 | - Changed [#910](https://github.com/roboflow/supervision/pull/910): [`sv.PolygonZone`](/0.19.0/detection/tools/polygon_zone/#supervision.detection.tools.polygon_zone.PolygonZone) to now accept a list of specific box anchors that must be in zone for a detection to be counted.
|
366 | 499 |
|
|
0 commit comments