Implementation and deployment of https://arxiv.org/abs/1912.13457.
Python 3.6+
- Install MongoDB Guide
- Create mongo database with name
faceshifter
: in shell runmongo
and thenuse faceshifter;
cd faceshifter_tornado/
python3 -m venv ENV/
andsource ENV/bin/activate
pip install -r requirements.txt
- Download weights for AEI generator google drive link
- Extract weights
tar -xvf faceshifter_weights.tar -C faceshifter/model_weights/
- Run tests:
python -m tornado.test.runtests web.tests
- Launch server with inference worker
python app.py
- Send photos for swapping. Make
POST
request on/upload_image
with form-data files:source, target
. Copyid
from response. - Get swapping results. Make
GET
request to/result/$id/
. - Check
result_url
.
- Add highload testing with locust.io
- Use PyTorch jit compiled graph for saving RAM and speeding up inference
- Docker for faster deployment
- Use PostgreSQL or another relational database with migrations, transaction functionality for better data consistency
- Try to use JIT (PyPy) for faster python code execution
Model implementation reference: https://github.com/Heonozis/FaceShifter-pytorch/