mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2026-09-08 16:48:59 +02:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
230217ec11 | ||
|
|
156321f7a3 | ||
|
|
8234965ee8 | ||
|
|
ab64c186ec | ||
|
|
b8e781e539 | ||
|
|
ff7ee0d219 | ||
|
|
8d727eba3e | ||
|
|
eba2a958d3 | ||
|
|
14ba4f9c0b | ||
|
|
7d2d7fb1f3 | ||
|
|
57c4c32377 | ||
|
|
d00b09f5d8 | ||
|
|
897dc21da4 | ||
|
|
834092c891 | ||
|
|
da0672ad6b |
@@ -1,52 +0,0 @@
|
||||
name: Close stale issues
|
||||
|
||||
# Marks an issue as "stale" after 60 days with no activity, then closes it
|
||||
# 7 days later if there is still no activity. Any new comment removes the
|
||||
# stale label and resets the clock. Pull requests are not touched.
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 1 * * *" # daily at 01:30 UTC
|
||||
workflow_dispatch: {} # allow manual runs from the Actions tab
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
# --- timing (inactivity-based) ---
|
||||
days-before-stale: 60 # mark stale after 60 days with no activity
|
||||
days-before-close: 7 # close 7 days after being marked stale
|
||||
remove-stale-when-updated: true # a new comment resets the clock
|
||||
|
||||
# apply only to issues, never to pull requests ("tickets" = issues)
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
|
||||
# --- labels ---
|
||||
stale-issue-label: stale
|
||||
# never auto-close issues carrying any of these labels
|
||||
exempt-issue-labels: "pinned,security,keep-open,in-progress"
|
||||
|
||||
# close as "not planned" (gray) — accurate for inactivity, not a fix.
|
||||
# change to "completed" if you'd rather they show as resolved.
|
||||
close-issue-reason: not_planned
|
||||
|
||||
# --- messages (kept factual; no unverifiable claims) ---
|
||||
stale-issue-message: >
|
||||
This issue has had no activity for 60 days and has been marked as
|
||||
stale. If it's still relevant, please leave a comment — otherwise it
|
||||
will be closed automatically in 7 days. Thank you for contributing! 🙏
|
||||
close-issue-message: >
|
||||
This issue was closed automatically because it had no activity for 7
|
||||
days after being marked stale. If you're still hitting this on the
|
||||
current release, please reopen it or open a new issue with up-to-date
|
||||
details (OS, version, and logs). Thank you! 🙏
|
||||
|
||||
# process oldest issues first, and enough per run to clear a backlog
|
||||
ascending: true
|
||||
operations-per-run: 100
|
||||
@@ -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">
|
||||
|
||||
<img src="https://github.com/user-attachments/assets/6538e3a6-c957-431a-b586-2d6abcf534dc" width="34" alt="Mac Silicon">
|
||||
|
||||
<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
|
||||

|
||||
@@ -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
@@ -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:
|
||||
|
||||
@@ -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
@@ -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))
|
||||
|
||||
@@ -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']:
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user