Face Painter simulates the process of painter painting portrait oil painting. Instead of making up a portrait painting by color blocks directly (Paint once), we parse the face at first, paint each part separately then and put them together finally (Paint in order), by which we get a portrait oil painting with clear outlines and pronounced facial features.
Input | Face parsing |
---|---|
Process | Final painting | |
---|---|---|
Paint once | ||
Paint in order |
According to four principles, from big to small, from top to bottom, from left to right and from inside to outside, Face Painter draws a portrait painting in the following order:
- rough outline
- face skin
- eyebrows, eyes and glasses
- nose and ears
- lips and mouth
- hat, hair, neck and cloth
- ear rings and neck lace
- background
The core methods are as follows:
- Canny edge detector -> detect face outline
- Face segmentation network -> parse face into different parts
- Painting network -> paint an image
- Python >= 3.7 (Recommend to use Anaconda or Miniconda)
- PyTorch >= 1.8
- NVIDIA GPU + CUDA
-
Clone repo
git clone https://github.com/JiaHeng-DLUT/face_painter.git
-
Install dependent packages
pip install -r requirements.txt
Note that Face Painter is only tested in Ubuntu, and may be not suitable for Windows. You may try Windows WSL with CUDA supports :-) (It is now only available for insider build with Fast ring).
python run.py
The painting output can be found in the output
directory by default, which takes about 15 minutes.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
The codes and the pretrained model in this repository are under the MIT license as specified by the LICENSE file.
If you have any question, please email [email protected]
.