in machine learning, tutorial

A Practical Tutorial for FakeApp

Share Button

You can read all the posts in this series here:


As explained in the first lecture of this course, An Introduction to DeepFakes and Face-Swap Technology, creating a deepfakes requires three steps: extraction, training and creation.

Step 1. Extraction

To train your model, FakeApp needs a large datasets of images. Unless you have hundreds of pictures already selected, FakeApp comes with a handy feature that allows to extract all frames from a video. This can be done in the GET DATASET tab. All you need is to specify a link to an mp4 video. Clicking on EXTRACT will start the process.

If your original video is called movie.mp4, the frames will be extracted in a folder called dataset-video. Inside, there will be another folder called extracted which contains the aligned images ready to be used in the training process. You might also see a file called alignments.json, which indicates, for each aligned frame, its original position in the image from which it was extracted.

After the extraction process is done, the only thing you need is the  extracted folder; you can delete all other files. Before proceeding to the next step, just make sure that the aligned faces are, indeed, aligned (picture below). The face detection fails fairly often, so expect some manual work to do. 

Ideally, what you need is a video of person A and a video of person B. You’ll then need to run the process twice, to get two folders. If you have multiple videos of the same person, extract all of them an merge the folders. Alternatively, you can attach the videos one after the other using Movie Maker, or an equivalent program.

Step 2. Training

In FakeApp, you can train your model from the TRAIN tab. Under Data A and Data B you need to copy the path of the extracted folders. As a convention, Data A is the folder extracted from the background video, and Data B contains the faces of the person you want to insert into the Data A video. The training process will convert the face of person A into person B. In reality, the neural network is working in both directions; it does not really matter which one you choose as A and which one you choose as B.

You will also need a folder for the model. If this is your first time training from person A to person B, you can use an empty folder. FakeApp will use it to store the parameters of the trained neural network.

The training settings need to be set up before starting this process. In red, below, are indicates the ones that refer to the training process. Nodes and Layers are used to configure the neural network; Batch Size is used to train it on a larger number of faces. The meaning of these parameters is explained in depth in another post.

If your GPU has less than 2GB of RAM, it is likely the highest settings you can run are:

You will have to adjust your settings depending on how much memory is available on your GPU. These are the recommended setting you should usually run, although this may vary based on your model.

Parameter 2 GB 8 GB
Batch Size 16 128
Nodes 64 1024
Layers 3 4

If you do not have enough memory, the process will fail.

Monitor the progress. While training, you will see a window that shows how well the neural network is performing. The GIF below shows three hours worth of training, using game developer Richard Franke and his alter ego Kitty Powers (with videos from Kitty Powers’ Matchmaker and Kitty Powers’ Love Life trailers) as person B and person A, respectively.

You can press Q at any time to stop the training process. To resume it, simply start it again using that same folder as model. FakeApp also shows a score which indicates the error committed while trying to reconstruct person A into B and person B into A. Values below 0.02 are usually considered acceptable.

Step 3. Creation

The process of creating a video is very similar to the one in GET DATASET. You need to provide the path to an mp4 video, and the folder of your model. That is the folder that contains the files: encoder.h5, decoder_A.h5 and decoder_B.h5. You will also need to specify the target FPS.

Pressing CREATE will automatically:

  • Extract all the frames from the source video in the workdir-video folder,
  • Crop all faces and align them in the workdir-video/extracted folder,
  • Process each face using the trained model,
  • Merge the faces back into the original frame and store them in the workdir-video/merged folder,
  • Join all the frames to create the final video.

In the settings (below), there is an option to decide if you want person A to be converted to person B (A to B) or person B to person A (B to A).

The other options are used to merge the reconstructed face back into the frame. They will be discussed in details in a later post.


You can read all the posts in this series here:

A special thanks goes to Christos Sfetsios and David King, who gave me access to the machine I have used to create the deepfakes used in this tutorial.


📧 Stay updated

A new tutorial is released every week.

💖 Support this blog

This websites exists thanks to the contribution of patrons on Patreon. If you think these posts have either helped or inspired you, please consider supporting this blog.


Write a Comment



  1. wow! its very useful tutorial for fakeapp user. I was so excited to install Fakeapp, but I am so sad because my laptop has Intel Graphic Card. Any Way thank you for the article.
    Dal Saru

  2. Thanks for great tutorial!

    I used FakeApp 1.1 to train a model from scratch to under 0.009 loss, and the previews look great, but the merged (extracted) results look not so great and very different, screenshots below:

    Converted (zoomed in):

    The above converted result (merged folder) was the best I could get, using the following settings: seamless false, blur size 0, and kernel size 0.

    A previous test with another model which was also built from scratch to under 0.01 loss gave an even worse result, were the previews while training looked amazing once again, but once converted did not even look like a face but rather like a distorted nightmare stain.

    Any idea on what I’m doing wrong?

    • Hi Mathieu,

      I suspect you are creating deepfakes using porn actresses. I have been talking about that is a rather bad idea in an earlier post in the series.
      So yes, that is definitely one thing that is wrong. 🙂

  3. Richard
    Hi I am having a PC built dedicated to run Fakeapps 2.1 or 2.2 can you advise me what additional software would be required and in what order they should be installed and the procedure how to set it all up.

  4. Hey Alan! Thank you so so much for these tutorials. Really really comprehensive and helpful. One note, when I tried pausing and restarting training on 2.2, it looks like it totally reset my model. Losses went back up after 10+ hrs processing, and when I went to create the video, the faces were blank. Did I do something wrong? Thanks a lot!

  5. Hello. I’m trying to create deepfakes of a pictures where there are more than one face inside. In this scenario,things going to be more complicated. Do you have some suggestion to give me ? Do you plan to write a tutorial about how to do what ? thanks.

    • Hi Mario!
      If you are using faceswap, you can provide an image of the face you want to use. This will force the algorithm to ignore all the others, although is not always super accurate.

      If you are not using faceswap or that feature is not available, I would suggest editing the original video to cover all the other faces with a black box. Process the video like that, and then just merge it with the original one so that you can crop only the parts of the videos where the swapped face is present.

      Also, I hope you have full consent from all the people involved in the video!
      Don’t forget that!

  6. hi
    during doing “train” i got a message “training process ended .if you did not end it yourself ,an error occurred .check the end of the log .txt file for details, and feel free to post it on help

  7. undefined File “d:\anaconda\envs\fakeapp\lib\site-packages\PyInstaller\loader\”, line 631, in exec_module
    File “”, line 7, in
    File “C:\Users\jb nov\AppData\Local\FakeApp\app-2.2.0\resources\api\torch\”, line 76, in
    from torch._C import *
    ImportError: DLL load failed: The specified module could not be found.
    [7320] Failed to execute script execute====the above is log file ,your opnion please

  8. Hi,
    Can you tell me wich nvidia card are you using? (the specific model)
    I tried with a Asus Dual GTX 1060, and did not allowed me to install the cuda developer drivers.


  9. Why i don’t get “extracted” file after extracting
    I only get a hundred photos

    And the second try .. it is always eror until now

    Can you help me ?

    I’m using Windos 8

  10. Hi, I can’t extract images from the video. Always the same error: “An error has occurred in the creation process. Check the end of the log.txt file for details”.

  11. I can’t seem to get past the first bit with the sign that says Announcments reload the app, which I thnk I have done but not sure