Source network architecture

We're going to be using the Inception-V3 network architecture (https://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Szegedy_Rethinking_the_Inception_CVPR_2016_paper.pdf). The Inception architecture is interesting and quite sophisticated relative to what you've seen so far in this book. If you recall from Chapter 7, Convolutional Neural Networks, one of the decisions we had to make around our network architecture was a choice in filter size. For each layer, we had to decide if we should use a 3 x 3 filter, for example, instead of a 5 x 5 filter. Of course, maybe another convolution isn't called for at all; it might be that something like pooling might be more appropriate. So, what if we just did all things, at every layer. That's the motivation behind inception.

This architecture is based on a series of modules, or building blocks called inceptions modules. In each inception module, the previous activations are given to a 1 x 1 convolution, a 3 x 3 convolution, a 5 x 5 convolution, and a max pooling layer. The output is then concatenated together.

The Inception-V3 network consists of several of these inception modules stacked on top of each other. The final two layers are both fully connected, with the output layer being a 1,000 neuron softmax.

We can load the Inception-V3 network, and it's weights, by using the InceptionV3 class inside keras.applications.inception_v3. Keras has several popular networks available in it's network zoo, all located inside keras.applications. It's also possible to load models created in TensorFlow with just a little more work. Converting models trained in other architectures is possible as well, but it's outside the scope of a quick reference.

To load Inception, we just need to instantiate an InceptionV3 object, which is a Keras model, as shown in the following code:

from keras.applications.inception_v3 import InceptionV3
base_model = InceptionV3(weights='imagenet', include_top=False)

You may notice, we said include_top=False here, which signals that we don't want the top layers of the network. This spares us the work of removing them by hand. When this code runs the first time, it will download the Inception-V3 network architecture and saved weights and cache those for us. Now we just need to add our own fully connected layers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.133.49