Hey! We have been loving the deepfakes that Corridor Digital have been doing
lately, and one of our users has just in a similar thing using Marty McFly and Doc
Brown as Robert Downey jr. It's great, go check that out.
But we haven't got much time to do this so let's go figure it out now. We thought
to try our hand in deepfaking using DeepFaceLab, and see what results we
could get from just a day's play. Limited time, limited skill, limited knowledge, limited everything. So we're going to be going over the steps
then jumping into HitFilm for compositing. First up make sure to pick
the right build for your GPU. Our machines aren't strong enough so we're
now going to tear apart one downstairs that we have sitting around, and rip out its
guts. It's all good for Corridor Digital, they've got machines that have like
4 2080Ti's in them. Not that it isn't hard still because they know what they're
doing, but like, it's tough for us because it's our first day and we've realized none of our
machines have more than one graphics card in. We've got a couple of 1080s so
we're gonna try a 1080 but looks like it might take a while. We do a hundred
thousand iterations, which is it looping over the thing and checking it out, it's
about three and a half days yeah so we don't have three and a half days so, we don't have three and a half days so
we're gonna see how well it does in like a day and a half with a 1080 in a cold
room. Download the .exe from the GDrive, link in the description, and install the
program to a location of your choosing. There's also a link to the GitHub where
you can get more info on the DeepFaceLab so go check that out. Once installed
go into the DeepFaceLab in Nvidia folder, and you'll find a workspace
folder created. This is the folder where all the action will happen and
essentially we'll be going through each of these batch files. We decided to
replace my face for which we needed a clip. As it's our first time, we kept it
short and kept the lighting flat to avoid any problems during training. So
we're going to try and keep your face probably like 20 degrees in either
direction so we're not ever losing an eye, not ever getting a profile. While
it can do that, it's where it starts getting sketchy. So to help it, we're
gonna try and keep you kind of looking towards the camera. CanI just take picture of your
face, face on I'm going to see if I can find a celebrity that's close to you. Okay.
Please be someone good. it's not just whether we can find a celebrity, it's whether we can find a
celebrity dataset. In the database, yeah I know. I've been told I look like James McAvoy. For the actual Face Swap there's a bunch of databases
online that you can find. We managed to find one of Leonardo DiCaprio, and
Nicolas Cage but things were already crazy enough. What you're looking for is
as many images and angles as possible. We didn't have the time to create our own
collection but this is possible in DeepFaceLab, so subscribe and hit the bell
icon to stay tuned for a tutorial on that process. Once you've found your
collection and downloaded it, you'll need to import these into the data source
folder. To extract and analyze faces from your chosen video, the clip you're
placing the celeb onto, take it into HitFilm and trim it down to the points you
need. This is the long enough process as is, so no need to extend the run time.
Export as an mp4 into the workspace folder and name your folder data_dst.
This is the destination video. Run step 3,
extract images from video data destination full fps, this will run
through the clip converting it into an image sequence. We didn't go through
stage 4 at this time, but we'll be going into these steps in the future. The points in
stage 5 are to organize the results. Start by extracting the frames, sort by
histogram, check the results, this will delete anything that may cause errors.
Finally, re-extract deleted results debug. We run this step to manually align
frames that we deleted in the last step. Training, step 6.
This is the actual machine learning process. We ended up doing two versions
to test the quality of each. Quick 96 is the low-quality output while SAEHD
can match with HD quality. Enter the name of your model you're now creating, choose
what you're running on, and depending on the mode that you choose, you'll be asked
for settings. We ended up going with the defaults and recommendations for now. Now
it'll start doing its thing, running as many iterations as it's been told. The
recommended number of iterations is 10,000. This can be a long process but
the more you do the cleaner will be. The graph above the images will indicate the
errors. As the process goes on, this will eventually turn into a slope. Now we wait
until we're done or, when you think it's had enough, hit the return key. If we now
enter the data destination folder, you'll notice there are image sequences that
have been created containing merge outputs and masks. We'll be using these
within HitFilm. Right okay, so within HitFilm all we're gonna do is go up to the arrow
here and go to image sequence, find where we've found our merged file, select that
import, right-click, let's turn that into a composite shot and he is looking
all Leonardo DiCaprio-y. And if we want to change this, we can just go into
import the mask layers, the merge mask, and if we want to add that we can, well,
we can use this as a Set Matte to alter this in any way we want, make it
extra cool. We did it! We actually got Leo DiCaprio's face to stick onto mine.
This is a huge achievement for us considering it's only been our first day
of play this is a massive proof-of-concept that we can now take
what we've learned and apply it to other things. We can revisit the Witcher
tutorial that we did the other week and, instead of comping, we could just deepfake
everyone. This is a massive accomplishment. We've already reached out
to the guy who did the Back to the Future deepfake hoping that he can
give us some guidance and tips. But let's pass the question off to you; if you know
anything about deepfakes let us know in the comments section down below if there's
anything that we can try. Lighting is definitely one thing that we definitely need to
experiment with. We had a lot of circular motion going on so we need to figure out
what that is. If you've never deepfaked before, links in the description to
everything that we used during this process. So have a go yourself, and see
what results you can get within a day's play. If you'd like to see a full
tutorial on the process of deepfaking, do let us know in the comments below.
Subscribe and hit the bell icon to avoid missing out when we revisit this. We'll
also be posting any tests on our on Instagram @fxhome_official. So
follow and check-in sometime to see what we're up to. And we'll see you in the
next tutorial.