Reputation: 2899
I'm currently running this:
image = urllib.urlopen(imgUrl)
pool3_features = sess.run(pool3,{'incept/DecodeJpeg/contents:0': image})
and I get this error:
Unable to get element from the feed as bytes.
Upvotes: 1
Views: 2547
Reputation: 2899
The solution was quite simple... All I had to do was call the read
method on response from urlopen. The following works like a charm:
image = urllib.urlopen(imgUrl)
pool3_features = sess.run(pool3,{'incept/DecodeJpeg/contents:0': image.read()})
Upvotes: 3
Reputation: 639
Just use a method to load it into NumPy and then load that into TensorFlow. This is likely more reliable, more flexible.
http://www.pyimagesearch.com/2015/03/02/convert-url-to-image-with-python-and-opencv/
Upvotes: -1