GoldenFake 007

In recent months, AI-assisted face-swapping has been the hot topic across the internet. From the moment the technology was unleashed in a dark corner of Reddit, to its now widespread family-friendly fame, the ethics and impact of face-swapping (or “deepfakes”) have been hugely controversial.

The process has even been automated as of Feb 2018, but before OpenFaceSwap came along it was a much more involved task. In those early days, I acquired the necessary source code and dependencies – Google’s TensorFlow machine learning platform, Keras2 to make TensorFlow work with Python, and the OpenCV image recognition library – in an attempt to swap Pierce Brosnan for Timothy Dalton in a clip from the GoldenEye 007 movie.

The process is simple in theory – find a video that you want to face-swap, extract images of the face you want to replace, feed them to TensorFlow along with images of the face you want to insert, and let the AI do the rest.

To explain in more detail: TensorFlow interprets the face you want to replace as “incorrect”, and the face you want to insert as “correct”. As the AI learns what an “incorrect” and “correct” face looks like, it slowly changes the “incorrect” face to look like the “correct” one, and you end up with a library of face-swapped images.

The next step is to reinsert the face-swapped images into the video, and I ended up with this blurry half-Brosnan half-Dalton abomination:

Controversy aside, this didn’t make it onto the main portfolio site because of the poor quality – but that’s what this Skunkworks Blog is for!

Leave a Reply

Your email address will not be published. Required fields are marked *