Compare commits
4 Commits
a01314b52c
...
44ef1fdcac
Author | SHA1 | Date |
---|---|---|
|
44ef1fdcac | |
|
8a03fccb59 | |
|
d7139d5c6e | |
|
4e36622a47 |
|
@ -176,9 +176,12 @@ def update_status(message: str, scope: str = 'DLC.CORE') -> None:
|
||||||
ui.update_status(message)
|
ui.update_status(message)
|
||||||
|
|
||||||
def start() -> None:
|
def start() -> None:
|
||||||
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
# Note: pre_start is called in run() before start() now.
|
||||||
if not frame_processor.pre_start():
|
# If it were to be called here, it would also need the status_fn_callback.
|
||||||
return
|
# 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
|
||||||
update_status('Processing...')
|
update_status('Processing...')
|
||||||
# process image to image
|
# process image to image
|
||||||
if has_image_extension(modules.globals.target_path):
|
if has_image_extension(modules.globals.target_path):
|
||||||
|
@ -190,7 +193,7 @@ def start() -> None:
|
||||||
print("Error copying file:", str(e))
|
print("Error copying file:", str(e))
|
||||||
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
||||||
update_status('Progressing...', frame_processor.NAME)
|
update_status('Progressing...', frame_processor.NAME)
|
||||||
frame_processor.process_image(modules.globals.source_path, modules.globals.output_path, modules.globals.output_path)
|
frame_processor.process_image(modules.globals.source_path, modules.globals.output_path, modules.globals.output_path, status_fn_callback=update_status)
|
||||||
release_resources()
|
release_resources()
|
||||||
if is_image(modules.globals.target_path):
|
if is_image(modules.globals.target_path):
|
||||||
update_status('Processing to image succeed!')
|
update_status('Processing to image succeed!')
|
||||||
|
@ -210,7 +213,7 @@ def start() -> None:
|
||||||
temp_frame_paths = get_temp_frame_paths(modules.globals.target_path)
|
temp_frame_paths = get_temp_frame_paths(modules.globals.target_path)
|
||||||
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
||||||
update_status('Progressing...', frame_processor.NAME)
|
update_status('Progressing...', frame_processor.NAME)
|
||||||
frame_processor.process_video(modules.globals.source_path, temp_frame_paths)
|
frame_processor.process_video(modules.globals.source_path, temp_frame_paths, status_fn_callback=update_status)
|
||||||
release_resources()
|
release_resources()
|
||||||
# handles fps
|
# handles fps
|
||||||
if modules.globals.keep_fps:
|
if modules.globals.keep_fps:
|
||||||
|
@ -249,7 +252,9 @@ def run() -> None:
|
||||||
if not pre_check():
|
if not pre_check():
|
||||||
return
|
return
|
||||||
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
|
||||||
if not frame_processor.pre_check():
|
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
|
||||||
return
|
return
|
||||||
limit_resources()
|
limit_resources()
|
||||||
if modules.globals.headless:
|
if modules.globals.headless:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,7 @@ from modules.face_analyser import (
|
||||||
)
|
)
|
||||||
from modules.capturer import get_video_frame, get_video_frame_total
|
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.core import get_frame_processors_modules
|
||||||
|
from modules.processors.frame.face_swapper import reset_tracker_state # Added import
|
||||||
from modules.utilities import (
|
from modules.utilities import (
|
||||||
is_image,
|
is_image,
|
||||||
is_video,
|
is_video,
|
||||||
|
@ -240,6 +241,7 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
command=lambda: (
|
command=lambda: (
|
||||||
setattr(modules.globals, "many_faces", many_faces_value.get()),
|
setattr(modules.globals, "many_faces", many_faces_value.get()),
|
||||||
save_switch_states(),
|
save_switch_states(),
|
||||||
|
reset_tracker_state() # Added reset call
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
many_faces_switch.place(relx=0.6, rely=0.65)
|
many_faces_switch.place(relx=0.6, rely=0.65)
|
||||||
|
@ -266,7 +268,8 @@ def create_root(start: Callable[[], None], destroy: Callable[[], None]) -> ctk.C
|
||||||
command=lambda: (
|
command=lambda: (
|
||||||
setattr(modules.globals, "map_faces", map_faces.get()),
|
setattr(modules.globals, "map_faces", map_faces.get()),
|
||||||
save_switch_states(),
|
save_switch_states(),
|
||||||
close_mapper_window() if not map_faces.get() else None
|
close_mapper_window() if not map_faces.get() else None,
|
||||||
|
reset_tracker_state() # Added reset call
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
map_faces_switch.place(relx=0.1, rely=0.75)
|
map_faces_switch.place(relx=0.1, rely=0.75)
|
||||||
|
@ -604,9 +607,11 @@ def select_source_path() -> None:
|
||||||
RECENT_DIRECTORY_SOURCE = os.path.dirname(modules.globals.source_path)
|
RECENT_DIRECTORY_SOURCE = os.path.dirname(modules.globals.source_path)
|
||||||
image = render_image_preview(modules.globals.source_path, (200, 200))
|
image = render_image_preview(modules.globals.source_path, (200, 200))
|
||||||
source_label.configure(image=image)
|
source_label.configure(image=image)
|
||||||
|
reset_tracker_state() # Added reset call
|
||||||
else:
|
else:
|
||||||
modules.globals.source_path = None
|
modules.globals.source_path = None
|
||||||
source_label.configure(image=None)
|
source_label.configure(image=None)
|
||||||
|
reset_tracker_state() # Added reset call even if source is cleared
|
||||||
|
|
||||||
|
|
||||||
def swap_faces_paths() -> None:
|
def swap_faces_paths() -> None:
|
||||||
|
@ -979,6 +984,8 @@ def create_webcam_preview(camera_index: int):
|
||||||
frame_count = 0
|
frame_count = 0
|
||||||
fps = 0
|
fps = 0
|
||||||
|
|
||||||
|
reset_tracker_state() # Ensure tracker is reset before starting webcam loop
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
ret, frame = cap.read()
|
ret, frame = cap.read()
|
||||||
if not ret:
|
if not ret:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
numpy>=1.23.5,<2
|
numpy>=1.23.5,<2
|
||||||
typing-extensions>=4.8.0
|
typing-extensions>=4.8.0
|
||||||
opencv-python==4.10.0.84
|
opencv-contrib-python==4.10.0.84
|
||||||
cv2_enumerate_cameras==1.1.15
|
cv2_enumerate_cameras==1.1.15
|
||||||
onnx==1.16.0
|
onnx==1.16.0
|
||||||
insightface==0.7.3
|
insightface==0.7.3
|
||||||
|
|
Loading…
Reference in New Issue