Back to Portfolio

CNN-Based Image Deblurring using Defocused Blur Dataset

AI / Computer Vision2025

A lightweight CNN autoencoder trained on the Defocused Blur Dataset to restore sharpness in defocused images, achieving 15.3 dB PSNR and 0.39 SSIM.

CNN-Based Image Deblurring using Defocused Blur Dataset

The Problem

Blurry or defocused images are a persistent problem in photography, surveillance, and computer vision systems. Traditional deblurring methods fail to capture the complex non-linear distortions introduced by camera shake or defocus, resulting in loss of texture and spatial detail. There was a need for a lightweight learning-based solution capable of restoring sharpness effectively without requiring heavy computational resources.

Problem illustration

The Solution

To address this challenge, a CNN-based autoencoder architecture was developed to perform single-image deblurring. The network consists of 3 convolutional encoder layers and 5 decoder (Conv2DTranspose) layers, forming a symmetric structure that reconstructs clear images from defocused inputs. The model was trained on the Defocused Blur Dataset from Kaggle using MSE loss, PSNR, and SSIM metrics. It achieved a validation loss of 0.0379 and PSNR of 15.3 dB, demonstrating promising results in restoring spatial structure while maintaining computational efficiency.

Dataset Preparation

Collected and preprocessed paired blurred and sharp images from the Defocused Blur Dataset. All samples were resized to 224x224 and normalized.

Model Architecture

Implemented a 7-layer CNN autoencoder using TensorFlow. Downsampling was achieved with Conv2D and LeakyReLU activations, while upsampling used Conv2DTranspose layers.

Training & Optimization

Trained the model for 70 epochs with Adam optimizer and dynamic learning rate adjustment via ReduceLROnPlateau. Evaluated using PSNR and SSIM metrics.

Architecture

A symmetric convolutional autoencoder network with 3 encoder and 5 decoder layers. Uses LeakyReLU activations and 1.3M total parameters.

  • 3 × Conv2D (Encoder) with filters 64 → 128 → 256
  • 5 × Conv2DTranspose (Decoder) with filters 256 → 128 → 64 → 32 → 3
  • LeakyReLU activations for non-linearity
  • MSE loss, Adam optimizer, ReduceLROnPlateau scheduler

Dataset

Source: Kaggle – kwentar/blur-dataset

  • defocused_blurred/ : blurred input images
  • sharp/ : ground truth sharp images

Total: 216 paired images

Split: 80% train, 10% validation, 10% test

Image Size: 224x224 pixels

Training Details

  • epochs: 70
  • batchSize: 32
  • optimizer: Adam
  • lossFunction: Mean Squared Error (MSE)
  • metrics: PSNR,SSIM
  • learningRate: Adaptive (ReduceLROnPlateau)
  • framework: TensorFlow 2.x
  • environment: Google Colab GPU

Results & Analysis

Metrics:

  • trainingLoss: ~0.0353
  • validationLoss: ~0.0379
  • PSNR: 15.3 dB
  • SSIM: 0.39

Observations:

  • Model effectively reconstructs spatial structures but struggles with fine textures.
  • Learning rate scheduling improved convergence and reduced oscillations.
  • Performance is consistent across validation sets.

Future Improvements

  • Integrate perceptual (VGG-based) loss for better texture recovery.
  • Adopt U-Net or ResNet-style encoders for deeper feature extraction.
  • Add residual connections to preserve fine details.
  • Fine-tune on motion-blurred datasets for generalization.
  • Deploy model using TensorFlow Lite for mobile optimization.

Technologies Used

PythonTensorFlow 2.xKerasNumPyMatplotlibGoogle ColabPSNR / SSIM Evaluation
CNN-Based Image Deblurring using Defocused Blur Dataset | Abdulrahman Hamdi