OpenFaceSwap: A DeepFakes GUI
What is OpenFaceSwap?
OpenFaceSwap is a free and open source end user package based on the faceswap community GitHub repository. OpenFaceSwap includes:
- A portable Winpython environment with all necessary python dependencies pre-installed.
- A fully functional GUI that does more than simply echo python commands.
- An exact copy of the most recent faceswap package.
- Two additional custom faceswap packages designed for high or low performance.
How do I obtain OpenFaceSwap?
Download the BETA version here:
WARNING: Use at your own risk. This is a work in progress and by downloading this package you agree that we are not responsible for any loss or damages you incur from OpenFaceSwap.
Current security hashes:
- File size: 458,892,751
- MD5: 05986B2E914307FD87646D82CFC56C9D
- SHA1: F32EE526ADCDF7A241ECD61B74EA3EEBA763F6D2
- SHA256: 413FA0648D9BD1BBAB5114086AB8342F60C8E00861B610C9E0D9B7E58A1E1B90
- File size: 458,870,358 bytes
- MD5: 0F8205DE6D7784B03C063D2B7FDC3B47
- SHA1: 003C052804534F77151C851A9EC8D24D68382839
- SHA256: D3856B021ED7946114BB2495A9161A070CF859E79F9B8B325B114D3A9C215491
- Microsoft Visual Studio Redistributable 2015 (Link)
- CUDA 9.0, NOT 9.1 (Link)
- cuDNN 7.05, NOT 7.1, (Link, requires email registration)
- Latest NVIDIA graphics card drivers (Link)
- Windows 10 or Windows 2016 Server, Intel processor second generation (Sandy Bridge) or later, NVIDIA graphics card with compute capability 3.0 or higher
For instructions on how to use OpenFaceSwap, jump down to here.
Why use OpenFaceSwap?
OpenFaceSwap offers a number of benefits over current deepfakes software packages.
- Simple installation of the GUI and the accompanying portable python environment. No downloading of additional files or local compiling necessary.
- Light and fast package that fits in an installer with less than 450 MB. No unpacking of large temporary files for each runtime, either.
- A true GUI that can execute a complete deepfakes workflow with only mouse clicks.
- Saving and loading of configurations as well as custom commands.
- Shortcut icons for examining and editing output folders in Windows Explorer.
- An audio syncing option for video creation.
- Use and management of default folders for beginners who want to avoid details.
- No obnoxious watermarks.
- Option to override any step with arbitrary custom commands.
- Able to view and edit all code for complete customization.
- Three provided faceswap packages, and the ability to import and use additional faceswap packages.
- A GUI shell that is compatible with other python installations or compiled binaries. Simply adjust the engine configuration file.
- Multi-threading for more efficient GPU usage that provides 50-75% faster training (see benchmarks).
- Tensorflow 1.7 with AVX compilation, CUDA 9.0, and cuDNN 7.0 that is 5-10% faster than Tensorflow 1.5, and 10-20% faster than Tensorflow 1.4.
- An experimental faceswap package with loss balancing for up to 2x faster training of difficult data sets. Combined with the other features, this can provide up to 3x faster training than FakeApp.
- Pre-compiled dlib 19.10.0 with full GPU support.
- An experimental faceswap package including a dfaker plugin for 128 x 128 pixel resolution, large face area outputs (see benchmarks).
- A low memory faceswap package to accommodate users of 2GB graphics cards.
- All community plugins including GAN, GAN128, and IAE models.
- All source code is included in the installed package as human-readable Ruby or Python files. The dangers of closed source deepfakes software have been documented by Malwarebytes and Reddit.
- The GUI shell may be run by installing Ruby Shoes and loading the .rb file.
- The python source code may be run on any other python installation provided that the necessary dependencies are present.
- The GUI and python backends are all released under the GNU GPL3 license.
- Documented security hashes for verification of safe installation downloads.
How to use OpenFaceSwap?
Install the 4 pre-requisites listed above. For CUDA, choose a custom installation. Ignore any warnings from CUDA about the lack of a C++ compiler. Do not install the drivers through CUDA.
- Unzip the cuDNN files.
- You need to manually copy 3 files from cuDNN to the corresponding folders in your CUDA installation, which is usually at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
- Copy cuda\bin\cudnn64_7.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
- Copy cuda\include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include
- Copy cuda\lib\x64\cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64
Download and run the .exe OpenFaceSwap Installer. Choose a directory for installation that is not in Program Files due to possible user permission errors. The default is set to “C:\OpenFaceSwap”.
Wait while the files are unpacked.
Double click the desktop shortcut, or run the file OpenFaceSwap.exe from your installation directory. The very first time you run, it may take several minutes for anything to happen. You can check your Task Manager to make sure OpenFaceSwap.exe is present and active.
For beginners or first-time users, you can simply press the buttons without worrying about the details. Later you may wish to explore further.
To get started, click the “Video A” button and select a video file. This will be the video with the face you want to change.
Click “Images A” to extract all of the frames from Video A. When done, hit any key at the prompt to continue. If you like, you can press the magnifying glass icon next to the directory name to inspect the results.
Click “Faces A” to extract all of the faces from Image Set A. Ideally, your video only has one face present. You may wish to inspect your results and remove any erroneous face extractions.
Repeat the above three steps with Video B, which is the face that you will insert. If you have a set of images instead of a video, you can instead skip ahead to the “Images B” text box. Click the folder icon to select the directory that has all of your images. Then, proceed to click the “Faces B” button as before.
Click “Model”. When you hover over the button, the necessary input folders will be highlighted. In this case, those are folders for Faces A and Faces B. Training your model will take many hours. You can wait until the printed loss values are less than 0.02. Also, check the previews for the quality of the faceswap. When ready, press the Enter key to stop training.
Click “Swaps” to apply your model to turn face A into face B. If you hover over the button, you will see that you need input folders for Faces A and Model. When this is finished, you may wish to inspect your results as before.
Finally, click “Movie” to generate movie file. Your movie file will be named as shown in the text box and be placed within your OpenFaceSwap installation directory. Click the magnifying glass to open up the folder and play the movie file.
When you are done, you may wish to click the Trash icon and empty your default folders. If you want to delete your model files, you can also do that by checking the appropriate box.
Click the gear icon next to each command to see a number of options.
Not all command line options are available from the GUI. You can enter custom commands by checking the “Custom” box. You may wish to highlight and copy the original commands first and then edit them.
You can save and load all of your settings, including your custom commands, using the icons in the upper left corner.
The GUI shell runs using python backends or “engines”. The default engine in the installation is an exact copy of the most recent faceswap GitHub repository. To load the experimental or low memory faceswap packages, edit the openfaceswapconfig.txt file to point to the appropriate paths. This will normally only involve inserting a “_exp” or “_lowmem” in the appropriate paths.
Note that you can mix and match different extraction and conversion scripts from different packages in the engine configuration file, although there could be unforseen compatibility issues.
Some notes on the engines:
- DFaker only works in the experimental engine.
- The Original model uses loss balancing in the experimental engine with a minimum training ratio of 1:4 (see the code).
- The LowMem model in the low memory engine should work for 2GB graphics cards. The extraction uses face_recognition instead of face-alignment, so the results will be slightly different. This can be useful if you are having errors with one extraction module. Note that the alignments.json files in the experimental engine have a slightly different format.
The portable Winpython package is a complete and independent no-install platform. If you wish to use the python package, run the “WinPython Command Prompt.exe” prompt from the “python” directory. This will setup the proper environment and let you use commands such as “python faceswap.py” from the CLI.
Questions or requests
Report all bugs and ask questions in the forums.
Known bugs or issues
The Original model is the most thoroughly tested model. Others, such as GAN and IAE may give unexpected results or errors.
The Converter Adjust setting does not function properly. This is due to the underlying python code.