DEV Community

Cover image for A guide into deepfakes
Akash Pattnaik
Akash Pattnaik

Posted on

A guide into deepfakes

Hello everyone, I'm Akash and I'm gonna guide you through the process of deepfake someone. Let's just get into it, you can get to know about deepfakes from google, I'm just gonna get right into it.

πŸ’» System Requirements

  • Either a good GPU or CPU.
  • Any operating system [I'm using windows 11]
  • A good data source

⭐ Initializing

Head over to deepfakes/faceswap and install all the stuff that it asks you to do and then open the terminal with in faceswap env from anaconda.

  • Start Terminal

Follow these instructions to install and setup faceswap.

πŸ› Data Requirments

Deepfaking is a heavy and very long process. You need a large amount of data for the output to be remotely precise. So it's best if you get monologue videos and extract frames from them.

We will need 2 videos -

  • A - The video of the person who's face you want to copy
  • B - The video of a person on which A will be implemented into.

πŸ“‚ Directory Setup

You need to create a new directory and the structure will be something like this -

FaceSwapProject
      |--- A πŸ“
      |--- B  πŸ“
      |--- A.mp4
      |--- B.mp4
      |--- Model πŸ“
      |--- output πŸ“
Enter fullscreen mode Exit fullscreen mode

πŸ‘Ύ Extracting Faces

Launch the GUI interface with the command python faceswap.py gui in the anaconda prompt.

Extract the faces of video A to folder A and same as to B

  • Extracting Faces

πŸ‘Ÿ Training Model

The Input refers to the folder containing the faces ["A", "B"].

Chose the Model Dir as the empty Model Folder in the project directory.

Training Model

⚠️ Important While Training

  • Training time doesn't matter if you don't have a good data source.
  • The more you train, the better the result.
  • Stop looking at the loss of A and B, rather use the preview as the indicator to know when to stop the training.

Output βœ…

In the output section, the input need the video in which the face is to be changed, thus B.

Chose the Model Dir as the Model directory in the project. This is the trained data of the faces.
Chode the Output Dir as the output directory in the Project.

  • Output Generation

Top comments (2)

Collapse
 
newdev0 profile image
Devesh Pal

Please don't use it for faking someone's identity

Collapse
 
akashpattnaik profile image
Akash Pattnaik

How did you know my plan to put your face on adult stars...