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?

Exercises

  1. Choosing learning rate is not a solved problem. There is no one “right” learning rate. What happens if you make the learning rate 10 times bigger? 10 times smaller? What if you start with a large learning rate and then reduce it after some training?
  2. We used the same loss function and optimizer as the original code, which was first released back in 2018, but there are a lot of options now that weren’t available then. Try replacing the loss function with others from PyTorch’s extensive collection (https://pytorch.org/docs/stable/nn.html#loss-functions). Some of them will work without any change, but some won’t work for our situation at all. Try different ones, or even try combinations of loss functions!
  3. We defined a model that downscaled from a 64x64 pixel image and re-created that same image. But with some tweaks, this same architecture can instead create a 128x128 or 256x256 pixel image. How would you make changes to the model...