Code Monkey home page Code Monkey logo

face-swap's Introduction

Face-Swap

Python end-to-end pipeline to swap faces in videos and images.

The aim of this code is to implement an end-to-end pipeline to swap faces in a video just like Snapchat’s face swap filter or this face swap website. The following figure shows an illustration of the face swap where we swap Ron Weasley's face with Hermione Granger's face.

Repo List

Landmark detection and Triangulation

1- If you want to see triangulation and landmark detection on an arbitrary image run this:

python Wrapper.py --triangulation [path to the image]

Face swap between two images

Download the PRN trained model at BaiduDrive or GoogleDrive, and put it into codes/Data/net-data

Link: https://drive.google.com/file/d/1UoE-XuW1SDLUjZmJPkIZ1MLxvQFgmTFH/view

2- To swap faces of two arbitrary images run this:

python Wrapper.py --image_swap true --src_image [path to source image] --dst_image [path to destination image] --method [metod key]

Note: Method key should be choosen between tri, tps, or prnet.

"tri" stands for Delaunay Triangulation.

"tps" stands for Thin Plate Splines.

"prnet" stands for PR Net.

Face swap in a video and a target iamge

3- Two swap a face in a video with an target image run this:

python Wrapper.py --video [path to the .mp4 video] --image [path to destination image] --method [metod key] --name [output video name]

Note: You can set frame per second by setting --fps [your desire frame per second]

Face swap in a single video

4- Two swap two faces in a video run this:

python Wrapper.py --video [path to the .mp4 video] --tf true --method [metod key] --name [output video name]

Note: You can set frame per second by setting --fps [your desire frame per second]

Appendix

Note1: For the full project description click here.

Note2: For the full documentation click here.

face-swap's People

Contributors

hsouri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

awsmasim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.