This project allows users to perform real-time face swapping on a webcam feed. It is built upon the base of the ROOP project.
Ensure you have the required dependencies and your system meets the necessary requirements. Download model.
wget https://civitai.com/api/download/models/85159 -O inswapper_128.onnx
This project requires setting up a virtual webcam. Here's how you can achieve this:
- Load the v4l2loopback module:
sudo modprobe v4l2loopback
- To configure the virtual device, you can run:
sudo modprobe -r v4l2loopback && sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="Overlay" exclusive_caps=1 max_buffers=2
- To verify the virtual device has been correctly set up, run:
ls -la -1 /sys/devices/virtual/video4linux
If everything is set up correctly, you should see your virtual device listed.
To run the face-swap on your live webcam feed:
-
Navigate to the project directory.
-
Execute the main script:
python main.py
This will initiate the face-swapping process on your webcam. Ensure your virtual webcam device is selected as the source in any application you're using.
- The virtual webcam device can be used in software such as video conferencing tools, allowing you to use the face-swap feature in real-time communications.
- Ensure the v4l2loopback module is correctly set up before attempting to run the main script.
This project is based on the ROOP project. A big thank you to all contributors of the original project.