def join_with_delimiter(self, string): """ """ string = string.decode(encoding='utf-8') string = DELIMITER.join([c for c in list(string)]) string = string + DELIMITER return string
def make_example(filename, image_data, text, height, width): """ """ # Join with delimiter, Add EOS Token length = len(text) text = DELIMITER.join([c for c in text] + [EOS_TOKEN]) example = tf.train.Example(features=tf.train.Features( feature={ 'image/encoded': _bytes_feature(tf.compat.as_bytes(image_data)), 'image/height': _int64_feature([height]), 'image/width': _int64_feature([width]), 'image/filename': _bytes_feature(tf.compat.as_bytes(filename)), 'text/string': _bytes_feature(tf.compat.as_bytes(text)), 'text/length': _int64_feature([length]) })) return example