Saumith's picture
Update README.md
ab89933
---
title: Optimised Mosaic Generator
emoji: 🧩
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
---
# ⚑ Optimised Mosaic Generator (Lab 5)
A high-performance image mosaic generator built using FAISS, OpenCV, and LAB color matching.
20×–100Γ— faster than the baseline (Lab 1) implementation.
---
## πŸš€ Features
- FAISS-accelerated nearest neighbor search
- Up to 20,000 CIFAR-100 tiles
- LAB color space matching
- OpenCV fast tile resizing
- Efficient tile caching (baked into the Space after first run)
- MSE + SSIM quality metrics
- Beautiful Gradio interface
---
## 🧠 How it works
1. Input image is cropped to fit the chosen grid size
2. Convert image to LAB and compute mean color per cell
3. Preprocess 10k–20k CIFAR tiles
4. Find the best tile match for each cell using FAISS L2 search
5. Assemble final mosaic in optimized NumPy format
6. Compute MSE/SSIM and render output
---
## πŸ“¦ Technologies Used
- Python
- Gradio
- NumPy
- OpenCV
- FAISS
- Hugging Face Datasets
- CIFAR-100 tiles
- PIL (Pillow)
---
## πŸ› οΈ Options
- Grid sizes: **16 / 32 / 64 / 128**
- Tile sizes: **8, 16, 24, 32 px**
- Tile bank size: **up to 20,000 tiles**
- Optional color quantization
- Show/hide grid overlay
---
## πŸ“ˆ Performance
This version is dramatically faster than Lab 1:
- Vectorized implementation β†’ **5Γ— speedup**
- FAISS + OpenCV implementation β†’ **20–100Γ— speedup**
- Memory-efficient tile caching
- Fast, interactive UI
---
## πŸ–ΌοΈ Example
Try uploading any portrait, landscape, or artwork to see mosaic results instantly.
---
## πŸ“„ License
MIT License
Β© 2025 Saumith Devarsetty