Skip to content

Commit

Permalink
Add ComparisonAnnotator docs, remove Crop & RoundBox annotator from p…
Browse files Browse the repository at this point in the history
…review

* Up to 20 tabs can be made at once. This is likely a bug relating to the underlying mkdocs plugin, but a quick check for hardcoded values yielded nothing.
  • Loading branch information
LinasKo committed Dec 11, 2024
1 parent 4c88e03 commit 001f85a
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 36 deletions.
112 changes: 77 additions & 35 deletions docs/detection/annotators.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,28 @@ Annotators accept detections and apply box or mask visualizations to the detecti

</div>

=== "RoundBox"
<!--
=== "RoundBox"

```python
import supervision as sv
```python
import supervision as sv

image = ...
detections = sv.Detections(...)
image = ...
detections = sv.Detections(...)

round_box_annotator = sv.RoundBoxAnnotator()
annotated_frame = round_box_annotator.annotate(
scene=image.copy(),
detections=detections
)
```
round_box_annotator = sv.RoundBoxAnnotator()
annotated_frame = round_box_annotator.annotate(
scene=image.copy(),
detections=detections
)
```

<div class="result" markdown>
<div class="result" markdown>

![round-box-annotator-example](https://media.roboflow.com/supervision-annotator-examples/round-box-annotator-example-purple.png){ align=center width="800" }
![round-box-annotator-example](https://media.roboflow.com/supervision-annotator-examples/round-box-annotator-example-purple.png){ align=center width="800" }

</div>
</div>
-->

=== "BoxCorner"

Expand Down Expand Up @@ -234,7 +236,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/mask-annotator-example-purple.png){ align=center width="800" }
![mask-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
mask-annotator-example-purple.png){ align=center width="800" }

</div>

Expand All @@ -255,7 +258,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![polygon-annotator-example](https://media.roboflow.com/supervision-annotator-examples/polygon-annotator-example-purple.png){ align=center width="800" }
![polygon-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
polygon-annotator-example-purple.png){ align=center width="800" }

</div>

Expand Down Expand Up @@ -283,7 +287,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![label-annotator-example](https://media.roboflow.com/supervision-annotator-examples/label-annotator-example-purple.png){ align=center width="800" }
![label-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
label-annotator-example-purple.png){ align=center width="800" }

</div>

Expand Down Expand Up @@ -314,7 +319,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![label-annotator-example](https://media.roboflow.com/supervision-annotator-examples/label-annotator-example-purple.png){ align=center width="800" }
![label-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
label-annotator-example-purple.png){ align=center width="800" }

</div>

Expand All @@ -341,24 +347,26 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![icon-annotator-example](https://media.roboflow.com/supervision-annotator-examples/icon-annotator-example.png){ align=center width="800" }
![icon-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
icon-annotator-example.png){ align=center width="800" }

</div>

=== "Crop"
<!-- === "Crop"

```python
import supervision as sv
```python
import supervision as sv

image = ...
detections = sv.Detections(...)
image = ...
detections = sv.Detections(...)

crop_annotator = sv.CropAnnotator()
annotated_frame = crop_annotator.annotate(
scene=image.copy(),
detections=detections
)
```
crop_annotator = sv.CropAnnotator()
annotated_frame = crop_annotator.annotate(
scene=image.copy(),
detections=detections
)
```
-->

=== "Blur"

Expand All @@ -377,7 +385,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![blur-annotator-example](https://media.roboflow.com/supervision-annotator-examples/blur-annotator-example-purple.png){ align=center width="800" }
![blur-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
blur-annotator-example-purple.png){ align=center width="800" }

</div>

Expand All @@ -398,7 +407,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![pixelate-annotator-example](https://media.roboflow.com/supervision-annotator-examples/pixelate-annotator-example-10.png){ align=center width="800" }
![pixelate-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
pixelate-annotator-example-10.png){ align=center width="800" }

</div>

Expand Down Expand Up @@ -429,7 +439,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![trace-annotator-example](https://media.roboflow.com/supervision-annotator-examples/trace-annotator-example-purple.png){ align=center width="800" }
![trace-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
trace-annotator-example-purple.png){ align=center width="800" }

</div>

Expand Down Expand Up @@ -458,7 +469,8 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![heat-map-annotator-example](https://media.roboflow.com/supervision-annotator-examples/heat-map-annotator-example-purple.png){ align=center width="800" }
![heat-map-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
heat-map-annotator-example-purple.png){ align=center width="800" }

</div>

Expand All @@ -479,7 +491,31 @@ Annotators accept detections and apply box or mask visualizations to the detecti

<div class="result" markdown>

![background-overlay-annotator-example](https://media.roboflow.com/supervision-annotator-examples/background-color-annotator-example-purple.png)
![background-overlay-annotator-example](https://media.roboflow.com/supervision-annotator-examples/background-color-annotator-example-purple.png){ 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,
detections_2=detections_2
)
```

<div class="result" markdown>

![comparison-annotator-example](https://media.roboflow.com/supervision-annotator-examples/
comparison-annotator-example.png){ align=center width="800" }

</div>

Expand Down Expand Up @@ -622,6 +658,12 @@ Annotators accept detections and apply box or mask visualizations to the detecti

:::supervision.annotators.core.BackgroundOverlayAnnotator

<div class="md-typeset">
<h2><a href="#supervision.annotators.core.ComparisonAnnotator">ComparisonAnnotator</a></h2>
</div>

:::supervision.annotators.core.ComparisonAnnotator

<div class="md-typeset">
<h2><a href="#supervision.annotators.core.ColorLookup">ColorLookup</a></h2>
</div>
Expand Down
21 changes: 20 additions & 1 deletion supervision/annotators/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from supervision.annotators.base import BaseAnnotator, ImageType
from supervision.annotators.utils import (
ColorLookup,
Trace,
Trace,
resolve_color,
resolve_text_background_xyxy,
)
Expand Down Expand Up @@ -2756,6 +2756,25 @@ def annotate(
Returns:
The annotated image.
Example:
```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,
detections_2=detections_2
)
```
![comparison-annotator-example](https://media.roboflow.com/
supervision-annotator-examples/comparison-annotator-example.png)
"""
assert isinstance(scene, np.ndarray)
if detections_1.is_empty() and detections_2.is_empty():
Expand Down

0 comments on commit 001f85a

Please sign in to comment.