Reputation: 131
I tried to test some learning networks after I completed training with a tensorflow.
But my test image is [512 512 1] data of channel 1 in 512 horizontal and 512 vertical pixels.
I changed the image data to a numpy array.
The tensor network should be [? 512 512 1] It looks like this.
How do I convert a numpy array to a tensor? ([512 512 1] -> [? 512 512 1])
Upvotes: 0
Views: 2892
Reputation: 1465
You just have to append one dimension
arr = your_image # [512, 512, 1]
new_arr = np.expand_dims(arr, 0)
tensor = tf.convert_to_tensor(new_arr)
Now you can use feed dict or something else.
Upvotes: 4