A face beautify / makeup transfer demo and inference workflow.
Install the required dependencies:
pip install numpy opencv-python pillow tqdm onnxruntimeDownload the models from the following link: models face_models.pth
Place the downloaded model files (including detector, parsing, and transfer ONNX weights) under the project model/ directory so that paths such as model/HP_FACE_DETECTOR.onnx, model/faceparsing.onnx, and model/appface_transfer_female/ / model/appface_transfer_male/ resolve correctly.
- Put test images in
inputs/. - Run the main entry script:
appface.py
Example:
python appface.py -t 0 -d 1 -f "[398, 233, 715, 645]"- Results are written under
outputs/.
-t/--type: processing gender preset,int,0or1, default00: female style set (model/appface_transfer_female/)1: male style set (model/appface_transfer_male/)
-d/--detail: sharpness / detail strength,float, default11: default model behavior1.1–1.5: extra sharpening layered on top
-f/--face_rect: optional face bounding box, string parsed as a four-number list[x1, y1, x2, y2]- If omitted, all detected faces above the confidence threshold are processed.
Runtime Python packages are listed in the Installation section above (numpy, opencv-python, pillow, tqdm, onnxruntime).