TFRecord: Key: image/object/class/text. Can't parse serialized Example

I’m downloading a TFRecord data set from Roboflow, and parsing it to be used by tf.keras.applications.mobilenet.MobileNet.
I run the data set through this function:

def parse_tfrecord_fn(example):
    feature_description = {
        'image/object/bbox/ymax':[1], tf.float32),
        'image/encoded':[], tf.string),
        'image/height':[1], tf.int64),
        'image/object/bbox/ymin':[1], tf.float32),
        'image/filename':[1], tf.string),
        'image/format':[1], tf.string),
        'image/width':[1], tf.int64),
        'image/object/bbox/xmin':[1], tf.float32),
        'image/object/bbox/xmax':[1], tf.float32),
        'image/object/class/text':[3], tf.string),
        'image/object/class/label':[1], tf.int64),
    example =, feature_description)
    image = tf.image.decode_jpeg(example['image/encoded'], channels=3)
    label = example['image/object/class/label']
    image = tf.image.resize(image, (224, 224))
    image = tf.keras.applications.mobilenet.preprocess_input(image)
    return image, label

After processing my data set on it, parsed_dataset =, I do the following:

base_model = MobileNet(weights = 'imagenet', include_top=False)
x = base_model.output
x = GlobalAveragePooling2D()(x)
x = Dense(128, activation='relu')(x)
output = Dense(num_features, activation='softmax')(x)

model = Model(inputs=base_model.input, outputs=output)

I then compile and fit the model

model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])

num_epochs = 1000, epochs=num_epochs, verbose=1)

However, due to, epochs=num_epochs, verbose=1), I get the error:

InvalidArgumentError: Graph execution error:

Key: image/object/class/text. Can’t parse serialized Example.
[[{{node ParseSingleExample/ParseExample/ParseExampleV2}}]]
[[IteratorGetNext]] [Op:__inference_train_function_112072]

I’ve tried going through the Stack Overflow posts discussing this problem: python - Tensorflow TFRecord: Can't parse serialized example - Stack Overflow.

Could you please let me know how to approach this problem?

Project Type: Object Detection
Project Universe Link or Workspace/Project ID: Accessible Train Station

Hi @buildfor

Unfortunately, here on the Roboflow Forum, as much as we’d like to, we only have the capacity to assist with issues directly on or closely related to Roboflow’s products, projects, or features.

I think you would get the best help by going to Stack Overflow and checking out existing topics or creating your own.