Deep-Live-Cam ディープフェイク動画や画像の作成ができるローカルPC上で学習なしで高品質な顔入れ替えに特化したソフトウェア


Deep-Live-Cam

https://github.com/hacksider/Deep-Live-Cam

インストール

@echo off
call %~dp0\scripts\env_for_icons.bat  %*
SET PATH=%PATH%;%WINPYDIRBASE%\PortableGit;%WINPYDIRBASE%\PortableGit\bin
SET PATH=%PATH%;%WINPYDIRBASE%\ffmpeg\bin
If not exist %WINPYDIRBASE%\content mkdir  %WINPYDIRBASE%\content 
::goto :skip_v
set HF_HOME=E:\my_cache\hf_home
set TRANSFORMERS_CACHE=E:\my_cache\transformers
set DIFFUSERS_CACHE=E:\my_cache\diffusers
echo HF_HOME = %HF_HOME%
echo TRANSFORMERS_CACHE = %TRANSFORMERS_CACHE%
echo DIFFUSERS_CACHE = %DIFFUSERS_CACHE%
:skip_v
set APP_NAME=Deep-Live-Cam
set APP_DIR=%WINPYDIRBASE%\content\%APP_NAME%
echo %APP_DIR%
cd %WINPYDIRBASE%\content\

If not exist  %APP_DIR% git clone https://github.com/hacksider/Deep-Live-Cam


cd %APP_DIR%
timeout /t 5
if not defined VENV_DIR (set "VENV_DIR=%APP_DIR%\venv")
if EXIST %VENV_DIR% goto :activate_venv

::python.exe -m venv "%VENV_DIR%" 
python.exe -m venv "%VENV_DIR%" --system-site-packages 
if %ERRORLEVEL% == 0 goto :pip
echo Unable to create venv 
goto :skip_venv

:pip
call "%VENV_DIR%\Scripts\activate"

pip install -r requirements.txt


::huggingface-cli download hacksider/deep-live-cam --local-dir ./models
cmd.exe /k

:activate_venv
call "%VENV_DIR%\Scripts\activate"
python run.py --execution-provider cuda
 ::cmd.exe /k
goto :skip_venv
:skip_cmd
::
:skip_venv
 :: ::
cmd.exe /k

モデルのダウンロード

  1. GFPGANv1.4
  2. inswapper_128_fp16.onnx

in the “models" folder.

使い方

python run.py --execution-provider cuda

画像または動画を選ぶ

スタートボタンを押して処理する

コマンドラインオプション

options:
  -h, --help                                               show this help message and exit
  -s SOURCE_PATH, --source SOURCE_PATH                     select a source image
  -t TARGET_PATH, --target TARGET_PATH                     select a 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 original fps
  --keep-audio                                             keep original audio
  --keep-frames                                            keep temporary frames
  --many-faces                                             process every face
  --map-faces                                              map source target faces
  --mouth-mask                                             mask the mouth region
  --video-encoder {libx264,libx265,libvpx-vp9}             adjust output video encoder
  --video-quality [0-51]                                   adjust output video quality
  --live-mirror                                            the live camera display as you see it in the front-facing camera frame
  --live-resizable                                         the live camera frame is resizable
  --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

コマンドラインでの使用方法

python run.py --execution-provider cuda  -s "Y:\0.png" -t "Y:\1.png" -o "Y:\output.png"

Python

Posted by eightban