ImageVectorSearch is an open-source project that provides a reverse image search engine based on image embeddings. It uses ResNet50 for image embedding generation and Milvus for efficient and scalable image similarity searches.
ImageVectorSearch leverages state-of-the-art deep learning models to generate image embeddings and utilizes Milvus, an open-source vector database, for efficient similarity searches. The project aims to provide a simple and scalable solution for reverse image searches.
- Image embedding generation using ResNet50.
- Milvus integration for storing and searching image embeddings.
- Batch processing for data loading to Milvus.
- FastAPI integration for querying and retrieving similar images.
-
Clone the repository:
git clone https://github.com/<YOUR_USERNAME>/<YOUR_REPO_NAME>.git cd <YOUR_REPO_NAME>
-
Install dependencies:
pip install -r requirements.txt
To generate image embeddings for a given URL, use the following code snippet:
from image_embedding import ImageEmbed
image_embed = ImageEmbed()
embedding = image_embed.image_embedding("<IMAGE_URL>")
print("Image Embedding:", embedding)
To load and process data and insert it into Milvus, run the following code:
from image_embedding import ImageEmbed
image_embed = ImageEmbed()
image_embed.load_data()
To search for similar images given a URL, use the following code:
from image_embedding import ImageEmbed
image_embed = ImageEmbed()
image_embed.search_image("<IMAGE_URL>")
Ensure you have a .env file in the root directory with the following variables:
HOST=<MILVUS_HOST>
PORT=<MILVUS_PORT>
DIM=<EMBEDDING_DIMENSION>
COLLECTION_NAME=<MILVUS_COLLECTION_NAME>
INDEX_TYPE=<MILVUS_INDEX_TYPE>
METRIC_TYPE=<MILVUS_METRIC_TYPE>
BATCH_SIZE=<BATCH_SIZE>
Replace <MILVUS_HOST>, <MILVUS_PORT>, and other placeholders with your actual Milvus configuration.
Install and run Milvus by following the instructions in the Milvus Documentation https://milvus.io/docs/install_standalone-docker.md