Face Recognization Using VGG16

VGG-16 is a convolutional neural network architecture . There are 13 convolutional layers, 5 Max Pooling layers and 3 Dense layers which sums up to 21 layers but only 16 weight layers.

No alt text provided for this image
No alt text provided for this image

IMAGENET DATASET:-

Imagenet is an image database organized according to the WordNet hierarchy (currently only the nouns), in which each node of the hierarchy is depicted by hundreds and thousands of images. Currently we have an average of over five hundred images per node. Each meaningful concept in WordNet, possibly described by multiple words or word phrases, is called a "synonym set" or "synset"

In my model , there were three datasets or classes which i used is :

  1. Akansh (myself)
  2. Arpit Pathak (friend)
  3. Amitabh Bachhan
No alt text provided for this image
No alt text provided for this image

Getting started with:-

Importing the required modules from keras and then implementing them in our model.

Initializing the weights and geting all the necessary information about the pretrained model vgg16 like about the convulation and the pooling layers.

No alt text provided for this image

Freezing of the Layers of the vgg16 dataset:-

As the pretrained vgg16 model already at its best trained status so there is no need to train it again as it costs us much time and the cpu power . So we can freeze it and will train our rest of the layer and adding our fully connected layer on top of the vgg16 layers.

Lets go to model building by importing the VGG16 model , freezing its layers and then adding our fully connected layers on the top of it.

No alt text provided for this image

DEFINING THE MODEL:-

As already the vgg16 model has its layers which we set them to freeze but now we need to add more layers which were fully connected to train our model and bring it out the best accuracy.

Here i used a dense layer and a relu activation function. On top i used softmax activation function.

No alt text provided for this image

MODEL SUMMARY:-

It tells us about the no of classes , layers , shape and parameters used in the model.

No alt text provided for this image
No alt text provided for this image

TRAINING THE MODEL:-

Here i used only 5 epochs because the data is not much and we get proper accuracy after 5 epochs only and save it .

No alt text provided for this image
No alt text provided for this image

FINAL STEP:- LOADING AND PREDICTIONS

No alt text provided for this image
No alt text provided for this image

Model Prediction Successful . Face recognition done correctly.

GITHUB LINK:-


To view or add a comment, sign in

More articles by Akansh Agarwal

Others also viewed

Explore content categories