DeepFaceLab is the leading software for creating deepfakes.
Find a file
2018-06-05 12:14:47 +04:00
.github initial 2018-06-04 17:12:43 +04:00
doc 0 2018-06-05 08:57:19 +04:00
facelib initial 2018-06-04 17:12:43 +04:00
gpufmkmgr initial 2018-06-04 17:12:43 +04:00
localization initial 2018-06-04 17:12:43 +04:00
mainscripts initial 2018-06-04 17:12:43 +04:00
mathlib initial 2018-06-04 17:12:43 +04:00
models AVATAR now 256 2018-06-05 09:17:25 +04:00
nnlib initial 2018-06-04 17:12:43 +04:00
utils initial 2018-06-04 17:12:43 +04:00
.gitignore initial 2018-06-04 17:12:43 +04:00
CODEGUIDELINES initial 2018-06-04 17:12:43 +04:00
LICENSE Initial commit 2018-06-04 17:10:00 +04:00
main.py initial 2018-06-04 17:12:43 +04:00
README.md upd readme 2018-06-05 12:14:47 +04:00
requirements-gpu-cuda9-cudnn7.txt initial 2018-06-04 17:12:43 +04:00

DeepFaceLab is a tool that utilizes deep learning to recognize and swap faces in pictures and videos.

Based on original FaceSwap repo. Facesets of FaceSwap or FakeApp are not compatible with this repo. You should to run extract again.

Features:

  • new models

  • new architecture, easy to experiment with models

  • works on 2GB old cards , such as GT730. Example of fake trained on 2GB gtx850m notebook in 18 hours https://www.youtube.com/watch?v=bprVuRxBA34

  • face data embedded to png files

  • automatic GPU manager, chooses best gpu(s) and supports --multi-gpu

  • new preview window

  • extractor in parallel

  • converter in parallel

  • added --debug option for all stages

  • added MTCNN extractor which produce less jittered aligned face than DLIBCNN, but can produce more false faces. Comparison dlib (at left) vs mtcnn on hard case: MTCNN produces less jitter.

  • added Manual extractor. You can fix missed faces manually or do full manual extract, click on video: Watch the video Result

  • standalone zero dependencies ready to work prebuilt binary for all windows versions, see below

Model types:

  • H64 (2GB+) - half face with 64 resolution. It is as original FakeApp or FaceSwap, but with new TensorFlow 1.8 DSSIM Loss func and separated mask decoder + better ConverterMasked. for 2GB and 3GB VRAM model works in reduced mode.
  • H64 Robert Downey Jr.:
  • H128 (3GB+) - as H64, but in 128 resolution. Better face details. for 3GB and 4GB VRAM model works in reduced mode.
  • H128 Cage:
  • H128 asian face on blurry target:
  • DF (5GB+) - @dfaker model. As H128, but fullface model.
  • DF example - later
  • LIAEF128 (5GB+) - new model. Result of combining DF, IAE, + experiments. Model tries to morph src face to dst, while keeping facial features of src face, but less agressive morphing. Model has problems with closed eyes recognizing.
  • LIAEF128 Cage:
  • LIAEF128 Cage video:
  • Watch the video
  • LIAEF128YAW (5GB+) - currently testing. Useful when your src faceset has too many side faces vs dst faceset. It feeds NN by sorted samples by yaw.
  • MIAEF128 (5GB+) - as LIAEF128, but also it tries to match brightness/color features.
  • MIAEF128 model diagramm:
  • MIAEF128 Ford success case:
  • MIAEF128 Cage fail case:
  • AVATAR (4GB+) - 256pix face controlling model. Usage:
  • src - controllable face (Cage)
  • dst - controller face (your face)
  • converter --input-dir must contains extracted dst faces in sequence to be converted, its mean you can train on 1500 dst faces, but use only 100 for convert.

Sort tool:

hist groups images by similar content

hist-dissim places most similar to each other images to end.

hist-blur sort by blur in groups of similar content

brightness

hue

face and face-dissim currently useless

Best practice for gather src faceset:

  1. delete first unsorted aligned groups of images what you can to delete. Dont touch target face mixed with others.
  2. blur -> delete ~half of them
  3. hist -> delete groups of similar and leave only target face
  4. hist-blur -> delete blurred at end of groups of similar
  5. hist-dissim -> leave only first 1000-1500 faces, because number of src faces can affect result. For YAW feeder model skip this step.
  6. face-yaw -> just for finalize faceset

Best practice for dst faces:

  1. delete first unsorted aligned groups of images what you can to delete. Dont touch target face mixed with others.
  2. hist -> delete groups of similar and leave only target face

Facesets:

  • Nicolas Cage.

  • Cage/Trump workspace

download from here: https://mega.nz/#F!y1ERHDaL!PPwg01PQZk0FhWLVo5_MaQ

Build info

dlib==19.10.0 from pip compiled without CUDA. Therefore you have to compile DLIB manually.

Command line example for windows: python setup.py install -G "Visual Studio 14 2015" --yes DLIB_USE_CUDA

Prebuilt python folder with DeepFaceLab:

Windows 7,8,8.1,10 zero dependency (except GeForce Drivers) prebuilt Python 3.6.5 embeddable folder with DeepFaceLab can be downloaded from torrent https://rutracker.org/forum/viewtopic.php?p=75318742 (magnet link inside).

Pull requesting:

I understand some people want to help. But result of mass people contribution we can see in deepfakes\faceswap. High chance I will decline PR. Therefore before PR better ask me what you want to change or add to save your time.