https://github.com/sensity-ai/dot Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Skills + GitHub Sponsors + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} sensity-ai / dot Public * Notifications * Fork 74 * Star 1.2k The Deepfake Offensive Toolkit License BSD-3-Clause license 1.2k stars 74 forks Star Notifications * Code * Issues 5 * Pull requests 0 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights sensity-ai/dot This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 1 tag Code Latest commit @giorgiop giorgiop Update README.md (#7) ... 1f035d9 Jun 7, 2022 Update README.md (#7) 1f035d9 Git stats * 4 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows first public commit Jun 4, 2022 assets first public commit Jun 4, 2022 data first public commit Jun 4, 2022 docs first public commit Jun 4, 2022 dot Update readme (#6) Jun 6, 2022 envs first public commit Jun 4, 2022 scripts first public commit Jun 4, 2022 tests Update readme (#6) Jun 6, 2022 .flake8 first public commit Jun 4, 2022 .gitignore first public commit Jun 4, 2022 .pre-commit-config.yaml first public commit Jun 4, 2022 .yamllint first public commit Jun 4, 2022 CONTRIBUTING.md first public commit Jun 4, 2022 LICENSE first public commit Jun 4, 2022 README.md Update README.md (#7) Jun 7, 2022 pyproject.toml first public commit Jun 4, 2022 requirements-dev.txt first public commit Jun 4, 2022 requirements.txt first public commit Jun 4, 2022 setup.cfg first public commit Jun 4, 2022 View code [ ] Deepfake Offensive Toolkit How it works Installation Install Pre-requisites Create Conda Environment With GPU Support With CPU Support (slow, not recommended) Install dot Download Models Usage Running dot Controlling dot Virtual Camera Injection Windows Ubuntu MacOS License Contributing Setup Dev-Tools List of maintainers Research README.md Deepfake Offensive Toolkit build-dot code-check dot (aka Deepfake Offensive Toolkit) makes real-time, controllable deepfakes ready for virtual cameras injection. dot is created for performing penetration testing against e.g. identity verification and video conferencing systems, for the use by security analysts, Red Team members, and biometrics researchers. If you want to learn more about dot is used for penetration tests with deepfakes in the industry, read these articles by The Verge and Biometric Update dot is developed for research and demonstration purposes. As an end user, you have the responsibility to obey all applicable laws when using this program. Authors and contributing developers assume no liability and are not responsible for any misuse or damage caused by the use of this program. [dot_intro] How it works In a nutshell, dot works like this __________________ _____________________________ __________________________ | your webcam feed | -> | suite of realtime deepfakes | -> | virtual camera injection | ------------------ ----------------------------- -------------------------- All deepfakes supported by dot do not require additional training. They can be used in real-time on the fly on a photo that becomes the target of face impersonation. Supported methods: * face swap (via SimSwap), at resolutions 224 and 512 + with the option of face superresolution (via GPen) at resolutions 256 and 512 * lower quality face swap (via OpenCV) * FOMM, First Order Motion Model for image animation Installation Install Pre-requisites * Linux sudo apt install ffmpeg cmake * MacOS brew install ffmpeg cmake Create Conda Environment The instructions assumes that you have Miniconda installed on your machine. If you don't, you can refer to this link for installation instructions. With GPU Support conda env create -f envs/environment-gpu.yaml conda activate dot Install the torch and torchvision dependencies based on the CUDA version installed on your machine: * Install cudatoolkit from conda: conda install cudatoolkit= (replace with the version on your machine) * Install torch and torchvision dependencies: pip install torch== 1.9.0+ torchvision==0.10.0+ -f https:// download.pytorch.org/whl/torch_stable.html, where is the CUDA tag defined by Pytorch. For example, pip install torch== 1.9.0+cu111 torchvision==0.10.0+cu111 -f https:// download.pytorch.org/whl/torch_stable.html for CUDA 11.1. See here for a list of all available torch and torchvision versions. To check that torch and torchvision are installed correctly, run the following command: python -c "import torch; print (torch.cuda.is_available())". If the output is True, the dependencies are installed with CUDA support. With CPU Support (slow, not recommended) conda env create -f envs/environment-cpu.yaml conda activate dot Install dot pip install -e . Download Models There are 2 options for downloading the model weights: * GDrive: Download folder from here, unzip and place the folder in the root directory of the repository. * gdown: Run the following command: gdown https://drive.google.com/drive/folders/1FX1QoXragN4aKJZFo2DLiDE8fqKHeXEB -O ./saved_models --folder Usage Running dot Run dot --help to get a full list of available options. 1. Simswap dot \ --swap_type simswap \ --target 0 \ --source "./data" \ --parsing_model_path ./saved_models/simswap/parsing_model/checkpoint/79999_iter.pth \ --arcface_model_path ./saved_models/simswap/arcface_model/arcface_checkpoint.tar \ --checkpoints_dir ./saved_models/simswap/checkpoints \ --show_fps \ --use_gpu 2. SimSwapHQ dot \ --swap_type simswap \ --target 0 \ --source "./data" \ --parsing_model_path ./saved_models/simswap/parsing_model/checkpoint/79999_iter.pth \ --arcface_model_path ./saved_models/simswap/arcface_model/arcface_checkpoint.tar \ --checkpoints_dir ./saved_models/simswap/checkpoints \ --crop_size 512 \ --show_fps \ --use_gpu Additionally, to enable face superresolution, use the flag --gpen_type gpen_256 or --gpen_type gpen_512. 3. FOMM dot \ --swap_type fomm \ --target 0 \ --source "./data" \ --model_path ./saved_models/fomm/vox-adv-cpk.pth.tar \ --show_fps \ --use_gpu 4. FaceSwap dot \ --swap_type faceswap_cv2 \ --target 0 \ --source "./data" \ --model_path ./saved_models/faceswap_cv/shape_predictor_68_face_landmarks.dat \ --show_fps \ --use_gpu Note: To use dot on CPU (not recommended), do not pass the --use_gpu flag. Controlling dot Disclaimer: We use the SimSwap technique for the following demonstration Running dot via any of the above methods generates real-time Deepfake on the input video feed using source images from the ./data folder. [dot_run] When running dot a list of available control options appear on the terminal window as shown above. You can toggle through and select different source images by pressing the associated control key. Watch the following demo video for better understanding of the control options: [dot_demo] Virtual Camera Injection Instructions vary depending on your operating system. Windows * Install OBS Studio. * Install VirtualCam plugin. Choose Install and register only 1 virtual camera. * Run OBS Studio. * In the Sources section, press on Add button ("+" sign), select Windows Capture and press OK. In the appeared window, choose "[python.exe]: fomm" in Window drop-down menu and press OK. Then select Edit -> Transform -> Fit to screen. * In OBS Studio, go to Tools -> VirtualCam. Check AutoStart, set Buffered Frames to 0 and press Start. * Now OBS-Camera camera should be available in Zoom (or other videoconferencing software). Ubuntu sudo apt update sudo apt install v4l-utils v4l2loopback-dkms v4l2loopback-utils sudo modprobe v4l2loopback devices=1 card_label="OBS Cam" exclusive_caps=1 v4l2-ctl --list-devices sudo add-apt-repository ppa:obsproject/obs-studio sudo apt install obs-studio Open OBS Studio and check if tools --> v4l2sink exists. If it doesn't follow these instructions: mkdir -p ~/.config/obs-studio/plugins/v4l2sink/bin/64bit/ ln -s /usr/lib/obs-plugins/v4l2sink.so ~/.config/obs-studio/plugins/v4l2sink/bin/64bit/ Use the virtual camera with OBS Studio: * Open OBS Studio * Go to tools --> v4l2sink * Select /dev/video2 and YUV420 * Click on start * Join a meeting and select OBS Cam MacOS * Download and install OBS Studio for MacOS from here * Open OBS and follow the first-time setup (you might be required to enable certain permissions in System Preferences) * Run dot with --use_cam flag to enable camera feed * Click the "+" button in the sources section - select "Windows Capture", create a new source and enter "OK" - select window with "python" included in the name and enter OK * Click "Start Virtual Camera" button in the controls section * Select "OBS Cam" as default camera in the video settings of the application target of the injection License This is not a commercial Sensity product, and it is distributed freely with no warranties The software is distributed under BSD 3-Clause. dot utilizes several open source libraries. If you use dot, make sure you agree with their licenses too. In particular, this codebase is built on top of the following research projects: * https://github.com/AliaksandrSiarohin/first-order-model * https://github.com/alievk/avatarify-python * https://github.com/neuralchen/SimSwap * https://github.com/yangxy/GPEN Contributing This repository follows the Google Python Style Guide for code formatting. If you have ideas for improving dot, feel free to open relevant Issues and PRs. Please read CONTRIBUTING.md before contributing to the repository. If you are working on improving the speed of dot, please read first our guide on code profiling. Setup Dev-Tools 1. Install Dev Requirements pip install -r requirements-dev.txt 2. Install Pre-Commit Hooks pre-commit install 3. Run Unit Tests (with coverage) pytest --cov=dot --cov-report=term --cov-fail-under=10 List of maintainers * @ghassen1302 * @vassilispapadop * @giorgiop * @AjinkyaIndulkar * @kjod Research * Run dot on image and video files instead of camera feed About The Deepfake Offensive Toolkit Resources Readme License BSD-3-Clause license Stars 1.2k stars Watchers 10 watching Forks 74 forks Releases 1 1.0.0 Public release Latest Jun 4, 2022 Contributors 2 * * Languages * Python 95.6% * Cuda 3.8% * C++ 0.6% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.