Skip to content

Commit 6f30c87

Browse files
authored
Merge pull request #392 from roboflow/docs/documentation-refactoring
Refactor documentation structure and improve annotator details
2 parents 410b7eb + 93a8110 commit 6f30c87

File tree

6 files changed

+177
-51
lines changed

6 files changed

+177
-51
lines changed

docs/annotators.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
=== "BoundingBox"
2+
3+
```python
4+
>>> import supervision as sv
5+
6+
>>> image = ...
7+
>>> detections = sv.Detections(...)
8+
9+
>>> bounding_box_annotator = sv.BoundingBoxAnnotator()
10+
>>> annotated_frame = bounding_box_annotator.annotate(
11+
... scene=image.copy(),
12+
... detections=detections
13+
... )
14+
```
15+
16+
<div class="result" markdown>
17+
18+
![bounding-box-annotator-example](https://media.roboflow.com/supervision-annotator-examples/bounding-box-annotator-example.png){ align=center width="800" }
19+
20+
</div>
21+
22+
=== "Mask"
23+
24+
```python
25+
>>> import supervision as sv
26+
27+
>>> image = ...
28+
>>> detections = sv.Detections(...)
29+
30+
>>> mask_annotator = sv.MaskAnnotator()
31+
>>> annotated_frame = mask_annotator.annotate(
32+
... scene=image.copy(),
33+
... detections=detections
34+
... )
35+
```
36+
37+
<div class="result" markdown>
38+
39+
![mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/mask-annotator-example.png){ align=center width="800" }
40+
41+
</div>
42+
43+
=== "Ellipse"
44+
45+
```python
46+
>>> import supervision as sv
47+
48+
>>> image = ...
49+
>>> detections = sv.Detections(...)
50+
51+
>>> ellipse_annotator = sv.EllipseAnnotator()
52+
>>> annotated_frame = ellipse_annotator.annotate(
53+
... scene=image.copy(),
54+
... detections=detections
55+
... )
56+
```
57+
58+
<div class="result" markdown>
59+
60+
![ellipse-annotator-example](https://media.roboflow.com/supervision-annotator-examples/ellipse-annotator-example.png){ align=center width="800" }
61+
62+
</div>
63+
64+
=== "BoxCorner"
65+
66+
```python
67+
>>> import supervision as sv
68+
69+
>>> image = ...
70+
>>> detections = sv.Detections(...)
71+
72+
>>> corner_annotator = sv.BoxCornerAnnotator()
73+
>>> annotated_frame = corner_annotator.annotate(
74+
... scene=image.copy(),
75+
... detections=detections
76+
... )
77+
```
78+
79+
<div class="result" markdown>
80+
81+
![box-corner-annotator-example](https://media.roboflow.com/supervision-annotator-examples/box-corner-annotator-example.png){ align=center width="800" }
82+
83+
</div>
84+
85+
=== "Circle"
86+
87+
```python
88+
>>> import supervision as sv
89+
90+
>>> image = ...
91+
>>> detections = sv.Detections(...)
92+
93+
>>> circle_annotator = sv.CircleAnnotator()
94+
>>> annotated_frame = circle_annotator.annotate(
95+
... scene=image.copy(),
96+
... detections=detections
97+
... )
98+
```
99+
100+
<div class="result" markdown>
101+
102+
![circle-annotator-example](https://media.roboflow.com/supervision-annotator-examples/circle-annotator-example.png){ align=center width="800" }
103+
104+
</div>
105+
106+
=== "Label"
107+
108+
```python
109+
>>> import supervision as sv
110+
111+
>>> image = ...
112+
>>> detections = sv.Detections(...)
113+
114+
>>> label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER)
115+
>>> annotated_frame = label_annotator.annotate(
116+
... scene=image.copy(),
117+
... detections=detections
118+
... )
119+
```
120+
121+
<div class="result" markdown>
122+
123+
![label-annotator-example](https://media.roboflow.com/supervision-annotator-examples/label-annotator-example-2.png){ align=center width="800" }
124+
125+
</div>
126+
127+
## BoundingBoxAnnotator
128+
129+
:::supervision.annotators.core.BoundingBoxAnnotator
130+
131+
## MaskAnnotator
132+
133+
:::supervision.annotators.core.MaskAnnotator
134+
135+
## EllipseAnnotator
136+
137+
:::supervision.annotators.core.EllipseAnnotator
138+
139+
## BoxCornerAnnotator
140+
141+
:::supervision.annotators.core.BoxCornerAnnotator
142+
143+
## CircleAnnotator
144+
145+
:::supervision.annotators.core.CircleAnnotator
146+
147+
## LabelAnnotator
148+
149+
:::supervision.annotators.core.LabelAnnotator
File renamed without changes.

docs/detection/annotate.md

Lines changed: 0 additions & 23 deletions
This file was deleted.
File renamed without changes.

mkdocs.yml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,27 @@ nav:
2828
- Home: index.md
2929
- Quickstart:
3030
- Detections: quickstart/detections.md
31-
- API reference:
32-
- Classifications:
33-
- Core: classification/core.md
34-
- Detections:
35-
- Core: detection/core.md
36-
- Annotate: detection/annotate.md
37-
- Utils: detection/utils.md
38-
- Tools:
39-
- Polygon Zone: detection/tools/polygon_zone.md
40-
- Inference Slicer: detection/tools/inference_slicer.md
41-
- Trackers:
42-
- Core: tracker/core.md
43-
- Dataset:
44-
- Core: dataset/core.md
45-
- Metrics:
46-
- Detection Models: metrics/detection.md
47-
- Draw:
48-
- Utils: draw/utils.md
49-
- Utils:
50-
- Video: utils/video.md
51-
- Image: utils/image.md
52-
- Notebook: utils/notebook.md
53-
- File: utils/file.md
31+
- Classifications:
32+
- Core: classification/core.md
33+
- Detections:
34+
- Core: detection/core.md
35+
- Annotate: detection/annotate.md
36+
- Utils: detection/utils.md
37+
- Tools:
38+
- Polygon Zone: detection/tools/polygon_zone.md
39+
- Inference Slicer: detection/tools/inference_slicer.md
40+
- Annotators: annotators.md
41+
- Trackers: trackers.md
42+
- Datasets: datasets.md
43+
- Metrics:
44+
- Object Detection: metrics/detection.md
45+
- Draw:
46+
- Utils: draw/utils.md
47+
- Utils:
48+
- Video: utils/video.md
49+
- Image: utils/image.md
50+
- Notebook: utils/notebook.md
51+
- File: utils/file.md
5452
- Changelog: changelog.md
5553

5654
theme:

supervision/annotators/core.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,13 +346,15 @@ def annotate(
346346
detections: Detections,
347347
) -> np.ndarray:
348348
"""
349-
Draws circle on the frame using the detections provided.
349+
Annotates the given scene with circles based on the provided detections.
350+
350351
Args:
351-
scene (np.ndarray): The image on which the circle will be drawn
352-
detections (Detections): The detections for which the
353-
circle will be drawn
352+
scene (np.ndarray): The image where box corners will be drawn.
353+
detections (Detections): Object detections to annotate.
354+
354355
Returns:
355-
np.ndarray: The image with the circle drawn on it
356+
np.ndarray: The annotated image.
357+
356358
Example:
357359
```python
358360
>>> import supervision as sv

0 commit comments

Comments
 (0)