mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-30 22:07:23 +02:00
switch workflow strategy to disk|memory
This commit is contained in:
@@ -25,7 +25,7 @@ def create_workflow_program() -> ArgumentParser:
|
||||
program = ArgumentParser(add_help = False)
|
||||
group_workflow = program.add_argument_group('workflow')
|
||||
group_workflow.add_argument('--workflow-mode', help = translator.get('help.workflow_mode'), default = config.get_str_value('workflow', 'workflow_mode', 'auto'), choices = facefusion.choices.workflow_modes)
|
||||
group_workflow.add_argument('--workflow-strategy', help = translator.get('help.workflow_strategy'), default = config.get_str_value('workflow', 'workflow_strategy', 'stream'), choices = facefusion.choices.workflow_strategies)
|
||||
group_workflow.add_argument('--workflow-strategy', help = translator.get('help.workflow_strategy'), default = config.get_str_value('workflow', 'workflow_strategy', 'memory'), choices = facefusion.choices.workflow_strategies)
|
||||
job_store.register_step_keys([ 'workflow_mode', 'workflow_strategy' ])
|
||||
return program
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ Locales : TypeAlias = Dict[Language, Dict[str, Any]]
|
||||
LocalePoolSet : TypeAlias = Dict[str, Locales]
|
||||
|
||||
WorkflowMode = Literal['auto', 'image-to-image', 'image-to-video']
|
||||
WorkflowStrategy = Literal['disk', 'stream']
|
||||
WorkflowStrategy = Literal['disk', 'memory']
|
||||
|
||||
CameraCaptureSet : TypeAlias = Dict[str, cv2.VideoCapture]
|
||||
CameraPoolSet = TypedDict('CameraPoolSet',
|
||||
|
||||
@@ -3,7 +3,7 @@ from functools import partial
|
||||
from facefusion import process_manager, state_manager
|
||||
from facefusion.types import ErrorCode
|
||||
from facefusion.workflows.core import clear, setup
|
||||
from facefusion.workflows.to_video import analyse_video, extract_frames, finalize_video, merge_frames, process_disk_frames, process_stream_frames, restore_audio
|
||||
from facefusion.workflows.to_video import analyse_video, extract_frames, finalize_video, merge_frames, process_disk_frames, process_memory_frames, restore_audio
|
||||
|
||||
|
||||
def process(start_time : float) -> ErrorCode:
|
||||
@@ -22,8 +22,8 @@ def process(start_time : float) -> ErrorCode:
|
||||
merge_frames
|
||||
])
|
||||
|
||||
if state_manager.get_item('workflow_strategy') == 'stream':
|
||||
tasks.append(process_stream_frames)
|
||||
if state_manager.get_item('workflow_strategy') == 'memory':
|
||||
tasks.append(process_memory_frames)
|
||||
|
||||
tasks.extend(
|
||||
[
|
||||
|
||||
@@ -83,7 +83,7 @@ def process_disk_frames() -> ErrorCode:
|
||||
return 0
|
||||
|
||||
|
||||
def process_stream_frame(frame_number : int, temp_video_resolution : Resolution) -> VisionFrame:
|
||||
def process_memory_frame(frame_number : int, temp_video_resolution : Resolution) -> VisionFrame:
|
||||
target_vision_frames = select_video_frames(state_manager.get_item('target_path'), frame_number, state_manager.get_item('target_frame_amount'))
|
||||
target_vision_frame = get_middle(target_vision_frames)
|
||||
temp_vision_frame = target_vision_frame.copy()
|
||||
@@ -102,7 +102,7 @@ def process_stream_frame(frame_number : int, temp_video_resolution : Resolution)
|
||||
return numpy.ascontiguousarray(temp_vision_frame)
|
||||
|
||||
|
||||
def process_stream_frames() -> ErrorCode:
|
||||
def process_memory_frames() -> ErrorCode:
|
||||
trim_frame_start, trim_frame_end = restrict_trim_frame(state_manager.get_item('target_path'), state_manager.get_item('trim_frame_start'), state_manager.get_item('trim_frame_end'))
|
||||
output_video_resolution = scale_resolution(detect_video_resolution(state_manager.get_item('target_path')), state_manager.get_item('output_video_scale'))
|
||||
temp_video_resolution = restrict_video_resolution(state_manager.get_item('target_path'), output_video_resolution)
|
||||
@@ -121,7 +121,7 @@ def process_stream_frames() -> ErrorCode:
|
||||
futures = []
|
||||
|
||||
for frame_number in temp_frame_range:
|
||||
future = executor.submit(process_stream_frame, frame_number, temp_video_resolution)
|
||||
future = executor.submit(process_memory_frame, frame_number, temp_video_resolution)
|
||||
futures.append(future)
|
||||
|
||||
for future in futures:
|
||||
|
||||
Reference in New Issue
Block a user