tf.train.shuffle_batch not working for me
<p>I'm trying to process my input data using the TensorFlow clean way (tf.train.shuffle_batch), most of this code I gathered from the tutorials with slight modifications like the decode_jpeg function.</p>

<pre><code>size = 32,32
classes = 43
train_size = 12760
batch_size = 100
max_steps = 10000

def read_and_decode(filename_queue):
    reader = tf.TFRecordReader()
    _, serialized_example = reader.read(filename_queue)
    features = tf.parse_single_example(
        serialized_example,
        # Defaults are not specified since both keys are required.
        features={
            'image/encoded': tf.FixedLenFeature([], tf.string),
            'image/class/label': tf.FixedLenFeature([], tf.int64),
            'image/height': tf.FixedLenFeature([], tf.int64),
            'image/width': tf.FixedLenFeature([], tf.int64),
        })
    label = tf.cast(features['image/class/label'], tf.int32)
    reshaped_image = tf.image.decode_jpeg(features['image/encoded'])
    reshaped_image = tf.image.resize_images(reshaped_image, size[0], size[1], method = 0)
    reshaped_image = tf.image.per_image_whitening(reshaped_image)
    return reshaped_image, label

def inputs(train, batch_size, num_epochs):
    subset = "train"
    tf_record_pattern = os.path.join(FLAGS.train_dir + '/GTSRB', '%s-*' % subset)
    data_files = tf.gfile.Glob(tf_record_pattern)
    filename_queue = tf.train.string_input_producer(
        data_files, num_epochs=num_epochs)

    # Even when reading in multiple threads, share the filename
    # queue.
    image, label = read_and_decode(filename_queue)

    # Shuffle the examples and collect them into batch_size batches.
    # (Internally uses a RandomShuffleQueue.)
    # We run this in two threads to avoid being a bottleneck.
    images, sparse_labels = tf.train.shuffle_batch(
        [image, label], batch_size=batch_size, num_threads=2,
        capacity=1000 + 3 * batch_size,
        # Ensures a minimum amount of shuffling of examples.
        min_after_dequeue=1000)
    return images, sparse_labels
</code></pre>

<p>When I try to run</p>

<pre><code>batch_x, batch_y = inputs(True, 100,100)
</code></pre>

<p>I get the following error:</p>

<pre><code>---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
&lt;ipython-input-6-543290a0c903&gt; in &lt;module&gt;()
----&gt; 1 batch_x, batch_y = inputs(True, 100,100)

&lt;ipython-input-5-a8c07c7fc263&gt; in inputs(train, batch_size, num_epochs)
     73         capacity=1000 + 3 * batch_size,
     74         # Ensures a minimum amount of shuffling of examples.
---&gt; 75         min_after_dequeue=1000)
     76     #return image, label
     77     return images, sparse_labels

/Users/Kevin/tensorflow/lib/python2.7/site-packages/tensorflow/python/training/input.pyc in shuffle_batch(tensors, batch_size, capacity, min_after_dequeue, num_threads, seed, enqueue_many, shapes, allow_smaller_final_batch, shared_name, name)
    800     queue = data_flow_ops.RandomShuffleQueue(
    801         capacity=capacity, min_after_dequeue=min_after_dequeue, seed=seed,
--&gt; 802         dtypes=types, shapes=shapes, shared_name=shared_name)
    803     _enqueue(queue, tensor_list, num_threads, enqueue_many)
    804     full = (math_ops.cast(math_ops.maximum(0, queue.size() - min_after_dequeue),

/Users/Kevin/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/data_flow_ops.pyc in __init__(self, capacity, min_after_dequeue, dtypes, shapes, names, seed, shared_name, name)
    580     """
    581     dtypes = _as_type_list(dtypes)
--&gt; 582     shapes = _as_shape_list(shapes, dtypes)
    583     names = _as_name_list(names, dtypes)
    584     # If shared_name is provided and an op seed was not provided, we must ensure

/Users/Kevin/tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/data_flow_ops.pyc in _as_shape_list(shapes, dtypes, unknown_dim_allowed, unknown_rank_allowed)
     70   if not unknown_dim_allowed:
     71     if any([not shape.is_fully_defined() for shape in shapes]):
---&gt; 72       raise ValueError("All shapes must be fully defined: %s" % shapes)
     73   if not unknown_rank_allowed:
     74     if any([shape.dims is None for shape in shapes]):

ValueError: All shapes must be fully defined: [TensorShape([Dimension(32), Dimension(32), Dimension(None)]), TensorShape([])]
</code></pre>

<p>I'm not sure what is causing this error, I imagine it has something to do with the way I'm processing my image because it shows that they have no dimensions when they should have 3 channels (RGB).</p>

<p>The <a href="https://www.tensorflow.org/versions/r0.10/api_docs/python/io_ops.html#batching-at-the-end-of-an-input-pipeline" rel="nofollow">batching methods in TensorFlow</a> (<code>tf.train.batch()</code>, <code>tf.train.batch_join()</code>, <code>tf.train.shuffle_batch()</code>, and <code>tf.train.shuffle_batch_join()</code>) require that every element of the batch has the exact same shape*, so that they can be packed into dense tensors. In your code, it appears that the third dimension of the <code>image</code> tensor that you pass to <code>tf.train.shuffle_batch()</code> has unknown size. This corresponds to the number of channels in each image, which is 1 for monochrome images, 3 for color images, or 4 for color images with an alpha channel. If you pass an explicit <code>channels=N</code> (where <code>N</code> is 1, 3, or 4 as appropriate), this will give TensorFlow enough information about the shape of the image tensor to proceed.</p>

<hr>

<p>&nbsp;* With one exception: when you pass <code>dynamic_pad=True</code> to <code>tf.train.batch()</code> or <code>tf.train.batch_join()</code> the elements can have different shapes, but they must have the same rank. In general, this is used only for sequential data, rather than image data (where it will have undesirable behavior at the edges of the image).</p>

python tensorflow