Skip to content

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

Open
@carandraug

Description

@carandraug

🚀 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions