Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CursedPrograms/Roop-FaceSwap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

33 Commits

Repository files navigation

Twitter: @NorowaretaGemu License: MIT




Roop-FaceSwap

Requirements

Verifying CUDA and cuDNN Installation

To verify that CUDA is installed correctly, run the following in Command Prompt or PowerShell:

nvcc --version
This should return the version of the CUDA compiler. If it says 'nvcc' is not recognized, make sure the CUDA bin directory is added to your system PATH (e.g., C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\bin).

For cuDNN, ensure the following cuDNN files are copied into your CUDA folder:

bin\cudnn*.dll → into CUDA_PATH\bin
include\cudnn*.h → into CUDA_PATH\include
lib\x64\cudnn*.lib → into CUDA_PATH\lib\x64

Setup Instructions

1. Create and Activate the Virtual Environment

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
& "C:\Users\YourUsername\AppData\Local\Programs\Python\Python310\python.exe" -m venv onnx-env
. .\onnx-env\Scripts\Activate.ps1
pip install -r requirements.txt

Or run:

  • install_requirements.bat

    pip install torch torchvision

. .\onnx-env\Scripts\Activate.ps1 onnx-env\Scripts\activate.bat source onnx-env/Scripts/activate

Run main.py

Using Python directly:

python run.py

Using provided scripts:

Windows:

  • .\run.bat or
  • .\run.ps1

Unix-like systems (Linux/macOS):

  • .\run.sh


Python Requirements:

--extra-index-url https://download.pytorch.org/whl/cu118
numpy==1.24.3
opencv-python==4.8.0.74
onnx==1.14.0
insightface==0.7.3
psutil==5.9.5
tk==0.1.0
customtkinter==5.2.0
tkinterdnd2==0.3.0; sys_platform != 'darwin' and platform_machine != 'arm64'
tkinterdnd2-universal==1.7.3; sys_platform == 'darwin' and platform_machine == 'arm64'
pillow==10.0.0
onnxruntime==1.15.1; python_version != '3.9' and sys_platform == 'darwin' and platform_machine != 'arm64'
onnxruntime-coreml==1.13.1; python_version == '3.9' and sys_platform == 'darwin' and platform_machine != 'arm64'
onnxruntime-silicon==1.13.1; sys_platform == 'darwin' and platform_machine == 'arm64'
onnxruntime-gpu==1.15.1; sys_platform != 'darwin'
tensorflow==2.13.0
opennsfw2==0.10.2
protobuf==4.23.4
tqdm==4.65.0
gfpgan==1.3.8

Installation

Basic - It is more likely to work on your computer, but will be quite slow

Acceleration - Unleash the full potential of your CPU and GPU


Usage

Start the program with arguments:

python run.py [options]
-h, --help show this help message and exit
-s SOURCE_PATH, --source SOURCE_PATH select an source image
-t TARGET_PATH, --target TARGET_PATH select an target image or video
-o OUTPUT_PATH, --output OUTPUT_PATH select output file or directory
--frame-processor FRAME_PROCESSOR [FRAME_PROCESSOR ...] frame processors (choices: face_swapper, face_enhancer, ...)
--keep-fps keep target fps
--keep-frames keep temporary frames
--skip-audio skip target audio
--many-faces process every face
--reference-face-position REFERENCE_FACE_POSITION position of the reference face
--reference-frame-number REFERENCE_FRAME_NUMBER number of the reference frame
--similar-face-distance SIMILAR_FACE_DISTANCE face distance used for recognition
--temp-frame-format {jpg,png} image format used for frame extraction
--temp-frame-quality [0-100] image quality used for frame extraction
--output-video-encoder {libx264,libx265,libvpx-vp9,h264_nvenc,hevc_nvenc} encoder used for the output video
--output-video-quality [0-100] quality used for the output video
--max-memory MAX_MEMORY maximum amount of RAM in GB
--execution-provider {cpu} [{cpu} ...] available execution provider (choices: cpu, ...)
--execution-threads EXECUTION_THREADS number of execution threads
-v, --version show program's version number and exit

Headless

Using the -s/--source, -t/--target and -o/--output argument will run the program in headless mode.


© Cursed Entertainment

AltStyle によって変換されたページ (->オリジナル) /