Compare commits

...
Author SHA1 Message Date
Kenneth Estanislao 230217ec11 update on requirements
some update on what is needed to be updated
2026-07-29 05:20:29 +08:00
Kenneth Estanislao 156321f7a3 Upgrade onnxruntime-gpu to version 1.26.0
Updated onnxruntime-gpu version to 1.26.0 for non-Darwin platforms.
2026-07-29 04:37:54 +08:00
Nguyen Van Nam 8234965ee8 fix: clamp video frame seek index (#1790)
Prevent get_video_frame() from seeking to invalid frame positions.

The default frame_number=0 now resolves to the first frame instead of -1, and oversized frame requests clamp to the final valid frame instead of seeking past the end. Empty or invalid videos now return None safely after releasing the capture.

Affected files: capturer.py

Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
2026-07-23 22:16:38 +08:00
Dopan ab64c186ec Merge pull request #1879 from dunegym/fix/openvino-dll-loading
fix: resolve OpenVINO DLL loading on Windows for OpenVINOExecutionProvider
2026-07-19 15:12:49 +08:00
Makaru b8e781e539 chore: remove trailing whitespace 2026-07-19 12:20:54 +08:00
KRSHH ff7ee0d219 Revise Quickstart section in README 2026-07-19 00:25:10 +05:30
Nguyen Van Nam 8d727eba3e fix: bound face-cluster count by available embeddings (#1793)
`find_cluster_centroids()` iterates `k` from 1..`max_k` unconditionally. If `len(embeddings) < max_k`, `KMeans(n_clusters=k)` will raise `ValueError` when `k` exceeds the number of samples. This is an unhandled crash path on small datasets.


Affected files: cluster_analysis.py

Signed-off-by: Nguyen Van Nam <nam.nv205106@gmail.com>
2026-07-14 23:55:23 +08:00
Cocoon-Break eba2a958d3 fix: skip empty face clusters in default_target_face (#1757)
Skip face clusters when no best face was detected, preventing a NoneType error while preserving normal face-detection behavior.

Closes #1755
2026-07-14 23:51:43 +08:00
dunegym 14ba4f9c0b fix: centralize OPENVINO_PROVIDER_CONFIG and log SystemExit
Address Sourcery review feedback on PR #1879:

- Move OPENVINO_PROVIDER_CONFIG from _onnx_enhancer.py to
  platform_info.py (a leaf module with no modules.* imports), so
  the enhancer and face_swapper no longer import each other just to
  share a constant. _onnx_enhancer re-exports it; face_swapper now
  imports it at module top level instead of inside get_face_swapper().
- Narrow run.py's SystemExit handling: catch SystemExit separately
  and print a [startup] message so the failure is visible instead
  of being swallowed alongside ImportError/FileNotFoundError.
2026-07-12 15:16:18 +08:00
dunegym 7d2d7fb1f3 fix: address PR review feedback — SystemExit, AUTO device, thread timing
- Catch SystemExit from add_openvino_libs_to_path() so a missing
  OpenVINO installation never causes a hard exit on Windows
- Replace hard-coded GPU+FP16 with AUTO:GPU,NPU,CPU device priority,
  letting OpenVINO pick the best available accelerator
- Extract shared OPENVINO_PROVIDER_CONFIG constant to avoid
  duplication between _onnx_enhancer and face_swapper
- Defer thread-suggestion evaluation until after execution_providers
  is assigned, fixing a latent timing bug that affected OpenVINO,
  CUDA, and DML thread hints
2026-07-11 12:45:00 +08:00
noahximus 57c4c32377 Merge pull request #1876 from ElKhalil19/main 2026-07-07 04:55:43 +08:00
El Khalil d00b09f5d8 docs: update manual installation to use shallow clone (#1866) 2026-07-03 19:54:39 +01:00
dunegym 897dc21da4 fix: resolve OpenVINO DLL loading on Windows for OpenVINOExecutionProvider
- Add add_openvino_libs_to_path() call in run.py before any ONNX
  InferenceSession creation to register openvino.dll directory
- Detect and advertise OpenVINOExecutionProvider in platform_info
  banner and accelerator label
- Prioritize openvino over dml in suggest_default_execution_provider
- Configure OpenVINO EP with GPU + FP16 device options for optimal
  performance (~13 FPS on Intel GPU vs ~1 FPS CPU fallback)
- Set thread hint to 1 when OpenVINO EP is active
2026-06-28 21:46:55 +08:00
Kenneth Estanislao 834092c891 Update Quick Start section to v2.7 RC6 2026-06-24 18:15:40 +08:00
Kenneth Estanislao da0672ad6b Enhance README with details on pre-built versions
Updated the README to clarify the benefits of pre-built versions and optimizations for hardware.
2026-06-24 18:14:59 +08:00
11 changed files with 157 additions and 44 deletions
+54 -25
View File
@@ -30,13 +30,39 @@ By using this software, you agree to these terms and commit to using it in a man
Users are expected to use this software responsibly and legally. If using a real person's face, obtain their consent and clearly label any output as a deepfake when sharing online. We are not responsible for end-user actions.
## Exclusive v2.7 RC2 Quick Start - Pre-built (Windows/Mac Silicon/CPU)
## Pre-built Quickstart
<a href="https://deeplivecam.net/index.php/quickstart"> <img src="media/Download.png" width="285" height="77" />
<p align="center">
<a href="https://deeplivecam.net/index.php/quickstart">
<img src="https://github.com/user-attachments/assets/fa2cdf79-c933-4b93-844a-b087192261ed" width="100%" alt="Lite / Ultimate Download Banner">
</a>
</p>
##### This is the fastest build you can get if you have a discrete NVIDIA or AMD GPU, CPU or Mac Silicon, And you'll receive special priority support. 2.7 beta is the best you can have with 30+ extra features than the open source version.
###### These Pre-builts are perfect for non-technical users or those who don't have time to, or can't manually install all the requirements. Just a heads-up: this is an open-source project, so you can also install it manually.
<p align="center">
<img src="https://github.com/user-attachments/assets/56b61811-3a1e-4672-9b50-cf7f6e8e6852" width="40" alt="Windows">
&nbsp;&nbsp;&nbsp;
<img src="https://github.com/user-attachments/assets/6538e3a6-c957-431a-b586-2d6abcf534dc" width="34" alt="Mac Silicon">
&nbsp;&nbsp;&nbsp;
<img src="https://github.com/user-attachments/assets/ad45142e-426c-4364-a2a9-a512670cc62c" width="40" alt="CPU">
</p>
<p align="center">
<strong>Windows • Mac Silicon • CPU • NVIDIA • AMD</strong>
</p>
<p align="center">
Builds optimized for your hardware.
</p>
<p align="center">
<a href="https://deeplivecam.net/index.php/quickstart">
<img src="media/Download.png" width="280" alt="Download">
</a>
</p>
> **Ultimate** includes **30+ exclusive features**, performance optimizations, and **priority support**.
Perfect if you want the fastest setup with **zero manual installation**, pre-configured dependencies, and optimized builds for every supported platform.
## TLDR; Live Deepfake in just 3 Clicks
![easysteps](https://github.com/user-attachments/assets/af825228-852c-411b-b787-ffd9aac72fc6)
@@ -109,7 +135,7 @@ This is more likely to work on your computer but will be slower as it utilizes t
**1. Set up Your Platform**
- Python (3.11 recommended)
- Python (3.14 recommended; 3.11-3.14 supported)
- pip
- git
- [ffmpeg](https://www.youtube.com/watch?v=OlNWCpFdVMA) - ```iex (irm ffmpeg.tc.ht)```
@@ -118,7 +144,7 @@ This is more likely to work on your computer but will be slower as it utilizes t
**2. Clone the Repository**
```bash
git clone https://github.com/hacksider/Deep-Live-Cam.git
git clone --depth 1 https://github.com/hacksider/Deep-Live-Cam.git
cd Deep-Live-Cam
```
@@ -142,7 +168,7 @@ pip install -r requirements.txt
```
For Linux:
```bash
# Ensure you use the installed Python 3.11
# Ensure you use the installed Python 3.14
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
@@ -150,17 +176,17 @@ pip install -r requirements.txt
**For macOS:**
Apple Silicon (M1/M2/M3) requires specific setup:
Apple Silicon (M1 through M5) requires specific setup:
```bash
# Install Python 3.11 (specific version is important)
brew install python@3.11
# Install Python 3.14
brew install python@3.14
# Install tkinter package (required for the GUI)
brew install python-tk@3.11
brew install python-tk@3.14
# Create and activate virtual environment with Python 3.11
python3.11 -m venv venv
# Create and activate virtual environment with Python 3.14
python3.14 -m venv venv
source venv/bin/activate
# Install dependencies
@@ -212,26 +238,29 @@ python run.py --execution-provider cuda
**CoreML Execution Provider (Apple Silicon)**
Apple Silicon (M1/M2/M3) specific installation:
Apple Silicon (M1 through M5) specific installation:
1. Make sure you've completed the macOS setup above using Python 3.11.
2. Install dependencies:
1. Make sure you've completed the macOS setup above using Python 3.14.
2. No extra install step is needed — `requirements.txt` pulls the official
`onnxruntime` build, whose macOS wheels ship the CoreML execution provider.
If you previously installed the unmaintained `onnxruntime-silicon` fork,
remove it first, as it shadows the real package:
```bash
pip uninstall onnxruntime onnxruntime-silicon
pip install onnxruntime-silicon==1.13.1
pip uninstall onnxruntime-silicon
pip install -r requirements.txt
```
3. Usage:
```bash
python3.11 run.py --execution-provider coreml
python3.14 run.py --execution-provider coreml
```
**Important Notes for macOS:**
- You **must** use Python 3.11, not newer versions like 3.13
- Always run with `python3.11` command not just `python` if you have multiple Python versions installed
- If you get error about `_tkinter` missing, reinstall the tkinter package: `brew reinstall python-tk@3.11`
- Python 3.11 is the minimum (onnxruntime dropped 3.10); 3.14 is recommended
- Always run with `python3.14` command not just `python` if you have multiple Python versions installed
- If you get error about `_tkinter` missing, reinstall the tkinter package: `brew reinstall python-tk@3.14`
- If you get model loading errors, check that your models are in the correct folder
- If you encounter conflicts with other Python versions, consider uninstalling them:
```bash
@@ -239,9 +268,9 @@ python3.11 run.py --execution-provider coreml
brew list | grep python
# Uninstall conflicting versions if needed
brew uninstall --ignore-dependencies python@3.13
brew uninstall --ignore-dependencies python@3.11
# Keep only Python 3.11
# Keep only Python 3.14
brew cleanup
```
+7 -2
View File
@@ -14,8 +14,13 @@ def get_video_frame(video_path: str, frame_number: int = 0) -> Any:
if modules.globals.color_correction:
capture.set(cv2.CAP_PROP_CONVERT_RGB, 1)
frame_total = capture.get(cv2.CAP_PROP_FRAME_COUNT)
capture.set(cv2.CAP_PROP_POS_FRAMES, min(frame_total, frame_number - 1))
frame_total = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
if frame_total <= 0:
capture.release()
return None
target_index = 0 if frame_number <= 1 else min(frame_total - 1, frame_number - 1)
capture.set(cv2.CAP_PROP_POS_FRAMES, target_index)
has_frame, frame = capture.read()
if has_frame and modules.globals.color_correction:
+12
View File
@@ -4,6 +4,18 @@ from typing import Any
def find_cluster_centroids(embeddings, max_k=10) -> Any:
n_samples = len(embeddings)
if n_samples == 0:
raise ValueError("embeddings must not be empty")
if max_k < 1:
raise ValueError("max_k must be at least 1")
max_k = min(max_k, n_samples)
if max_k == 1:
kmeans = KMeans(n_clusters=1, random_state=0)
kmeans.fit(embeddings)
return kmeans.cluster_centers_
inertia = []
cluster_centroids = []
K = range(1, max_k+1)
+11 -3
View File
@@ -58,7 +58,7 @@ def parse_args() -> None:
program.add_argument('--live-resizable', help='The live camera frame is resizable', dest='live_resizable', action='store_true', default=False)
program.add_argument('--max-memory', help='maximum amount of RAM in GB', dest='max_memory', type=int, default=suggest_max_memory())
program.add_argument('--execution-provider', help='execution provider', dest='execution_provider', default=[suggest_default_execution_provider()], choices=suggest_execution_providers(), nargs='+')
program.add_argument('--execution-threads', help='number of execution threads', dest='execution_threads', type=int, default=suggest_execution_threads())
program.add_argument('--execution-threads', help='number of execution threads', dest='execution_threads', type=int, default=None)
program.add_argument('-v', '--version', action='version', version=f'{modules.metadata.name} {modules.metadata.version}')
# register deprecated args
@@ -90,6 +90,12 @@ def parse_args() -> None:
modules.globals.execution_threads = args.execution_threads
modules.globals.lang = args.lang
# The argparse default (None) avoids evaluating suggest_execution_threads()
# before providers are decoded, and deprecated-arg overrides above may
# have already set execution_threads.
if modules.globals.execution_threads is None:
modules.globals.execution_threads = suggest_execution_threads()
#for ENHANCER tumblers:
for enhancer_key in ('face_enhancer', 'face_enhancer_gpen256', 'face_enhancer_gpen512'):
modules.globals.fp_ui[enhancer_key] = enhancer_key in args.frame_processor
@@ -132,9 +138,9 @@ def suggest_max_memory() -> int:
def suggest_default_execution_provider() -> str:
"""Pick the best available provider: cuda > rocm > coreml > dml > cpu."""
"""Pick the best available provider: cuda > rocm > coreml > openvino > dml > cpu."""
available = encode_execution_providers(onnxruntime.get_available_providers())
for pref in ('cuda', 'rocm', 'coreml', 'dml'):
for pref in ('cuda', 'rocm', 'coreml', 'openvino', 'dml'):
if pref in available:
return pref
return 'cpu'
@@ -157,6 +163,8 @@ def suggest_execution_threads() -> int:
return 1
if 'CUDAExecutionProvider' in modules.globals.execution_providers:
return 2
if 'OpenVINOExecutionProvider' in modules.globals.execution_providers:
return 1
# For CPU execution, use most cores but leave some for system
return max(4, min(cpu_count - 2, 16))
+3
View File
@@ -335,6 +335,9 @@ def default_target_face():
best_frame = frame
break
if best_face is None:
continue # No faces detected in this cluster — skip
for frame in map['target_faces_in_frame']:
for face in frame['faces']:
if face['det_score'] > best_face['det_score']:
+11
View File
@@ -40,6 +40,15 @@ ONNX_PROVIDERS: List[str] = _detect_onnx_providers()
HAS_CUDA_PROVIDER: bool = "CUDAExecutionProvider" in ONNX_PROVIDERS
HAS_COREML_PROVIDER: bool = "CoreMLExecutionProvider" in ONNX_PROVIDERS
HAS_DML_PROVIDER: bool = "DmlExecutionProvider" in ONNX_PROVIDERS
HAS_OPENVINO_PROVIDER: bool = "OpenVINOExecutionProvider" in ONNX_PROVIDERS
# OpenVINO execution-provider config shared by every ONNX session builder.
# AUTO:GPU,NPU,CPU lets OpenVINO pick the best available device in priority
# order (Intel GPU → NPU → CPU).
OPENVINO_PROVIDER_CONFIG = (
"OpenVINOExecutionProvider",
{"device_type": "AUTO:GPU,NPU,CPU"},
)
def camera_backends() -> List[Tuple[int, int]]:
@@ -65,6 +74,8 @@ def accelerator_label() -> str:
return "CoreML (Apple Neural Engine)"
if HAS_COREML_PROVIDER:
return "CoreML"
if HAS_OPENVINO_PROVIDER:
return "OpenVINO (Intel)"
if HAS_DML_PROVIDER:
return "DirectML"
return "CPU"
+13
View File
@@ -1,4 +1,17 @@
import importlib.util
import os
import numpy
# Keras 3 defaults to the TensorFlow backend, which has no Python 3.14 wheels.
# opennsfw2 only runs inference, so any installed backend works; pick one that
# is actually present before opennsfw2 imports keras.
if "KERAS_BACKEND" not in os.environ:
for _backend in ("torch", "tensorflow", "jax"):
if importlib.util.find_spec(_backend) is not None:
os.environ["KERAS_BACKEND"] = _backend
break
import opennsfw2
from PIL import Image
import cv2 # Add OpenCV import
@@ -14,6 +14,7 @@ import numpy as np
import onnxruntime
import modules.globals
from modules.platform_info import OPENVINO_PROVIDER_CONFIG
IS_APPLE_SILICON = platform.system() == "Darwin" and platform.machine() == "arm64"
@@ -50,6 +51,9 @@ def build_provider_config(providers=None):
"AllowLowPrecisionAccumulationOnGPU": 1,
},
))
elif p == "OpenVINOExecutionProvider":
# AUTO lets OpenVINO select the best device
config.append(OPENVINO_PROVIDER_CONFIG)
else:
config.append(p)
return config
+3
View File
@@ -18,6 +18,7 @@ from modules.utilities import (
)
from modules.cluster_analysis import find_closest_centroid
from modules.gpu_processing import gpu_gaussian_blur, gpu_sharpen, gpu_add_weighted, gpu_resize
from modules.platform_info import OPENVINO_PROVIDER_CONFIG
import os
from collections import deque
import time
@@ -270,6 +271,8 @@ def get_face_swapper() -> Any:
# Use bare provider — ONNX Runtime defaults are
# fastest on modern GPUs (Blackwell/sm_120).
providers_config.append(p)
elif p == "OpenVINOExecutionProvider":
providers_config.append(OPENVINO_PROVIDER_CONFIG)
else:
providers_config.append(p)
FACE_SWAPPER = insightface.model_zoo.get_model(
+15 -14
View File
@@ -1,17 +1,18 @@
numpy>=1.23.5,<2
typing-extensions>=4.8.0
opencv-python==4.10.0.84
cv2_enumerate_cameras==1.1.15
onnx==1.18.0
numpy>=2.0,<3
typing-extensions>=4.15.0
opencv-python==4.14.0.94
opencv-python-headless==4.14.0.94
cv2_enumerate_cameras==1.3.3
onnx==1.22.0
insightface==0.7.3
psutil==5.9.8
psutil==7.2.2
PySide6>=6.7,<7
pillow==12.1.1
tqdm>=4.65.0
onnxruntime-silicon==1.16.3; sys_platform == 'darwin' and platform_machine == 'arm64'
onnxruntime-gpu==1.23.2; sys_platform != 'darwin'
tensorflow>=2.15.0; sys_platform != 'darwin'
tensorflow>=2.15.0; sys_platform == 'darwin' and python_version < '3.13'
opennsfw2==0.10.2
protobuf==4.25.1
pillow==12.3.0
tqdm>=4.66.3
onnxruntime==1.28.0; sys_platform == 'darwin' and platform_machine == 'arm64'
onnxruntime==1.23.0; sys_platform == 'darwin' and platform_machine != 'arm64'
onnxruntime-gpu==1.26.0; sys_platform != 'darwin'
opennsfw2==0.18.0
keras>=3.0.0
protobuf>=6.33.5,<8
pygrabber; sys_platform == 'win32'
+24
View File
@@ -31,6 +31,30 @@ if sys.platform == "win32":
except (OSError, AttributeError):
pass
# On Windows, register OpenVINO DLL directories so onnxruntime's
# OpenVINOExecutionProvider can find openvino.dll. This must happen
# before any ONNX InferenceSession is created. Failure is non-fatal:
# OpenVINO simply isn't installed, and onnxruntime will fall back to CPU.
try:
from onnxruntime.tools.add_openvino_win_libs import ( # type: ignore[import-untyped] # noqa: E501
add_openvino_libs_to_path,
)
add_openvino_libs_to_path()
except ImportError:
# onnxruntime build without the OpenVINO tooling module — no-op.
pass
except FileNotFoundError:
# OpenVINO site-packages dir absent — no-op.
pass
except SystemExit as exc:
# add_openvino_libs_to_path() calls sys.exit() when OpenVINO libs
# can't be located (e.g. OPENVINO_LIB_PATHS unset). Log the message
# it raised with so the failure is visible, but keep startup alive.
print(
f"[startup] OpenVINO DLL registration skipped: {exc}",
flush=True,
)
# On Linux, pre-load NVIDIA shared libraries (cuDNN, cuBLAS, nvrtc...) shipped
# inside the venv via pip wheels (nvidia-cudnn-cu12, etc.). LD_LIBRARY_PATH
# cannot be set after Python starts, so we use ctypes.CDLL with RTLD_GLOBAL