How tf.train.batch creates a package

In the TIFF-10 TensorFlow tutorial, I came across the following line:

images, label_batch = tf.train.batch( [image, label], batch_size=batch_size, num_threads=num_preprocess_threads, capacity=min_queue_examples + 3 * batch_size) 

The tf.train.batch() function seems to perceive as input only one image and one label. How to create a package with several images?

+7
tensorflow
source share
1 answer

It is required to introduce a pair [image, label] , which, yes, it is one pair. tf.train.batch , however, creates an internal queue. Threads num_threads will accumulate pairs in the queue until capacity reached.

images, label_batch are actually dequeue operations.

Remember that you define a computational graph, so the [image, label] pair is two nodes of the graph, and a different real pair of image, label your training set will go through these nodes. Thus, tf.train.batch can capture a stream of images and tags and fill the queue.

+7
source share

All Articles