Playing Deepfake on Mac, part 1: Setup

This guide does not work any more. Please check the last one on more popular DeepFakeLab.

This a quick update on how to use Scene Selector to prepare and merge movie frames for a face swapped movie. You still need code from

In short, face-swapping a movie includes 3 steps:

  1. Extract faces of two different faces. You will need many of them for different expressions and positions in order to get a good result.
  2. Train the model to learn how to transform from face A to face B from the data of step 1.
  3. Convert the face on each movie frame and merge back to a movie.

Every step involves the heavy usage of GPU, though it can run with CPU. It is about 1/10 of speed comparing to GPU. Especially for step 2, if you started from a pretrained model, it takes about 4-6 hours to generate a new good model ( on AMD RX580 eGPU). It takes significant time running it on CPU.

Here is the step by step instruction if you don’ t have python virtual environment ready.

Go to and install Homebrew with the terminal command on the page.

  1. Create your isolated environment with command. You can use your preferred location.
brew install pyenv-virtualenv
pyenv install 3.6.6
pyenv virtualenv 3.6.6 faceswap-env

Add following lines to enviroment(pre-10.15: ~/.bash_profile, 10.15 if you use zsh: ~/.zshrc) so pyenv can work properly.

eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Restart the shell or execute the command above. Then use following command to start the working environment.

pyenv activate faceswap-env
  1. Now change the directory to the place you want Faceswap program to be downloaded.
cd ~/Downloads
git clone
  1. Activate your working environment (for every new terminal session you have to do this. )
  2. Change the directory to faceswap directory
  3. Run the install script and follow the instructions.
  4. setup plaidml(if you use GPU)
# setup plaidml to choose the GPU.

Now you can test if your setup works with a directory of images or a video file.

python faceswap extract -i INPUT_DIRECTORY -o OUTPUT_DIRECTORY

Your plaidml might not be set to the device of the most powerful GPU you plan to use. Use plaidml-setup command to set it correctly. If you are running nVidia card on MacOS 10.13.*, you can also use plaidml instead of building tensorflow for GPU by yourself.

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: