This repository contains an ensemble of different techniques for face anti-spoofing, combining approaches such as binary pixel-wise segmentation, patch analysis, depth-based analysis, and deepfake detection. It aims to provide a comprehensive solution to detecting fake or spoofed faces in images.
-
Binary_Pixel: Contains the implementation of a binary pixel-wise segmentation approach for anti-spoofing.
-
Patch_Depth: Implements a patch and depth-based approach for anti-spoofing.
-
MesoNet: Implements a deepfake detection technique using MesoNet.
-
Ensemble(Final): Combines and integrates the above approaches into an ensemble for improved accuracy.
-
MTCNN_Face_Extraction: Implements face extraction using the MTCNN model.
-
PRNet: Implements depth-based face construction using PRNet.
-
SimSwap: Not an added folder but used to generate deepfake data on our dataset. Uses SimSwap repo.
Try to run the code in a conda environment
conda create --name fas python=3.8
conda activate fas
In case of a dlib error
pip install cmake
conda install -c conda-forge dlib
To run the code in this repository, you need to install the required dependencies listed in the requirements.txt
file.
pip install -r requirements.txt
- Upgrade macOS to version 12+
- Remove torch, torchvision from requirements.txt
- Install miniconda
- Run the following before following the other conda instructions
conda config --set auto_activate_base false
- Brew install the rust compiler
brew install cmake protobuf rust
- Install Tensorflow and Pytorch using the follows
conda install -c apple tensorflow-deps
pip install tensorflow-macos
pip install tensorflow-metal
conda install pytorch torchvision torchaudio -c pytorch
- Other installations which might be required for installation: hdf5, h5py, chardet, scipy
- Create the environment from the above instructions
- Make Ensemble(Final) as current directory.
- Create a folder test_img_folder and add images to it
- Run the command
python ensemble.py