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

Add label_colors argument to draw_bounding_boxes #8578

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

carandraug
Copy link

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.

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

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.

2 participants