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

'ImageFont' object has no attribute 'getsize' #48

Open
JJJYmmm opened this issue Sep 4, 2023 · 0 comments
Open

'ImageFont' object has no attribute 'getsize' #48

JJJYmmm opened this issue Sep 4, 2023 · 0 comments

Comments

@JJJYmmm
Copy link

JJJYmmm commented Sep 4, 2023

When I run /colab/pix2seq_inference_object_detection.ipynb, I meet an error as shown in the following figure.
image
It shows that the problem lies in line233 and line243 in /tasks/visualization/vis_utils.py.

display_str_heights = [font.getsize(ds)[1] for ds in display_str_list] # line 233 
text_width, text_height = font.getsize(display_str) # line 243

class PIL.ImageFont(PIL.version=10.0.0) don't have function getsize() directly, you should get the class member font first, then you can use function getsize().
so the solution is below.

display_str_heights = [font.font.getsize(ds)[1] for ds in display_str_list] # line 233 
text_width, text_height = font.font.getsize(display_str) # line 243

Then,you can see it works!
image

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

1 participant