报错:OutOfRangeError: FIFOQueue '_1_batch/fifo_queue' is closed and has insufficient elements 解决办法

  Tensorflow在跑图像数据时报错,报错信息如下:

OutOfRangeError (see above for traceback): FIFOQueue '_1_batch/fifo_queue' is closed and has insufficient elements (requested 8, current size 1)
	 [[Node: batch = QueueDequeueManyV2[component_types=[DT_FLOAT, DT_UINT8], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](batch/fifo_queue, batch/n)]]

  信息显示读取数据队列出现问题,刚开始一直以为是  tf.train.shuffle_batch参数出现问题,于是不断调参数,但均无效。

tf.train.shuffle_batch(
      tensors,
      batch_size = 16,
      capacity = 512,  # 这个参数多次调整,无效
      min_after_dequeue = 128,  # 这个参数多次调整,无效
      keep_input=True,
      num_threads=num_threads,  # 这个参数调整多次,无效
      seed=seed,
      enqueue_many=enqueue_many,
      shapes=shapes,
      allow_smaller_final_batch=allow_smaller_final_batch,
      shared_name=shared_name,
      name=name)

  最终解决方法:原始数据问题,存在一张异常照片,删除即可。

  最后在检查数据的时候,发现原始数据中存在一张异常照片,删除即恢复正常。

  所以,当遇到类似问题时,请先检查原始数据,可能并不是程序本身的错误。

“Image_295”为异常图片
 

猜你喜欢

转载自blog.csdn.net/weixin_41713230/article/details/81539348