Summary
In this chapter, we ran the convert process on a folder full of images, replacing the faces using a trained model. We also turned the images back into a video, including changes to account for frame rate and copying audio.
We started by going over how to prepare a video for conversion. The convert process requires data created by the extract process from Chapter 5, Extracting Faces, and a trained AI model from Chapter 6, Training a Deepfake Model. With all the parts from the previous chapters, we were ready to convert.
We then walked through the code for the conversion process. This involved looking at the initialization, where we covered getting the Python script ready to operate. We then loaded the AI models and got them set up to work on a GPU if we have one. Next, we got the data ready for us to convert the faces in each frame. Finally, we ran two nested loops, which processed every face in every frame, swapping them to the other face. This part gave us a folder filled...