Hi,
Thanks for the reply. But I cant do that as there is an error in exercise#2 (get_records)
Error:
descriptor ‘ParseFromString’ for ‘google.protobuf.pyext._message.CMessage’ objects doesn’t apply to a ‘bytes’ object
code:
def get_records(dataset, num_records):
‘’‘Extracts records from the given dataset.
Args:
dataset (TFRecordDataset): dataset saved by ExampleGen
num_records (int): number of records to preview
‘’’
# initialize an empty list
records = []
### START CODE HERE
# Use the `take()` method to specify how many records to get
for tfrecord in dataset.take(num_records):
# Get the numpy property of the tensor
serialized_example = tfrecord.numpy()
# Initialize a `tf.train.Example()` to read the serialized data
example = tf.train.Example
# Read the example data (output is a protocol buffer message)
example.ParseFromString(serialized_example)
# convert the protocol bufffer message to a Python dictionary
example_dict = (MessageToDict(example))
# append to the records list
records.append(example_dict)
### END CODE HERE
return records