Open ndamclean opened 4 years ago
Hello! This commit seems to be the issue.
I can fix it tomorrow, but PRs are welcome :)
I'm using 1.1.2 in Google Colab but still encounter this problem... downgrade to 1.1.0 works.
Oh right, I cannot merge the PR myself. Would anyone be available to make a PR? The diff is in #294 .
this is may mybe a Keras-Preprocessing bug, i update Newest version Keras-Preprocessing 1.1.2,has the same problem
last,i back to pip3 install -U Keras-Preprocessing===1.1.0 fix it
my code is
response = requests.get(image_url, timeout=5, verify=False, headers={'connection': 'close'})
image_io = io.BytesIO(response.content)
img = image.load_img(image_io, target_size=(256, 256))
Thanks for figuring this out! I was buffering some images to memory while assessing them with a keras model and code that worked last year was throwing the same error:
keras_preprocessing/image/utils.py", line 113, in load_img with open(path, 'rb') as f: TypeError: expected str, bytes or os.PathLike object, not _io.BytesIOBytesIO
...downgrading to keras-preprocessing===1.1.0 in both Windows and Ubuntu builds fixed it immediately!
I also encounter this issue ... the commit in #261 break io.ByteIo. Just want to know will fix it? Thanks
I do a fix in the #339
The most recent release on PyPi (
1.1.1
) seems to break the compatibility of thetensorflow.keras.preprocessing.image.load_img
function with pythonio.BytesIO
arguments as input.This code snippet was working in the previous release (
1.1.0
). (requirespip
-installablerequests
package to run)After updating to the
1.1.1
release, the above snippet crashes with the following error message: