DeepFaceLab is the leading software for creating deepfakes.
Find a file
2019-01-07 10:13:50 +04:00
.github initial 2018-06-04 17:12:43 +04:00
doc removed UFM model, 2019-01-06 19:59:53 +04:00
facelib refactoring. Added RecycleGAN for testing. 2018-12-28 19:38:52 +04:00
localization DockerFile for Mac users to run DeepfaceLab with CPU Mode (#95) 2019-01-01 18:08:21 +04:00
mainscripts increased speed of sort by hist sim for ten thousands of faces 2019-01-04 22:54:09 +04:00
mathlib refactoring. Added RecycleGAN for testing. 2018-12-28 19:38:52 +04:00
models DF: fix default mask 2019-01-07 10:13:50 +04:00
nnlib added new model U-net Face Morpher. 2019-01-02 17:26:12 +04:00
samples fixed sort by yaw feeder 2019-01-07 09:40:00 +04:00
utils increased speed of sort by hist sim for ten thousands of faces 2019-01-04 22:54:09 +04:00
.gitignore DockerFile for Mac users to run DeepfaceLab with CPU Mode (#95) 2019-01-01 18:08:21 +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 upd 2019-01-03 22:15:10 +04:00
README.md removed UFM model, 2019-01-06 19:59:53 +04:00
requirements-cpu.txt added --cpu-only mode for all stages. Upd readme. Added requirements-cpu.txt 2018-12-21 16:54:22 +04:00
requirements-gpu-cuda9-cudnn7.txt upgrading to tf 1.11.0 and keras 2.2.4 2018-12-01 22:53:50 +04:00

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

Features:

  • new models

  • new architecture, easy to experiment with models

  • face data embedded to png files

  • automatic GPU manager, chooses best gpu(s) and supports --multi-gpu (only for identical cards). Warning: dont use cards in SLI mode.

  • cpu mode. 8th gen Intel core CPU able to train H64 model in 2 days.

  • 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: Result

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

Warning: Facesets of FaceSwap or FakeApp are not compatible with this repo. You should to run extract again.

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. Strongly recommended not to mix various light conditions in src faces.

  • LIAEF128 (5GB+) - Less agressive Improved Autoencoder Fullface 128 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

  • SAE (2GB+) - Styled AutoEncoder. It is like LIAEF but with new face style loss like in UFM.

SAE model Cage-Trump video: https://www.youtube.com/watch?v=2R_aqHBClUQ

Sort tool:

blur places most blurred faces at end of folder

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

black Places images which contains black area at end of folder. Useful to get rid of src faces which cutted by screen.

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. black -> delete faces cutted by black area at end of folder
  3. blur -> delete 30-50% at end of folder
  4. hist -> delete groups of similar and leave only target face
  5. hist-dissim -> leave only first 1500 faces
  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

Ready to work facesets:

  • Nicolas Cage 4 facesets (1 mix + 3 different)

  • Steve Jobs

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, orelse use MT extractor only.

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

CPU only mode

CPU mode enabled by arg --cpu-only for all stages. Follow requirements-cpu.txt to install req packages. Do not use DLIB extractor in CPU mode, its too slow. Only H64 model reasonable to train on home CPU.

Mac/linux/docker script support.

This repo supports only windows build of scripts. If you want to support mac/linux/docker - create such fork, it will be referenced here.

Prebuilt windows app:

Windows 7,8,8.1,10 zero dependency (just install/update your GeForce Drivers) prebuilt DeepFaceLab (include GPU and CPU versions) can be downloaded from

  1. torrent https://rutracker.org/forum/viewtopic.php?p=75318742 (magnet link inside).
  2. https://mega.nz/#F!b9MzCK4B!zEAG9txu7uaRUjXz9PtBqg

Video tutorial: https://www.youtube.com/watch?v=K98nTNjXkq8

**Windows 10 memory problem:

Windows 10 consumes % of VRAM even if card unused for video output.

Problem of the year:

algorithm of overlaying neural face onto video face located in ConverterMasked.py. Can someone implement adaptive histogram matching to prevent glares when a dark eyes face merges onto a light eyes face ?