Compare commits

...

34 Commits

Author SHA1 Message Date
Kenneth Estanislao 4324b41b9e
Update ui.py
hides NSFW button
2024-08-15 03:03:57 +08:00
Kenneth Estanislao a6e00211f0
Merge pull request #321 from gianpaj/stop-live-mode-if-preview-is-closed
Stop live mode when the preview window is closed
2024-08-15 03:01:37 +08:00
Gianfranco Palumbo 99214c7ab1 Stop live mode the preview window is closed 2024-08-14 17:52:42 +02:00
Kenneth Estanislao 080d6f5110
Merge pull request #282 from jasonkneen/main-macos-metal-gpu-optimisation
macOS optimisations for Silicon Macs for GPU / Metal usage (reduced CPU load from 600% to 150%)
2024-08-13 20:30:26 +08:00
Jason Kneen 155546b937 Update .gitignore 2024-08-13 13:23:13 +01:00
Kenneth Estanislao 79fbb7998c
Merge pull request #281 from snewell92/patch-1 2024-08-13 20:09:04 +08:00
Sean Newell 5ce2fd298b
sourcery update
Grammar updates

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2024-08-13 14:03:05 +02:00
Sean Newell 740410dd73
Strengthen ethical consideration
Nothing we say is legally binding in here, but it
behooves us to be stronger in our language - getting consent
to be digitally reproduced should be required
and standard procedure.
2024-08-13 13:50:02 +02:00
Kenneth Estanislao cbc7c22f1c
Create CONTRIBUTING.md 2024-08-13 03:12:58 +08:00
Kenneth Estanislao a31e81fa66
Update README.md
https://www.reddit.com/r/singularity/comments/1eo4sne/comment/lhl7odv/
2024-08-11 21:59:31 +08:00
Kenneth Estanislao e8a8acca9f
Update README.md 2024-08-11 21:17:04 +08:00
Kenneth Estanislao a9d4564726
Update README.md
relinking this to the old repo
2024-08-11 21:08:38 +08:00
Kenneth Estanislao fc47cffb18
Update README.md 2024-08-11 16:35:38 +08:00
Kenneth Estanislao fff3009c80
Merge pull request #152 from Saharsha-N/patch-1
Update README.md
2024-08-10 22:08:08 +08:00
Saharsha-N 84c10400b9
Update README.md
Fixed a typo.
2024-08-10 09:55:36 -04:00
Kenneth Estanislao 9f58dfeee1
Merge pull request #140 from rahulbansal16/main
Fix this cyclic dependency issue which was coming while installing rquirements
2024-08-10 20:29:59 +08:00
Rahul Bansal 04e72a85c3 Fix this cyclic dependency issue which was coming while doing the pip install requirements. Now the code is working. You are able to run it on your Windows machine. 2024-08-10 17:43:39 +05:30
Kenneth Estanislao 6a17297e2f
Update README.md 2024-08-10 14:19:20 +08:00
Kenneth Estanislao ddd19474da
Merge pull request #115 from hacksider/revert-88-main
Revert "Enable to choose a camera device in UI" Will put it on experimental as of this moment
2024-08-10 13:57:37 +08:00
Kenneth Estanislao d49a77b3a3
Revert "Enable to choose a camera device in UI" 2024-08-10 13:54:12 +08:00
Kenneth Estanislao 40029921ef
Merge pull request #88 from samoylenkodmitry/main
Enable to choose a camera device in UI
2024-08-10 13:18:27 +08:00
Dmitry Samoylenko d4c8adc5d3
Merge branch 'hacksider:main' into main 2024-08-09 18:59:28 +02:00
Dmitry Samoylenko 58993be308 Enable to choose a camera device in UI
Signed-off-by: samoylenkodmitry <samoylenkodmitry@gmail.com>
2024-08-09 19:58:56 +03:00
Kenneth Estanislao f16caefc21
Merge pull request #81 from Rhymond/patch-1
Small typo in README.md
2024-08-10 00:41:17 +08:00
Kenneth Estanislao f03f5277f6
Update setup_deep_live_cam.bat
added option to detect if directory exist
2024-08-10 00:33:48 +08:00
Kenneth Estanislao f48b1b4620
Merge pull request #83 from Thepathakarpit/main
Added batch file to run all the steps using just one command
2024-08-10 00:30:56 +08:00
Thepathakarpit 069fcf9950
Add files via upload 2024-08-09 21:46:58 +05:30
Raymond 72f587ca06
Update README.md 2024-08-09 18:09:46 +03:00
Kenneth Estanislao 6bb9e1ba15
Merge pull request #74 from c4fun/main
solve the FACE_ENHANCER os problem for non-nt(linux, mac) system
2024-08-08 13:15:57 +08:00
c4fun 6400a80a91 solve the FACE_ENHANCER os problem for non-nt(linux, mac) system 2024-08-07 23:26:47 +08:00
Kenneth Estanislao fc9bd973f0
Merge pull request #63 from hacksider/dependabot/pip/tensorflow-2.12.1
Bump tensorflow from 2.12.0 to 2.12.1
2024-07-31 11:30:30 +08:00
dependabot[bot] 5384ea6236
Bump tensorflow from 2.12.0 to 2.12.1
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.12.0...v2.12.1)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-31 03:29:52 +00:00
Kenneth Estanislao 702744a89a
Merge pull request #62 from SamuraiBarbi/patch-1
Update requirements.txt
2024-07-31 11:29:02 +08:00
SamuraiBarbi 63793e9034
Update requirements.txt
Changing numpy version requirement to 1.23.5 due to the current requirements for the package version have conflicting dependencies.
2024-07-29 15:35:02 -04:00
8 changed files with 157 additions and 22 deletions

4
.gitignore vendored
View File

@ -6,14 +6,16 @@ __pycache__/
.todo .todo
*.log *.log
*.backup *.backup
tf_env/
*.png *.png
*.mp4 *.mp4
*.mkv *.mkv
.tmp/ .tmp/
temp/ temp/
.venv/
venv/ venv/
env/
workflow/ workflow/
gfpgan/ gfpgan/
models/inswapper_128.onnx models/inswapper_128.onnx

1
CONTRIBUTING.md Normal file
View File

@ -0,0 +1 @@
Please always push on the experimental to ensure we don't mess with the main branch. All the test will be done on the experimental and will be pushed to the main branch after few days of testing.

View File

@ -4,9 +4,9 @@
## Disclaimer ## Disclaimer
This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc. This software is meant to be a productive contribution to the rapidly growing AI-generated media industry. It will help artists with tasks such as animating a custom character or using the character as a model for clothing etc.
The developers of this software are aware of its possible unethical applicaitons and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law. The developers of this software are aware of its possible unethical applications and are committed to take preventative measures against them. It has a built-in check which prevents the program from working on inappropriate media including but not limited to nudity, graphic content, sensitive material such as war footage etc. We will continue to develop this project in the positive direction while adhering to law and ethics. This project may be shut down or include watermarks on the output if requested by law.
Users of this software are expected to use this software responsibly while abiding the local law. If face of a real person is being used, users are suggested to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users. Users of this software are expected to use this software responsibly while abiding by local laws. If the face of a real person is being used, users are required to get consent from the concerned person and clearly mention that it is a deepfake when posting content online. Developers of this software will not be responsible for actions of end-users.
## How do I install it? ## How do I install it?
@ -135,7 +135,7 @@ Choose a face (image with desired face) and the target image/video (image/video
Just follow the clicks on the screenshot Just follow the clicks on the screenshot
1. Select a face 1. Select a face
2. Click live 2. Click live
3. Wait for a few second (it takes a longer time, usually 10 to 30 seconds before the preview shows up) 3. Wait for a few seconds (it takes a longer time, usually 10 to 30 seconds before the preview shows up)
![demo-gif](demo.gif) ![demo-gif](demo.gif)
@ -166,10 +166,14 @@ options:
Looking for a CLI mode? Using the -s/--source argument will make the run program in cli mode. Looking for a CLI mode? Using the -s/--source argument will make the run program in cli mode.
## Want the Next Update Now?
If you want the latest and greatest build, or want to see some new great features, go to our [experimental branch](https://github.com/hacksider/Deep-Live-Cam/tree/experimental) and experience what the contributors have given.
## Credits ## Credits
- [henryruhs](https://github.com/henryruhs): for being an irreplaceable contributor to the project
- [ffmpeg](https://ffmpeg.org/): for making video related operations easy - [ffmpeg](https://ffmpeg.org/): for making video related operations easy
- [deepinsight](https://github.com/deepinsight): for their [insightface](https://github.com/deepinsight/insightface) project which provided a well-made library and models. - [deepinsight](https://github.com/deepinsight): for their [insightface](https://github.com/deepinsight/insightface) project which provided a well-made library and models.
- [havok2-htwo](https://github.com/havok2-htwo) : for sharing the code for webcam - [havok2-htwo](https://github.com/havok2-htwo) : for sharing the code for webcam
- [GosuDRM](https://github.com/GosuDRM/nsfw-roop) : for uncensoring roop - [GosuDRM](https://github.com/GosuDRM/nsfw-roop) : for uncensoring roop
- and all developers behind libraries used in this project. - and [all developers](https://github.com/hacksider/Deep-Live-Cam/graphs/contributors) behind libraries used in this project.
- Foot Note: [This is originally roop-cam, see the full history of the code here.](https://github.com/hacksider/roop-cam) Please be informed that the base author of the code is [s0md3v](https://github.com/s0md3v/roop)

View File

@ -165,7 +165,6 @@ def update_status(message: str, scope: str = 'DLC.CORE') -> None:
if not modules.globals.headless: if not modules.globals.headless:
ui.update_status(message) ui.update_status(message)
def start() -> None: def start() -> None:
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors): for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
if not frame_processor.pre_start(): if not frame_processor.pre_start():

View File

@ -2,6 +2,7 @@ from typing import Any, List
import cv2 import cv2
import threading import threading
import gfpgan import gfpgan
import os
import modules.globals import modules.globals
import modules.processors.frame.core import modules.processors.frame.core
@ -34,8 +35,11 @@ def get_face_enhancer() -> Any:
with THREAD_LOCK: with THREAD_LOCK:
if FACE_ENHANCER is None: if FACE_ENHANCER is None:
if os.name == 'nt':
model_path = resolve_relative_path('..\models\GFPGANv1.4.pth') model_path = resolve_relative_path('..\models\GFPGANv1.4.pth')
# todo: set models path https://github.com/TencentARC/GFPGAN/issues/399 # todo: set models path https://github.com/TencentARC/GFPGAN/issues/399
else:
model_path = resolve_relative_path('../models/GFPGANv1.4.pth')
FACE_ENHANCER = gfpgan.GFPGANer(model_path=model_path, upscale=1) # type: ignore[attr-defined] FACE_ENHANCER = gfpgan.GFPGANer(model_path=model_path, upscale=1) # type: ignore[attr-defined]
return FACE_ENHANCER return FACE_ENHANCER

View File

@ -61,11 +61,11 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
target_label = ctk.CTkLabel(root, text=None) target_label = ctk.CTkLabel(root, text=None)
target_label.place(relx=0.6, rely=0.1, relwidth=0.3, relheight=0.25) target_label.place(relx=0.6, rely=0.1, relwidth=0.3, relheight=0.25)
source_button = ctk.CTkButton(root, text='Select a face', cursor='hand2', command=lambda: select_source_path()) select_face_button = ctk.CTkButton(root, text='Select a face', cursor='hand2', command=lambda: select_source_path())
source_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1) select_face_button.place(relx=0.1, rely=0.4, relwidth=0.3, relheight=0.1)
target_button = ctk.CTkButton(root, text='Select a target', cursor='hand2', command=lambda: select_target_path()) select_target_button = ctk.CTkButton(root, text='Select a target', cursor='hand2', command=lambda: select_target_path())
target_button.place(relx=0.6, rely=0.4, relwidth=0.3, relheight=0.1) select_target_button.place(relx=0.6, rely=0.4, relwidth=0.3, relheight=0.1)
keep_fps_value = ctk.BooleanVar(value=modules.globals.keep_fps) keep_fps_value = ctk.BooleanVar(value=modules.globals.keep_fps)
keep_fps_checkbox = ctk.CTkSwitch(root, text='Keep fps', variable=keep_fps_value, cursor='hand2', command=lambda: setattr(modules.globals, 'keep_fps', not modules.globals.keep_fps)) keep_fps_checkbox = ctk.CTkSwitch(root, text='Keep fps', variable=keep_fps_value, cursor='hand2', command=lambda: setattr(modules.globals, 'keep_fps', not modules.globals.keep_fps))
@ -88,9 +88,9 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
many_faces_switch = ctk.CTkSwitch(root, text='Many faces', variable=many_faces_value, cursor='hand2', command=lambda: setattr(modules.globals, 'many_faces', many_faces_value.get())) many_faces_switch = ctk.CTkSwitch(root, text='Many faces', variable=many_faces_value, cursor='hand2', command=lambda: setattr(modules.globals, 'many_faces', many_faces_value.get()))
many_faces_switch.place(relx=0.6, rely=0.65) many_faces_switch.place(relx=0.6, rely=0.65)
nsfw_value = ctk.BooleanVar(value=modules.globals.nsfw) # nsfw_value = ctk.BooleanVar(value=modules.globals.nsfw)
nsfw_switch = ctk.CTkSwitch(root, text='NSFW', variable=nsfw_value, cursor='hand2', command=lambda: setattr(modules.globals, 'nsfw', nsfw_value.get())) # nsfw_switch = ctk.CTkSwitch(root, text='NSFW', variable=nsfw_value, cursor='hand2', command=lambda: setattr(modules.globals, 'nsfw', nsfw_value.get()))
nsfw_switch.place(relx=0.6, rely=0.7) # nsfw_switch.place(relx=0.6, rely=0.7)
start_button = ctk.CTkButton(root, text='Start', cursor='hand2', command=lambda: select_output_path(start)) start_button = ctk.CTkButton(root, text='Start', cursor='hand2', command=lambda: select_output_path(start))
start_button.place(relx=0.15, rely=0.80, relwidth=0.2, relheight=0.05) start_button.place(relx=0.15, rely=0.80, relwidth=0.2, relheight=0.05)
@ -292,5 +292,8 @@ def webcam_preview():
preview_label.configure(image=image) preview_label.configure(image=image)
ROOT.update() ROOT.update()
if PREVIEW.state() == 'withdrawn':
break
cap.release() cap.release()
PREVIEW.withdraw() # Close preview window when loop is finished PREVIEW.withdraw() # Close preview window when loop is finished

View File

@ -1,6 +1,6 @@
--extra-index-url https://download.pytorch.org/whl/cu118 --extra-index-url https://download.pytorch.org/whl/cu118
numpy==1.24.3 numpy==1.23.5
opencv-python==4.8.1.78 opencv-python==4.8.1.78
onnx==1.16.0 onnx==1.16.0
insightface==0.7.3 insightface==0.7.3
@ -16,7 +16,7 @@ onnxruntime==1.18.0; sys_platform == 'darwin' and platform_machine != 'arm64'
onnxruntime-silicon==1.16.3; sys_platform == 'darwin' and platform_machine == 'arm64' onnxruntime-silicon==1.16.3; sys_platform == 'darwin' and platform_machine == 'arm64'
onnxruntime-gpu==1.18.0; sys_platform != 'darwin' onnxruntime-gpu==1.18.0; sys_platform != 'darwin'
tensorflow==2.13.0rc1; sys_platform == 'darwin' tensorflow==2.13.0rc1; sys_platform == 'darwin'
tensorflow==2.12.0; sys_platform != 'darwin' tensorflow==2.12.1; sys_platform != 'darwin'
opennsfw2==0.10.2 opennsfw2==0.10.2
protobuf==4.23.2 protobuf==4.23.2
tqdm==4.66.4 tqdm==4.66.4

122
setup_deep_live_cam.bat Normal file
View File

@ -0,0 +1,122 @@
@echo off
setlocal EnableDelayedExpansion
:: 1. Setup your platform
echo Setting up your platform...
:: Python
where python >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Python is not installed. Please install Python 3.10 or later.
pause
exit /b
)
:: Pip
where pip >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Pip is not installed. Please install Pip.
pause
exit /b
)
:: Git
where git >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo Git is not installed. Installing Git...
winget install --id Git.Git -e --source winget
)
:: FFMPEG
where ffmpeg >nul 2>&1
if %ERRORLEVEL% neq 0 (
echo FFMPEG is not installed. Installing FFMPEG...
winget install --id Gyan.FFmpeg -e --source winget
)
:: Visual Studio 2022 Runtimes
echo Installing Visual Studio 2022 Runtimes...
winget install --id Microsoft.VC++2015-2022Redist-x64 -e --source winget
:: 2. Clone Repository
if exist Deep-Live-Cam (
echo Deep-Live-Cam directory already exists.
set /p overwrite="Do you want to overwrite? (Y/N): "
if /i "%overwrite%"=="Y" (
rmdir /s /q Deep-Live-Cam
git clone https://github.com/hacksider/Deep-Live-Cam.git
) else (
echo Skipping clone, using existing directory.
)
) else (
git clone https://github.com/hacksider/Deep-Live-Cam.git
)
cd Deep-Live-Cam
:: 3. Download Models
echo Downloading models...
mkdir models
curl -L -o models/GFPGANv1.4.pth https://path.to.model/GFPGANv1.4.pth
curl -L -o models/inswapper_128_fp16.onnx https://path.to.model/inswapper_128_fp16.onnx
:: 4. Install dependencies
echo Creating a virtual environment...
python -m venv venv
call venv\Scripts\activate
echo Installing required Python packages...
pip install --upgrade pip
pip install -r requirements.txt
echo Setup complete. You can now run the application.
:: GPU Acceleration Options
echo.
echo Choose the GPU Acceleration Option if applicable:
echo 1. CUDA (Nvidia)
echo 2. CoreML (Apple Silicon)
echo 3. CoreML (Apple Legacy)
echo 4. DirectML (Windows)
echo 5. OpenVINO (Intel)
echo 6. None
set /p choice="Enter your choice (1-6): "
if "%choice%"=="1" (
echo Installing CUDA dependencies...
pip uninstall -y onnxruntime onnxruntime-gpu
pip install onnxruntime-gpu==1.16.3
set exec_provider="cuda"
) else if "%choice%"=="2" (
echo Installing CoreML (Apple Silicon) dependencies...
pip uninstall -y onnxruntime onnxruntime-silicon
pip install onnxruntime-silicon==1.13.1
set exec_provider="coreml"
) else if "%choice%"=="3" (
echo Installing CoreML (Apple Legacy) dependencies...
pip uninstall -y onnxruntime onnxruntime-coreml
pip install onnxruntime-coreml==1.13.1
set exec_provider="coreml"
) else if "%choice%"=="4" (
echo Installing DirectML dependencies...
pip uninstall -y onnxruntime onnxruntime-directml
pip install onnxruntime-directml==1.15.1
set exec_provider="directml"
) else if "%choice%"=="5" (
echo Installing OpenVINO dependencies...
pip uninstall -y onnxruntime onnxruntime-openvino
pip install onnxruntime-openvino==1.15.0
set exec_provider="openvino"
) else (
echo Skipping GPU acceleration setup.
)
:: Run the application
if defined exec_provider (
echo Running the application with %exec_provider% execution provider...
python run.py --execution-provider %exec_provider%
) else (
echo Running the application...
python run.py
)
pause