This is a practice project for deblurring blurry images using a Generative Adversarial Network (GAN). The model is trained to convert blurry images into sharp ones. Evaluation is done using PSNR (Peak Signal-to-Noise Ratio) and SSIM (Structural Similarity Index).
project/
├── data/
│ ├── blurred/ # Blurry input images
│ ├── clear/ # Sharp ground truth images
│ ├── Blur\_script.ipynb # Script for creating blurred images
│ └── data.ipynb # Data loading and preprocessing
│
├── model/
│ ├── gan.py # Generator and Discriminator architectures
│ └── gan.ipynb # Architecture testing or development
│
├── training/
│ ├── train\_loop.ipynb # Training loop for GAN
│ └── evaluate.ipynb # Evaluation with PSNR and SSIM
│
├── results/
│ └── sample\_result.png # Output comparison image (blurry | generated | clear)
│
├── requirements.txt # Required Python packages
└── README.md # Project description
- Generator: A U-Net-based network implemented in
model/gan.py. - Discriminator: A PatchGAN-style discriminator implemented in the same file.
The training is handled in training/train_loop.ipynb. It uses paired blurry and sharp images from the data/ folder to train the GAN to reconstruct sharp images.
After training, model performance is evaluated using:
- PSNR (Peak Signal-to-Noise Ratio)
- SSIM (Structural Similarity Index)
Evaluation code is in training/evaluate.ipynb.
Install dependencies using:
pip install -r requirements.txt
The image below shows a blurry input, the generated sharp image, and the original sharp image:
- Inspired by: DeblurGAN paper (Kupyn et al., 2018)
This project is for learning purposes. You can improve results by:
- Using a larger dataset
- Implementing advanced models like DeblurGAN-v2 or ESRGAN
- Adding perceptual loss (e.g. VGG-based loss)
