This repository contains a Python script for face makeup application and enhancement using the CodeFormer model. The script leverages face recognition and CodeFormer, a deep learning model, to enhance facial features in images.
Before running the script, make sure you have the following dependencies installed:
- Python
- OpenCV (
pip install opencv-python
) - PyTorch (
pip install torch torchvision
) - NumPy (
pip install numpy
) - basicsr library (Ensure that the required libraries are installed. You can find them in the
requirements.txt
file.)
-
Install the required Python packages:
pip install -r requirements.txt
or through the provided
CodeFormer.ipynb
nootebook. -
Replace the
./CodeFormer/inference_codeformer.py
with theinferece_codeformer.py
file provided in this repository. -
Run the
inference_codeformer.py
script script:python face_restoration.py
The script includes options for different makeup styles:
option_makeup = 1
: Deep Gray Eyebrows, Red Lip, Gray Eyes, Black Eyelineroption_makeup = 2
: Brown Eyebrows, Hot Pink Lip, Gray Eyes, Brown Eyelineroption_makeup = 3
: Deep Gray Eyebrows, Dark Orange Brown Lip, Gray Eyes, Black Eyelineroption_makeup = 4
: Deep Gray Eyebrows, Light Pink Lip, Gray Eyes, Brown Eyelineroption_makeup = 5
: Deep Gray Eyebrows, Crimson Lip, Gray Eyes, Black Eyeliner
You can modify the option_makeup
variable in the inferece_codeformer.py
script to choose a specific makeup style.
The following were the results from the DLIB makeup application code
Below are the results from the DLIB library refined through Codeformer
Shown below are the final results with makeup application through DLIB and refinement through Codeformer
- The CodeFormer model is used for face restoration.
- Face recognition is performed using the
face_recognition
library.