MagicMirror is a Python application that uses computer vision; image processing and deep learning to transfer hairstyles from a face (a source image) to another (a target image).
Deep learning is applied to recognize face shapes, which is then used to filter user hairstyle feeds to only display faces with similar face shapes to ensure high quality Hair Transfer.
Implicitly, hair transfer uses face swapping but a modest attempt is made here to emphasize on hair features of the target image.
TensorFlow was used for deep learning. The Inception V3 deep learning model was retrained to recognize five face shapes.
- Python 3.6+
- pip package manager
-
Create and activate a virtual environment
# Create virtual environment python3 -m venv myenv # Activate virtual environment # On Unix/macOS: source myenv/bin/activate # On Windows: myenv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
Credits: Switching Eds with Python