Created
August 24, 2021 14:15
-
-
Save dpoulopoulos/22d18fc0c212e651bda65b891018a14a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def image_feature(value): | |
"""Returns a bytes_list from a string / byte.""" | |
return tf.train.Feature( | |
bytes_list=tf.train.BytesList(value=[tf.io.encode_jpeg(value).numpy()]) | |
) | |
def bytes_feature(value): | |
"""Returns a bytes_list from a string / byte.""" | |
return tf.train.Feature( | |
bytes_list=tf.train.BytesList(value=[value.encode()]) | |
) | |
def float_feature(value): | |
"""Returns a float_list from a float / double.""" | |
return tf.train.Feature( | |
float_list=tf.train.FloatList(value=[value]) | |
) | |
def int64_feature(value): | |
"""Returns an int64_list from a bool / enum / int / uint.""" | |
return tf.train.Feature( | |
int64_list=tf.train.Int64List(value=[value]) | |
) | |
def float_feature_list(value): | |
"""Returns a list of float_list from a float / double.""" | |
return tf.train.Feature( | |
float_list=tf.train.FloatList(value=value) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment