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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

position, colour, and background colour of text labels in draw_bounding_boxes #8317

Open
carandraug opened this issue Mar 14, 2024 · 1 comment

Comments

@carandraug
Copy link

carandraug commented Mar 14, 2024

馃殌 The feature

Text labels from torchvision.utils.draw_bounding_boxes are currently always inside the box with origin at the top left corner of the box, without a background colour, and the same colour as the bounding box itself. These are three things that would be nice to control.

Motivation, pitch

The problem with the current implementation is that it makes it hard to read the label, particularly when the bounding box is filled (because the text has the same colour as the filling colour and is placed inside the box.

For example, this is the results from the current implementation:

intro-detection-R52854-JRL231711104-coco

Moving the label to outside the box already makes things better:

intro-detection-R52854-JRL231711104

But by controlling those three things (placement of label, background colour behind the label, and text colour) one could fit to whatever they have. For what is worth, in the original issue for this feature, the only example image had labels outside the box, text coloured different from the box (black), and background of the same colour as the box. See #2556 (comment)

I'm happy to contribute this but want to know if this will be accepted and with what interface.

@NicolasHug
Copy link
Member

Thanks for opening this issue @carandraug. I think the proposal is reasonable, the current position of the label does make them difficult to read.

In terms of API / functionality, what exactly would you have in mind?

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

No branches or pull requests

2 participants