| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This solution has become one of 4 winners of the hackathon 1st stage.
Create potentially viral app for the Photolab audience.
Technically, our app should have been embedded inside Photolab app as a web-view.
So we decided to create something fairly simple: what if we let users swap faces from several input photos with arbitrary number of people to another photo with some crowd, in fully unsupervised way. The result is then posted on facebook and can be used to challenge their friends to find someone familiar in the mixed photos.
Our web service must be easy to use, able to create high-quality swaps and make it fast.
Here is the algorithm:
After we formed all pairs of faces, we need to get landmarks for every face to be able warp it while swapping. Again, we can use pretrained dlib's landmarks predictor.
Finally do the face-swapping!
Basically we can go two ways:
In our case, simple heuristic works just fine: do the triangulation only if detected face bbox is big enough to fill k <= bbox_h/img_h of image height (where k is a given value).
In order to speed up the inference, detected faces has been separated in n_jobs groups to make similarity calculation and face swapping in n_jobs parallel independent processes (where n_jobs is, again, a given value).
User start from choosing couple photos of him and / or his friend(s) and the photo where input faces should be placed:
And after ~2 sec. he gets the result and can share it on various social platforms:
As you can see, we swapped the most similar faces and did it pretty well.
Check out more examples with me and Elon:



docker pull gasparjan/photolab_hack:latest
cd ~/.aws
[profile %USER_NAME%]
[%USER_NAME%] aws_access_key_id = "" aws_secret_access_key = ""
docker run --rm -it -v /tmp:/tmp -v /root/.aws:/root/.aws \
-p 8080:8000 --ipc=host gasparjan/photolab_hack:latest
or go to the project folder and run bash script:
cd ~/photolab_hack ./run_docker.sh
Server starts automatically.
| Back | FazBrowse Home | New Git URL |