[go: nahoru, domu]

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

Patch RichLabelAnnotator, fix in-place functionality of other annotators #1277

Merged
merged 11 commits into from
Jul 3, 2024

Conversation

LinasKo
Copy link
Collaborator
@LinasKo LinasKo commented Jun 12, 2024

Description

This is a 3-in-1:

  1. Addressed faults with RichLabelAnnotator left after Adds support for unicode labels with new RichLabelAnnotator class #1116
  • Primarily: it would not convert back to np.ndarray after annotation
  1. Realized many annotators do nothing when used in-place.
  1. Color Annotator would fill boxes with solid color if used in-place, with numpy.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

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

Ran every annotator except for TraceAnnotator.
Ran tests.
Colab: https://colab.research.google.com/drive/1NvVs28MnSb-_W-zkFa6-FXiY-0G4nx7k#scrollTo=dVZIKNV1uXVl

Any specific deployment considerations

Docs

  • Docs updated? What were the changes:

@LinasKo LinasKo changed the title Patch RichLabelAnnotator, fix others Patch RichLabelAnnotator, fix in-place functionality of other annotators Jun 12, 2024
@LinasKo LinasKo requested a review from SkalskiP June 12, 2024 12:27
@SkalskiP
Copy link
Collaborator

@LinasKo I see a lot of copy to and copy operations. Have you measured how those impact performance?

supervision/annotators/core.py Outdated Show resolved Hide resolved
@LinasKo
Copy link
Collaborator Author
LinasKo commented Jun 13, 2024

@LinasKo I see a lot of copy to and copy operations. Have you measured how those impact performance?

No. I'll do that, will let you know the results. If we prefer to optimize, I can do that.

@LinasKo
Copy link
Collaborator Author
LinasKo commented Jun 18, 2024
  1. Renamed to ensure_cv2_image_... and ensure_pil_image_.... I've seen this before, and we're not necessarily doing a conversion.
  2. Removed a few copy operations. I finally understand why cv2 has the destination parameter in methods like addWeighted, despite returning an image :)

The Colab now has tests in the end, comparing the performance on a 10,000x10,000 size empty image.
Results should show performance dips if any copying is expensive.

With the latest version, performance is equivalent or slightly better than in base supervision.

@LinasKo LinasKo requested a review from SkalskiP June 18, 2024 19:25
@LinasKo
Copy link
Collaborator Author
LinasKo commented Jun 19, 2024

Hey @onuralpszr ,

Given you've worked on it before, would you mind reviewing these changes too? There's a colab that shows how it works, only requiring that you upload the font file.

@onuralpszr
Copy link
Collaborator

@LinasKo start reviewing

@SkalskiP SkalskiP merged commit f06dcf7 into develop Jul 3, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RichLabelAnnotator] - add support for unicode labels
3 participants