Create TensocrflowTFRecords at this format

Greetings!

I need to write Tensorflow TFRecords files in this specific format, for input to an object detection model:

PrefetchDataset element_spec={
    'image': TensorSpec(shape=(None, None, 3), dtype=tf.uint8, name=None), 
    'image/filename': TensorSpec(shape=(), dtype=tf.string, name=None), 
    'image/id': TensorSpec(shape=(), dtype=tf.int64, name=None), 
    'objects': {
        'area': TensorSpec(shape=(None,), dtype=tf.int64, name=None), 
        'bbox': TensorSpec(shape=(None, 4), dtype=tf.float32, name=None), 
        'id': TensorSpec(shape=(None,), dtype=tf.int64, name=None), 
        'is_crowd': TensorSpec(shape=(None,), dtype=tf.bool, name=None), 
        'label': TensorSpec(shape=(None,), dtype=tf.int64, name=None)}
}

I want to implement like this implementation, but at above specified format (where ‘ojbects’ key have another subkeys in it)

Thanks in advance!
Allan S.