A CNN based implementation of Instagram-like animal filters, trained using kaggle's Facial Keypoints Detection dataset. Uses OpenCV to generate a real-time video feed! 😺🚀

The Facial Filters Application is an interactive Python program that leverages computer vision and deep learning techniques to apply dynamic animal filters to a person's face in real-time through a webcam feed. This engaging application combines the power of Convolutional Neural Networks (CNNs) for facial keypoints detection with OpenCV for face detection and image manipulation.
- Pandas 🔗
- NumPy 🔗
- Scikit-Learn 🔗
- TensorFlow 🔗
- Matplot 🔗
- Download required files into a working directory🛠️
- Download dataset from kaggle🛠️
- Install dependencies from the file🛠️
- Customise code to your specification🛠️
- Train model🛠️
- Run implementation code🛠️
- Download this whole repository into a working directory that you created.🧩
- Extract the images.zip file into a images folder.🧩
- Run
pip install -r requirements.txt
in a terminal open in the working directory or in your IDE's integrated terminal. Just make sure the terminal is active inside the working directory.🧩 - Download and the extract the csv file from the kaggle link given above into your working directory.🧩
- Now open the prepare_plot_train_save.ipynb file.🧩
- In the code, at the end, in the
os.chdir
function to save the trained model, change the path of the working directory to the path of your working directory on your local system. Failure in doing so will lead to an error!🧩 - Run the whole jupyter notebook and it should train succesfully for 100 epochs (or however you modify it) and produce and save a model.h5 file.🧩
- In case you run into any dependency error, just run
pip install *package name of missing dependency*
. You can google the name of the packages that we've imported to find out the official names of the packages that you need to type in. Some included in this code are,opencv-python
for cv2,scikit-learn
for sklearn,matplotlib
for matplotlib etc.🧩 - Remember, if any download is in the form of a
.zip
file, you have to extract it's contents to the working directory.🧩 - In case you get an
SyntaxError: (unicode error) 'unicodeescape' codec
error, replace all the\
(forward slash) with\\
(double forward slashes) in the path that you specify inside theos.chdir
command above.🧩 - Run the apply_animal_filters.py file after the model is trained. Run this file either in your IDE's integrated terminal, or in a terminal open in the working directory. Once again, make sure the terminal is active inside the working directory.🧩
- And there you go! Filters on your face!🧩
⭐️Developed in collaboration with Shubhika Verma for PESU I/O Slot 16. Shubhika Verma is the Subject Matter Expert for the course 'Computer Vision: Introduction to CNNs and YoloV5.'⭐️