Compare commits

..

1 Commits

Author SHA1 Message Date
rehanbgmi 52a2ef3a95
Merge 0fc481db47 into 12fda0a3ed 2025-06-18 15:38:47 +02:00
4 changed files with 388 additions and 609 deletions

View File

@ -176,12 +176,9 @@ def update_status(message: str, scope: str = 'DLC.CORE') -> None:
ui.update_status(message)
def start() -> None:
# Note: pre_start is called in run() before start() now.
# If it were to be called here, it would also need the status_fn_callback.
# For example:
# for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
# if not frame_processor.pre_start(status_fn_callback=update_status): # If pre_start was here
# return
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
if not frame_processor.pre_start():
return
update_status('Processing...')
# process image to image
if has_image_extension(modules.globals.target_path):
@ -193,7 +190,7 @@ def start() -> None:
print("Error copying file:", str(e))
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
update_status('Progressing...', frame_processor.NAME)
frame_processor.process_image(modules.globals.source_path, modules.globals.output_path, modules.globals.output_path, status_fn_callback=update_status)
frame_processor.process_image(modules.globals.source_path, modules.globals.output_path, modules.globals.output_path)
release_resources()
if is_image(modules.globals.target_path):
update_status('Processing to image succeed!')
@ -213,7 +210,7 @@ def start() -> None:
temp_frame_paths = get_temp_frame_paths(modules.globals.target_path)
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
update_status('Progressing...', frame_processor.NAME)
frame_processor.process_video(modules.globals.source_path, temp_frame_paths, status_fn_callback=update_status)
frame_processor.process_video(modules.globals.source_path, temp_frame_paths)
release_resources()
# handles fps
if modules.globals.keep_fps:
@ -252,9 +249,7 @@ def run() -> None:
if not pre_check():
return
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
if not frame_processor.pre_check(): # pre_check in face_swapper does not use update_status
return
if hasattr(frame_processor, 'pre_start') and not frame_processor.pre_start(status_fn_callback=update_status): # Pass callback here
if not frame_processor.pre_check():
return
limit_resources()
if modules.globals.headless:

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,6 @@ from modules.face_analyser import (
)
from modules.capturer import get_video_frame, get_video_frame_total
from modules.processors.frame.core import get_frame_processors_modules
from modules.processors.frame.face_swapper import reset_tracker_state # Added import
from modules.utilities import (
is_image,
is_video,
@ -241,7 +240,6 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
command=lambda: (
setattr(modules.globals, "many_faces", many_faces_value.get()),
save_switch_states(),
reset_tracker_state() # Added reset call
),
)
many_faces_switch.place(relx=0.6, rely=0.65)
@ -268,8 +266,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
command=lambda: (
setattr(modules.globals, "map_faces", map_faces.get()),
save_switch_states(),
close_mapper_window() if not map_faces.get() else None,
reset_tracker_state() # Added reset call
close_mapper_window() if not map_faces.get() else None
),
)
map_faces_switch.place(relx=0.1, rely=0.75)
@ -607,11 +604,9 @@ def select_source_path() -> None:
RECENT_DIRECTORY_SOURCE = os.path.dirname(modules.globals.source_path)
image = render_image_preview(modules.globals.source_path, (200, 200))
source_label.configure(image=image)
reset_tracker_state() # Added reset call
else:
modules.globals.source_path = None
source_label.configure(image=None)
reset_tracker_state() # Added reset call even if source is cleared
def swap_faces_paths() -> None:
@ -984,8 +979,6 @@ def create_webcam_preview(camera_index: int):
frame_count = 0
fps = 0
reset_tracker_state() # Ensure tracker is reset before starting webcam loop
while True:
ret, frame = cap.read()
if not ret:

View File

@ -2,7 +2,7 @@
numpy>=1.23.5,<2
typing-extensions>=4.8.0
opencv-contrib-python==4.10.0.84
opencv-python==4.10.0.84
cv2_enumerate_cameras==1.1.15
onnx==1.16.0
insightface==0.7.3