Neural Network Projects with Python by James Loy;

Neural Network Projects with Python by James Loy;

Author:James Loy; [Неизв.]
Language: eng
Format: epub
Tags: COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM044000 - COMPUTERS / Neural Networks, COM037000 - COMPUTERS / Machine Theory
Publisher: Packt Publishing
Published: 2019-02-28T07:11:52+00:00


INPUT_SIZE = 128 # Change this to 48 if the code takes too long to run

vgg16 = VGG16(include_top=False, weights='imagenet',

input_shape=(INPUT_SIZE,INPUT_SIZE,3))

Note that we used include_top=False when we created a new VGG16 model. This argument tells Keras not to import the fully connected layers at the end of the VGG16 network.

We're now going to freeze the rest of the layers in the VGG16 model, since we're not going to retrain them from scratch. We can freeze the layers by running the following code snippet:

for layer in vgg16.layers:

layer.trainable = False

Next, we're going to add a fully connected layer with 1 node right at the end of the neural network. The syntax to do this is slightly different, since the VGG16 model is not a Keras Sequential model that we're used to. In any case, we can add the layers by running the following code:

from keras.models import Model



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.