3 Keras & Data Retrieval in TensorFlow 2
This chapter covers
- Different APIs provided by Keras (i.e. Sequential, Functional and Sub-classing APIs)
- Using
tf.data
API to retrieve and manipulate persisted data - Using Keras data generators to read data in with few lines of code
- Using
tensorflow-datasets
to access and use popular machine learning datasets
We have explored the nitty-gritties of the low-level TensorFlow API such as, defining tf.Variable
objects and tf.Tensor
objects. We also looked at some of the commonly used functionality provided in TensorFlow in the form of tf.Operation
. Finally, we looked at some complex operations such as matrix multiplication and convolution in detail. If you analyze any standard deep neural network, you will see that they are made from standard mathematical operations such as matrix multiplication or convolution.
However, if you were to implement these networks using the low level TensorFlow API, you’ll find yourself replicating these operations in code many times, costing you valuable hours. But the good news is you don’t have to. TensorFlow provides a sub-module called Keras which takes care of this problem. Keras is a sub-library in TensorFlow that hides the former mentioned building blocks and provides a high-level API (Application Programming Interface) for developing machine learning models. In this chapter, we will see that Keras has several different APIs to choose from depending on the complexity of your solution.