Update model to inswapper_128_fp16

Faster as claimed. Also adjusted the size of the preview to a smaller size. You should see a significant improvement on this
pull/6/head
Kenneth Estanislao 2023-10-03 23:38:17 +08:00
parent 04adada813
commit 16712476a9
4 changed files with 8 additions and 7 deletions

1
.gitignore vendored
View File

@ -18,3 +18,4 @@ workflow/
gfpgan/ gfpgan/
models/inswapper_128.onnx models/inswapper_128.onnx
models/GFPGANv1.4.pth models/GFPGANv1.4.pth
*.onnx

View File

@ -1,3 +1,3 @@
name = 'Deep Live Cam' name = 'Deep Live Cam'
version = '1.0.1' version = '1.3.0'
edition = 'Portable' edition = 'Portable'

View File

@ -17,7 +17,7 @@ NAME = 'DLC.FACE-SWAPPER'
def pre_check() -> bool: def pre_check() -> bool:
download_directory_path = resolve_relative_path('../models') download_directory_path = resolve_relative_path('../models')
conditional_download(download_directory_path, ['https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx']) conditional_download(download_directory_path, ['https://huggingface.co/hacksider/deep-live-cam/blob/main/inswapper_128_fp16.onnx'])
return True return True
@ -39,7 +39,7 @@ def get_face_swapper() -> Any:
with THREAD_LOCK: with THREAD_LOCK:
if FACE_SWAPPER is None: if FACE_SWAPPER is None:
model_path = resolve_relative_path('../models/inswapper_128.onnx') model_path = resolve_relative_path('../models/inswapper_128_fp16.onnx')
FACE_SWAPPER = insightface.model_zoo.get_model(model_path, providers=modules.globals.execution_providers) FACE_SWAPPER = insightface.model_zoo.get_model(model_path, providers=modules.globals.execution_providers)
return FACE_SWAPPER return FACE_SWAPPER

View File

@ -257,11 +257,11 @@ def webcam_preview():
global preview_label, PREVIEW global preview_label, PREVIEW
cap = cv2.VideoCapture(0) # Use index for the webcam (adjust the index accordingly if necessary) cap = cv2.VideoCapture(0) # Use index for the webcam (adjust the index accordingly if necessary)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) # Set the width of the resolution cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) # Set the width of the resolution
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) # Set the height of the resolution cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) # Set the height of the resolution
cap.set(cv2.CAP_PROP_FPS, 60) # Set the frame rate of the webcam cap.set(cv2.CAP_PROP_FPS, 60) # Set the frame rate of the webcam
PREVIEW_MAX_HEIGHT = 720 PREVIEW_MAX_WIDTH = 640
PREVIEW_MAX_WIDTH = 1280 PREVIEW_MAX_HEIGHT = 480
preview_label.configure(image=None) # Reset the preview image before startup preview_label.configure(image=None) # Reset the preview image before startup