Hands-On Convolutional Neural Networks with TensorFlow
by Iffat Zafar, Giounona Tzanidou, Richard Burton, Nimesh Patel, Leonardo Araujo
Making a TFRecord
Before we start, let's break down how a TFRecord works. After you open a TFRecord file for writing, you create something called an Example. This is just a protocol buffer that we will use to stuff all the data we want to save inside. Within an Example, we will store our data in Features. Features is a way to describe the data inside of our Example. A Feature can be one of three types: bytes list, float list, or int64 list. Once we have put all our data into the Features and written them into the Example buffer, we will serialize the whole protocol buffer to a string and then this is what we write to the TFRecord file.
Let's see how this can work in practice. We will keep using our previous example of image classification ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access