天天看点

读取tfrecord出错问题

错误:OutOfRangeError (see above for traceback): RandomShuffleQueue '_2_shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)

     [[Node: shuffle_batch = QueueDequeueManyV2[component_types=[DT_DOUBLE, DT_INT64, DT_INT64], timeout_ms=-1, _device="/job:localhost/replica:0/task:0/device:CPU:0"](shuffle_batch/random_shuffle_queue, shuffle_batch/n)]]

改正

1.

tf.local_variables_initializer().run()

tf.global_variables_initializer().run()      

2.使用多个线程

train_img_batch, train_label_batch = tf.train.shuffle_batch([train_img, train_label],
                                                batch_size=Config.batch_size, num_threads=10, capacity=1000,
                                               min_after_dequeue=500)
      

3.GPU性能