Skip to content

3bsalam-1/CBIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Content-Based Image Retrieval (CBIR) using Autoencoders

A Deep Learning project that implements Content-Based Image Retrieval (CBIR) functionality using a Convolutional Autoencoder on the CIFAR-10 dataset. The system learns compressed feature representations (embeddings) of images to clean noisy inputs and retrieve visually similar images efficiently.

πŸš€ Features

  • Autoencoder Architecture: A convolutional neural network that compresses images into a lower-dimensional latent space.
  • Image Denoising: Capable of removing noise from images as part of the reconstruction process.
  • Similarity Search: Retrieves the most similar images from the training set for a given query image using Euclidean distance in the latent space.
  • Performance Metrics: Evaluates retrieval performance using Mean Average Precision (mAP).

πŸ“‚ Project Structure

CBIR/
β”œβ”€β”€ src/                # Source code modules
β”‚   β”œβ”€β”€ data_loader.py  # CIFAR-10 loading and preprocessing
β”‚   β”œβ”€β”€ model.py        # Autoencoder architecture definition
β”‚   β”œβ”€β”€ train.py        # Training procedure
β”‚   β”œβ”€β”€ evaluate.py     # Evaluation metrics and scoring
β”‚   └── visualization.py# Image plotting and saving
β”œβ”€β”€ models/             # Directory for saved models
β”œβ”€β”€ data/               # Data files (not tracked by git)
β”œβ”€β”€ output_images/      # Generated results (denoised/retrieved images)
β”œβ”€β”€ main.py             # CLI Entry point
└── requirements.txt    # Python dependencies

πŸ› οΈ Installation

  1. Clone the repository (if applicable) or download the source.
  2. Install dependencies:
    pip install -r requirements.txt

πŸƒ Usage

The project is controlled via the main.py script.

1. Train the Model

Train the autoencoder from scratch.

python main.py train --epochs 20 --batch_size 128

This will save the model to models/autoencoder.h5.

2. Evaluate Performance

Calculate the Mean Average Precision score.

python main.py evaluate --n_test_samples 1000

3. Run Retrieval Demo

Perform a search for a specific test image.

python main.py demo --index 1 --n_samples 10

Results will be saved in output_images/.

4. Denoise Demo

Visualize the denoising capability of the autoencoder.

python main.py denoise

πŸ“Š Results

The model learns to map 32x32 RGB images to a robust feature space.

  • Denoising: The model can effectively remove Gaussian noise from inputs.
  • Retrieval: Queries return semantically similar images based on visual features (color, shape, texture) rather than just raw pixel matching.

πŸ“ License

This project is open-source and available for educational purposes.

About

πŸ–ΌοΈA Deep Learning project that implements Content-Based Image Retrieval (CBIR) functionality using a Convolutional Autoencoder on the CIFAR-10 dataset. The system learns compressed feature representations (embeddings) of images to clean noisy inputs and retrieve visually similar images efficiently.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages