OutOfRangeError (see above for traceback): FIFOQueue ‘_2_batch/fifo_queue’ is closed and has insufficient elements (requested 100, current size 0) [[node batch (defined at E:/Tensorflow/验证码识别/cnn_captcha.py:25) = QueueDequeueManyV2[component_types=[DT_STRING, DT_FLOAT], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](batch/fifo_queue, batch/n)]]
python 在调用tensorflow模块中的批处理时出现的错误
解决方法: 观察代码中有关shape的操作 对图片的处理要根据图片的相关像素尺寸来进行set_shape
file_queue = tf.train.string_input_producer(file_list)
reader = tf.WholeFileReader()
filename, image = reader.read(file_queue)
decoded = tf.image.decode_jpeg(image)
decoded.set_shape([20, 80, 3])
如果直接这样运行就要报错 经过观察图片 更改为decoded.set_shape([60,160,3]),代码成功运行
|