Search⌘ K
AI Features

Project Creation: Part Two

Explore how to build a Pokemon image classifier by leveraging transfer learning with the ResNet50 model. Learn to connect a custom classifier with a pre-trained convolutional base using TensorFlow's Functional API. Understand how global average pooling and dropout layers improve model performance and prevent overfitting.

We made, shuffled, and preprocessed our dataset in the previous lesson. In this lesson, we will work with the ResNet50 model.

Importing the libraries

We will use TensorFlow's Keras module to build this project.

Python 3.5
from tensorflow.python.keras.applications.resnet50 import ResNet50
from tensorflow.python.keras.optimizers import Adam
from tensorflow.python.keras.layers import *
from tensorflow.python.keras.models import Model
import numpy as np
print("Imported Successfully!")

Load the ResNet50 model

The next step is to load the ResNet50 model. We will also have a look at the summary of the model to understand the architecture of the ResNet50 model.

Python 3.5
model = ResNet50(include_top = False, weights = 'imagenet', input_shape = (224,224,3))
print(model.summary())

Explanation:

  • The weights will start to download. It will take a bit of time to complete the download process.

  • We passed three parameters in the ResNet50().

    • include_top: the default value of this parameter is True. It means that we want to load the model with the classifier.
...