gpt4 book ai didi

python - 如何将 URL 中的图像加载到 Tensorflow 中?

转载 作者:行者123 更新时间:2023-12-01 03:18:36 25 4
gpt4 key购买 nike

我目前正在运行这个:

image = urllib.urlopen(imgUrl)
pool3_features = sess.run(pool3,{'incept/DecodeJpeg/contents:0': image})

我收到此错误:

Unable to get element from the feed as bytes.

最佳答案

解决方案非常简单...我所要做的就是根据 urlopen 的响应调用 read 方法。以下内容就像一个魅力:

image = urllib.urlopen(imgUrl)
pool3_features = sess.run(pool3,{'incept/DecodeJpeg/contents:0': image.read()})

关于python - 如何将 URL 中的图像加载到 Tensorflow 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42218771/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com