Make Your Own Deepfake Video in a Few Easy Steps

A simple guide for creating your own Deepfake video

If you’re reading this article, then you’ve likely seen or heard about a particular AI algorithm called deepfakes. Much of this hype has comes as a result of major apps like Snapchat, FaceApp, or Instagram using this algorithm to create entertaining content.

In this article, I’ll show you how to quickly and easily create your own deepfake video. To do this, I’ll be using the implementation for the research effort First Order Motion Model for Image Animation, developed by Aliaksandr Siarohin, Stéphane Lathuilière, Sergey Tulyakov, Elisa Ricci, and Nicu Sebe.

I’ll show you how to use their code to create deepfakes using your own pictures and videos.

What is Deepfake?

A deepfake video is a fake photo, video, or story generated by neural networks. Deepfake developers use artificial intelligence and machine learning algorithms to imitate the facial features and body postures of real humans.

These deepfakes diverge from other common forms of fake media by being extremely hard to identify. In addition to their impressive technological underpinnings, deepfakes have the potential to cause enormous damage.

In April 2018, BuzzFeed showcased how far deepfake video technology has come by combining Barack Obama’s face with Jordan Peele’s convincing voice impersonation.

Deepfakes depend on autoencoder neural network type. It contains an encoder, which decreases an image to a lower-dimensional latent space, and a decoder, which reconstructs the image from the latent representation. Deepfakes use this structure by having a universal encoder which encodes a character into the latent space. The latent representation includes key characteristics of their facial features and body posture.

How to Make Your Own Deepfake Video

Now that we’ve taken a quick look at deepfakes and some of the controversy surrounding them, let’s look at how to implement our own.

For setting up our deepfake, I’ll be using Aliaksandr Siarohin’s Google Colab code.

First, make sure you copy his code to your Google Drive since we don’t want to alter his code:

Before we get started, we need to download a few required files from the Drive link below. You just need to download one .jpeg image, one .mp4 video, a vox-cpk.pth.tar file, and a vox-adv-cpk.pth.tar file. But if you need to check with the images and videos they provided, download everything.

After downloading the files, create a folder named first-order-motion-model in your Google Drive and upload the downloaded files.

To run with your own data…

  • If you want your face to be added to a video, then take a selfie and change its size to 256 X 256 pixels (you can simply use Paint to edit the size). This is the input size that the model accepts.

Upload all your data to the first-order-motion-model folder on your Drive.

To run your face on the videos they’ve provided, change the following code to your file name. Then follow the rest of the steps as presented.

  • If you want someone else’s face to be added to your video file, that file also needs to be on the size of 256 X 256 pixels.

To convert your video into the above size, scroll down to the part of the code labeled “Run on your data”. Remove the boilerplate code provided and add the following code:

This will create a converted video result.mp4

Copy the result.mp4 file into thefirst-order-motion-model folder and change the following code from “Load driving video and source image”

And that’s it. Here is an example I created using Nicolas Cage’s face and the TV show Friends.

I hope this quick start guide to setting up your very own deepfake was useful. Have fun making some funny content (nothing dangerous!). Thank you, and stay safe!

Avatar photo


Our team has been at the forefront of Artificial Intelligence and Machine Learning research for more than 15 years and we're using our collective intelligence to help others learn, understand and grow using these new technologies in ethical and sustainable ways.

Comments 0 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *