Skip to content

propardhu/Docker_ELK_Image_Search

Repository files navigation

Advanced Image Search System with Machine Learning and Elasticsearch

Elastic Stack version Build Status Join the chat

Run the latest version of the [Elastic stack][elk-stack] with Docker and Docker Compose.

It gives you the ability to analyze any data set by using the searching/aggregation capabilities of Elasticsearch and the visualization power of Kibana.

Based on the [official Docker images][elastic-docker] from Elastic:

Other available stack variants:

  • tls: TLS encryption enabled in Elasticsearch, Kibana (opt in), and Fleet
  • searchguard: Search Guard support

Important

[Platinum][subscriptions] features are enabled by default for a [trial][license-mngmt] duration of 30 days. After this evaluation period, you will retain access to all the free features included in the Open Basic license seamlessly, without manual intervention required, and without losing any data. Refer to the How to disable paid features section to opt out of this behaviour.


tl;dr

docker-compose up setup
docker-compose up

Animated demo


Advanced Image Search System with Machine Learning and Elasticsearch

Overview

This project demonstrates the creation of an advanced image search system using OpenAI's CLIP model and Elasticsearch. The system allows for searching images using other images rather than keywords, leveraging machine learning techniques to process images into feature vectors and Elasticsearch for storing and searching these vectors using cosine similarity.

Prerequisites

  • Docker
  • Python 3.7+
  • Libraries: torch, transformers, pillow, requests, torchvision, matplotlib, flask
  • Jupyter Notebook

Project Structure

.
├── templates
├── uploads
├── SearchEngine.ipynb
├── app.py

Setup

Step 1: Set Up the ELK Stack Using Docker

  1. Clone the repository:

    git clone https://github.com/propardhu/Docker_ELK_Image_Search.git
    cd Docker_ELK_Image_Search
  2. Bring up the ELK stack using Docker Compose:

    docker-compose up
  3. Verify the setup:

Step 2: Install Python Dependencies

Install the necessary Python libraries:

pip install torch transformers pillow requests torchvision matplotlib flask jupyter

Step 3: Preprocess Images and Store Vectors in Elasticsearch

  1. Start Jupyter Notebook:

    jupyter notebook
  2. Open the SearchEngine.ipynb notebook and run all cells to preprocess the Oxford Pets dataset and store the image vectors in Elasticsearch.

Step 4: Run the Flask App

  1. Ensure the project structure is as follows:

    .
    ├── templates
    ├── uploads
    ├── SearchEngine.ipynb
    ├── app.py
    
  2. Start the Flask app by running:

    python app.py
  3. Access the web interface by opening your browser and going to http://localhost:5000.

Conclusion

In this project, we built an advanced image search system using OpenAI's CLIP model and Elasticsearch. By setting up the ELK stack with Docker, installing the necessary dependencies, running the Jupyter notebook to preprocess and store vectors, and running the Flask app, you can search for images using other images through a user-friendly web interface.


Would you like me to remember anything specific about this project or your work with it?