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
- Host: GitHub
- URL: https://github.com/abimathi03/face-prediction
- Owner: Abimathi03
- Created: 2024-10-05T04:27:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-24T17:46:09.000Z (about 1 year ago)
- Last Synced: 2025-06-29T10:39:34.563Z (12 months ago)
- Topics: autoencoder, convolution, deep-learning, facemask, model, reconstruction
- Language: Jupyter Notebook
- Homepage:
- Size: 666 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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