First things first !
What is a deepfake ?
Deepfakes are basically fake videos of real people or objects generated using complex machine learning algorithms, that require some good computational power as well.
So, I was just wondering on youtube and suddenly youtube algorithm came up with some unexpected recommendation, it was Jordan peele and Barack Obama's deep fake video. which you can watch it here
and I decided to make one like that.
Now, I don't have any experience with machine learning or deep learning stuff, neither I have that much computational power, but still I found one really cool Github repo out there which can help with all those problems.
AliaksandrSiarohin / first-order-model
This repository contains the source code for the paper First Order Motion Model for Image Animation
Now, as this Repository states that it contains the source code for the paper First Order Motion Model for Image Animation by Aliaksandr Siarohin, Stéphane Lathuilière, Sergey Tulyakov, Elisa Ricci and Nicu Sebe. So all with all credits to them they have done some really great work.
Now we can easily clone this repo to our pc and start working on it, but that will require you to install all the heavy requirements too, which I think will take much more time if you have never worked with all that machine learning stuff. And also not to forget the GPU power that's required.
So, I think in that case we should use the Colab Demo that they have provided which is much easier to work with. Now all you need is google drive account to add source image and driving video to the modal.
Also you will need to add first-order-motion-modal folder from the link provided in colab demo file to your G-drive which you can download and upload it to your drive or you can simply create a copy to your drive.
This folder includes some default data in it to try but you can easily add your data to the modal by changing the path in source_image and reader.
Change the path in both the variable to your g-drive location like for example if your source_image and driving video are located in 'My drive' than your path will be
source_image = imageio.imread('/content/gdrive/My Drive/source_image.png')
reader = imageio.get_reader('/content/gdrive/My Drive/driving_video.mp4')
Now there are some limitations to this modal which you have to keep in mind in order to make it work as expected. For the source_image it should be a proper square image i.e the aspect ratio of the source image should be exactly 1:1 . similarly the dirving video should also be a proper square video you can choose any of online services to crop video to 1:1 aspect ratio.
Once you have done that just run the remaining code blocks from colab-demo and you will have your deepfake video.
Top comments (0)