Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added smart positioning (non overlapping labels) to VertexLabelAnnotator #1625

Merged
merged 16 commits into from
Nov 12, 2024

Conversation

kshitijaucharmal
Copy link
Contributor

@kshitijaucharmal kshitijaucharmal commented Oct 28, 2024

Description

Resolved issue #1383 regarding overlapping labels in output.
Changes Done in VertexLabelAnnotator, LabelAnnotator and RichLabelAnnotator
No Extra dependencies used

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

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

Have added an optional argument to the VertexLabelAnnotator called use_smart_positioning which defaults to False.
Enabling this prevents overlapping.

Before:

overlapping.mp4

After:

VertexLabelAnnotator:

smart.mp4

Label Annotator:

labelanno_smart.mp4

Rich Label Annotator (font: Vampire Wars):

rich_label_smart.mp4

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:
  • Changes to docstrings in:
  1. VertexLabelAnnotator
  2. LabelAnnotator
  3. RichLabelAnnotator

Collab Link: https://colab.research.google.com/drive/1GPHr7PpZ_eNs8Gkxx_A4w6PL5p4pJAn1?usp=sharing#scrollTo=ZHptw0Fk4lk4

@CLAassistant
Copy link

CLAassistant commented Oct 28, 2024

CLA assistant check
All committers have signed the CLA.

@kshitijaucharmal kshitijaucharmal marked this pull request as draft October 29, 2024 10:45
@kshitijaucharmal kshitijaucharmal marked this pull request as ready for review October 29, 2024 10:51
@onuralpszr onuralpszr added enhancement New feature or request api:annotator Annotators labels Oct 30, 2024
@LinasKo
Copy link
Collaborator

LinasKo commented Oct 31, 2024

Accepting this based on the videos. I sense there's a lot of reviewing to do 🙂

Would you be able to create a Colab showcasing the usage?

@LinasKo LinasKo added the hacktoberfest-accepted Contribute to the notion of open-source this October! label Oct 31, 2024
* Alos, refactored RichLabelAnnotator so its structure matches LabelAnnotator
supervision/annotators/core.py Outdated Show resolved Hide resolved
supervision/annotators/core.py Outdated Show resolved Hide resolved
supervision/annotators/core.py Outdated Show resolved Hide resolved
supervision/annotators/core.py Outdated Show resolved Hide resolved
supervision/detection/utils.py Outdated Show resolved Hide resolved
supervision/detection/utils.py Outdated Show resolved Hide resolved
supervision/detection/utils.py Outdated Show resolved Hide resolved
supervision/annotators/core.py Show resolved Hide resolved
supervision/annotators/core.py Show resolved Hide resolved
supervision/detection/utils.py Outdated Show resolved Hide resolved
@LinasKo
Copy link
Collaborator

LinasKo commented Nov 12, 2024

I've witnessed that the new algo sometimes produces more jerky motions of the label when applied to the video. I pushed the most stable combination I could find, but there's definitely room for improvement.

Merging this in! Thank you very much, @kshitijaucharmal, @SkalskiP!

@LinasKo LinasKo merged commit 3bb22ab into roboflow:develop Nov 12, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:annotator Annotators enhancement New feature or request hacktoberfest-accepted Contribute to the notion of open-source this October!
5 participants