Skip to content

Add compatibility for custom font sizes on bounding boxes #8894

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Conversation

mrdbourke
Copy link

As of PIL 10.1.0+ the size parameter is available in PIL.ImageFont.load_default(size).

This enables the font_size parameter in draw_bounding_boxes to be used even if font=None.

See PIL docs: https://pillow.readthedocs.io/en/stable/reference/ImageFont.html#PIL.ImageFont.load_default

As of PIL 10.1.0+ the `size` parameter is available in `PIL.ImageFont.load_default(size)`. 

This enables the `font_size` parameter in `draw_bounding_boxes` to be used even if `font=None`.

See PIL docs: https://pillow.readthedocs.io/en/stable/reference/ImageFont.html#PIL.ImageFont.load_default
Copy link

pytorch-bot bot commented Feb 3, 2025

🔗 Helpful Links

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

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

❌ 14 New Failures, 1 Unrelated Failure

As of commit ebea484 with merge base b5c7443 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were 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.

@NicolasHug
Copy link
Member

Thanks for the PR @mrdbourke ,

can you please look into fixing this test:

___________________________ test_draw_boxes_warning ____________________________
test/test_utils.py:211: in test_draw_boxes_warning
    with pytest.warns(UserWarning, match=re.escape("Argument 'font_size' will be ignored since 'font' is not set.")):
E   Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted.
E   The list of emitted warnings is: [].

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants