From e24133cbb1c77c2aeb938fc17d4b42528119e380 Mon Sep 17 00:00:00 2001 From: Henry Ruhs Date: Thu, 3 Oct 2024 18:31:41 +0200 Subject: [PATCH] 3.0.0 Gold (#788) * Fix suffix of swapper and lip syncer models * Fix suffix of swapper and lip syncer models --- facefusion/processors/choices.py | 10 ++--- facefusion/processors/modules/face_swapper.py | 40 +++++++++---------- facefusion/processors/modules/lip_syncer.py | 22 +++++----- facefusion/processors/typing.py | 4 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/facefusion/processors/choices.py b/facefusion/processors/choices.py index 9ab399eb..094e1f72 100755 --- a/facefusion/processors/choices.py +++ b/facefusion/processors/choices.py @@ -11,19 +11,19 @@ face_enhancer_models : List[FaceEnhancerModel] = [ 'codeformer', 'gfpgan_1.2', ' face_swapper_set : FaceSwapperSet =\ { 'blendswap_256': [ '256x256', '384x384', '512x512', '768x768', '1024x1024' ], - 'ghost_256_unet_1': [ '256x256', '512x512', '768x768', '1024x1024' ], - 'ghost_256_unet_2': [ '256x256', '512x512', '768x768', '1024x1024' ], - 'ghost_256_unet_3': [ '256x256', '512x512', '768x768', '1024x1024' ], + 'ghost_1_256': [ '256x256', '512x512', '768x768', '1024x1024' ], + 'ghost_2_256': [ '256x256', '512x512', '768x768', '1024x1024' ], + 'ghost_3_256': [ '256x256', '512x512', '768x768', '1024x1024' ], 'inswapper_128': [ '128x128', '256x256', '384x384', '512x512', '768x768', '1024x1024' ], 'inswapper_128_fp16': [ '128x128', '256x256', '384x384', '512x512', '768x768', '1024x1024' ], 'simswap_256': [ '256x256', '512x512', '768x768', '1024x1024' ], - 'simswap_512_unofficial': [ '512x512', '768x768', '1024x1024' ], + 'simswap_unofficial_512': [ '512x512', '768x768', '1024x1024' ], 'uniface_256': [ '256x256', '512x512', '768x768', '1024x1024' ] } frame_colorizer_models : List[FrameColorizerModel] = [ 'ddcolor', 'ddcolor_artistic', 'deoldify', 'deoldify_artistic', 'deoldify_stable' ] frame_colorizer_sizes : List[str] = [ '192x192', '256x256', '384x384', '512x512' ] frame_enhancer_models : List[FrameEnhancerModel] = [ 'clear_reality_x4', 'lsdir_x4', 'nomos8k_sc_x4', 'real_esrgan_x2', 'real_esrgan_x2_fp16', 'real_esrgan_x4', 'real_esrgan_x4_fp16', 'real_esrgan_x8', 'real_esrgan_x8_fp16', 'real_hatgan_x4', 'span_kendata_x4', 'ultra_sharp_x4' ] -lip_syncer_models : List[LipSyncerModel] = [ 'wav2lip', 'wav2lip_gan' ] +lip_syncer_models : List[LipSyncerModel] = [ 'wav2lip_96', 'wav2lip_gan_96' ] age_modifier_direction_range : Sequence[int] = create_int_range(-100, 100, 1) expression_restorer_factor_range : Sequence[int] = create_int_range(0, 100, 1) diff --git a/facefusion/processors/modules/face_swapper.py b/facefusion/processors/modules/face_swapper.py index bc475783..72aa8e03 100755 --- a/facefusion/processors/modules/face_swapper.py +++ b/facefusion/processors/modules/face_swapper.py @@ -51,14 +51,14 @@ MODEL_SET : ModelSet =\ 'mean': [ 0.0, 0.0, 0.0 ], 'standard_deviation': [ 1.0, 1.0, 1.0 ] }, - 'ghost_256_unet_1': + 'ghost_1_256': { 'hashes': { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_256_unet_1.hash', - 'path': resolve_relative_path('../.assets/models/ghost_256_unet_1.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_1_256.hash', + 'path': resolve_relative_path('../.assets/models/ghost_1_256.hash') }, 'embedding_converter': { @@ -70,8 +70,8 @@ MODEL_SET : ModelSet =\ { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_256_unet_1.onnx', - 'path': resolve_relative_path('../.assets/models/ghost_256_unet_1.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_1_256.onnx', + 'path': resolve_relative_path('../.assets/models/ghost_1_256.onnx') }, 'embedding_converter': { @@ -85,14 +85,14 @@ MODEL_SET : ModelSet =\ 'mean': [ 0.5, 0.5, 0.5 ], 'standard_deviation': [ 0.5, 0.5, 0.5 ] }, - 'ghost_256_unet_2': + 'ghost_2_256': { 'hashes': { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_256_unet_2.hash', - 'path': resolve_relative_path('../.assets/models/ghost_256_unet_2.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_2_256.hash', + 'path': resolve_relative_path('../.assets/models/ghost_2_256.hash') }, 'embedding_converter': { @@ -104,8 +104,8 @@ MODEL_SET : ModelSet =\ { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_256_unet_2.onnx', - 'path': resolve_relative_path('../.assets/models/ghost_256_unet_2.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_2_256.onnx', + 'path': resolve_relative_path('../.assets/models/ghost_2_256.onnx') }, 'embedding_converter': { @@ -119,14 +119,14 @@ MODEL_SET : ModelSet =\ 'mean': [ 0.5, 0.5, 0.5 ], 'standard_deviation': [ 0.5, 0.5, 0.5 ] }, - 'ghost_256_unet_3': + 'ghost_3_256': { 'hashes': { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_256_unet_3.hash', - 'path': resolve_relative_path('../.assets/models/ghost_256_unet_3.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_3_256.hash', + 'path': resolve_relative_path('../.assets/models/ghost_3_256.hash') }, 'embedding_converter': { @@ -138,8 +138,8 @@ MODEL_SET : ModelSet =\ { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_256_unet_3.onnx', - 'path': resolve_relative_path('../.assets/models/ghost_256_unet_3.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/ghost_3_256.onnx', + 'path': resolve_relative_path('../.assets/models/ghost_3_256.onnx') }, 'embedding_converter': { @@ -235,14 +235,14 @@ MODEL_SET : ModelSet =\ 'mean': [ 0.485, 0.456, 0.406 ], 'standard_deviation': [ 0.229, 0.224, 0.225 ] }, - 'simswap_512_unofficial': + 'simswap_unofficial_512': { 'hashes': { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/simswap_512_unofficial.hash', - 'path': resolve_relative_path('../.assets/models/simswap_512_unofficial.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/simswap_unofficial_512.hash', + 'path': resolve_relative_path('../.assets/models/simswap_unofficial_512.hash') }, 'embedding_converter': { @@ -254,8 +254,8 @@ MODEL_SET : ModelSet =\ { 'face_swapper': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/simswap_512_unofficial.onnx', - 'path': resolve_relative_path('../.assets/models/simswap_512_unofficial.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/simswap_unofficial_512.onnx', + 'path': resolve_relative_path('../.assets/models/simswap_unofficial_512.onnx') }, 'embedding_converter': { diff --git a/facefusion/processors/modules/lip_syncer.py b/facefusion/processors/modules/lip_syncer.py index 53f2a380..6be93294 100755 --- a/facefusion/processors/modules/lip_syncer.py +++ b/facefusion/processors/modules/lip_syncer.py @@ -26,42 +26,42 @@ from facefusion.vision import read_image, read_static_image, restrict_video_fps, MODEL_SET : ModelSet =\ { - 'wav2lip': + 'wav2lip_96': { 'hashes': { 'lip_syncer': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip.hash', - 'path': resolve_relative_path('../.assets/models/wav2lip.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip_96.hash', + 'path': resolve_relative_path('../.assets/models/wav2lip_96.hash') } }, 'sources': { 'lip_syncer': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip.onnx', - 'path': resolve_relative_path('../.assets/models/wav2lip.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip_96.onnx', + 'path': resolve_relative_path('../.assets/models/wav2lip_96.onnx') } }, 'size': (96, 96) }, - 'wav2lip_gan': + 'wav2lip_gan_96': { 'hashes': { 'lip_syncer': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip_gan.hash', - 'path': resolve_relative_path('../.assets/models/wav2lip_gan.hash') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip_gan_96.hash', + 'path': resolve_relative_path('../.assets/models/wav2lip_gan_96.hash') } }, 'sources': { 'lip_syncer': { - 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip_gan.onnx', - 'path': resolve_relative_path('../.assets/models/wav2lip_gan.onnx') + 'url': 'https://github.com/facefusion/facefusion-assets/releases/download/models-3.0.0/wav2lip_gan_96.onnx', + 'path': resolve_relative_path('../.assets/models/wav2lip_gan_96.onnx') } }, 'size': (96, 96) @@ -88,7 +88,7 @@ def get_model_options() -> ModelOptions: def register_args(program : ArgumentParser) -> None: group_processors = find_argument_group(program, 'processors') if group_processors: - group_processors.add_argument('--lip-syncer-model', help = wording.get('help.lip_syncer_model'), default = config.get_str_value('processors.lip_syncer_model', 'wav2lip_gan'), choices = processors_choices.lip_syncer_models) + group_processors.add_argument('--lip-syncer-model', help = wording.get('help.lip_syncer_model'), default = config.get_str_value('processors.lip_syncer_model', 'wav2lip_gan_96'), choices = processors_choices.lip_syncer_models) facefusion.jobs.job_store.register_step_keys([ 'lip_syncer_model' ]) diff --git a/facefusion/processors/typing.py b/facefusion/processors/typing.py index b1ef4c84..16dcfc53 100644 --- a/facefusion/processors/typing.py +++ b/facefusion/processors/typing.py @@ -9,10 +9,10 @@ ExpressionRestorerModel = Literal['live_portrait'] FaceDebuggerItem = Literal['bounding-box', 'face-landmark-5', 'face-landmark-5/68', 'face-landmark-68', 'face-landmark-68/5', 'face-mask', 'face-detector-score', 'face-landmarker-score', 'age', 'gender', 'race'] FaceEditorModel = Literal['live_portrait'] FaceEnhancerModel = Literal['codeformer', 'gfpgan_1.2', 'gfpgan_1.3', 'gfpgan_1.4', 'gpen_bfr_256', 'gpen_bfr_512', 'gpen_bfr_1024', 'gpen_bfr_2048', 'restoreformer_plus_plus'] -FaceSwapperModel = Literal['blendswap_256', 'ghost_256_unet_1', 'ghost_256_unet_2', 'ghost_256_unet_3', 'inswapper_128', 'inswapper_128_fp16', 'simswap_256', 'simswap_512_unofficial', 'uniface_256'] +FaceSwapperModel = Literal['blendswap_256', 'ghost_1_256', 'ghost_2_256', 'ghost_3_256', 'inswapper_128', 'inswapper_128_fp16', 'simswap_256', 'simswap_unofficial_512', 'uniface_256'] FrameColorizerModel = Literal['ddcolor', 'ddcolor_artistic', 'deoldify', 'deoldify_artistic', 'deoldify_stable'] FrameEnhancerModel = Literal['clear_reality_x4', 'lsdir_x4', 'nomos8k_sc_x4', 'real_esrgan_x2', 'real_esrgan_x2_fp16', 'real_esrgan_x4', 'real_esrgan_x4_fp16', 'real_hatgan_x4', 'real_esrgan_x8', 'real_esrgan_x8_fp16', 'span_kendata_x4', 'ultra_sharp_x4'] -LipSyncerModel = Literal['wav2lip', 'wav2lip_gan'] +LipSyncerModel = Literal['wav2lip_96', 'wav2lip_gan_96'] FaceSwapperSet = Dict[FaceSwapperModel, List[str]]