2024-01-17 12:11:31 +01:00
|
|
|
---
|
|
|
|
|
comments: true
|
|
|
|
|
---
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
# Annotators
|
|
|
|
|
|
2024-10-03 11:45:41 -07:00
|
|
|
Annotators accept detections and apply box or mask visualizations to the detections. Annotators have many available styles.
|
|
|
|
|
|
2024-07-12 18:18:50 +03:00
|
|
|
=== "Box"
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
```python
|
2024-01-24 12:50:23 +03:00
|
|
|
import supervision as sv
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-24 12:50:23 +03:00
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-07-12 18:18:50 +03:00
|
|
|
box_annotator = sv.BoxAnnotator()
|
|
|
|
|
annotated_frame = box_annotator.annotate(
|
2024-01-20 14:19:06 +05:30
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-24 12:50:23 +03:00
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2023-10-09 16:15:35 +02:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
=== "RoundBox"
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
```python
|
|
|
|
|
import supervision as sv
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
round_box_annotator = sv.RoundBoxAnnotator()
|
|
|
|
|
annotated_frame = round_box_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2025-07-16 01:04:51 +02:00
|
|
|
)
|
|
|
|
|
```
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
<div class="result" markdown>
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
{ align=center width="800" }
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2025-07-16 01:04:51 +02:00
|
|
|
</div>
|
2024-01-05 22:59:29 +03:00
|
|
|
|
2023-10-06 20:51:31 +02:00
|
|
|
=== "BoxCorner"
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
corner_annotator = sv.BoxCornerAnnotator()
|
|
|
|
|
annotated_frame = corner_annotator.annotate(
|
2024-01-24 12:50:23 +03:00
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-24 12:50:23 +03:00
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2023-10-09 16:15:35 +02:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-12-05 10:42:05 +00:00
|
|
|
=== "Color"
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
color_annotator = sv.ColorAnnotator()
|
|
|
|
|
annotated_frame = color_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2023-10-09 16:15:35 +02:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-10-06 20:51:31 +02:00
|
|
|
=== "Circle"
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
circle_annotator = sv.CircleAnnotator()
|
|
|
|
|
annotated_frame = circle_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2023-10-09 16:15:35 +02:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-10-18 18:53:39 +02:00
|
|
|
=== "Dot"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-18 18:53:39 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-18 18:53:39 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
dot_annotator = sv.DotAnnotator()
|
|
|
|
|
annotated_frame = dot_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-18 18:53:39 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2024-01-22 21:52:56 +03:00
|
|
|
{ align=center width="800" }
|
2023-10-18 18:53:39 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-12-06 13:59:05 +01:00
|
|
|
=== "Triangle"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-12-06 13:59:05 +01:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-12-06 13:59:05 +01:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
triangle_annotator = sv.TriangleAnnotator()
|
|
|
|
|
annotated_frame = triangle_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-12-06 13:59:05 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
|
|
|
|
{ align=center width="800" }
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-10-06 20:51:31 +02:00
|
|
|
=== "Ellipse"
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
ellipse_annotator = sv.EllipseAnnotator()
|
|
|
|
|
annotated_frame = ellipse_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2023-10-09 16:15:35 +02:00
|
|
|
{ align=center width="800" }
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
=== "Halo"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-09 16:15:35 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-09 16:15:35 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
halo_annotator = sv.HaloAnnotator()
|
|
|
|
|
annotated_frame = halo_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-09 16:15:35 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2024-01-22 21:52:56 +03:00
|
|
|
{ align=center width="800" }
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
=== "PercentageBar"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-24 15:40:08 +03:00
|
|
|
import supervision as sv
|
2024-01-22 21:52:56 +03:00
|
|
|
|
2024-01-24 15:40:08 +03:00
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2024-01-22 21:52:56 +03:00
|
|
|
|
2024-01-24 15:40:08 +03:00
|
|
|
percentage_bar_annotator = sv.PercentageBarAnnotator()
|
|
|
|
|
annotated_frame = percentage_bar_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-24 15:40:08 +03:00
|
|
|
)
|
2024-01-22 21:52:56 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
|
|
|
|
{ align=center width="800" }
|
2023-10-06 20:51:31 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
=== "Mask"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-06 20:51:31 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-06 20:51:31 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
mask_annotator = sv.MaskAnnotator()
|
|
|
|
|
annotated_frame = mask_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-06 20:51:31 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-11-15 17:49:17 +01:00
|
|
|
=== "Polygon"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-11-15 17:49:17 +01:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-11-15 17:49:17 +01:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
polygon_annotator = sv.PolygonAnnotator()
|
|
|
|
|
annotated_frame = polygon_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-11-15 17:49:17 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-11-15 17:49:17 +01:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-10-03 11:38:28 +02:00
|
|
|
=== "Label"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-03-25 15:01:59 +01:00
|
|
|
import supervision as sv
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-03-25 15:01:59 +01:00
|
|
|
labels = [
|
|
|
|
|
f"{class_name} {confidence:.2f}"
|
2026-02-03 22:00:40 +09:00
|
|
|
for class_name, confidence in zip(
|
|
|
|
|
detections["class_name"],
|
|
|
|
|
detections.confidence,
|
|
|
|
|
)
|
2024-03-25 15:01:59 +01:00
|
|
|
]
|
|
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER)
|
|
|
|
|
annotated_frame = label_annotator.annotate(
|
2026-02-03 22:00:40 +09:00
|
|
|
scene=image.copy(), detections=detections, labels=labels
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-05-15 18:35:36 +03:00
|
|
|
=== "RichLabel"
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
import supervision as sv
|
|
|
|
|
|
|
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
|
|
|
|
|
|
|
|
|
labels = [
|
|
|
|
|
f"{class_name} {confidence:.2f}"
|
2026-02-03 22:00:40 +09:00
|
|
|
for class_name, confidence in zip(
|
|
|
|
|
detections["class_name"],
|
|
|
|
|
detections.confidence,
|
|
|
|
|
)
|
2024-05-15 18:35:36 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
rich_label_annotator = sv.RichLabelAnnotator(
|
2026-02-03 22:00:40 +09:00
|
|
|
font_path="TTF_FONT_PATH",
|
|
|
|
|
text_position=sv.Position.CENTER,
|
2024-05-15 18:35:36 +03:00
|
|
|
)
|
2024-07-24 17:37:00 +05:30
|
|
|
annotated_frame = rich_label_annotator.annotate(
|
2024-05-15 18:35:36 +03:00
|
|
|
scene=image.copy(),
|
|
|
|
|
detections=detections,
|
2026-02-03 22:00:40 +09:00
|
|
|
labels=labels,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-10-03 11:38:28 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-08-26 23:53:54 +03:00
|
|
|
=== "Icon"
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
import supervision as sv
|
|
|
|
|
|
|
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
|
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
icon_paths = ["<ICON_PATH>" for _ in detections]
|
2024-08-26 23:53:54 +03:00
|
|
|
|
|
|
|
|
icon_annotator = sv.IconAnnotator()
|
|
|
|
|
annotated_frame = icon_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
|
|
|
|
detections=detections,
|
2026-02-03 22:00:40 +09:00
|
|
|
icon_path=icon_paths,
|
2024-08-26 23:53:54 +03:00
|
|
|
)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2024-08-26 23:53:54 +03:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-12-11 16:58:36 +02:00
|
|
|
<!-- === "Crop"
|
2024-03-14 14:43:19 +01:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
```python
|
|
|
|
|
import supervision as sv
|
2024-03-14 14:43:19 +01:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2024-03-14 14:43:19 +01:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
crop_annotator = sv.CropAnnotator()
|
|
|
|
|
annotated_frame = crop_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
|
|
|
|
detections=detections,
|
|
|
|
|
)
|
|
|
|
|
```
|
2024-12-11 18:09:31 +02:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
|
|
|
|
{ align=center width="800" }
|
|
|
|
|
|
|
|
|
|
</div>
|
2024-12-11 18:09:31 +02:00
|
|
|
|
2024-12-11 16:58:36 +02:00
|
|
|
-->
|
2024-03-14 14:43:19 +01:00
|
|
|
|
2023-10-04 23:50:47 +02:00
|
|
|
=== "Blur"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-10-04 23:50:47 +02:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-10-04 23:50:47 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
blur_annotator = sv.BlurAnnotator()
|
2026-02-03 22:00:40 +09:00
|
|
|
annotated_frame = (blur_annotator.annotate(scene=image.copy(), detections=detections),)
|
2023-10-04 23:50:47 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-10-04 23:50:47 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-12-05 12:03:59 +01:00
|
|
|
=== "Pixelate"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
2023-12-05 12:03:59 +01:00
|
|
|
|
2024-01-21 12:06:10 +05:30
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
2023-12-05 12:03:59 +01:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
pixelate_annotator = sv.PixelateAnnotator()
|
|
|
|
|
annotated_frame = pixelate_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-01-20 14:19:06 +05:30
|
|
|
)
|
2023-12-05 12:03:59 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-12-05 12:03:59 +01:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-10-04 15:35:07 +02:00
|
|
|
=== "Trace"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
|
|
|
|
from ultralytics import YOLO
|
|
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
model = YOLO("yolov8x.pt")
|
2024-01-20 14:19:06 +05:30
|
|
|
|
|
|
|
|
trace_annotator = sv.TraceAnnotator()
|
|
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
video_info = sv.VideoInfo.from_video_path(video_path="...")
|
|
|
|
|
frames_generator = sv.get_video_frames_generator(source_path="...")
|
2024-01-20 14:19:06 +05:30
|
|
|
tracker = sv.ByteTrack()
|
|
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
with sv.VideoSink(target_path="...", video_info=video_info) as sink:
|
2024-01-20 14:19:06 +05:30
|
|
|
for frame in frames_generator:
|
|
|
|
|
result = model(frame)[0]
|
|
|
|
|
detections = sv.Detections.from_ultralytics(result)
|
|
|
|
|
detections = tracker.update_with_detections(detections)
|
|
|
|
|
annotated_frame = trace_annotator.annotate(
|
|
|
|
|
scene=frame.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
|
|
|
|
)
|
2024-01-20 14:19:06 +05:30
|
|
|
sink.write_frame(frame=annotated_frame)
|
2023-10-18 21:25:44 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-10-18 21:25:44 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
=== "HeatMap"
|
|
|
|
|
|
|
|
|
|
```python
|
2024-01-20 14:19:06 +05:30
|
|
|
import supervision as sv
|
|
|
|
|
from ultralytics import YOLO
|
2023-10-18 21:25:44 +02:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
model = YOLO("yolov8x.pt")
|
2023-10-18 21:25:44 +02:00
|
|
|
|
2024-01-20 14:19:06 +05:30
|
|
|
heat_map_annotator = sv.HeatMapAnnotator()
|
2023-10-18 21:25:44 +02:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
video_info = sv.VideoInfo.from_video_path(video_path="...")
|
|
|
|
|
frames_generator = sv.get_video_frames_generator(source_path="...")
|
2023-10-18 21:25:44 +02:00
|
|
|
|
2026-02-03 22:00:40 +09:00
|
|
|
with sv.VideoSink(target_path="...", video_info=video_info) as sink:
|
2024-01-20 14:19:06 +05:30
|
|
|
for frame in frames_generator:
|
|
|
|
|
result = model(frame)[0]
|
|
|
|
|
detections = sv.Detections.from_ultralytics(result)
|
|
|
|
|
annotated_frame = heat_map_annotator.annotate(
|
|
|
|
|
scene=frame.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
|
|
|
|
)
|
2024-01-20 14:19:06 +05:30
|
|
|
sink.write_frame(frame=annotated_frame)
|
2023-10-04 15:35:07 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2023-10-04 15:35:07 +02:00
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-08-07 09:21:16 +01:00
|
|
|
=== "Background Color"
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
import supervision as sv
|
|
|
|
|
|
|
|
|
|
image = ...
|
|
|
|
|
detections = sv.Detections(...)
|
|
|
|
|
|
2024-08-07 16:39:22 +03:00
|
|
|
background_overlay_annotator = sv.BackgroundOverlayAnnotator()
|
|
|
|
|
annotated_frame = background_overlay_annotator.annotate(
|
2024-08-07 09:21:16 +01:00
|
|
|
scene=image.copy(),
|
2026-02-03 22:00:40 +09:00
|
|
|
detections=detections,
|
2024-08-07 09:21:16 +01:00
|
|
|
)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2024-12-11 16:58:36 +02:00
|
|
|
{ align=center width="800" }
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
=== "Comparison"
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
import supervision as sv
|
|
|
|
|
|
|
|
|
|
image = ...
|
|
|
|
|
detections_1 = sv.Detections(...)
|
|
|
|
|
detections_2 = sv.Detections(...)
|
|
|
|
|
|
|
|
|
|
comparison_annotator = sv.ComparisonAnnotator()
|
|
|
|
|
annotated_frame = comparison_annotator.annotate(
|
|
|
|
|
scene=image.copy(),
|
|
|
|
|
detections_1=detections_1,
|
2026-02-03 22:00:40 +09:00
|
|
|
detections_2=detections_2,
|
2024-12-11 16:58:36 +02:00
|
|
|
)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<div class="result" markdown>
|
|
|
|
|
|
2026-02-03 01:01:19 +09:00
|
|
|
{ align=center width="800" }
|
2024-08-07 17:29:01 +03:00
|
|
|
|
2024-08-07 09:21:16 +01:00
|
|
|
</div>
|
|
|
|
|
|
2024-10-02 21:09:58 -03:00
|
|
|
<div class="md-typeset">
|
2024-10-03 13:29:14 -07:00
|
|
|
<h2>Try Supervision Annotators on your own image</h2>
|
|
|
|
|
Visualize annotators on images with COCO classes such as people, vehicles, animals, household items.
|
2024-10-02 21:09:58 -03:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style="height: 400px; width: 100%; border-radius: 8px; overflow: hidden;"><iframe src="https://app.roboflow.com/workflows/embed/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ3b3JrZmxvd0lkIjoiNDdtd2xuWW16S25VNWtOYUZjMG8iLCJ3b3Jrc3BhY2VJZCI6ImtyT1RBYm5jRmhvUU1DZExPbGU0IiwidXNlcklkIjoiRVJNUFBZY3FQMmZWWjB1NkRpNXZaYXJDdlZPMiIsImlhdCI6MTcyNjgzOTM2N30.gj2F6SnmmURAScJe4PTC1raUXsAK5mZyrUIGIJ44NhM?hideToolbar=true&hideHeader=true&defaultVisual=true" loading="lazy" title="Roboflow Workflow for Supervision Annotators" style="width: 100%; height: 100%; min-height: 400px; border: none;"></iframe></div>
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-07-12 18:18:50 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.BoxAnnotator">BoxAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-07-12 18:18:50 +03:00
|
|
|
:::supervision.annotators.core.BoxAnnotator
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.RoundBoxAnnotator">RoundBoxAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2024-01-22 21:52:56 +03:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.RoundBoxAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.BoxCornerAnnotator">BoxCornerAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.BoxCornerAnnotator
|
2024-01-23 21:07:09 +03:00
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.OrientedBoxAnnotator">OrientedBoxAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2024-01-23 21:07:09 +03:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.OrientedBoxAnnotator
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.ColorAnnotator">ColorAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-06 20:51:31 +02:00
|
|
|
|
2023-12-05 10:38:32 +00:00
|
|
|
:::supervision.annotators.core.ColorAnnotator
|
2023-10-06 20:51:31 +02:00
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.CircleAnnotator">CircleAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-03 11:38:28 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.CircleAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.DotAnnotator">DotAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-18 18:53:39 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.DotAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.TriangleAnnotator">TriangleAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-12-06 13:59:05 +01:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.TriangleAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.EllipseAnnotator">EllipseAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-03 11:38:28 +02:00
|
|
|
|
2023-10-06 20:51:31 +02:00
|
|
|
:::supervision.annotators.core.EllipseAnnotator
|
2023-10-04 15:35:07 +02:00
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.HaloAnnotator">HaloAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-09 16:15:35 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.HaloAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.PercentageBarAnnotator">PercentageBarAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2024-01-22 21:52:56 +03:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.PercentageBarAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.HeatMapAnnotator">HeatMapAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-18 21:25:44 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.HeatMapAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.MaskAnnotator">MaskAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-04 15:35:07 +02:00
|
|
|
|
2023-10-06 20:51:31 +02:00
|
|
|
:::supervision.annotators.core.MaskAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.PolygonAnnotator">PolygonAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-11-15 17:09:27 +01:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.PolygonAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.LabelAnnotator">LabelAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-06 20:51:31 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.LabelAnnotator
|
2023-10-04 23:50:47 +02:00
|
|
|
|
2024-05-15 18:35:36 +03:00
|
|
|
<div class="md-typeset">
|
|
|
|
|
<h2><a href="#supervision.annotators.core.RichLabelAnnotator">RichLabelAnnotator</a></h2>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
:::supervision.annotators.core.RichLabelAnnotator
|
|
|
|
|
|
2024-08-15 11:38:13 +03:00
|
|
|
<div class="md-typeset">
|
|
|
|
|
<h2><a href="#supervision.annotators.core.IconAnnotator">IconAnnotator</a></h2>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
:::supervision.annotators.core.IconAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.BlurAnnotator">BlurAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-04 23:50:47 +02:00
|
|
|
|
2023-10-04 21:52:49 +00:00
|
|
|
:::supervision.annotators.core.BlurAnnotator
|
2023-10-06 20:51:31 +02:00
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.PixelateAnnotator">PixelateAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-12-05 12:03:59 +01:00
|
|
|
|
|
|
|
|
:::supervision.annotators.core.PixelateAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.TraceAnnotator">TraceAnnotator</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-06 20:51:31 +02:00
|
|
|
|
2023-10-06 18:52:00 +00:00
|
|
|
:::supervision.annotators.core.TraceAnnotator
|
2023-10-18 18:53:39 +02:00
|
|
|
|
2024-02-22 19:52:51 +02:00
|
|
|
<div class="md-typeset">
|
2024-03-14 14:43:19 +01:00
|
|
|
<h2><a href="#supervision.annotators.core.CropAnnotator">CropAnnotator</a></h2>
|
2024-02-22 19:52:51 +02:00
|
|
|
</div>
|
|
|
|
|
|
2024-03-14 14:43:19 +01:00
|
|
|
:::supervision.annotators.core.CropAnnotator
|
|
|
|
|
|
2024-08-07 09:21:16 +01:00
|
|
|
<div class="md-typeset">
|
2024-08-07 16:39:22 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.BackgroundOverlayAnnotator">BackgroundOverlayAnnotator</a></h2>
|
2024-08-07 09:21:16 +01:00
|
|
|
</div>
|
|
|
|
|
|
2024-08-07 16:39:22 +03:00
|
|
|
:::supervision.annotators.core.BackgroundOverlayAnnotator
|
2024-02-22 19:52:51 +02:00
|
|
|
|
2024-12-11 16:58:36 +02:00
|
|
|
<div class="md-typeset">
|
|
|
|
|
<h2><a href="#supervision.annotators.core.ComparisonAnnotator">ComparisonAnnotator</a></h2>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
:::supervision.annotators.core.ComparisonAnnotator
|
|
|
|
|
|
2024-01-31 15:56:08 +03:00
|
|
|
<div class="md-typeset">
|
2024-02-01 20:23:11 +03:00
|
|
|
<h2><a href="#supervision.annotators.core.ColorLookup">ColorLookup</a></h2>
|
2024-01-31 15:56:08 +03:00
|
|
|
</div>
|
2023-10-18 18:53:39 +02:00
|
|
|
|
|
|
|
|
:::supervision.annotators.utils.ColorLookup
|