supervision icon indicating copy to clipboard operation
supervision copied to clipboard

[IconAnnotator] - Add IconAnnotator to Mark Objects with Custom Icons/Images

Open dfreilich opened this issue 4 months ago • 3 comments

Description

This PR adds an IconAnnotator class, which can annotate images. For best results, the icon should be a transparent icon without a background, so that it will come up clearly against any images.

zidane-icon-annotated

Some open questions for discussion:

  1. The demo image for the annotation didn't follow the standard placement for the icon (it seems to be above the image, rather than at the center top border of the detection). I added logic to center the icon horizontally, but I wasn't sure about adding that vertically as well.
  2. To what degree is it important to have color adaption for the icon annotation? It can look very nice, but it also introduces more error cases, for icons that aren't transparent, and will just show up as a colored box as a result.

I'd love to hear your thoughts on it.

A Collab notebook which demonstrates the change is here

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

This change includes a unit test (the first created for annotations) to verify that the annotation works, and the result closely matches a so-called golden file

Docs

  • [ ] Docs updated? What were the changes:

Closes #460

dfreilich avatar Feb 20 '24 20:02 dfreilich

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Feb 20 '24 20:02 CLAassistant

Hi @dfreilich 👋🏻 ! Thank you very much for your interest in Supervision.

  • Given that we don't yet have a concrete idea for end-to-end testing of annotators, I wouldn't want to introduce it as part of this PR. I kindly ask you to remove the following files from this PR:
    • test/data/zidane.jpg
    • test/data/zidane-icon-annotated.jpg
    • test/data/icons8-diamond-50.png
    • test/annotators/test_core.py
  • Your new annotator has not been included in the documentation. To do this, make the appropriate changes to annotators.md.

SkalskiP avatar Feb 21 '24 21:02 SkalskiP

@SkalskiP Thanks for the review! I addressed the comments, and removed the unit tests I had created. With regards to the changes in acceptance.md, I assumed that it didn't make sense to add the IconAnnotator to the carousel at the top (like we do here: https://github.com/roboflow/supervision/blob/8599345a3c00c26e7a05d7c81e23bf1d5cf8b8e2/docs/annotators.md?plain=1#L8-L27) until we have an agreed upon example that's hosted on media.roboflow.com, like the rest of the examples, but I can add one if you'd like.

dfreilich avatar Feb 22 '24 18:02 dfreilich