换脸程序
由于后面需要安装 python dlib
包,所以需要先确定 CMake
已经安装:
sudo apt update
sudo apt install cmake
brew install cmake
brew install python-tk
git clone https://github.com/JeffTrain/face-swap
cd face-swap
pip install -r requirements.txt
python face_swap.py ted_cruz.jpg donald_trump.jpg
sh test.sh
以上示例命令会把特德·克鲁斯的脸部换到唐纳德·特朗普的照片上。
源照片 | 目标照片 | 结果照片 |
---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
环境 | Python 版本 | 结果 |
---|---|---|
Windows | 2.7 | 通过 |
Windows WSL | 2.7 | 通过 |
Mac OSX | 3.9.12 | 通过 |
- Okteto: https://face-swap-jeff-tian.cloud.okteto.net/apidocs
- Napptive: https://face-swap-cctsq03nniljeo1bj0ng.apps.playground.napptive.dev/apidocs
- Okteto: https://face-swap-jeff-tian.cloud.okteto.net/graphql
- Napptive: https://face-swap-cctsq03nniljeo1bj0ng.apps.playground.napptive.dev/graphql
. venv/bin/activate
pip install -r requirements.txt
python -m flask --app hello run --host 0.0.0.0 --port 5001
open http://localhost:5000/apidocs
open http://localhost:5001/graphql
docker build --tag face-swap:test .
docker run -d -p 5001:5000 face-swap:test
open http://localhost:5001/apidocs/
open http://localhost:5001/graphql