Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (2024)

Mehmet Emin Masca

·

Follow

--

Deepfake is one of the sexiest technologies of our age, no doubt. How about trying it by yourself?

Deepfakes (a portmanteau of “deep learning” and “fake”[1]) are synthetic media[2] in which a person in an existing image or video is replaced with someone else’s likeness. While the act of faking content is not new, deepfakes leverage powerful techniques from machine learning and artificial intelligence to manipulate or generate visual and audio content with a high potential to deceive.[3] The main machine learning methods used to create deepfakes are based on deep learning and involve training generative neural network architectures, such as autoencoders[3] or generative adversarial networks (GANs).[4][5], says Wikipedia.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (3)

I have shocking news for you. You can do this too, with your computer at home. Huh, sounds interesting, right? Let’s get to the tutorial then!

  • First of all, we need to get to the Github page of this project.

https://github.com/iperov/DeepFaceLab

  • You will see the “Releases” section when you scroll down. Pick the most suitable version for yourself. I used the Torrent Client to download.
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (4)
  • You don’t need to download all of them. Download only a suitable one for your graphic cards. I have an RTX 2060, and I downloaded the NVIDIA-up-to-RTX2080Ti one.
  • When downloading process is done, double click and hit “Extract.” We are ready to create miracles now!
  • This page welcomes you. It’s better to get used to it because you will spend all your time here. You will be the BFFs! The “Workspace” folder is where you’ll do wonders. It all starts here.
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (5)
  • Two .mp4 videos named “data_dst” and “data_src” welcome you when you enter the “Workspace” folder. These two videos come as default videos, and you can start working on them directly. I tried with these two videos, but I replaced them with new ones later, when I was working on new projects. That’s why, these two videos in the photo below this text, aren’t the default ones. I put them there.
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (6)

“data_src” (source) is your source video.

“data_dst” (destination) is your destination video.

Facesets from the data_src video will be extracted, and they will be replaced with the face in the data_dst video.

  • High resolution (4K WebM is best, lower than 1080p is not recommended)
  • Faces not too far from the camera and unobstructed
  • Multiple angles, facial expressions
  • Brightly and evenly lit
  • Faces should somewhat match (beard, hat, hair, skin color, shape, glasses)
  • Need at least 2 mins of good quality video. Interview videos work well.

(https://pub.dfblue.com/pub/2019-10-25-deepfacelab-tutorial)

You have to name the videos that you will work as “data_src” and “data_dst.” This is a very significant point. You can create a new folder and put your old data, source, and result videos in it. My advice to you is not to delete them because it’s good to compile them, and you can go back and look at your old projects and their materials.
In addition, just click the “clear workspace” when you start a new project. Everything is going to be ready to go. The only thing you need to do is to put “data_src” and “data_dst” videos into the workspace then.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (7)

What you need to do is;

  • 2) extract images from video data_src (It extracts images from “data_src”) (Press the “Enter” a few times to use the default settings.)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (8)
  • 3) extract images from video data_dst FULL FPS (It extracts images from “data_dst”) (Press the “Enter” a few times to use the default settings.)
  • 4) data_src faceset extract (It extracts facesets from data_src. See? It’s Not Rocket Science guys!)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (9)
  • 4.1) data_src view aligned result (You can see your results here. For the best results, delete unnecessary photos that do not meet our criteria before starting the training session. For example, misrecognized faces, distorted images, etc.)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (10)
  • 5) data_dst faceset extract (It extracts facesets from data_dst) (Same as step 4)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (11)
  • 5.1) data_dst view aligned results (You can see your results here. For the best results, delete unnecessary photos that do not meet our criteria before starting the training session. For example, misrecognized faces, distorted images, etc.) (same as step 4.1)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (12)
  • 5.XSeg) data_dst mask — edit

Now it’s a critical point. In this chapter, we will mask faces manually. We must do the masking process carefully. If you mask incorrectly or sloppy, you will get an annoying result. I did the masking process a bit sloppy and included the individual’s hair in several places. This produced a frustrating result. I’ll put the photo at the end.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (13)
  • 5.XSeg) data_src mask — edit

We do the same process again for our source video. Same as the previous step.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (14)
  • 5.XSeg) train

Now it’s time to start training our XSeg model. When it asks you for Face type, write “wf” and start the training session by pressing Enter. The exciting part begins!

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (15)

First, let’s agree on this:

THE MORE ITERATIONS = THE BETTER RESULT

My suggestion to you is to have a minimum of 10,000 Iters. Of course it could be more. Because what we just said, THE MORE ITERATIONS = THE BETTER RESULT.

When you say OK, that’s enough, you can press “Enter” and complete the model’s training. Let’s continue.

  • 5.XSeg) data_dst trained mask — apply (We apply our trained model)
  • 5.XSeg) data_src trained mask — apply (We apply our trained model)
  • 5.XSeg) data_src mask — edit (We check the result, mask the bad results again to get the best output)
  • 5.XSeg) data_dst mask — edit (We check the result, mask the bad results again to get the best output)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (16)
  • 5.XSeg) train (After remasking, we train some more. If you haven’t made any remaskings, you don’t need to retrain.)
  • 5.XSeg) data_dst trained mask — apply (We apply the retrained model just like previous steps.)
  • 5.XSeg) data_src trained mask — apply (We apply the retrained model just like previous steps.)

As the last step;

6) train SAEHD

We click and start the training of our model. Make sure to have a minimum of 100.000 iterations. The more, the better. If you wish, you can do 500.000 or 1.000.000 iterations. But the more iters, the better result! When you say “OK, it’s enough,” press the “Enter” key and complete the training session.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (17)

Your system will have hard times during this process. Your computer will get hot as hell. I went and bought a laptop cooler for myself while the process was going on. I’ll show you this with a picture.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (18)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (19)

We have come to an end now.

  • 7) merge SAEHD

And you’ll see an interactive screen.

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (20)
Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (21)

In this example, you see the results of false masking. If the masking process had been done in more detail, I would have achieved an incredibly realistic result this time. I made this mistake on purpose so that you don’t make the same mistakes.

8) merged to mp4

Click it, and you will see your result. The result you get will be waiting for you in the “Workspace” folder with the name “result.mp4”. You can share your results with your friends and loved ones, on the internet or with me!

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (22)

I hope this tutorial will be useful for you. You can ask me questions anytime.

You can contact me on:

LinkedIn: https://www.linkedin.com/in/mehmet-emin-masca-359812207/

E-Mail: eminmasca@hotmail.com

Creating Deepfake Miracles With DeepFaceLab Tutorial (SAEHD Model) (2024)
Top Articles
Latest Posts
Article information

Author: Ray Christiansen

Last Updated:

Views: 5991

Rating: 4.9 / 5 (49 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Ray Christiansen

Birthday: 1998-05-04

Address: Apt. 814 34339 Sauer Islands, Hirtheville, GA 02446-8771

Phone: +337636892828

Job: Lead Hospitality Designer

Hobby: Urban exploration, Tai chi, Lockpicking, Fashion, Gunsmithing, Pottery, Geocaching

Introduction: My name is Ray Christiansen, I am a fair, good, cute, gentle, vast, glamorous, excited person who loves writing and wants to share my knowledge and understanding with you.