From a18929b7fb6199f61de391d70b022f72a538a353 Mon Sep 17 00:00:00 2001 From: harisreedhar Date: Thu, 17 Oct 2024 17:00:13 +0530 Subject: [PATCH] change --- facefusion/face_helper.py | 8 ++++++++ facefusion/processors/modules/age_modifier.py | 15 ++++++++------- facefusion/typing.py | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/facefusion/face_helper.py b/facefusion/face_helper.py index 085ebd72..bee07883 100644 --- a/facefusion/face_helper.py +++ b/facefusion/face_helper.py @@ -56,6 +56,14 @@ WARP_TEMPLATES : WarpTemplateSet =\ [ 0.50123859, 0.61331904 ], [ 0.43364461, 0.68337652 ], [ 0.57015325, 0.68306005 ] + ]), + 'styleganex_512': numpy.array( + [ + [ 0.43907768, 0.54098284 ], + [ 0.56204778, 0.54122359 ], + [ 0.50123859, 0.61331904 ], + [ 0.44716341, 0.66936502 ], + [ 0.55637032, 0.66911184 ] ]) } diff --git a/facefusion/processors/modules/age_modifier.py b/facefusion/processors/modules/age_modifier.py index f0a78dcc..8ae02df0 100755 --- a/facefusion/processors/modules/age_modifier.py +++ b/facefusion/processors/modules/age_modifier.py @@ -33,27 +33,28 @@ MODEL_SET : ModelSet =\ { 'age_modifier': { - 'url': 'https://huggingface.co/bluefoxcreation/StyleGANEX-AGE/resolve/main/styleganex_age_opt.hash', - 'path': resolve_relative_path('../.assets/models/styleganex_age_opt.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/styleganex_age.hash', + 'path': resolve_relative_path('../.assets/models/styleganex_age.hash') } }, 'sources': { 'age_modifier': { - 'url': 'https://huggingface.co/bluefoxcreation/StyleGANEX-AGE/resolve/main/styleganex_age_opt.onnx', - 'path': resolve_relative_path('../.assets/models/styleganex_age_opt.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/styleganex_age.onnx', + 'path': resolve_relative_path('../.assets/models/styleganex_age.onnx') + } }, 'templates': { 'target': 'ffhq_512', - 'target_with_background': 'styleganex_384' + 'target_with_background': 'styleganex_512' }, 'sizes': { 'target': (256, 256), - 'target_with_background': (384, 384) + 'target_with_background': (512, 512) } } } @@ -176,7 +177,7 @@ def forward(crop_vision_frame : VisionFrame, extend_vision_frame : VisionFrame) def fix_color(extend_vision_frame_raw : VisionFrame, extend_vision_frame : VisionFrame) -> VisionFrame: - color_difference = compute_color_difference(extend_vision_frame_raw, extend_vision_frame, (48, 48)) + color_difference = compute_color_difference(extend_vision_frame_raw, extend_vision_frame, (24, 24)) color_difference_mask = create_static_box_mask(extend_vision_frame.shape[:2][::-1], 1.0, (0, 0, 0, 0)) color_difference_mask = numpy.stack((color_difference_mask, ) * 3, axis = -1) extend_vision_frame = normalize_color_difference(color_difference, color_difference_mask, extend_vision_frame) diff --git a/facefusion/typing.py b/facefusion/typing.py index 37042fde..13ab61ce 100755 --- a/facefusion/typing.py +++ b/facefusion/typing.py @@ -85,7 +85,7 @@ ProcessStep = Callable[[str, int, Args], bool] Content = Dict[str, Any] -WarpTemplate = Literal['arcface_112_v1', 'arcface_112_v2', 'arcface_128_v2', 'ffhq_512', 'mtcnn_512', 'styleganex_384'] +WarpTemplate = Literal['arcface_112_v1', 'arcface_112_v2', 'arcface_128_v2', 'ffhq_512', 'mtcnn_512', 'styleganex_384', 'styleganex_512'] WarpTemplateSet = Dict[WarpTemplate, NDArray[Any]] ProcessMode = Literal['output', 'preview', 'stream']