roboflow / supervision

We write your reusable computer vision tools. 💜
https://supervision.roboflow.com
MIT License
24.04k stars 1.79k forks source link

Create `sv.TriangleMarkerAnnotator` #397

Closed SkalskiP closed 11 months ago

SkalskiP commented 1 year ago

Description

Supervision is expanding its range of annotators. Following the example of BoundingBoxAnnotator, MaskAnnotator, or EllipseAnnotator, create TriangleMarkerAnnotator - whose task is to mark objects related to sv.Detections with triangles.

Like other annotators, it should allow you to choose a color palette and a color mapping strategy - index, class, track. It should also allow you to control the position of the triangle in relation to the box using sv.Position.

Pseudocode

class TriangleMarkerAnnotator(BaseAnnotator):

    def __init__(
        self,
        color: Union[Color, ColorPalette] = ColorPalette.default(),
        height: int = 10,
        position: Position = Position.TOP_CENTER,
        color_map: str = "class",
    ):
        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.

cvPolli commented 1 year ago

@SkalskiP I'm interested in this issue, please assign it for me <3

ugly-custard commented 1 year ago

hello, I'm also interested in this issue is the triangle supposed to look like one of those rpg games like below?

annotated

onuralpszr commented 1 year ago

hello, I'm also interested in this issue is the triangle supposed to look like one of those rpg games like below?

annotated

Triangle is already under work :) sorry

cvPolli commented 1 year ago

hello, I'm also interested in this issue is the triangle supposed to look like one of those rpg games like below? annotated

Triangle is already under work :) sorry

So why this is issue is with hacktoberfest label and still open?

In cases of detecting people, it would be interesting for the triangle to be centered with the person's head, but I didn't understand if MarkerAnnotator is used to annotate or to draw predictions, depending on the answer, what I said doesn't make sense

onuralpszr commented 1 year ago

So why this is issue is with hacktoberfest label and still open?

it is open because PR still going on ?

https://github.com/roboflow/supervision/issues/397

Also related comment : https://github.com/roboflow/supervision/issues/370#issuecomment-1744856519

ugly-custard commented 1 year ago

Triangle is already under work :) sorry

ah okay, no one was assigned for this issue so I asked :)

cvPolli commented 1 year ago

i see, but doesn't make sense for me, this issue was open 7* hours go, whereas other issue was open 2 weeks ago....

cvPolli commented 1 year ago

Triangle is already under work :) sorry

ah okay, no one was assigned for this issue so I asked :)

that is my point also....

SkalskiP commented 1 year ago

Hi, @PolliArthur and @ugly-custard 👋🏻 I'm sorry for the confusion. It is all my fault.

@sanaullah-code started to work on the implementation, but he was not active in this issue, and I couldn't assign him directly. I'm genuinely sorry I wasted your time.

@PolliArthur and @ugly-custard, would any of you be interested in https://github.com/roboflow/supervision/issues/396? It is very similar but not assigned yet.

DanRHowarth commented 1 year ago

Hi @SkalskiP following on from Twitter, I'll take a look at this. If other contributors have made progress then just let me know! Thanks

SkalskiP commented 1 year ago

@DanRHowarth sure thing! Feel free to let me know if you need any help. Keep in mind that there was already one PR submitted: https://github.com/roboflow/supervision/pull/385. But we lost contact with the collaborator. :/ Still, there is some value there.

DanRHowarth commented 1 year ago

@DanRHowarth sure thing! Feel free to let me know if you need any help. Keep in mind that there was already one PR submitted: #385. But we lost contact with the collaborator. :/ Still, there is some value there.

Thanks! There's a bit of a learning curve for me but will crack on and see how far I can get, will let you know if there are any issues

SkalskiP commented 1 year ago

There's a bit of a learning curve for me but will crack on and see how far I can get

That is usually the best strategy!

kapter commented 1 year ago

Some thoughts: KKNDAnnotator line in white box is confidence, red if conf lower than .50

2023-10-10 в 01 58 37

ImageAnnotator image above head (default sim's gem) image

SkalskiP commented 1 year ago

The creativity you bring to this project 🙌🏻 want to build it? I could create a tasks for other contributors as well. I know you mentioned heat map annotator on Twitter/X.

kapter commented 1 year ago

Сreate tasks pls. I will concentrate on heat map. Tnx.

SkalskiP commented 1 year ago

@kapter tasks created:

kapter commented 1 year ago

result of heat map

https://github.com/roboflow/supervision/assets/6329901/396f7b85-6ace-403a-b18d-9ab0d8ff1013

DanRHowarth commented 1 year ago

Hi @SkalskiP, quick update: had a bit of set-up pain but I've got things working locally have dug into the existing triangle annotator code and got that working too. Probably won't be able to do much on the weekend but will pick this Monday. Let me know if there are any time issues to get this done sooner. Cheers :)