Code Monkey home page Code Monkey logo

dofaker's Introduction

English|简体中文

colab

DoFaker: A very simple face swapping tool

Insightface based face swapping tool to replace faces in videos or images. Windows and linux support CPU and GPU. Onnxruntime inference without pytorch.

Update

  • 2023/9/16 update pose transfer model
  • 2023/9/14 update face enhance(GFPGAN) and image super resolution(BSRGAN)

Tutorial

Qiuck Start

install dofaker

git clone https://github.com/justld/dofaker.git
cd dofaker
conda create -n dofaker
conda activate dofaker
pip install onnxruntime # onnxruntime-gpu
pip install -e .

open web ui(The model weights will be downloaded automatically):

dofaker

command line(linux):

bash test.sh

Install from source code

一、Installation

You should install onnxruntime or onnxruntime-gpu manually.

conda install

create virtual environment:

git clone https://github.com/justld/dofaker.git
cd dofaker
conda create -n dofaker
conda activate dofaker
pip install -r requirements.txt
pip install onnxruntime # onnxruntime-gpu
pip install -e .

pip install

git clone https://github.com/justld/dofaker.git
cd dofaker
pip install -r requirements.txt
pip install onnxruntime # onnxruntime-gpu
pip install -e .

二、Download Weight

All weights can be downloaded from release. These weight come from links refer to the botton links.

Unzip the zip file, the dir looks like follow:

|-dofaker
|-docs
|-weights
----|-models
--------|-buffalo_l
----------|-1k3d68.onnx
----------|-2d106det.onnx
----------|-...
--------|-buffalo_l.zip
--------|-inswapper_128.onnx
--------|-GFPGANv1.3.onnx
--------|-bsrgan_4.onnx
|-run_faceswapper.py
|-web_ui.py

三、Usage

You can use dofaker in web_ui or command line.

web ui

web gui only support one face swap once, if you want to swap multiple faces, please refer to command usage.

python web_ui.py

command

You can swap multiple faces in command.

python run_faceswapper.py --source "image or video path to be swapped" --dst_face_paths "dst_face1_path" "dst_face2_path" ... --src_face_paths "src_face1_path" "src_face2_path" ...

The command follow will replace dst_face1 and dst_face2 detected in input_video.mp4 with src_face1 and src_face2:

python run_faceswapper.py --source input_video.mp4 --dst_face_paths dst_face1.jpg dst_face2.jpg --src_face_paths src_face1.jpg src_face2.jpg
args description
source The image or video to be swapped
dst_face_paths The images includding faces in source to be swapped. If None, replace all faces in source media.
src_face_paths The images includding faces in source to be swapped

Attention

Do not apply this software to scenarios that violate morality, law, or infringement. The consequences caused by using this software shall be borne by the user themselves.

Sponsor

Thank you for support

Thanks

dofaker's People

Contributors

justld 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.