I have inputs to a tensorflow convnet as rank-4 tensors (32, 32, 3, 73257) (73257 comes from number of imgs) which are numpy arrays, but my placeholder variable for my x inputs is 2-d, (None, 3072). The 3072 comes from the img height x img width x channels. My question is, how do I reshape or use the images so that theyre compatible with the placeholder?
P.S. These images are from the SVHN cropped 32x32 dataset
images = np.array(features, dtype=np.float32)
...
x = tf.placeholder(tf.float32, shape=[None, 3072])
...
for _ in range(1000):
batch = next_batch(50, images, labels)
train_step.run(feed_dict={x: batch[0], y_: batch[1]})
...
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for i in range(20000):
batch = next_batch(50, images, labels)
if i % 100 == 0:
train_accuracy = accuracy.eval(feed_dict={
x: batch[0], y_: batch[1], keep_prob: 1.0})
print('step %d, training accuracy %g' % (i, train_accuracy))
train_step.run(feed_dict={x: images, y_: labels, keep_prob: 0.5})