mirror of
https://github.com/facefusion/facefusion.git
synced 2026-08-29 03:50:38 +02:00
Face selector auto mode (#1137)
* introduce face selector auto mode * introduce face selector auto mode * introduce face selector auto mode * correct way is to pass source_vision_frames
This commit is contained in:
@@ -276,10 +276,11 @@ def normalize_extend_frame(extend_vision_frame : VisionFrame) -> VisionFrame:
|
||||
|
||||
def process_frame(inputs : AgeModifierInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Literal, TypeAlias, TypedDict
|
||||
from typing import Any, List, Literal, TypeAlias, TypedDict
|
||||
|
||||
from numpy.typing import NDArray
|
||||
|
||||
@@ -7,6 +7,7 @@ from facefusion.types import Mask, VisionFrame
|
||||
AgeModifierInputs = TypedDict('AgeModifierInputs',
|
||||
{
|
||||
'reference_vision_frame' : VisionFrame,
|
||||
'source_vision_frames' : List[VisionFrame],
|
||||
'target_vision_frame' : VisionFrame,
|
||||
'temp_vision_frame' : VisionFrame,
|
||||
'temp_vision_mask' : Mask
|
||||
|
||||
@@ -411,10 +411,11 @@ def prepare_crop_mask(crop_source_mask : Mask, crop_target_mask : Mask) -> Mask:
|
||||
|
||||
def process_frame(inputs : DeepSwapperInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, TypeAlias, TypedDict
|
||||
from typing import Any, List, TypeAlias, TypedDict
|
||||
|
||||
from numpy.typing import NDArray
|
||||
|
||||
@@ -7,6 +7,7 @@ from facefusion.types import Mask, VisionFrame
|
||||
DeepSwapperInputs = TypedDict('DeepSwapperInputs',
|
||||
{
|
||||
'reference_vision_frame' : VisionFrame,
|
||||
'source_vision_frames' : List[VisionFrame],
|
||||
'target_vision_frame' : VisionFrame,
|
||||
'temp_vision_frame' : VisionFrame,
|
||||
'temp_vision_mask' : Mask
|
||||
|
||||
@@ -257,10 +257,11 @@ def normalize_crop_frame(crop_vision_frame : VisionFrame) -> VisionFrame:
|
||||
|
||||
def process_frame(inputs : ExpressionRestorerInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -232,10 +232,11 @@ def calculate_scale(temp_vision_frame : VisionFrame) -> int:
|
||||
|
||||
def process_frame(inputs : FaceDebuggerInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from typing import Literal, TypedDict
|
||||
from typing import List, Literal, TypedDict
|
||||
|
||||
from facefusion.types import Mask, VisionFrame
|
||||
|
||||
FaceDebuggerInputs = TypedDict('FaceDebuggerInputs',
|
||||
{
|
||||
'reference_vision_frame' : VisionFrame,
|
||||
'source_vision_frames' : List[VisionFrame],
|
||||
'target_vision_frame' : VisionFrame,
|
||||
'temp_vision_frame' : VisionFrame,
|
||||
'temp_vision_mask' : Mask
|
||||
|
||||
@@ -486,10 +486,11 @@ def normalize_crop_frame(crop_vision_frame : VisionFrame) -> VisionFrame:
|
||||
|
||||
def process_frame(inputs : FaceEditorInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from typing import Literal, TypedDict
|
||||
from typing import List, Literal, TypedDict
|
||||
|
||||
from facefusion.types import Mask, VisionFrame
|
||||
|
||||
FaceEditorInputs = TypedDict('FaceEditorInputs',
|
||||
{
|
||||
'reference_vision_frame' : VisionFrame,
|
||||
'source_vision_frames' : List[VisionFrame],
|
||||
'target_vision_frame' : VisionFrame,
|
||||
'temp_vision_frame' : VisionFrame,
|
||||
'temp_vision_mask' : Mask
|
||||
|
||||
@@ -413,10 +413,11 @@ def blend_paste_frame(temp_vision_frame : VisionFrame, paste_vision_frame : Visi
|
||||
|
||||
def process_frame(inputs : FaceEnhancerInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Literal, TypeAlias, TypedDict
|
||||
from typing import Any, List, Literal, TypeAlias, TypedDict
|
||||
|
||||
from numpy.typing import NDArray
|
||||
|
||||
@@ -7,6 +7,7 @@ from facefusion.types import Mask, VisionFrame
|
||||
FaceEnhancerInputs = TypedDict('FaceEnhancerInputs',
|
||||
{
|
||||
'reference_vision_frame' : VisionFrame,
|
||||
'source_vision_frames' : List[VisionFrame],
|
||||
'target_vision_frame' : VisionFrame,
|
||||
'temp_vision_frame' : VisionFrame,
|
||||
'temp_vision_mask' : Mask
|
||||
|
||||
@@ -775,7 +775,7 @@ def process_frame(inputs : FaceSwapperInputs) -> ProcessorOutputs:
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
source_face = extract_source_face(source_vision_frames)
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if source_face and target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -282,11 +282,12 @@ def normalize_crop_frame(crop_vision_frame : VisionFrame) -> VisionFrame:
|
||||
|
||||
def process_frame(inputs : LipSyncerInputs) -> ProcessorOutputs:
|
||||
reference_vision_frame = inputs.get('reference_vision_frame')
|
||||
source_vision_frames = inputs.get('source_vision_frames')
|
||||
source_voice_frame = inputs.get('source_voice_frame')
|
||||
target_vision_frame = inputs.get('target_vision_frame')
|
||||
temp_vision_frame = inputs.get('temp_vision_frame')
|
||||
temp_vision_mask = inputs.get('temp_vision_mask')
|
||||
target_faces = select_faces(reference_vision_frame, target_vision_frame)
|
||||
target_faces = select_faces(reference_vision_frame, source_vision_frames, target_vision_frame)
|
||||
|
||||
if target_faces:
|
||||
for target_face in target_faces:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Literal, TypeAlias, TypedDict
|
||||
from typing import Any, List, Literal, TypeAlias, TypedDict
|
||||
|
||||
from numpy.typing import NDArray
|
||||
|
||||
@@ -7,6 +7,7 @@ from facefusion.types import AudioFrame, Mask, VisionFrame
|
||||
LipSyncerInputs = TypedDict('LipSyncerInputs',
|
||||
{
|
||||
'reference_vision_frame' : VisionFrame,
|
||||
'source_vision_frames' : List[VisionFrame],
|
||||
'source_voice_frame' : AudioFrame,
|
||||
'target_vision_frame' : VisionFrame,
|
||||
'temp_vision_frame' : VisionFrame,
|
||||
|
||||
Reference in New Issue
Block a user