# faceswap **Repository Path**: sternapeg/faceswap ## Basic Information - **Project Name**: faceswap - **Description**: 换脸程序 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2018-09-03 - **Last Updated**: 2020-12-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README This is the code behind the [Switching Eds blog post](http://matthewearl.github.io/2015/07/28/switching-eds-with-python/). 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](http://sourceforge.net/projects/dclib/files/dlib/v18.10/shape_predictor_68_face_landmarks.dat.bz2). 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 ``. ## 安装使用说明 1. 安装python 编译器, python 版本 2.7.15 https://www.python.org 2. 安装相关包 在根目录下,也就是在faceswap/下运行: ```shell pip install -r requirements.txt ``` 3. 运行脚本 在根目录下,运行命令 ```shell python faceswap.py ``` 例如: ```shell python faceswap.py image/01.jpg image/016.jpg ``` 生成照片,在根目录下位置: output.jpg 为换脸后的效果。 需要说明的是: 该算法只能支持仅包含一张脸的照片,多张脸会报错,运行成功。 ## 目录结构说明 ```shell faceswap ├── README.md ... 本文档 ├── requirements.txt ... 所需的依赖包 ├── faceswap.py ... 运行脚本 ├── shape_predictor_68_face_landmarks.dat ... 人脸识别库 ├── image/ ... 原照片所存目录 └── output.jpg ... 生成的换脸结果照片 ```