GithubHelp home page GithubHelp logo

lucasjinreal / faceswap_pytorch Goto Github PK

View Code? Open in Web Editor NEW
248.0 13.0 88.0 3.73 MB

Deep fake ready to train on any 2 pair dataset with higher resolution

Python 98.62% Shell 1.38%
deepfakes faceswap gan fakeface deeplearning pytorch

faceswap_pytorch's Introduction

High Resolution Face Swap

A face swap implementation with much more higher resolution result (128x128), this is a promoted and optimized swap face application based on deepfake tech. our implementation did those changes based on original deepfakes implementation:

  • deepfakes only support 64x64 input, we make it deeper and can output 128x128 size;
  • we proposed a new network called SwapNet, SwapNet128;
  • we changed the pre-proccess step with input data (such as warp face), make it more clear;
  • we make the dataset loader more efficient, load pair face data directly from 2 dir;
  • we proposed a new face outline replace tech to get a much more combination result with original image, their differences are like below image.

we will continuely update this repo, and make face swap much more intuitive and simple, anyone can build there own face changing model. Here are some result for 128x128 higher resolution face swap:

We have train on trump-cage and fanbingbing-galgadot convert model. The result is not fully trained yet, but it shows a promising result, the face in most situation can works perfect!

final result on face swap directly from original big image:

As you can see above, we can achieve high resolution and seamlessly combination with face transformation. final result on face swap directly from video (to be added soon):

Dependencies

our face swap implementation need alfred-py which can installed with:

sudo pip3 install alfred-py

Pretrained Model

We only provided pretrained model for 128x128 model, and it was hosted by StrangeAI (http://codes.strangeai.pro). For train from scratch, you can download the trump cage dataset from: https://anonfile.com/p7w3m0d5be/face-swap.zip . For those already StrangeAI VIP membership users, you can download the whole codes and models from http://strangeai.pro .

Train & Predict

the run, simply using:

python3 predict.py
# train fanbingbing-galgadot face swap
python3 train_trump_cage_64x64.py
python3 train_fbb_gal_128x128.py

this will predict on a trump face and convert it into cage face.

More Info

if you wanna be invited to our computer vision discussion wechat group, you can add me via wechat or found us at: http://strangeai.pro which is the biggest AI codes sharing platform in China.

Note About FaceSwap

We have did some failure attempt and experiments lots of combination to produce a good result, here are some notes you need to know to build a face swap tech:

  • Size is everything: we have try maximum 256x256 as input size, but it fails to swap face style between 2 faces;
  • Warp preprocess does not really matter, we have also trying to remove warp preprocess step and directly using target images for train, it can also success train a face swap model, but for dataset augumentation, better to warp it and make some random transform;
  • loss is not really matter. Just kick of train, and train about 15000 epochs, and you can get good result;
  • For data preparing, better extract faces first using dlib or alfred

Faceswap Datasets

Actually, we gathered a lot of faces datasets. beside the default one, you may also access them via Baidu cloud disk.

Copyright

FaceSwap is a project opensourced under MIT license, all right reserved by StrangeAI authors. website: http://strangeai.pro

faceswap_pytorch's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

faceswap_pytorch's Issues

Is there a brief tutorial?

I didn't find a tutorial in this repository? Maybe you can write a demo to show how to use this?
Thank you.

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.