Giter Site home page Giter Site logo

sy-nguyen / cbir-using-cnn-and-hash Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 139.39 MB

Content-Based Image Retrieval Using CNN and Hash

Python 78.54% HTML 21.46%
caltech101 content-based-image-retrieval flask keras tensorflow convolutional-neural-networks

cbir-using-cnn-and-hash's Introduction

Content-Based Image Retrieval Using CNN and Hash

Introduction

This project implements a Content-Based Image Retrieval (CBIR) system that allows users to upload an image and find similar images from the Caltech-101 dataset. The similarity between images is determined by extracting features using a Convolutional Neural Network (CNN) and comparing these features using hash.

Implementation

The project uses a pre-trained MobileNetV2 model to extract features from images. The extracted features are then converted into binary codes using a hash function, and the similarity between images is computed by comparing these binary codes.

Setup Instructions

1. Create a Virtual Environment

It is recommended to use a virtual environment to manage the project's dependencies. Create a virtual environment using the following command:

python -m venv venv

2. Activate the Virtual Environment

Activate the virtual environment using the following command:

venv\Scripts\activate

3. Install Required Libraries

Install the necessary libraries using the requirements.txt file:

pip install -r requirements.txt

or

pip install flask numpy pandas matplotlib pillow keras tensorflow

4. Train the Model and Generate Binary Codes

Before running the application, you need to train the model and generate the binary codes for the image dataset. Execute the train.py file with the following command:

python train.py

This will train the feature extraction model and create t binary codes for the images.

5. Run the Flask Application

After generating the binary codes, you can run the Flask application. Execute the app.py file with the following command:

python app.py

6. Access the Application

Open your web browser and go to the following URL to access the CBIR application:

http://127.0.0.1:5000/

Usage

  1. Upload an Image: On the main page, upload an image by clicking the "Choose File" button and selecting an image from your computer.

  2. View Results: After uploading, the application will process the image and display the query image along with the top 10 most similar images from the dataset.

  3. Search Another Image: You can upload another image by clicking the "Upload Another Image" button on the results page.

Conclusion

This project demonstrates how to build a CBIR system using Flask and a pre-trained CNN model for feature extraction. The similarity search is performed by comparing binary codes of image features, offering an efficient way to find similar images in a dataset.

cbir-using-cnn-and-hash's People

Contributors

sy-nguyen avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.