DECIMER/DECIMER_EfficinetNetV2_Transfomer_Trainer.py
def read_tfrecord(example):
    """Read a tf record file and decodes the image and text data
    back into original form.

    Args:
        example (tf.record): single entry from tf record file

    Returns:
        img (float array): 2D float array
        caption: tokenized SMILES string
    """
    feature = {
        "image_raw": tf.io.FixedLenFeature([], tf.string),
        "caption": tf.io.FixedLenFeature([], tf.string),
    }

    # decode the TFRecord
    example = tf.io.parse_single_example(example, feature)
    img = decode_image(example["image_raw"])
    caption = tf.io.decode_raw(example["caption"], tf.int32)
    return img, caption
Read a tf record file and decodes the image and text data
    back into original form.

    Args:
        example (tf.record): single entry from tf record file

    Returns:
        img (float array): 2D float array
        caption: tokenized SMILES string
    
Read a tf record file and decodes the image and text data
back into original form.
Read a tf record file and decodes the image and text data back into original form .
def read_tfrecord(example):
    feature = {
        "image_raw": tf.io.FixedLenFeature([], tf.string),
        "caption": tf.io.FixedLenFeature([], tf.string),
    }
    example = tf.io.parse_single_example(example, feature)
    img = decode_image(example["image_raw"])
    caption = tf.io.decode_raw(example["caption"], tf.int32)
    return img, caption
def read_tfrecord ( example ) : feature = { "image_raw" : tf . io . FixedLenFeature ( [ ] , tf . string ) , "caption" : tf . io . FixedLenFeature ( [ ] , tf . string ) , } example = tf . io . parse_single_example ( example , feature ) img = decode_image ( example [ "image_raw" ] ) caption = tf . io . decode_raw ( example [ "caption" ] , tf . int32 ) return img , caption
Read a tf record file and decodes the image and text data
back into original form.
Read a tf record file and decodes the image and text data back into original form .
"""Read a tf record file and decodes the image and text data
    back into original form.

    Args:
        example (tf.record): single entry from tf record file

    Returns:
        img (float array): 2D float array
        caption: tokenized SMILES string
    """ # decode the TFRecord
img (float array): 2D float array
caption: tokenized SMILES string
img ( float array ) : 2D float array caption : tokenized SMILES string
example
single entry from tf record file
single entry from tf record file