Wed. Jan 22nd, 2020

Tech4tress

Get Things Done

Deepfakes on Macintosh(needs editing)

DeepLearning series Ep 5 : DeepFakes on Macintosh Catalina CPU ( 13 inch MacBook Pro 2013)

Install Amphetamine from
https://apps.apple.com/in/app/amphetamine/id937984704?mt=12
this helps from keeping the mac from sleeping

Download and install Anaconda python 3.7 from
https://repo.anaconda.com/archive/Anaconda3-2019.10-MacOSX-x86_64.pkg

Download DeepFaceLab from
https://github.com/iperov/DeepFaceLab
and extract its content to Documents/deepfakes/DeepFaceLab

Download DeepFaceLab from and extract the conetents of Deepfacelab-master zip file to
Documents/deepfakes/DeepFaceLab

Commands used:

Command #base-directory
cd Documents/deepfakes/DeepFaceLab

Command #1
conda create -n deepfakes python=3.6

Command #2
conda activate deepfakes

Command #3
pip install -r requirements-cpu.txt

Command #4
conda install pytorch torchvision -c soumith

Command #bash_profile_edit
nano ~/.bash_profile

Content #BASH_PROFILE
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Command #source_bash_profile
source ~/.bash_profile

Command #5 : Extract data_src frames from Video
python main.py videoed extract-video --input-file WORKSPACE/data_src.mp4 --output-dir WORKSPACE/data_src

Command #6 : Extract data_dst frames from Video
python main.py videoed extract-video --input-file WORKSPACE/data_dst.mp4 --output-dir WORKSPACE/data_dst

Command #7 : Extract faces from data_src video
python main.py extract --input-dir WORKSPACE/data_src --output-dir WORKSPACE/data_src/aligned --detector mt --cpu-only

Command #8 : Extract faces from data_src video
python main.py extract --input-dir WORKSPACE/data_dst --output-dir WORKSPACE/data_dst/aligned --detector mt --cpu-only

Clear the extracted faces which arent clear enough

Command #9 : Train the model using the extracted images
python main.py train --training-data-src-dir WORKSPACE/data_src/aligned --training-data-dst-dir WORKSPACE/data_dst/aligned --model-dir WORKSPACE/model --model DF --cpu-only

Command #10 : Swap the faces from data_dst videos frames
python main.py convert --input-dir WORKSPACE/data_dst --output-dir WORKSPACE/data_dst/merged --aligned-dir WORKSPACE/data_dst/aligned --model-dir WORKSPACE/model --model DF --cpu-only

Command #11 : Convert the frames to video
python main.py videoed video-from-sequence --input-dir WORKSPACE/data_dst/merged --output-file WORKSPACE/result.mp4 --reference-file WORKSPACE/data_dst.*

links that helped me in the process
https://coderwall.com/p/-k_93g/mac-os-x-valueerror-unknown-locale-utf-8-in-python
https://medium.com/@debarko/how-to-install-pytorch-on-a-mac-os-x-97a79e28c70

129 total views, 11 views today