Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9018
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 670ffa5 with merge base ac7ad5f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
NicolasHug
left a comment
There was a problem hiding this comment.
Thanks for the PR @AntoineSimoulin , this looks good! I made some minor comments below, it'd be also great to have some small test to check the expected behavior, similar to the existing tests we have for draw_bounding_boxes
torchvision/utils.py
Outdated
| draw.rectangle( | ||
| (left - box_margin, top - box_margin, right + box_margin, bottom + box_margin), fill=color | ||
| ) | ||
| label_color = "black" |
There was a problem hiding this comment.
Do we have any reason to force label_color to black? Could we just make black the default, but let the user specify it if they wanted to?
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
|
@NicolasHug, thanks for the comments. I did the following modifications:
|
1d7c355 to
eabb41a
Compare
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
Co-authored-by: Nicolas Hug <contact@nicolas-hug.com>
|
Hey @AntoineSimoulin! You merged this PR, but no labels were added. |
Summary: Co-authored-by: Nicolas Hug <contact@nicolas-hug.com> Reviewed By: AntoineSimoulin Differential Revision: D79175033 fbshipit-source-id: 10091733ee5bc1a7e31f80c7bf1569a525c91603
Context
This PR add the ability to add background color for the label of bounding boxes. In this case, the background label will be the same as the one used for the box frame. The text itself will automatically be switched to black. This should allow better visibility in cases where brightness and darkness prevent from distinguishing regular labels, as mentioned in #8317
How to use
We add a
fill_labelsparameter in thedraw_bounding_boxesfunction. As illustrated below, this will draw a colored rectangle with the same size of the text rectangle for the text label. By default, the option is deactivated.