Creating batches from custom dataset of images in Tensorflow
<p>I'm reading a list of .jpg images from  disk, and I wanted to split it in several batches. But I got a ValueError while trying to create the first batch.</p>

<p>Here is my code:</p>

<pre><code>import tensorflow as tf
import os

images_list = []
for i in range(6):
    image = tf.read_file("{0}.jpg".format(i))
    image_tensor = tf.image.decode_jpeg(image, channels=3)
    image_tensor = tf.image.rgb_to_grayscale(image_tensor)
    image_tensor = tf.image.resize_images(image_tensor, 28, 28)
    image_tensor = tf.expand_dims(image_tensor, 0)
    images_list.append(image_tensor)

batches, _ = tf.train.batch(images_list, batch_size=3, enqueue_many=True, capacity=6)
</code></pre>

<p>And this is the error message:</p>

<pre><code>ValueError Traceback (most recent call last)
&lt;ipython-input-77-a07e94cddf32&gt; in &lt;module&gt;()
----&gt; 1 batches, _ = tf.train.batch(images_list, batch_size=3, enqueue_many=True, capacity=6)

ValueError: too many values to unpack
</code></pre>