supervision icon indicating copy to clipboard operation
supervision copied to clipboard

Create `sv.PercentageBarAnnotator`

Open SkalskiP opened this issue 1 year ago • 3 comments

Description

Supervision is expanding its range of annotators. Following the example of BoundingBoxAnnotator, MaskAnnotator, or EllipseAnnotator, create PercentageBarAnnotator - whose task is to draw percentage bars related to sv.Detections. The inspiration for this annotator is, of course, video games.

273726518-d97d9039-711c-4994-8df1-b5c1d1323ad3

It should also allow you to control the bar's position in relation to the box using sv.Position. The color of the bar and border should be configurable as well. By default, the bar should visualize sv.Detections.confidence value. Bar color should change across sv.ColorPalette provided as color argument.

Pseudocode

class PercentageBarAnnotator(BaseAnnotator):

    def __init__(
        self,
        color: Union[Color, ColorPalette] = ColorPalette.default(),
        border_color: Color = Color.black(),
        position: Position = Position.TOP_CENTER
    ):
        pass

    def annotate(
        self,
        scene: np.ndarray,
        detections: Detections,
    ) -> np.ndarray:
        pass

Documentation

Upenij that the new annotator is well documented. Read more in our contributor guidelines.

SkalskiP avatar Oct 12 '23 12:10 SkalskiP

I would like to work on this task.

jayaBalaR avatar Oct 12 '23 12:10 jayaBalaR

Sure thing!

SkalskiP avatar Oct 12 '23 12:10 SkalskiP

@SkalskiP

How does that look like?

Screenshot from 2023-10-13 14-56-55

Find whole video sample in link below: https://drive.google.com/file/d/14wkO9FVAjxJd8QHVMwknuKhRASwrMPJp/view?usp=drive_link

xaristeidou avatar Oct 13 '23 11:10 xaristeidou

This task was completed in https://github.com/roboflow/supervision/pull/720. Closing the issue.

SkalskiP avatar Jan 26 '24 08:01 SkalskiP