Rudra Rahul Chothe
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,117 +1,122 @@
|
|
1 |
-
---
|
2 |
-
language: en
|
3 |
-
license: mit
|
4 |
-
tags:
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
##
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
```
|
34 |
-
|
35 |
-
|
36 |
-
```
|
37 |
-
|
38 |
-
```
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
```
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
β βββ
|
52 |
-
β βββ
|
53 |
-
β βββ
|
54 |
-
βββ
|
55 |
-
βββ
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
```
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
```
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
**
|
74 |
-
|
75 |
-
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
**
|
98 |
-
- Uses
|
99 |
-
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
-
|
104 |
-
-
|
105 |
-
|
106 |
-
**
|
107 |
-
-
|
108 |
-
-
|
109 |
-
-
|
110 |
-
|
111 |
-
|
112 |
-
-
|
113 |
-
|
114 |
-
|
115 |
-
-
|
116 |
-
-
|
117 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- image-search
|
6 |
+
- machine-learning
|
7 |
+
title: Image Similarity Search Engine
|
8 |
+
sdk: streamlit
|
9 |
+
emoji: π»
|
10 |
+
colorFrom: blue
|
11 |
+
colorTo: pink
|
12 |
+
---
|
13 |
+
|
14 |
+
## Image Similarity Search Engine
|
15 |
+
A deep learning-based image similarity search engine that uses EfficientNetB0 for feature extraction and FAISS for fast similarity search. The application provides a web interface built with Streamlit for easy interaction.
|
16 |
+
|
17 |
+
Features
|
18 |
+
- Deep Feature Extraction: Uses EfficientNetB0 (pre-trained on ImageNet) to extract meaningful features from images
|
19 |
+
- Fast Similarity Search: Implements FAISS for efficient nearest-neighbor search
|
20 |
+
- Interactive Web Interface: User-friendly interface built with Streamlit
|
21 |
+
- Real-time Processing: Shows progress and time estimates during feature extraction
|
22 |
+
- Scalable Architecture: Designed to handle large image datasets efficiently
|
23 |
+
|
24 |
+
## Installation
|
25 |
+
## Prerequisites
|
26 |
+
|
27 |
+
Python 3.8 or higher
|
28 |
+
pip package manager
|
29 |
+
|
30 |
+
## Setup
|
31 |
+
|
32 |
+
1. Clone the repository:
|
33 |
+
```
|
34 |
+
git clone https://github.com/yourusername/image-similarity-search.git
|
35 |
+
cd image-similarity-search
|
36 |
+
```
|
37 |
+
2. Create and activate a virtual environment:
|
38 |
+
```
|
39 |
+
python -m venv venv
|
40 |
+
source venv/bin/activate # On Windows use: venv\Scripts\activate
|
41 |
+
```
|
42 |
+
3. Install required packages:
|
43 |
+
```
|
44 |
+
pip install -r requirements.txt
|
45 |
+
```
|
46 |
+
|
47 |
+
## Project Structure
|
48 |
+
```
|
49 |
+
image-similarity-search/
|
50 |
+
βββ data/
|
51 |
+
β βββ images/ # Directory for train dataset images
|
52 |
+
β βββ sample-test-images/ # Directory for test dataset images
|
53 |
+
β βββ embeddings.pkl # Pre-computed image embeddings
|
54 |
+
βββ src/
|
55 |
+
β βββ feature_extractor.py # EfficientNetB0 feature extraction
|
56 |
+
β βββ preprocessing.py # Image preprocessing and embedding computation
|
57 |
+
β βββ similarity_search.py # FAISS-based similarity search
|
58 |
+
β βββ main.py # Streamlit web interface
|
59 |
+
βββ requirements.txt
|
60 |
+
βββ README.md
|
61 |
+
βββ .gitignore
|
62 |
+
```
|
63 |
+
## Usage
|
64 |
+
|
65 |
+
1. **Prepare Your Dataset:**
|
66 |
+
Get training image dataset from drive:
|
67 |
+
```
|
68 |
+
https://drive.google.com/file/d/1U2PljA7NE57jcSSzPs21ZurdIPXdYZtN/view?usp=drive_link
|
69 |
+
```
|
70 |
+
Place your image dataset in the data/images directory
|
71 |
+
Supported formats: JPG, JPEG, PNG
|
72 |
+
|
73 |
+
2. **Generate Embeddings:**
|
74 |
+
```
|
75 |
+
python -m src.preprocessing
|
76 |
+
```
|
77 |
+
|
78 |
+
**This will**:
|
79 |
+
- Process all images in the dataset
|
80 |
+
- Show progress and time estimates
|
81 |
+
- Save embeddings to data/embeddings.pkl
|
82 |
+
|
83 |
+
3. **Run the Web Interface:**
|
84 |
+
```
|
85 |
+
streamlit run src/main.py
|
86 |
+
```
|
87 |
+
|
88 |
+
4. Using the Interface:
|
89 |
+
|
90 |
+
- Upload a query image using the file uploader
|
91 |
+
- Click "Search Similar Images"
|
92 |
+
- View the most similar images from your dataset
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
## Technical Details
|
97 |
+
**Feature Extraction**
|
98 |
+
- Uses EfficientNetB0 without top layers
|
99 |
+
- Input image size: 224x224 pixels
|
100 |
+
- Output feature dimension: 1280
|
101 |
+
|
102 |
+
**Similarity Search**
|
103 |
+
- Uses FAISS IndexFlatL2 for L2 distance-based search
|
104 |
+
- Returns top-k most similar images (default k=5)
|
105 |
+
|
106 |
+
**Web Interface**
|
107 |
+
- Responsive design with Streamlit
|
108 |
+
- Displays original and similar images with similarity scores
|
109 |
+
- Progress tracking during processing
|
110 |
+
|
111 |
+
**Dependencies**
|
112 |
+
- TensorFlow 2.x
|
113 |
+
- FAISS-cpu (or FAISS-gpu for GPU support)
|
114 |
+
- Streamlit
|
115 |
+
- Pillow
|
116 |
+
- NumPy
|
117 |
+
- tqdm
|
118 |
+
|
119 |
+
**Performance**
|
120 |
+
- Feature extraction: ~1 second per image on CPU
|
121 |
+
- Similarity search: Near real-time for datasets up to 100k images
|
122 |
+
- Memory usage depends on dataset size (approximately 5KB per image embedding)
|