An open API service indexing awesome lists of open source software.

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.

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