A Report on
“Deep Image Search Using
Machine Learning”
Submitted by-
Rachchh Dipak Bharatbhai
200320107060
Internship project
under the supervision of-
Dr. Kalpdrum Passi
for the period of-
July 6, 2023 to August 13, 2023
1
Acknowledgments
I would like to express our sincere gratitude to all those who
have contributed to the successful completion of this Image
Search Project and the corresponding report. Their support,
guidance, and expertise have played a crucial role in shaping
this project.
First and foremost, we extend our heartfelt thanks to our
project supervisor Dr. Kalpdrum Passi whose valuable insights
and constructive feedback guided us throughout the
development process. Their mentorship and encouragement
greatly enriched our understanding and capabilities.
2
Table of Contents
1. Introduction
2. Importing Libraries
3. Importing Datasets
4. Set up The Model- vgg19
5. Update The Data
6. Implementation
7. Methodology
8. Conclusion
3
1. Introduction
Imagine being able to find pictures that resemble a photo you have,
just by using a computer. That's what this project, "Deep Image
Search for Similar Images using Machine Learning," is all about. In
our world overflowing with pictures, it's become crucial to have a
smart way to search for images that look alike, and that's where the
magic of computers and machine learning comes in.
Think of it as teaching computers to understand images like we do.
This project uses a special kind of machine learning called deep
learning, which helps computers learn the patterns and details in
pictures. With the help of Python, a versatile programming language,
we're building a system that can take one picture as a clue and find a
bunch of other pictures that are similar to it.
Our project has a clear goal: create a tool that lets you find pictures
that look alike in a snap. We break this down into different steps, like
getting the pictures ready, teaching the computer about these
pictures, and making sure it can figure out which pictures are the
most alike. Python makes all these steps possible with its cool tools
for machine learning.
4
2. Importing Libraries
DeepImageSearch is a Python library for fast and accurate image
search. It offers seamless integration with Python, GPU support, and
advanced capabilities for identifying complex image patterns using
the Vision Transformer models.
From DeepImageSearch, We import Load_Data and Search_Setup
which helps the model to load data and searching.
5
3. Importing Data Sets
Load the data from the folder Which we already downloaded to a
variable.
Now we check the data. And Print Length of data and some samples.
I downloaded my dataset from Kaggle. From the link given below
https://www.kaggle.com/datasets/iamsouravbanerjee/animal-
image-dataset-90-different-animals
6
4. Set up the Model – ‘vgg19’
Now we set up and load the model.
The model we are using here is vgg19.
Extracting the Metadata and save the index file.
Review the metadata image file.
7
5. Update The Data
Adding new images to data for better prefomance.
Now, Here we updated the data so we have to update the
metadata as well.
8
6. Implementation
Here I used the get_similar_image() method to get the list of
similar images of the image we want.
But in this we cannot to see the images. So it’s better to plot
the images.
9
So here, We used plot_similar_images() method which plots
all the images similar to the image we want.
In both the method we give path of target image and number
of images to get/plot as parameter.
10
7. Mehodolodgy
Data Collection and Preparation:
- Gather a dataset of images that you want to search through.
- Preprocess the images to ensure they're in a consistent format,
usually resizing them to the same dimensions as the VGG19 model
expects.
Loading the VGG19 Model:
- Import the VGG19 model, which is pre-trained on a large dataset
for image classification.
- Remove the classification layers from the top, as you're using the
model for feature extraction rather than classification.
Feature Extraction:
- Pass each image through the VGG19 model and extract the
outputs from one of the intermediate layers. These outputs capture
the important features of each image.
- Flatten or reshape the extracted features to create a feature
vector for each image.
Similarity Measurement:
- Choose a similarity metric such as cosine similarity or Euclidean
distance.
- Calculate the similarity between the feature vectors of the query
image and all other images in the dataset.
11
Ranking and Retrieval:
- Rank the images based on their similarity scores.
- Retrieve the top N images that are most similar to the query
image.
User Interface (Optional):
- Create a user interface where users can input a query image.
- Display the retrieved similar images in a visually appealing way.
12
8. Conclusion
In this project, we've created a smart way to find pictures that look
similar to each other using a special computer model called VGG19.
Think of it like having a superpower to recognize patterns in pictures.
By using this model, we made a tool that can take one picture as a
clue and quickly find other pictures that are very much alike.
Imagine you're looking for more pictures that have the same vibe as
your favorite photo. Our project makes that search easy and fast. We
learned how to teach the computer to understand pictures and pick
out their special features. With this magic, we can find similar
pictures almost like magic too!
This project is like a bridge between technology and everyday life. It
shows that with some smart tricks, computers can help us discover
and enjoy pictures in a whole new way. So, whether you're into art,
shopping, or just exploring, our project has made finding similar
images a breeze!
13