Giter VIP home page Giter VIP logo

real-time-faceswap-with-onnx's Introduction

Real Time FaceSwap with ONNX

Using saved onnx models to perform arbitrary face swap task in real time

Major Dependencies

onnxruntime==1.6.0
opencv-python==4.4.0
kivy==2.0.0

How does the code work

The code does face detection --> face landmark detection ---> swap face by patching corresponding triangles from face A to face B with delaunay triangulation. The onnx models used in the first two steps can be found in this github repo, one tutorial of the last step can be found here.

The code uses kivy for the simple GUI construction.

How to play with it

1.Download pictures of whom you would like to swap your face with to the \portrait folder. A frontal view protrait picture will be ideal for final performance.

2.Execute faceswap_kivy.py to start the GUI.

  • Depending on your machine's acutal hardware setting, change the Camera index to use the right camera.
  • The dropdown menu will contain source portrait you downloaded in the \portrait folder. Select one and hit Start, you are good to go.
  • If multiple images are in the folder and you would like to use a different face, just clike reset and then re-select the one you want to use.
  • With a virtual camera software such as OBS Studio, you can make yourself appear as a different person on your online meetings/classes.
  1. You may also consider using tools such as Pyinstaller to package it to executable and deploy it to other machines without python installed.
example_faceswap.mp4

real-time-faceswap-with-onnx's People

Contributors

dykuang avatar

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.