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

fix OverflowError in text_visual func #14758

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GreatV
Copy link
Collaborator

@GreatV GreatV commented Feb 24, 2025

This pull request includes an important change to the tools/infer/utility.py file, specifically in the text_visual method. The change modifies the data type used to create a blank image, ensuring compatibility and correctness in image processing.

  • tools/infer/utility.py: Changed the data type from np.int8 to np.uint8 in the create_blank_img function to correctly handle image data.
  • np.int8 is a signed 8-bit integer, meaning it can store values from -128 to 127.
  • The value 255 exceeds the maximum limit of 127 for np.int8, causing an overflow. When NumPy tries to compute 1 * 255 and store the result (255) in an int8 array, it raises the OverflowError because 255 is out of bounds.

@GreatV GreatV requested a review from Liyulingyue February 24, 2025 13:16
Copy link

paddle-bot bot commented Feb 24, 2025

Thanks for your contribution!

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

Successfully merging this pull request may close these issues.

1 participant