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

[ImageMaskAnnotator]: Adds an annotator to overlay an image over specified classes of detections #1007

Closed
wants to merge 3 commits into from

Conversation

Log45
Copy link

@Log45 Log45 commented Mar 15, 2024

Description

ImageMaskAnnotator is a new annotator that overlays a user-specified image on detections included in a user-specified list of classes which defaults to class 0 (person for MS-COCO). Specified images can be PNGs, but with clear backgrounds, they are not guaranteed to cover the entire detection. Another barrier is using images with pure-black pixels which often gets turned clear after the overlay.

Motivation for this change was to allow users to redact certain objects or add anonymity to their products in a more customizable way than simply blurring specific detections.

One issue (that is non-breaking) that I would appreciate feedback on is that an IndexError occurs if any point of an object's xyxy attribute is outside of the frame, which I mitigated with a try/except loop, but the object is no longer covered in that exception. (Maybe I could add variables to have access to previous positions, but I'd like feedback on how to cover the entire rest of the detection that is inside of the frame).

This change does not require any additional dependencies.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update (I updated annotators.md)

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

There are no unit tests since the change is an additional annotator, but I've tested on my local machine and on colab and it works as intended. Attached is a colab notebook with an example of the change (inspired by @dfreilich 's notebook example):

https://colab.research.google.com/drive/1FkIwwDaSPVvSk2eKRbTeqHT89oZIbCFk?usp=sharing

Any specific deployment considerations

None that I can think of.

Docs

  • Docs updated? What were the changes:

annotators.md was updated to include the new ImageMaskAnnotator

@CLAassistant
Copy link

CLAassistant commented Mar 15, 2024

CLA assistant check
All committers have signed the CLA.

@SkalskiP
Copy link
Collaborator

Hi, @Log45 👋🏻 Thank you for your interest in supervision. I apologize for the late reply. I've been a bit busy with responsibilities unrelated to supervision. I have a few comments. Would you be willing to make the corrections?

@Log45
Copy link
Author

Log45 commented Mar 19, 2024

Hi, @Log45 👋🏻 Thank you for your interest in supervision. I apologize for the late reply. I've been a bit busy with responsibilities unrelated to supervision. I have a few comments. Would you be willing to make the corrections?

Yup, I'm open to feedback!

@Log45
Copy link
Author

Log45 commented Mar 25, 2024

@SkalskiP bumping because I'm not sure if you were notified when I last replied, I'm open to any feedback!

@LinasKo
Copy link
Collaborator

LinasKo commented Oct 1, 2024

Hey @Log45 👋

Apologies for the delay. I found your annotator proposal really interesting, and I appreciate that you included a specific use case—it gives us a better sense of the challenges our users are tackling and the projects they’re working on.

That said, I haven’t come across any requests to fully cover images by overlaying another. Especially since the last release, where IconAnnotator was introduced.

I’ll have to close this one for now, but thank you for your efforts in making our library better! 🤝

@LinasKo LinasKo closed this Oct 1, 2024
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.

4 participants