Comments (2)
You need to start the queue runners for filename_queue
to get populated. Here are some examples: https://www.tensorflow.org/programmers_guide/threading_and_queues
from tensorflowbook.
Thanks for your answer!! I used BGPark's code and got it to work. Sorry, I am new to Python (and GitHub) so I struggle a bit with the coding. I also played around a bit in case anyone is interested for themselves:
# Create H image.
import numpy as np
h=np.array([[[ 0, 0, 0],
[255, 255, 255],
[254, 0, 0]],
[[ 0, 191, 0],
[ 3, 108, 233],
[ 0, 191, 0]],
[[254, 0, 0],
[255, 255, 255],
[ 0, 0, 0]]], dtype='uint8')
h.shape
# Display created H image.
from matplotlib import pyplot as plt
plt.imshow(h, interpolation=None)
plt.show()
# Export H image as a jpg.
import matplotlib
matplotlib.image.imsave('my_dir/H.jpg', h)
# Import H image into TensorFlow.
import tensorflow as tf
image_filename = "my_dir/H.jpg"
filename_queue = tf.train.string_input_producer([image_filename])
image_reader = tf.WholeFileReader()
_, image_file = image_reader.read(filename_queue)
image = tf.image.decode_jpeg(image_file)
sess = tf.Session()
sess.run(tf.global_variables_initializer())
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(coord=coord, sess=sess)
a = sess.run(image)
a.shape
# Display imported H image.
from matplotlib import pyplot as plt
plt.imshow(a, interpolation=None)
plt.show()
from tensorflowbook.
Related Issues (20)
- I found it is rather slow when converting images to TFRecords, is it normal? HOT 4
- Sequence classification: GPU runs out of memory HOT 1
- The iterative batch generation code is so strange to me in Chapter 6 04_arxiv preprocessing.py.
- the accuracy of chapter5
- Typo on Chapter 3
- sp? on Chapter 4 HOT 1
- Ch. 6. Word Vector Embeddings - Python 2.7 HOT 5
- the first dimension of the kernel variable
- Chapter 5 code errors in cnn sample HOT 1
- Chapter 5 how to use trained model? HOT 2
- The Linear Regression Example is Incorrect. HOT 1
- chapter 5 working with images page 161
- CNN Implementation HOT 2
- where is the rest demo code of CNN implementation? HOT 1
- lazy_property will cause tensorflow function not to recompute with new batch
- The memory of the TensorFlow node object could not be reclaimed HOT 1
- Chapter 6 04_arxiv not suitable for tensorflow2.x version?
- Ch4_softmax HOT 4
- Running logistic regression throws error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorflowbook.