mirror of
https://github.com/hacksider/Deep-Live-Cam.git
synced 2026-06-01 18:21:38 +02:00
Fix: resolve 5 confirmed bugs (imwrite_unicode, macOS memory, face_analyser None crash, silent sys.exit, core memory calc)
This commit is contained in:
+5
-5
@@ -11,8 +11,8 @@ def imwrite_unicode(path, img, params=None):
|
||||
root, ext = os.path.splitext(path)
|
||||
if not ext:
|
||||
ext = ".png"
|
||||
result, encoded_img = cv2.imencode(ext, img, params if params else [])
|
||||
result, encoded_img = cv2.imencode(f".{ext}", img, params if params is not None else [])
|
||||
encoded_img.tofile(path)
|
||||
return True
|
||||
return False
|
||||
result, encoded_img = cv2.imencode(ext, img, params if params is not None else [])
|
||||
if not result:
|
||||
return False
|
||||
encoded_img.tofile(path)
|
||||
return True
|
||||
@@ -171,8 +171,6 @@ def limit_resources() -> None:
|
||||
# limit memory usage
|
||||
if modules.globals.max_memory:
|
||||
memory = modules.globals.max_memory * 1024 ** 3
|
||||
if platform.system().lower() == 'darwin':
|
||||
memory = modules.globals.max_memory * 1024 ** 6
|
||||
if platform.system().lower() == 'windows':
|
||||
import ctypes
|
||||
kernel32 = ctypes.windll.kernel32
|
||||
|
||||
@@ -257,6 +257,8 @@ def get_unique_faces_from_target_image() -> Any:
|
||||
modules.globals.source_target_map = []
|
||||
target_frame = cv2.imread(modules.globals.target_path)
|
||||
many_faces = get_many_faces(target_frame)
|
||||
if many_faces is None:
|
||||
return None
|
||||
i = 0
|
||||
|
||||
for face in many_faces:
|
||||
@@ -291,6 +293,8 @@ def get_unique_faces_from_target_video() -> Any:
|
||||
for temp_frame_path in tqdm(temp_frame_paths, desc="Extracting face embeddings from frames"):
|
||||
temp_frame = cv2.imread(temp_frame_path)
|
||||
many_faces = get_many_faces(temp_frame)
|
||||
if many_faces is None:
|
||||
continue
|
||||
|
||||
for face in many_faces:
|
||||
face_embeddings.append(face.normed_embedding)
|
||||
|
||||
@@ -37,6 +37,7 @@ def load_frame_processor_module(frame_processor: str) -> Any:
|
||||
frame_processor_module = importlib.import_module(f'modules.processors.frame.{frame_processor}')
|
||||
for method_name in FRAME_PROCESSORS_INTERFACE:
|
||||
if not hasattr(frame_processor_module, method_name):
|
||||
print(f"Frame processor {frame_processor} is missing required method {method_name}")
|
||||
sys.exit()
|
||||
except ImportError:
|
||||
print(f"Frame processor {frame_processor} not found")
|
||||
|
||||
Reference in New Issue
Block a user