This commit is contained in:
harisreedhar 2024-10-17 17:00:13 +05:30
parent 96666b6758
commit a18929b7fb
3 changed files with 17 additions and 8 deletions

View File

@ -56,6 +56,14 @@ WARP_TEMPLATES : WarpTemplateSet =\
[ 0.50123859, 0.61331904 ], [ 0.50123859, 0.61331904 ],
[ 0.43364461, 0.68337652 ], [ 0.43364461, 0.68337652 ],
[ 0.57015325, 0.68306005 ] [ 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 ]
]) ])
} }

View File

@ -33,27 +33,28 @@ MODEL_SET : ModelSet =\
{ {
'age_modifier': 'age_modifier':
{ {
'url': 'https://huggingface.co/bluefoxcreation/StyleGANEX-AGE/resolve/main/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_opt.hash') 'path': resolve_relative_path('../.assets/models/styleganex_age.hash')
} }
}, },
'sources': 'sources':
{ {
'age_modifier': 'age_modifier':
{ {
'url': 'https://huggingface.co/bluefoxcreation/StyleGANEX-AGE/resolve/main/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_opt.onnx') 'path': resolve_relative_path('../.assets/models/styleganex_age.onnx')
} }
}, },
'templates': 'templates':
{ {
'target': 'ffhq_512', 'target': 'ffhq_512',
'target_with_background': 'styleganex_384' 'target_with_background': 'styleganex_512'
}, },
'sizes': 'sizes':
{ {
'target': (256, 256), '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: 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 = 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) 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) extend_vision_frame = normalize_color_difference(color_difference, color_difference_mask, extend_vision_frame)

View File

@ -85,7 +85,7 @@ ProcessStep = Callable[[str, int, Args], bool]
Content = Dict[str, Any] 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]] WarpTemplateSet = Dict[WarpTemplate, NDArray[Any]]
ProcessMode = Literal['output', 'preview', 'stream'] ProcessMode = Literal['output', 'preview', 'stream']