当前位置: 首页 > 工具软件 > faceswap > 使用案例 >

faceswap php源码,faceswap

姜弘化
2023-12-01

This is the code behind the Switching Eds blog post.

See the link for an explanation of the code.

To run the script you'll need to install dlib (http://dlib.net) including its

Python bindings, and OpenCV. You'll also need to obtain the trained model from

sourceforge.

Unzip with bunzip2 and change PREDICTOR_PATH to refer to this file. The

script is run like so:

./faceswap.py

If successful, a file output.jpg will be produced with the facial features

from

replaced with the facial features from .

安装使用说明

安装python 编译器,

python 版本 2.7.15

https://www.python.org

安装相关包

在根目录下,也就是在faceswap/下运行:

pip install -r requirements.txt

运行脚本

在根目录下,运行命令

python faceswap.py

例如:

python faceswap.py image/01.jpg image/016.jpg

生成照片,在根目录下位置:

output.jpg 为换脸后的效果。

需要说明的是:

该算法只能支持仅包含一张脸的照片,多张脸会报错,运行成功。

目录结构说明

faceswap

├── README.md ... 本文档

├── requirements.txt ... 所需的依赖包

├── faceswap.py ... 运行脚本

├── shape_predictor_68_face_landmarks.dat ... 人脸识别库

├── image/ ... 原照片所存目录

└── output.jpg ... 生成的换脸结果照片

 类似资料: