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

https://github.com/abimathi03/face-prediction

Face Mask Reconstruction model using a Convolutional Autoencoder
https://github.com/abimathi03/face-prediction

autoencoder convolution deep-learning facemask model reconstruction

Last synced: 11 months ago
JSON representation

Face Mask Reconstruction model using a Convolutional Autoencoder

Awesome Lists containing this project

README

          

# ๐Ÿง  Face Prediction using Masked Autoencoder

This project implements a **Face Mask Reconstruction** model using a **Convolutional Autoencoder**. It detects faces in an image, masks the lower half of the face, and reconstructs the masked area using a trained deep learning model. A custom loss function based on **Structural Similarity Index (SSIM)** is used to enhance the quality of reconstructions.

---

## ๐Ÿ“‘ Table of Contents

1. [โœจ Features](#-features)
2. [๐Ÿ“ฆ Requirements](#-requirements)
3. [โš™๏ธ Installation](#-installation)
4. [๐Ÿš€ Usage of Intel OneAPI](#-usage-of-intel-oneapi)
5. [๐Ÿงฌ Code Overview](#-code-overview)
6. [๐Ÿ“Š Visualization](#-visualization)
7. [๐Ÿ“„ License](#-license)
8. [๐Ÿ™ Acknowledgments](#-acknowledgments)

---

## โœจ Features

- ๐Ÿ“ท Upload an image and detect faces using **MTCNN**
- ๐Ÿ˜ท Apply a mask to the lower half of the detected face
- ๐Ÿง  Reconstruct the masked region using a **Convolutional Autoencoder**
- ๐Ÿ“Š Visualize the original, masked, and reconstructed images side-by-side

---

## ๐Ÿ“ฆ Requirements

- Python 3.x
- TensorFlow
- OpenCV
- Matplotlib
- NumPy
- dlib
- facenet-pytorch

---

## โš™๏ธ Installation

### 1. Clone the Repository

git clone https://github.com/Abimathi03/FACE_PREDICTION.git
cd face-mask-reconstruction

### 2. Install Dependencies

Install all required packages using pip:

pip install tensorflow opencv-python matplotlib numpy dlib facenet-pytorch

โš ๏ธ Ensure you have CMake and Visual Studio Build Tools (for Windows) for installing dlib.

### 3. Download Pre-trained Models

Download the following file and place it in the project root:

- shape_predictor_68_face_landmarks.dat (for facial landmark detection)

You can get it from: http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2

## ๐Ÿš€ Usage of Intel OneAPI

Intel OneAPI is a toolkit for building optimized apps across CPUs and GPUs.

### Steps:

- Start a Jupyter Notebook or open a Google Colab session

- Run the main script to upload and process an image:

!python main.py

- Follow the on-screen prompts to upload your image. The system will:

- Detect the face

- Apply a lower-face mask

- Reconstruct the masked portion

- Display results

## ๐Ÿงฌ Code Overview
### ๐Ÿ” Face Detection
- Uses MTCNN to detect faces and facial landmarks.

### ๐Ÿงผ Image Preprocessing
- Resize and normalize the input images.

### ๐Ÿ—๏ธ Autoencoder Architecture
- Encoder: Compresses input into a latent representation

- Decoder: Reconstructs the image from the latent vector

### ๐Ÿ“ Custom Loss Function
- Uses SSIM (Structural Similarity Index) to compare masked vs reconstructed images for better visual fidelity.

## ๐Ÿ“Š Visualization

The system displays three outputs:

- Original image with detected face

- Masked face image (lower half masked)

- Reconstructed image using autoencoder

This side-by-side view makes it easy to assess model performance.

## ๐Ÿ“„ License

This project is licensed under the MIT License.
See the LICENSE file for more information.

## ๐Ÿ™ Acknowledgments

- MTCNN for face detection

- TensorFlow for deep learning models

- OpenCV for image processing utilities

- dlib for facial landmarks detection