MyTetra Share
Делитесь знаниями!
Руководство по установке DeepFakes (ПО для замены лиц на видео) на английском
Время создания: 25.01.2018 12:57
Текстовые метки: deepfakes, FakeApp, программа, замена лица, подмена, нейросеть, нейронная сеть, установка, инсталляция, инструкция, руководство, face, лицо
Раздел: Компьютер - Программное обеспечение
Запись: xintrea/mytetra_syncro/master/base/1516874227pxwcbd3po6/text.html на

h ttps://

I've completed a desktop app /w GUI to create deepfakes. Here is a what it looks like ( ). For anyone unfamiliar with this subreddit, deepfakes are neural network-generated faceswap videos created with a machine learning algorithm designed by /u/deepfakes( ). Check the sub wiki for more info. Here is an excellent example of a deepfake of Daisy Ridley ( ) produced with this app in less than a day by /u/nuttynutter6969 ( ). This app is intended to allow users to move through the full deepfake creation pipeline—creating training data, training a model, and creating fakes with that model—without the need to install Python and other dependencies or parse code. The download link is in the comments.


Download CUDA 8.0 and store it's bin folder in the PATH environment variable ( )

Split some videos with your two desired faces into two sets of a few hundred frames each with a tool like FFMPEG ( ). If you use FFMPEG, the command you want is: ffmpeg -i scene.mp4 -vf fps=[FPS OF VIDEO] "out%d.png". After splitting, run both directories of split frames through the "Align" tool to produce training data

Switch to the "Train" tool, and input the paths of the training data produced in step 1 (it should be in a folder called "aligned") as well as those of the encoder and decoders included in the "models" folder along with this project

Train until the preview window shows results you are satisfied with

Split the video to be faked into frames and run the "Merge" tool on them to create faked frames, which can then be remerged into a deepfaked video

Copy and reuse the same encoders for faster results in future fakes


-CUDA 8.0 must be installed, and its bin folder must be included in the PATH environment variable.

-At least a few GB of free space on disk to allow the app to create Temp files


-Run fakeapp.bat to launch the app

-RuntimeError: module compiled against api version 0xc but this version numpy is 0xb is just a warning related to how the alignment libraries were installed, the app will run properly despite it appearing if no other errors occur

-It may take 30-45 seconds after pressing the Start button for the app to unpack and start the training/merging scripts the first time

-You can still quit training by focusing the training window and pressing "q"

-Paths to models/data must be absolute, not relative

If it doesn't work for you:

The console for the tool you are using (Align, Train, or Merge) will output a full error log if the tool fails. Here are some known errors with solutions:

General Issues

All directories used by the app should have names comprised of only English characters. Many users have had issues with directories with Cyrillic or Chinese characters, so if you have directories like this make sure to use different directories with English character names when running the app.

If any tool's log contains AssertionError: dir.isDir(), the tool cannot find your directories. Make sure they are typed into the app correctly.

Align Issues

If the Align log contains KeyError: state_dict, your version of a dynamic library called2DFan-4.pth.tar is corrupted. This is a library downloaded the first time the Align tool is run, and it is possible for that download to fail to produce a working 2DFan file. Download a working version from the link in the comments (this link is not allowed to be in the post), and replace the corrupted version in C:\Users\[NAME]\AppData\Local\face_alignment\data.

If the Align log contains AssertionError: can't find input files make sure the File Type parameter is set to the same image type as the images in your data folder (i.e. png, jpg, etc.)

If the Align log contains error while calling cudaMalloc() reason: out of memory, you are probably training with images that are too large. Make sure images are not greater than 1200x700 in resolution, this resolution is plenty to produce a good model

Train Issues

If the Train log contains AssertionError in you are training with images of the wrong size, make sure you are only training with the 256x256 images created using the Align tool

If the Train log contains Missing cudart_64.dll you have the wrong version of CUDA installed (Tensorflow requires 8.0)

If the Train log contains MemoryError line 60/line 61 you are probably training with too many images at once for your GPU to handle and should reduce the number of images you are training with (500 is more than sufficient)

If the Train log contains OOM when allocating tensor with shape [W, X, Y, Z] the current model is too intensive for your GPU. Try lowering the batch size (to a lower power of 2 than 64) and see if that helps.

If the Train log mentions Theano Keras is wrongly trying to use Theano as a backend. Setting the KERAS_BACKEND environment variable to "tensorflow" should fix it.

Merge Issues

If Merge outputs faces with visible boxes around them, make sure that *Seamless is set to 'true' and faces are not too close up in the images you are working with. The scripts this app works with cannot always avoid creating a box on very large faces, but will almost always create a seamless merge with moderately-sized faces.

In the future I plan to make ease-of-use improvements to the app and look into replacing scripts with more efficient/streamlined/accurate versions as they come out.

Good_Man 11.Jan.201806:50ссылка 0.7

Link to FakeApp ( )

Link to an uncorrupted 2DFan if you get the KeyError: state_dict error. ( )

Good_Man 11.Jan.201806:51ссылка 0.3

Забыл добавить wiki ( ) от него же


*Can I see some examples of videos created by this algorithm?

For the best new examples, sort the sub by top/all-time. The most widely known example is this faked video of Gal Gadot (NSFW) ( ), which was featured on a number of sites ( ).

*Where are the original scripts that produced these videos?

The source code can be found here ( ). The entire project with pre-trained models can be found here ( ).

*Is there a program/website that I can use to produce these videos?

FakeApp ( ) is a community-developed desktop app to run the deepfakes algorithm without installing Python, Tensorflow, etc. Currently it supports only training/conversion of faces, and cannot create training data.

*How can I install and run the original scripts?

Follow the instructions here ( ).

*What tools do I need to produce these videos?

At a minimum, your computer should have a good GPU. Failing this, you can rent cloud GPU(s) through services like Google Cloud Platform ( ).

*How long does this whole process take?

Times vary by hardware quality, but generally speaking the pipeline is:

Extraction: Producing uniform training data of a model's face (5-20 min)

Training: Running a neural network to learn to emulate this face (8-12 hours)

Conversion: Using the neural network to project the target face onto the original face in a video frame-by-frame (5-20 min)


-In progress

Warp On Other Domain Landmarks ( )

Pose Similarity Estimation ( )

Alternate Loss Functions ( )


Original DeepFakes Implementation ( )

Image Selection Region Expansion ( )

Так же в этом разделе:
MyTetra Share v.0.59
Яндекс индекс цитирования