Skip to content

First Round submission for the Ethos Hackathon. This repository consists of the basic implementation of two model SRCNN and DeblurGANv2.

Notifications You must be signed in to change notification settings

who-else-but-arjun/Doraemon

Repository files navigation

Face Enhancement Pipeline

This repository contains a comprehensive pipeline for face enhancement, including face extraction, SRCNN-based super-resolution, and GAN-based deblurring. The project is structured to handle face images, enhance their resolution, and remove any blur, resulting in high-quality outputs.

Table of Contents

Overview

The pipeline processes face images through the following steps:

  1. Face Extraction: Detects and crops faces from input images using a Haar Cascade classifier.
  2. SRCNN (Super-Resolution): Enhances the resolution of the cropped faces using a Super-Resolution Convolutional Neural Network (SRCNN).
  3. Deblurring: Removes any blur from the SRCNN-enhanced images using a GAN-based model.

Requirements

The project requires the following dependencies:

  • Python 3.8+
  • TensorFlow
  • OpenCV
  • NumPy
  • scikit-image
  • Matplotlib

Setup

  1. Clone the repository:

    git clone https://github.com/who-else-but-arjun/Doraemon.git
    cd Doraemon
  2. Ensure you have the required .h5 weight files (generator.h5 for SRCNN and 3051crop_weight_200.h5 for the deblurring model) in the project directory.

  3. Place your input images in a directory, e.g., input_faces/.

Pipeline

The pipeline is outlined in the pipeline.ipynb Jupyter notebook, which walks through the entire process:

  1. Face Extraction: Using faceCrop.py, it extracts faces from the input images.
  2. Super-Resolution with SRCNN: Using SRCNN.py, it applies the SRCNN model trained on generator.h5 weights to enhance the image resolution.
  3. Deblurring: Using DeblurGANv2.py, it removes any blur from the SRCNN output using a pre-trained GAN model, with layers defined in layer_util.py.

Files Description

  • pipeline.ipynb: Jupyter notebook containing the step-by-step process from face extraction to enhancement and deblurring.
  • SRCNN.py: Implements the SRCNN model for super-resolution, loading pre-trained weights from generator.h5.
  • faceCrop.py: Contains the Haar Cascade classifier logic for face detection and cropping.
  • DeblurGANv2.py: Implements the GAN model for deblurring images, loading weights from deblur_generator.h5.
  • layer_util.py: Contains utility functions, including ResNet blocks necessary for the deblurring model.

How to Run

  1. Face Extraction:

    python faceCrop.py --input_folder input_faces --output_folder cropped_faces
  2. SRCNN Super-Resolution:

    python srcnn.py --input_folder cropped_faces --output_folder srcnn_output --weights generator.h5
  3. Deblurring:

    python deblur_gan_v2.py --input_folder srcnn_output --output_folder deblurred_output --weights deblur_generator.h5
  4. Run the entire pipeline:

    Execute all steps sequentially in the pipeline.ipynb notebook.

Results

The results of the pipeline will be saved in the specified output directories. You can compare the before and after images to evaluate the improvement in image quality.

About

First Round submission for the Ethos Hackathon. This repository consists of the basic implementation of two model SRCNN and DeblurGANv2.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published