FaceSwap as the name suggests is a face swapper that uses an object detection algorithm (Haar Cascade Classifier ) to detect faces on the webcam and swap them with another face!
This project uses a haar cascade classifier in order to detect all faces in real-time video and swap all the faces with a face of Keanu Revees xD
This is an object detection algorithm proposed by Viola and Jones that is used to detect facial features. The haar cascade classifier has 4 main stages :
A feature is essentially calculations that are performed on adjacent rectangular regions at a specific location. The calculation involves the summation of pixel intensities at each region and the difference between their sums. Example of haar features:
For large images, the features can be hard to determine, and hence to reduce computational complexity we use integral images. An integral image is calculated from the original image in such a way that each pixel is the sum of all pixels lying to the left and above it in the original image. This means that the last pixel would basically be the sum of all pixels in the image. Most of the features will be irrelevant, hence AdaBoost is used to determine the relevant features
AdaBoost essentially chooses the best features and trains the classifiers to use them. It uses a combination of weak learners to build a strong classifier
The idea behind this is, not all the features need to run on each and every window. If a feature fails on a particular window, then we can say that the facial features are not present there. The cascade classifier is made up of a series of stages, where each stage is a collection of weak learners. Weak learners are trained using boosting, which allows for a highly accurate classifier from the mean prediction of all weak learners.
- Add a CLI interface
- Swap faces using a better algorithm
If you are really interested in contributing to the please follow the below steps and rules.
- Fork the project 🍴 (Star ⭐ the repo before that 😛)
- Clone it.
- Build the project.
- Look for any issues in the To-Do section.
- Always create a new branch and work on the feature or bug. Check this if you are not that familiar with branching, Git Branching.
- If you are using any other module for implementing any new features, please install the modules in the virtual environment and update them in the
requirements.txt
by using the below command.
pip freeze > requirements.txt
If you have any doubts or issues, let the maintainers know about it. They would be ready to help.