/ImageRetrieval

Image Retrieval System - Flask Web Application - CLIP, BLIP, BEIT

Primary LanguagePython

πŸ” Image Retrieval System - CS336.P11.KHTN

Teacher Instruction

  • PhD. Ngo Duc Thanh

Team

No. Full name Student ID Email Github
1 TrαΊ§n NhΖ° CαΊ©m NguyΓͺn 22520004 22520004@gm.uit.edu.vn cnmeow
2 TrαΊ§n Thα»‹ CαΊ©m Giang 22520361 22520361@gm.uit.edu.vn Yangchann
3 Nguyα»…n Hα»―u HoΓ ng Long 22520817 22520817@gm.uit.edu.vn EbisuRyu
4 Đặng Hữu PhÑt 22521065 22521065@gm.uit.edu.vn HuuPhat125
5 Phan HoΓ ng PhΖ°α»›c 22521156 22521156@gm.uit.edu.vn HPhuoc0906

Introduction

This project aims to build a Flask web application for retrieving relevant images based on textual descriptions, using some of the most powerful models such as CLIP, BLIP, BEIT. It supports two main query types:

  • Text: Search for relevant images based on text input
  • Image: Upload an image to find related textual descriptions.

By combining state-of-the-art deep learning models, the system ensures high accuracy and versatility for image-based search tasks.

Installation

  1. Clone the repository:

    git clone https://github.com/cnmeow/ImageRetrievalSystem
    cd ImageRetrievalSystem
  2. Install the required dependencies:

    pip install -r requirements.txt
  3. Download data: In this project, we use Flickr30k dataset

  4. Directory structure:

   ImageRetrievalSystem/
    β”œβ”€β”€ app.py                  # Main application file (Flask app)
    β”œβ”€β”€ static/                 
    β”‚   β”œβ”€β”€ flickr30k/
    β”‚       β”œβ”€β”€ images/         # Folder images just downloaded
    β”œβ”€β”€ templates/
    β”œβ”€β”€ data/                   # Folder data just downloaded
    β”œβ”€β”€ index/                  # Folder index just downloaded
    β”œβ”€β”€ notebooks/              # Notebook model for system use, no web required
    β”œβ”€β”€ repos/  
    β”œβ”€β”€ src/                    # Source code of model
    β”œβ”€β”€ requirement.txt
  1. Web application:
  • Run the web server:
flask run

Features

  • Search by Text: Enter a text query to retrieve relevant images from the database.
    Example: "A baby girl is wearing a red hat".

    image
  • Search by Image: Upload an image to retrieve related text descriptions, captions, or tags. image

    Example: Upload a picture of a man image

    Receive query results similar to the image just uploaded image

  • Powered by CLIP, BLIP, and BEIT:

    • CLIP: Matches images and text by extracting semantic features.
    • BLIP: Automatically generates captions for images.
    • BEiT: Provides robust image feature extraction.
  • User-friendly Web Interface:

    • Upload an image or enter text to perform a search.
    • Displays query results in real-time.