3 min readMay 19, 2020


VGG16 is a convolutional neural network model proposed by K. Simonyan and A. Zisserman from the University of Oxford in the paper “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The model achieves 92.7% top-5 test accuracy in ImageNet, which is a dataset of over 14 million images belonging to 1000 classes. It was one of the famous model submitted to ILSVRC-2014. It makes the improvement over AlexNet by replacing large kernel-sized filters (11 and 5 in the first and second convolutional layer, respectively) with multiple 3×3 kernel-sized filters one after another.They take dataset from Imagenet.ImageNet is a dataset of over 15 million labeled high-resolution images belonging to roughly 22,000 categories.


So we take advantage of advance pre trained model of VGG16,by getting its weight,as our computation power is not too good, and train our whole model takes lot of Time.So we do a trick by the concept of Transfer learning. First we freeze all the layer of VGG16, then we add our layers in fully connected layer in last before the output layer.

In the above picture we are importing VGG16 and getting the model,and after that freezing all the layers.

In the above picture we are adding our own layers so that we can do face recognition or predict whatever we want by giving the dataset of it.After adding all the layers we merge both the model and get the new model.

In the above picture we are giving the dataset to the model for training the model and for testing the model

In the above picture after giving the dataset to the model, we compile whole the model then train the model ,after all the epochs we are ready for the prediction.And for better accuracy you can change the hyperparameters and do testing of it.

I have save the model so that i can use it in different program by just importing it.

I Launch one more program for face recognition,and also detect mobile and water bottle

In the above picture I have imported the model that i saved in previous program. and add a photo to detect it ,you can also do it by live camera .

In these above two pictures we have done prediction of our face recognition and also object detection. Here are some outputs that i got.


Hence we have done face recognition and object detection using VGG16, so that we trained our model in very less time and get very much accuracy.If you want thw code of this activity click here.