<p>To read the FSNS dataset you can use <a href="https://github.com/tensorflow/models/blob/master/attention_ocr/python/datasets/fsns.py" rel="nofollow noreferrer">https://github.com/tensorflow/models/blob/master/attention_ocr/python/datasets/fsns.py</a> directly or as a reference.</p>

<p>The feature keys are incorrect in the code snippet you provided - missing the 'image/' prefix. It should be 'image/encoded' instead of just 'encoded', 'image/width' instead of 'image' and so on. Refer to the Table 4 in the <a href="https://arxiv.org/abs/1702.03970" rel="nofollow noreferrer">paper</a>.</p>
How to read images and text in FSNS datasets?
<p>I just want to read image and text in your tfrecords file: <code>fsns/train/train-00511-of-00512Hi</code> in <a href="https://github.com/tensorflow/models/tree/a4944a57ad2811e1f6a7a87589a9fc8a776e8d3c/street" rel="nofollow noreferrer">FSNS datasets</a>.
But when I do the work follow the guide in Tfrecords Guide： <a href="http://warmspringwinds.github.io/tensorflow/tf-slim/2016/12/21/tfrecords-guide/" rel="nofollow noreferrer">link</a>, it shows error message following:</p>

<pre><code>InvalidArgumentError (see above for traceback): Name: &lt;unknown&gt;, Feature: encoded (data type: string) is required but could not be found.
     [[Node: ParseSingleExample/ParseExample/ParseExample = ParseExample[Ndense=4, Nsparse=0, Tdense=[DT_STRING, DT_INT64, DT_STRING, DT_INT64], dense_shapes=[[], [], [], []], sparse_types=[], _device="/job:localhost/replica:0/task:0/cpu:0"](ParseSingleExample/ExpandDims, ParseSingleExample/ParseExample/ParseExample/names, ParseSingleExample/ParseExample/ParseExample/dense_keys_0, ParseSingleExample/ParseExample/ParseExample/dense_keys_1, ParseSingleExample/ParseExample/ParseExample/dense_keys_2, ParseSingleExample/ParseExample/ParseExample/dense_keys_3, ParseSingleExample/ParseExample/Const, ParseSingleExample/ParseExample/Const_1, ParseSingleExample/ParseExample/Const_2, ParseSingleExample/ParseExample/Const_3)]]
</code></pre>

<p>It seems that the key name is wrong? My code is attached, could author or any other check my code and help me to fix the bug? </p>

<pre><code>import tensorflow as tf
import skimage.io as io

IMAGE_HEIGHT = 384
IMAGE_WIDTH = 384

tfrecords_filename = '/home/wangjianbo_i/google_model/MyCode/models/attention_ocr/python/datasets/data/fsns/train/train-00511-of-00512'

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={
        'height': tf.FixedLenFeature([], tf.int64),
        'width': tf.FixedLenFeature([], tf.int64),
        'encoded': tf.FixedLenFeature([], tf.string),
    'text':tf.FixedLenFeature([], tf.string)
        })

    image = tf.decode_raw(features['encoded'], tf.uint8)
    text = tf.decode_raw(features['text'], tf.uint8)

    height = tf.cast(features['height'], tf.int32)
    width = tf.cast(features['width'], tf.int32)

    image_shape = tf.stack([height, width, 3])

    image = tf.reshape(image, image_shape)

    image_size_const = tf.constant((IMAGE_HEIGHT, IMAGE_WIDTH, 3), dtype=tf.int32)

    resized_image = tf.image.resize_image_with_crop_or_pad(image=image,
                                           target_height=IMAGE_HEIGHT,
                                           target_width=IMAGE_WIDTH)

    images = tf.train.shuffle_batch( [resized_image],
                                                 batch_size=2,
                                                 capacity=30,
                                                 num_threads=2,
                                                 min_after_dequeue=10)

    return images,text


filename_queue = tf.train.string_input_producer(
    [tfrecords_filename], num_epochs=10)

image,text = read_and_decode(filename_queue)

init_op = tf.group(tf.global_variables_initializer(),
                   tf.local_variables_initializer())

with tf.Session()  as sess:

    sess.run(init_op)

    coord = tf.train.Coordinator()
    threads = tf.train.start_queue_runners(coord=coord)

    # Let's read off 3 batches just for example
    for i in xrange(3):

        img,text= sess.run([image,text])
    print img,text 
        print(img[0, :, :, :].shape) 
        print('current batch')

        io.imshow(img[0, :, :, :])
        io.show()

        io.imshow(img[1, :, :, :])
        io.show()

    coord.request_stop()
    coord.join(threads)
</code></pre>