Transfer learning with TensorFlow 2.0

In this section, we'll implement the two transfer learning scenarios again, but this time using TensorFlow 2.0.0 (TF). In this way, we can compare the two libraries. Instead of ResNet18, we'll use the ResNet50V2 architecture (more on that in the Chapter 3, Advanced Convolutional Networks). In addition to TF, this example also requires the TF Datasets 1.3.0 package (https://www.tensorflow.org/datasets), a collection of various popular ML datasets.

With that, let's get started:

  1. As usual, first, we need to do the imports:
import matplotlib.pyplot as pltimport tensorflow 

Get Advanced Deep Learning with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.