Reading TFRecords: AttributeError: 'str' object has no attribute 'queue_ref'
<p>I've spent all day on this and have no clue what I am doing wrong. Please help. I have created a TFRecords file with some images in it using the following code: </p>

<pre><code>def convert_to_TF(images, labels, name):
label_count = labels.shape[0]
print('There are %d images in this dataset.' % (label_count))
if images.shape[0] != label_count:
    raise ValueError('WTF! Devil! There are %d images and %d labels. Go fix yourself!' %
                     (images.shape[0], label_count))
rows = images.shape[1]
cols = images.shape[2]
depth = images.shape[3]

filename = os.path.join(name + '.tfrecords')
print('Writing', filename)
writer = tf.python_io.TFRecordWriter(filename)
for index in range(label_count):
    image_raw = images[index].tostring()
    example = tf.train.Example(features=tf.train.Features(feature={
        'height': _int64_feature(rows),
        'width': _int64_feature(cols),
        'depth': _int64_feature(depth),
        'label': _int64_feature(int(labels[index])),
        'image_raw': _bytes_feature(image_raw)}))
    writer.write(example.SerializeToString())
</code></pre>

<p>I then attempt to read the saved TFRecords file with:</p>

<pre><code>def read_and_decode(filename_queue):
reader = tf.TFRecordReader()
_, serialized_example = reader.read(filename_queue, 'train')
features = tf.parse_single_example(
    serialized_example,
    features={
        'image_raw': tf.FixedLenFeature([], tf.string),
        'label': tf.FixedLenFeature([], tf.int64),
        'height': tf.FixedLenFeature([], tf.int64),
        'width': tf.FixedLenFeature([], tf.int64),
        'depth': tf.FixedLenFeature([], tf.int64)
    })
image = tf.decode_raw(features['image_raw'], tf.uint8)
label = tf.cast(features['label'], tf.int32)
height = tf.cast(features['height'], tf.int32)
width = tf.cast(features['width'], tf.int32)
depth = tf.cast(features['depth'], tf.int32)
return image, label, height, width, depth
</code></pre>

<p>I then get the following error. </p>

<pre><code>Traceback (most recent call last):
File "/media/mcamp/Local SSHD/Python Projects/Garage Door Project/FreshStart/TFCode2.py", line 50, in &lt;module&gt;
    label, image = read_and_decode(filename)
  File "/media/mcamp/Local SSHD/Python Projects/Garage Door Project/FreshStart/TFCode2.py", line 31, in read_and_decode
    _, serialized_example = reader.read(filename_queue, 'train')
  File "/home/mcamp/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/io_ops.py", line 264, in read
    queue_ref = queue.queue_ref
AttributeError: 'str' object has no attribute 'queue_ref'
</code></pre>