Tutorialspoint

April Learning Carnival is here, Use code FEST10 for an extra 10% off

Computer Vision: Python Face Swap and Quick Deepfake In Colab

person icon Abhilash Nelson

4.4

Computer Vision: Python Face Swap and Quick Deepfake In Colab

Custom Face Swap using Python and OpenCV & Deepfake Image Animation using 'First Order Motion Model' paper in Colab

updated on icon Updated on Apr, 2024

language icon Language - English

person icon Abhilash Nelson

category icon IT & Software,IT Certification,Computer Vision

Lectures -28

Duration -4 hours

4.4

price-loader

30-days Money-Back Guarantee

Training 5 or more people ?

Get your team access to 10000+ top Tutorials Point courses anytime, anywhere.

Course Description

There's an old saying that goes, "Seeing is believing." But in the "Deepfake" universe, what we see is not always reality. Let's use a video example to define deep fake.

I made these films with just a single stamp-sized photo of individual people. You heard it right. You can make a deepfake of someone with just one face image and a few minutes on a standard PC. Even the dead can be made to speak or sing for you.

Computer Vision: Python Face Swap and Quick Deepfake In Colab Course Overview

There are exactly two halves to this course.

We'll build a simple Python-based face swap application in the first half. We will first provide an overview of the deep fake technique, including its uses, benefits, and drawbacks. The next step is to set up our machine with all the necessary requirements.  Anaconda, the platform and IDE for our Python programming will be installed. For individuals who want to study the fundamentals of the Python programming language, there are a few optional courses that come later.

The remaining dependencies needed to create our unique Python face swap program will be installed later. After that, we will write more than 300 lines of Python code one line at a time to finish the program. As an alternative, you can download the entire code from the Google Drive URL given in the course's final session. We will initially perform the face swap using two still photos. The target image is the other, whereas the first is the source image. We'll test it out later with live footage from our computer's web camera. Afterward, we'll change it so that it may be used with a previously saved video that is stored on our computer.

How the curriculum works

You can see from the examples that this was only a very simple face swap program and that it was far from flawless. We were merely interested in understanding how things operated behind the scenes.

A study titled "First Order Motion Model for Picture Animation" will serve as the foundation for the implementation of deep fake later on. It was submitted by Aliaksandr Siarohin, Stéphane Lathuilière, Sergei Tulyakov, Elisa Ricci, and Nicu Sebe as their work to Cornell University.

We have a backup plan that involves using the free GPU provided by Google Colab because training a deepfake requires pricey GPUs. In order to prepare our Google Drive, we will create folders, upload a sample driving video, and then add the source and target images that will be used to create the animated target image.

Also, we will download the Google Colab sample notebook and link it to Google Drive. The first-order motion model repository will then be copied from Google Drive.

Later, we'll also go ahead and clone the repository for face alignment. We'll set it up in our Google Colab after installation. Then, using a built-in Python program, we will begin by cropping the driving footage after moving the files into the appropriate folders.

The frozen inference graph of the already trained model will then be downloaded to our Google Drive. Now that the source pictures based on the driving footage are ready to be animated, the process may begin. We'll download the animated movie once it's finished. For a handful of the other source photos, we will likewise follow a similar procedure.

There won't be any audio in the animated video. Thus, utilizing any free or open-source video editing software that is available online, we must mix the music to it. Finally, we have all the deepfake animated videos with audio. We will do that in our following session.

In the last session, we'll also go over ways to conserve the limited amount of Google's free GPU time as well as solutions in case it runs out.

Just one more thing before I wrap up. Please utilize the information and methods described in this course in a very responsible manner. It is solely meant to be used for educational and research purposes. Any improper or careless use of this technique is not the responsibility of me as the instructor or the site where I am hosting this course.

That wraps up the subjects covered in this little course at the moment. The files used in this course's code, graphics, and weights have been shared in a folder. The download link will be provided in the final lesson or in the course's resource area. There are no restrictions on the use of the code in your projects.

You will receive a course completion certificate as well after finishing the course, which will enhance your portfolio.

Bibliographies and Reference Credits

  • NIPS Proceedings - First Order Motion Model for Image Animation - Aliaksandr Siarohin, Stéphane Lathuilière, Sergey Tulyakov, Elisa Ricci, Nicu Sebe

  • Cornell University - Computer Vision and Pattern Recognition - First Order Motion Model for Image Animation

  • Github - AliaksandrSiarohin - first-order-model

  • Github Pages - First Order Motion Model for Image Animation

  • Learn OpenCV - Delaunay Triangulation and Voronoi Diagram using OpenCV

  • Learn OpenCV - Face Swap using OpenCV - Satya Mallick

  • py source - Face swapping - Sergio Canu

Goals

What will you learn in this course:

  • Python-based Custom Face Swap Application with Image, Video, and Camera.

  • Deepfake Videos based on First Order Motion Model Image Animation Paper

Prerequisites

What are the prerequisites for this course?

  • a capable PC with Windows preferable, and a desire to investigate Deepfake Technologies

Computer Vision: Python Face Swap and Quick Deepfake In Colab

Curriculum

Check out the detailed breakdown of what’s inside the course

Introduction to Deepfake Technology
1 Lectures
Tutorialspoint
Preparing your computer - Installing Anaconda
1 Lectures
Tutorialspoint
Python Basics (Optional)
4 Lectures
Tutorialspoint
Installing OpenCV and other Dependencies
2 Lectures
Tutorialspoint
Custom Face Swap using Python
6 Lectures
Tutorialspoint
Realtime Webcam Custom Face Swap using Python
2 Lectures
Tutorialspoint
Pre-saved Video Custom Face Swap using Python
1 Lectures
Tutorialspoint
Introduction to First Order Animation Model and Colab GPU
1 Lectures
Tutorialspoint
Setting up Google Colab
2 Lectures
Tutorialspoint
Creating Deepfake Animation
4 Lectures
Tutorialspoint
Adding Audio to Video
1 Lectures
Tutorialspoint
Course Conclusion
1 Lectures
Tutorialspoint
SAMPLES AND SOURCE CODE DOWNLOAD
1 Lectures
Tutorialspoint
Deleted
1 Lectures
Tutorialspoint

Instructor Details

Abhilash Nelson

Abhilash Nelson

I am a pioneering, talented and security-oriented Android/iOS Mobile and PHP/Python Web Developer Application Developer offering more than eight years’ overall IT experience which involves designing, implementing, integrating, testing and supporting impact-full web and mobile applications.

I am a Post Graduate Masters Degree holder in Computer Science and Engineering.

My experience with PHP/Python Programming is an added advantage for server based Android and iOS Client Applications.

Course Certificate

Use your certificate to make a career change or to advance in your current career.

sample Tutorialspoint certificate

Our students work
with the Best

Feedbacks

D

David Ross

Good information, easy to follow.

Related Video Courses

View More

Annual Membership

Become a valued member of Tutorials Point and enjoy unlimited access to our vast library of top-rated Video Courses

Subscribe now
Annual Membership

Online Certifications

Master prominent technologies at full length and become a valued certified professional.

Explore Now
Online Certifications

Talk to us

1800-202-0515