Book Image

Exploring Deepfakes

By : Bryan Lyon, Matt Tora
Book Image

Exploring Deepfakes

By: Bryan Lyon, Matt Tora

Overview of this book

Applying Deepfakes will allow you to tackle a wide range of scenarios creatively. Learning from experienced authors will help you to intuitively understand what is going on inside the model. You’ll learn what deepfakes are and what makes them different from other machine learning techniques, and understand the entire process from beginning to end, from finding faces to preparing them, training the model, and performing the final swap. We’ll discuss various uses for face replacement before we begin building our own pipeline. Spending some extra time thinking about how you collect your input data can make a huge difference to the quality of the final video. We look at the importance of this data and guide you with simple concepts to understand what your data needs to really be successful. No discussion of deepfakes can avoid discussing the controversial, unethical uses for which the technology initially became known. We’ll go over some potential issues, and talk about the value that deepfakes can bring to a variety of educational and artistic use cases, from video game avatars to filmmaking. By the end of the book, you’ll understand what deepfakes are, how they work at a fundamental level, and how to apply those techniques to your own needs.
Table of Contents (15 chapters)
1
Part 1: Understanding Deepfakes
6
Part 2: Getting Hands-On with the Deepfake Process
10
Part 3: Where to Now?

Looking at existing deepfake software

There have been many programs that have risen to fill the niche of deepfaking; however, few of them are still under development or supported. The rapid development of GPU hardware and AI software has led to unique challenges in software development, and many deepfake programs are no longer usable. However, there are still several deepfake software programs and, in this section, we’ll go over the major options.

Important Note

The authors have made every effort to be unbiased in this section, but are among the developers of Faceswap. Faceswap will be covered in more detail in Chapter 4, The Deepfake Workflow, with a walkthrough of the workflow of a deepfake through the Faceswap software.

Faceswap

Faceswap is a Free and Open Source (FOSS) software program for creating deepfakes. It’s released under the GPL3 and can be used by anyone anywhere. It’s written in Python and runs AI on the TensorFlow backend. It supports NVIDIA, AMD, and Apple GPUs for accelerating the machine learning models, or can be run on a CPU at a reduced speed. There are installers for Windows and Linux that can help by installing all the needed libraries and tools inside of a self-contained environment.

It’s available at https://Faceswap.dev/.

DeepFaceLab

Originally a fork of Faceswap, DeepFaceLab is now developed mostly by Ivan Perov. DeepFaceLab is another FOSS software program for deepfakes. It is known for more experimental models and features. There is no GUI, but there are Jupyter Notebooks that can be run in any of the Jupyter environments. There is also a DirectML version, which provides another option for people using Windows. There are fully contained builds that are packaged together into a single compressed file, which provides a fully working package for many operating systems.

It’s available at https://github.com/iperov/DeepFaceLab.

First Order Model

First Order Model works in a fundamentally different way from Faceswap and DeepFaceLab. Instead of swapping a face onto a new video, First Order Model “puppets” the face, making it match the movements of a video but leaving the face the same. Furthermore, it doesn’t require training on each face pair, making it easy to use to make quick deepfakes where you can “animate” a person even with just a single photo of them.

It is important to note that while the First Order Model software is available freely, it is licensed only for non-commercial use: if you want to use it in a commercial context, you’ll need to contact the author for a license. It’s available at https://github.com/AliaksandrSiarohin/first-order-model.

Reface

Reface is yet another method of creating deepfakes. Reface is closed source and proprietary, so we can’t analyze exactly how it works, but it uses a zero-shot learning method like First Order Model to swap faces without requiring training on a pair of swaps. Reface offers apps for Apple iOS and Android and does the swap in the cloud, making it easier to get a quick result, but means that you might not be able to swap the exact clip you want, and licensing may be an issue.

It’s available at https://reface.ai/.