File size: 2,538 Bytes
71469eb
71c9ac0
 
 
 
 
 
71469eb
 
 
 
faf8b3f
 
 
 
d357241
faf8b3f
 
 
 
 
 
 
 
 
 
 
 
 
 
d357241
d3e79b4
faf8b3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3187e25
 
faf8b3f
 
 
 
3187e25
 
 
 
 
 
 
 
faf8b3f
 
 
 
 
 
 
d3e79b4
d357241
faf8b3f
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
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
---
title: Search-By-Image
emoji: 💻
colorFrom: indigo
colorTo: green
sdk: streamlit
sdk_version: 1.29.0
app_file: app.py
pinned: false
---

# Image Reverse Search Web App

## Description

### Image Reverse Search with Google’s EfficientNet and Facebook’s FAISS library optimizing search efficiency through fast image embeddings and approximate nearest neighbor algorithms | Training speed: 65k images efficientnet-b2: 4 mins vs Resnet-152: 10 mins

Upload a picture, and AI powered by deep learning will instantly show you visually related matches. Explore and discover connections through the magic of image recognition.

## Demo

Experience the app in action right in your browser: https://huggingface.co/spaces/Instantaneous1/search-by-image

![Demo](UI.png)

## Key Features

- Upload a query image to find visually similar images in the dataset.
- Explore retrieved images to discover related content.
- Adjust the number of matches displayed for visual comparisons.
- Utilizes a pre-trained image feature extractor model (EfficientNet-b2) for accurate image similarity.
- Employs FAISS index for fast approximate nearest neighbor search.
- Offers a user-friendly interface powered by Streamlit.

## Getting Started

1. Clone this repository:

```bash
git clone [git@github.com:sayan1999/search-by-image.git](git@github.com:sayan1999/search-by-image.git)
```

2. Install required libraries:

```bash
pip install -r requirements.txt
```

3. Run the Streamlit app:

for quickly dl embeddings and skipp training

```bash
streamlit run app.py
```

or

to rebuild embeddings

```bash
streamlit run app.py -- --dev
```

4. Access the app in your web browser (usually at http://localhost:8501).

## Technology Stack

Streamlit: Framework for building and deploying web apps in Python.
Torch: Powerful deep learning framework.
OpenDatasets: Library for convenient dataset downloading.
FAISS: Facebook's fast AI vector similarity search
EfficientNet-b2: Pre-trained image classification model for feature extraction.

## Usage

1. Access the app in your web browser at the provided link (usually http://localhost:8501).
2. Click the "Upload Image" button and select an image from your computer.
3. Optionally, adjust the number of matches using the slider.
4. Click the "Search" button to initiate the reverse image search.
5. The app will display the query image along with the retrieved similar images.

## Dataset

[https://www.kaggle.com/datasets/kkhandekar/image-dataset](https://www.kaggle.com/datasets/kkhandekar/image-dataset)