我目前正在尝试训练一个神经网络。我有一组文件名和它们相应的标签。但是,我在尝试训练网络时遇到了问题。输入队列未响应TensorFlow程序挂起
image_list, label_list = readImageLables()
images = ops.convert_to_tensor(image_list, dtype=dtypes.string)
labels = ops.convert_to_tensor(label_list, dtype=dtypes.int32)
with tf.Session() as sess:
init_op = tf.initialize_all_variables()
sess.run(init_op)
coord = tf.train.Coordinator()
threads = tf.train.start_queue_runners(sess=sess, coord=coord)
for epoch in range(hm_epochs):
epoch_loss = 0
for _ in range(int(7685/batch_size)):
print(labels.eval())
filename_queue = tf.train.slice_input_producer([images,labels], num_epochs=10, shuffle=True)
image,label = read_images_from_disk(filename_queue)
print(image.eval())
epoch_x, epoch_y = tf.train.batch([image, label], batch_size=batch_size)
print("wait what")
#imgs, lbls = epoch_x.eval(), epoch_y.eval()
_, c = sess.run([optimizer, cost], feed_dict={x: epoch_x.eval(), y: epoch_y.eval()})
epoch_loss += c
print('Epoch', epoch, 'completed out of',hm_epochs,'loss:',epoch_loss)
在我尝试打印图像数据的行中,程序挂起。即使删除了该行,该程序仍会挂在最后一次sess.run调用中,我正在提供此数据。我已经初始化队列跑步者,协调员等。但是,我有一种感觉,filename_queue有问题。在tf.train.slice_input_producer行中是否有任何缺少的内容?程序挂起或者只是需要一段时间才能加载。通常需要多少时间才能加载批量为100的纪元和80乘70的图像?
您是否看到程序在'top'或'nvidia-smi'上采取任何资源? – drpng