Skip to content

fix OverflowError in text_visual func #14758

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

Merged
merged 1 commit into from
Feb 26, 2025

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!

@Liyulingyue
Copy link
Collaborator

Great works!

@Liyulingyue Liyulingyue merged commit 1d52a2b into PaddlePaddle:main Feb 26, 2025
3 checks passed
@GreatV GreatV deleted the fix_visual_error branch February 26, 2025 07:50
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.

2 participants