This project aims to develop a minimum viable product for detecting deepfake videos using the LSTM architecture and OpenFace2. The project is a work in progress.
The project is built to detect deepfake videos using LSTM in combination with OpenFace2 for facial feature extraction. Celeb-DF is the primary data source used in training the model. Features extraction from the videos are used to train the model in the form of csv files. The project currently achieves a validation accuracy of 77% and we are hoping to improve the model and incorporate more techniques into it.
- Python 3
- PyTorch
- OpenFace 2.0.0
- OpenCv4
OpenFace 2 is used in the project for facial feature extraction. It is the main feature source of the project. OpenFace 2 can be installed by cloning their repository and following the installation guide in their wiki. The Ubuntu installation was followed for this project. The "FeatureExtraction" executable file is used to extract features in a Python script before being preprocessed and used for training.
Use the installation steps for the respective operating system in which you are going to train the model and ensure that the openface directory is in the root of the project.
The script folder contains the scripts required to preprocess, prepare and label new video data. The code does not currently load the latest checkpoint but you can easily add this before starting the training loop.
First step is to extract features from your videos using the feature_extraction.py file.
- --openface_exe : the path to the openface feature extraction binary file. This would normally be in ./build/bin of the open face directory.
- --input_dir : the directory where your video files reside.
- --output_dir : the directory to which you wish to save the extracted features.
Simply run the script with the above parameters and the extracted features will be saved to the output directory.
Once you have extracted the features, you can run the prepocessor.py script. This script has several functions which were used in early stages of the project.