【发布时间】:2017-09-03 17:16:59
【问题描述】:
当我初始化我的神经网络时:
print('Checking the Training on a Single Batch...')
with tf.Session() as sess:
# Initializing the variables
sess.run(tf.global_variables_initializer())
# Training cycle
for epoch in range(epochs):
batch_i = 1
for batch_features, batch_labels in (input_data, input_labels):
train_neural_network(sess, optimizer, keep_probability, batch_features, batch_labels)
print('Epoch {:>2}, Batch {}: '.format(epoch + 1, batch_i), end='')
print_stats(sess, batch_features, batch_labels, cost, accuracy)
我在 For 循环中得到 ValueError: too many values to unpack (expected 2)。
我想可能是因为我没有创建批次,所以我创建了:
tf.train.batch([input_data, input_labels], batch_size, num_threads=1, capacity=32)
但我得到错误:
TypeError: Cannot convert a list containing a tensor of dtype <dtype: 'uint8'> to <dtype: 'float32'> (Tensor is: <tf.Tensor 'stack_16495:0' shape=(280, 440, 3) dtype=uint8>)
input_data / input_labels 都是使用tf.stack 创建的数组张量列表。
【问题讨论】:
标签: python image-processing tensorflow neural-network