fix OverflowError
in text_visual func
#14758
Open
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes an important change to the
tools/infer/utility.py
file, specifically in thetext_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 fromnp.int8
tonp.uint8
in thecreate_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.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.