March 2019
Intermediate to advanced
196 pages
4h 50m
English
In this example, we look at a more complicated record structure given by this dictionary:
filename = './students.tfrecords'data = { 'ID': 61553, 'Name': ['Jones', 'Felicity'], 'Scores': [45.6, 97.2] }
Using this, we can construct a tf.train.Example class, again using the Feature() method. Note how we have to encode our string:
ID = tf.train.Feature(int64_list=tf.train.Int64List(value=[data['ID']]))Name = tf.train.Feature(bytes_list=tf.train.BytesList(value=[n.encode('utf-8') for n in data['Name']]))Scores = tf.train.Feature(float_list=tf.train.FloatList(value=data['Scores']))example = tf.train.Example(features=tf.train.Features(feature={'ID': ID, 'Name': Name, 'Scores': Scores }))
Serializing and writing this record to ...
Read now
Unlock full access