Deepfakes is an artificial intelligence technique. DeepFakes is a combination of Deep Learning and Fake images and video. DeepFakes is used to superimpose video and image into a source image and videos. In simpler words, you can swap the person in the video with anybody else. The result of this Deep learning algorithm is outstanding. You cannot easily differentiate between the real one and the fake one.
Now, let’s walk through the algorithms. Let’s take a video clip of Titanic featuring Leonardo DiCaprio and we want to change it with Nicolas Cage. So, for the train the model we need a dataset for both Leonardo and Nicolas Cage. You can get the dataset of these actors from Google search engine or DuckDuckGo search engine.
You can use Faceswap python library to automatically download these images from search engines to your home directory. Once you downloaded these datasets you are ready to go. The most important thing in deep learning is that the more the datasets you have, more accurate result you will get.
After you get the images .we are going to perform image detection techniques on this dataset. For that, you can use OpenCV library. There is the function available on this library you can use to detect faces on the image. This OpenCV library uses Histogram of Oriented Gradient techniques to crop the image and get only the face from all the images so that we can swap later. Now we have the pure dataset of faces of both the actors.
Now we are going to train our model with these datasets. For this, we use a convolutional neural network. Specifically, DeepFakes uses one Encoder and two Decoder. These two datasets train two model one for each actor. The first network only trains on the image of Leonardo and second network only train on the image of Nicolas Cage. The encoder converts the image into a face vector. Now, Decoder A learns how to convert a base vector to the image of Leonardo and Decoder B learns how to convert a base vector to an image of Nicolas Cage. Then compare both the image and swap each other.
After training the model we can feed video. A video is basically a collection of images frames. So it takes a frame of images and then crop the face from the image and then swap it. Then we concatenate all the image and watch the swapped video.
Right now this DeepFakes is great for making fun videos. But as more developer’s works on this DeepFakes it is going to be very difficult to differentiate between real and fake one. This opens lots of opportunities for the content creator to create some awesome videos. This DeepFakes gives a tool to create something extraordinary which is not possible before.
This post can be overwhelming to all who don’t know anything about machine learning and deep learning. But this post gives you a glimpse of the power of artificial intelligence. I hope this post will encourage you to read more about the power of artificial intelligence.