How To Make Baka Mitai Memes And Other Facemorphs

Making a deepfake Facemorph such as a Baka Mitai meme is much more challenging than slapping some text over an image in Photoshop, but is also much more rewarding. Luckily, all the tools are readily available and you don’t have to install any special software – although you will need a desktop computer to create your meme.

Facemorphs are created using a tool called First Order Motion Model for Image Animation, or FOMMIA. To create a Facemorph meme, you will also need a 256×256 pixel image of someone’s face in PNG format and a 256px by 256px MP4 video of a person talking or singing. For Baka Mitai memes, this video of YouTuber Dobbsyrules is used as a source video (you can download here).

Be sure not to miss any steps!

Step One

First of all, open a demo for the paper “First Order Motion Model for Image Animation” made by Aliaksandr Siarohin by clicking here. The link will take you to a collaborative Google Research page containing the necessary scripts for creating your deepfake. Start by copying the line below and entering next to the little play button in the first cell. Press the button to run the script; in the window that will pop up, click “RUN ANYWAY.”

!pip install PyYAML==5.3.1


Demo for paper "First Order Motion Model for Image Animation" 1) Paste this line Clone repository !pip install PYYAML==5.3.1 !git clone https://github.com/AliaksandrSiarohin/first-order-model Cloning into 'first-order-model'... remote: Enumerating objects: 85, done. remote: Total 85 (delta 0), reused e (delta 0), pack-reused 85 Unpacking objects: 100% (85/85), done. 2) Press this button [2] cd first-order-model A / content/first-order-model Mount your Google drive folder on Colab Text Line Font

Step Two

Once the script runs successfully, press the play button in the next cell containing the text “cd first-order-model.” Proceed to do the same for the next cell containing the text “from google.colab import drive.”


[2] cd first-order-model / content/first-order-model 3) Click this button Mount your Google drive folder on Colab [3] from google.colab import drive drive.mount ('/content/gdrive') 4) Click this button Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=9473189{ Enter your authorization code: .......... Mounted at /content/gdrive 5) Click the link Add folder https://drive.google.com/drive/folders/1kZ1gCnpfU0BnpdU47pLM _TQ6RypDDqgw? usp=sharing to your google drive. Text Line Blue Font

This will prompt you to click a URL link that will offer you to authorize the project for your Google Account(s). Copy the authorization link and enter in the suggested box. Press enter on your keyboard.


G Sign in with Google Google Drive File Stream wants to access your Google Account This will allow Google Drive File Stream to: See, edit, create, and delete all of your Google Drive files View the photos, videos and albums in your Google Photos View Google people information such as profiles O and contacts See, edit, create, and delete any of your Google O Drive documents Make sure you trust Google Drive File Stream You may be sharing sensitive info with this site or app. Learn about how Google Drive File Stream will handle your data b6yePressofAllowwacy policies. You can alvays see or remove access in your Google Account. Learn about the risks Cancel Allow Text Font Line GoodiCopy this code Sign in Please copy this code, switch to your application and paste it there: 4/2gHeY211rE5uRYrGmgGvMjSFyGEj_vO- WEB5WTWruRet3QZGQtBFuLI Text Line Font Parallel
Mount your Google drive folder on Colab from google.colab import drive 8) Paste the code into the box drive.mount ('/content/gdrive') Go to this URL in a browser: ht://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pft Enter your authorization cod. Add folder https://drive.google.com/drive/folders/1kZ1gCnpfU0BnpdU47pLM TQ6RypDDqgw?usp=sharing to your google drive. Text Line Font

Step Three

The line below the third cell prompts you to add a folder to your Google Drive – you can either copy the entire folder or create a folder titled “first-order-motion-model” on your Google Drive and copy the files “vox-adv-cpk.tar” and “vox-cpk.pth.tar” into it. If you have trouble locating the files, you can download them here and move them to the folder (file one; file two)

Next, add a source 256×256 MP4 video and a 256×256 PNG photograph that your meme will be using to the folder. For Baka Mitai memes, use this video of YouTuber Dobbsyrules. Rename your image file to 02.png and your video file to 04.mp4.


Your Drive Folder should look like this: Drive Search in Drive Source image My Drive > first-order-motion-model Name Owner Last modifi. File size Source video 02.png 21:20 me 63 KB me 04.mp4 2 18:22 me 7 MB me Files you copied vox-adv-cpk.pth.tar 2 18:16 me 716 MB me vox-cpk.pth.tar 18:15 me 695 MB me Text Line Font Number

Step Four

Run the script in the fourth cell “Load driving video and source image.” This will take a few moments. The script will produce a video of your raw MP4 and PNG shown side by side.


Load driving video and source image * V GD 0 i 7 import imageio import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation 9) Press this button from skimage.transform import resize from IPython.display import HTML import warnings warnings.filterwarnings("ignore") source_image = imageio.imread('/content/gdrive/My Drive/first-order-motion-model/02.png') driving_video = imageio.mimread('/content/gdrive/My Drive/first-order-motion-model/04.mp4') #Resize image and video to 256x256 source_image = resize(source_image, (256, 256))[..., :3] driving_video = [resize(frame, (256, 256))[..., :3] for frame in driving_video] def display(source, driving, generated=None): fig = plt.figure (figsize=(8 + 4 * (generated is not None), 6)) ims = [] for i in range(len(driving)): cols = [source] cols.append (driving[i]) if generated is not None: cols.append(generated[i]) im = plt.imshow(np.concatenate(cols, axis=1), animated=True) plt.axis ('off') ims.append([im]) Text Line Font II 0:12/0:41 Face Hair Facial hair Head Chin Beard Eyebrow Nose Forehead Glasses Cheek Eyewear Moustache

Run the script in the fifth cell, and then in the sixth (the last cell will take a few moments to generate your video). If you encounter an error, check if you missed any of the steps; if this is not the case, try logging in from another Google account.


Create a model and load checkpoints [5] from demo import load_checkpoints generator, kp_detector = load_checkpoints (config_path='config/vox-256.yaml', 10) Press this button checkpoint_path='/content/gdrive/My Drive/first-order-motion-model/vox-cpk. Perform image animation [6] from demo import make_animation from skimage import img_as_ubyte 11) Then this one predictions = make_animation(source_image, driving_video, generator, kp_detector, relative=True) #save resulting video imageio.mimsave('../generated.mp4', [img_as_ubyte(frame) for frame in predictions]) #video can be downloaded from /content folder HTML (display(source_image, driving_video, predictions).to_htm15_video()) 100%| || 211/211 [00:07<00:00, 29.03it/s] Text Font Line Product Pink Magenta

If all the steps were performed correctly, you will see a side-by-side video with your source image, source video and your deepfake ready. To download it, go to the side menu on the left side and click on the folder icon. Download the file “generated.mp4.” Enjoy your meme!


II 0:37/0:41 Face Facial expression Head Chin Forehead Facial hair
Ofirst-order-model-demo.ipynb File Edit View Insert Runtime Tools Help Cannot save changes + Code + Text A Copy to Drive Table of contents Demo for paper "First Order Motion Model for Image Animation" [22] from demo import load_checkpoints generator, kp_detector = load_checkpo checkpoin <> Running on your data B Section Perform image animation 12) Click this folder icon from demo import make_animation from skimage import img_as_ubyte predictions = make_animation(source_i #save resulting video imageio.mimsave('../generated.mp4', [ #video can be downloaded from /conten HTML (display(source_image, driving_vi 100%|| 836/836 [00:34<00:00 Text Line Font + Code + Text Copy to Drive E Files [22] from demo import load_checkpoints <> generator, kp_detector = load_checkpoints(config_path= checkpoint_path='/content/g first-order-model gdrive Perform image animation sample_data generated.mp4 make_animation ort img_as_ubyte Download Delete file ike_animation(source_image, driving_vide Rename file video Сoрy path 13) Right-click "generated.mp4, '../generated. mp4', [img_as_ubyte (frame Refresh wnloaded from /content folder then "download" HTML (display(source_image, driving_video, predictions). Text Line Font

“Dame Da Ne Meme Tutorial” by Homemade Memes was used to create this guide – check it out on YouTube

Source: https://knowyourmeme.com/editorials/guides/how-to-make-baka-mitai-memes-and-other-facemorphs