To follow along with this coding tutorial, all you’ll need is to sign onto Google Colab with your Google account, create a new notebook with GPU runtime type, and follow these steps listed below.

Step 1: Face Generation with StyleGAN2

Let’s first try to generate the face of the hypothetical person we want as our narrator in the output video. The current state-of-the-art Deep Learning technique in face generation is NVIDIA’s StyleGAN2. For this purpose, we’ll use the following website for obtaining a StyleGAN2 generated face.

Let’s first install the required web tools for scraping photos off this website. Execute the following in your Colab Notebook.

!rm -r sample_data
	!pip install selenium
	!apt-get update # to update ubuntu to correctly run apt install
	!apt install chromium-chromedriver
	!cp /usr/lib/chromium-browser/chromedriver /usr/bin
	import sys
	sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')
	from selenium import webdriver
	chrome_options = webdriver.ChromeOptions()
	chrome_options.add_argument('--headless')
	chrome_options.add_argument('--no-sandbox')
	chrome_options.add_argument('--disable-dev-shm-usage')
	driver = webdriver.Chrome('chromedriver',chrome_options=chrome_options)

Next, execute the following code to visit the website and download the image to your Colab environment. Run this portion of code again and again until you see a face you want to use for your intended purpose.

from selenium.webdriver.common.action_chains import ActionChains
	driver.get("https://thispersondoesnotexist.com/")
	import time 
	time.sleep(5)
	button = driver.find_element_by_id('saveButton')
	ActionChains(driver).move_to_element(button).click(button).perform()
	time.sleep(4)
	from IPython.display import Image
	Image('person.jpg')

You should see a high-res face displayed in your notebook as below. Note that in this tutorial, we will only be using female faces since the speech synthesizer used later only comes with a female voice. This can easily be extended to other cases with training separate speech models.

#artificial-intelligence #gaming #software-engineering #machine-learning #programming

How to Create Fake Talking Head Videos With Deep Learning
8.35 GEEK