0% found this document useful (0 votes)
4 views3 pages

AAIEXP@5

The experiment aimed to explore the VGG16 pre-trained deep learning model for image classification using the ImageNet dataset. VGG16, known for its simplicity and depth, consists of 16 layers and is efficient for making predictions through transfer learning. The results demonstrated accurate predictions for real-world images, showcasing the effectiveness of pre-trained models in AI applications.

Uploaded by

rahulcounsellor1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

AAIEXP@5

The experiment aimed to explore the VGG16 pre-trained deep learning model for image classification using the ImageNet dataset. VGG16, known for its simplicity and depth, consists of 16 layers and is efficient for making predictions through transfer learning. The results demonstrated accurate predictions for real-world images, showcasing the effectiveness of pre-trained models in AI applications.

Uploaded by

rahulcounsellor1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Mitesh Singh / B22 / 2101111

EXPERIMENT-05

AIM:

To explore the working and outcome generation process of a pre-trained deep learning
model—VGG16—on an image classification task using the ImageNet dataset.

THEORY:

1. Pre-Trained Models

Pre-trained models are deep learning architectures that have been previously trained on
large benchmark datasets like ImageNet. These models learn rich feature representations
and can be reused for various downstream tasks such as classification, detection, and
segmentation through transfer learning.

2. VGG16

VGG16 is a convolutional neural network architecture proposed by Visual Geometry Group


(VGG) from the University of Oxford. It consists of 16 layers with weights and is known for
its simplicity and depth.

● It uses only 3x3 convolutional layers, stacked on top of each other, followed by
max-pooling layers and fully connected layers.
Mitesh Singh / B22 / 2101111

● It is trained on the ImageNet dataset, which contains over 1.2 million images across
1,000 classes.

● The final layer produces a probability distribution over these 1,000 categories.

3. Transfer Learning & Prediction

Pre-trained models like VGG16 can be used directly to make predictions or fine-tuned for
specific tasks. These models are efficient as they reduce training time and require less data.

Implementation (Python using TensorFlow/Keras):

from tensorflow.keras.applications.vgg16 import VGG16, preprocess_input,


decode_predictions

from tensorflow.keras.preprocessing import image

import numpy as np

import matplotlib.pyplot as plt

import requests

from PIL import Image

from io import BytesIO

model = VGG16(weights='imagenet')

img_url = "https://upload.wikimedia.org/wikipedia/commons/6/6e/Golde33443.jpg" #
Golden retriever

response = requests.get(img_url)

img = Image.open(BytesIO(response.content)).resize((224, 224))

img_array = image.img_to_array(img)

img_batch = np.expand_dims(img_array, axis=0)

img_preprocessed = preprocess_input(img_batch)

predictions = model.predict(img_preprocessed)

decoded_preds = decode_predictions(predictions, top=3)[0]

plt.imshow(img)

plt.axis('off')

plt.title(f"Predicted: {decoded_preds[0][1]} ({decoded_preds[0][2]*100:.2f}%)")

plt.show()

for i, (imagenet_id, label, prob) in enumerate(decoded_preds):


Mitesh Singh / B22 / 2101111

print(f"{i + 1}. {label}: {prob:.4f}")

CONCLUSION:

In conclusion, the experiment successfully demonstrated the working of the VGG16 pre-
trained model in generating accurate predictions for real-world images. By utilizing a model
trained on the extensive ImageNet dataset, we were able to classify objects in an image
without any additional training. This highlights the power of transfer learning and pre-trained
models in reducing computational overhead while delivering high-accuracy outcomes. Such
models serve as foundational tools in many AI applications, from image classification to
feature extraction in more complex pipelines.

You might also like