https://github.com/bhuvan2018/enhancing_image_clarity_denoising_autoencoder
A lightweight Flask web application that performs real-time face image deblurring using a custom CBAM-enhanced U-Net model served via TensorFlow. It includes intelligent image enhancement, PSNR/SSIM/MAE/MSE metrics, and a clean UI to visualize deblurred results. Optimized for both mobile & desktop images, by restoring image clarity.
https://github.com/bhuvan2018/enhancing_image_clarity_denoising_autoencoder
daisyui docker flask lenis python tensorflow threejs
Last synced: 3 months ago
JSON representation
A lightweight Flask web application that performs real-time face image deblurring using a custom CBAM-enhanced U-Net model served via TensorFlow. It includes intelligent image enhancement, PSNR/SSIM/MAE/MSE metrics, and a clean UI to visualize deblurred results. Optimized for both mobile & desktop images, by restoring image clarity.
- Host: GitHub
- URL: https://github.com/bhuvan2018/enhancing_image_clarity_denoising_autoencoder
- Owner: bhuvan2018
- Created: 2025-07-18T10:35:49.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-07-18T14:15:58.000Z (12 months ago)
- Last Synced: 2025-07-18T14:33:19.026Z (12 months ago)
- Topics: daisyui, docker, flask, lenis, python, tensorflow, threejs
- Language: HTML
- Homepage:
- Size: 49.2 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Face Deblurring Web App ๐
A deep learning-powered web application to **restore low-quality or blurred face images** using a **CBAM-enhanced U-Net** architecture. The system performs intelligent image enhancement through CLAHE, denoising, and unsharp masking โ and provides detailed evaluation metrics including PSNR, SSIM, MAE, and MSE.
---
## ๐ Key Features
- ๐ค Upload blurry face images (e.g., selfies, low-light portraits)
- ๐งช Preprocessing pipeline with:
- CLAHE (Contrast Limited Adaptive Histogram Equalization)
- FastNlMeansDenoisingColored (light denoising)
- Unsharp masking
- Adaptive sharpness & contrast adjustment
- ๐ง Real-time deblurring with **TensorFlow SavedModel** via `TFSMLayer`
- ๐ Metrics Visualization:
- PSNR (Peak Signal-to-Noise Ratio)
- SSIM (Structural Similarity Index)
- MAE, MSE
- Noise Difference Histogram (Intensity Loss vs. Enhancement)
- ๐ฅ CSV log export of image metrics
- ๐ Web UI with:
- Landing page (`/`)
- Deblurring interface (`/in`)
- ๐ป Frontend stack: **Three.js**, **Daisy UI**, **Lenis UI**
---
## ๐ง Model Overview
- **Architecture:** U-Net with CBAM (Convolutional Block Attention Module)
- **Loss Function:** Perceptual + Pixel Loss (Multi-Scale)
- **Input/Output Size:** 128 ร 128
- **Trained On:** Human face datasets with synthetic blur (Gaussian + Motion)
- **Deployment Format:** TensorFlow SavedModel (`autoencoder_model/`)
---
## ๐ Getting Started
### 1. Clone the Repository
```bash
git clone https://github.com/bhuvan2018/Enhancing_Image_Clarity_Denoising_Autoencoder.git
cd Enhancing_Image_Clarity_Denoising_Autoencoder
````
### 2. Install Dependencies
```bash
pip install -r requirements.txt
```
### 3. Project Structure
```
โโโ app.py # Flask backend
โโโ autoencoder_model/ # Trained TensorFlow SavedModel
โโโ nginx/
โ โโโ default.conf
โโโ templates/
โ โโโ home.html # Landing page
โ โโโ index.html # Deblurring interface
โโโ static/
โ โโโ css/
โ โโโ styles.css
โ โโโ js/
โ โโโ script.js
โโโ docker-compose.yml
โโโ Dockerfile
โโโ render.yaml
โโโ requirements.txt
โโโ metrics_log.csv # Metrics log for processed images
โโโ README.md
```
### 4. Run Locally
#### Option A: Run Locally
```bash
python app.py
```
Open in browser:
* `http://127.0.0.1:5000/` โ Home
* `http://127.0.0.1:5000/in` โ Deblurring UI
#### Option B: Run with Docker
1. Build the Docker Image:
```bash
docker build -t face-deblurring-app .
```
2. Run the Container
```bash
docker run -d -p 5000:5000 face-deblurring-app
```
Open in browser:
* `http://localhost:5000/` โ Home
* `http://localhost:5000/in` โ Deblurring UI
---
## ๐ Sample Output Metrics
| Image | PSNR (dB) | SSIM | MAE | MSE |
| ------------ | --------- | ---- | ----- | ------ |
| `blur1.jpg` | 27.42 | 0.86 | 0.031 | 0.0021 |
| `blur2.jpg` | 28.13 | 0.88 | 0.028 | 0.0017 |
| `mobile.jpg` | 25.60 | 0.75 | 0.045 | 0.0034 |
---
## ๐ฆ Deployment
> โ๏ธ Deployment via **Docker**
---
## ๐ Dataset & Training Details
* **Dataset Used:** CelebA Faces + Human Faces Dataset
* **Blur Types:** Randomized Gaussian and Motion Blur (synthetically added)
* **Training Pipeline:**
* CBAM-enhanced U-Net
* Perceptual + Pixel loss (multi-scale)
* Trained using 128ร128 face crops
---
## ๐โโ๏ธ Author
**Bhuvan Shetty**
๐ง \[[bhuvanshetty2018@gmail.com](mailto:bhuvanshetty2018@gmail.com)]
Built with โค๏ธ using Flask, TensorFlow, Three.js, DaisyUI & Lenis