Skip to content

Add label_colors argument to draw_bounding_boxes #8578

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

Merged
merged 4 commits into from
Nov 28, 2024

Conversation

carandraug
Copy link
Contributor

Initial discussion and rational for this feature is in issue #8317 . As mentioned on that issue, this first PR addresses only the issue of label colour.

On issue #8317, I proposed to implement this by having a draw_label_kwargs argument which could then be passed to draw.text. This would exposes all the flexibility provided by PIL (font stroke width, separate font fill and stroke colours, etc). However, after doing that, I think that this "simpler", albeit more limited, approach is better because my original proposal:

  1. messy when there are multiple boxes - we can pass a list of colours for the boxes and the same should be supported for the label colour. If we require a dict of kwargs then we would need a list of kwargs, many of them duplicated. It's just messy.

  2. would bind us to PIL - if in the future this is done with something other than PIL then it would be difficult to keep BC

  3. user needs to reference PIL documentation - not only the documentation is now elsewhere, different PIL versions support different arguments so it can be tricky for the user to know what arguments are supported

Copy link

pytorch-bot bot commented Aug 9, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8578

Note: Links to docs will display an error until the docs builds have been completed.

❌ 10 New Failures, 4 Unrelated Failures

As of commit bf3876d with merge base 19fef3d (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR @carandraug . Sorry for the wait, I finally had a bit of free time to review it. It looks great, I'm happy to go with this simpler solution.

@NicolasHug NicolasHug merged commit f8d6f8f into pytorch:main Nov 28, 2024
44 of 58 checks passed
Copy link

Hey @NicolasHug!

You merged this PR, but no labels were added.
The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

facebook-github-bot pushed a commit that referenced this pull request Jan 13, 2025
Summary: Co-authored-by: Nicolas Hug <[email protected]>

Reviewed By: vmoens

Differential Revision: D68021986

fbshipit-source-id: 52148ab7fd8c55a3dfba3d0d8eeca16599ac9da3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants