Getting ready

In this section, let's try to understand how we can leverage the VGG16 pre-trained network for our gender classification exercise.

The VGG16 model's architecture is as follows:

Notice that the model's architecture is very similar to the model that we trained in the Gender classification using CNNs section. The major difference is that this model is deeper (more hidden layers). Additionally, the weights of the VGG16 network are obtained by training on millions of images.

We'll ensure that the VGG16 weights are frozen from updating while training our model to classify gender in an image. The output of passing an image in the gender classification exercise (which is of 300 x 300 x 3 in shape) is 9 x 9 x 512 in shape.

We shall keep the weights as they were in the original network, extract the 9 x 9 x 512 output, pass it through another convolution pooling operation, flatten it, connect it to a hidden layer, and then pass it through the sigmoid activation to determine whether the image is of a male or a female.

Essentially, by using the convolution and pooling layers of the VGG16 model, we are using the filters that were trained on a much bigger dataset. Ultimately, we will be fine-tuning the output of these convolution and pooling layers for the objects that we are trying to predict.

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

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