diff --git a/facefusion/core.py b/facefusion/core.py index 54d70fc..abc28ef 100755 --- a/facefusion/core.py +++ b/facefusion/core.py @@ -1,3 +1,4 @@ +import inspect import itertools import shutil import signal @@ -6,7 +7,7 @@ from time import time import numpy -from facefusion import benchmarker, cli_helper, content_analyser, face_classifier, face_detector, face_landmarker, face_masker, face_recognizer, logger, process_manager, state_manager, video_manager, voice_extractor, wording +from facefusion import benchmarker, cli_helper, content_analyser, face_classifier, face_detector, face_landmarker, face_masker, face_recognizer, hash_helper, logger, process_manager, state_manager, video_manager, voice_extractor, wording from facefusion.args import apply_args, collect_job_args, reduce_job_args, reduce_step_args from facefusion.common_helper import get_first from facefusion.content_analyser import analyse_image, analyse_video @@ -126,7 +127,10 @@ def common_pre_check() -> bool: voice_extractor ] - return all(module.pre_check() for module in common_modules) + content_analyser_content = inspect.getsource(content_analyser).encode() + is_valid = hash_helper.create_hash(content_analyser_content) == 'b159fd9d' + + return all(module.pre_check() for module in common_modules) and is_valid def processors_pre_check() -> bool: diff --git a/facefusion/face_store.py b/facefusion/face_store.py index 35ce5a0..bd7b2c5 100644 --- a/facefusion/face_store.py +++ b/facefusion/face_store.py @@ -15,16 +15,12 @@ def get_face_store() -> FaceStore: def get_static_faces(vision_frame : VisionFrame) -> Optional[List[Face]]: - vision_area = crop_vision_area(vision_frame) - vision_hash = create_hash(vision_area.tobytes()) - if vision_hash in FACE_STORE['static_faces']: - return FACE_STORE['static_faces'][vision_hash] - return None + vision_hash = create_hash(vision_frame.tobytes()) + return FACE_STORE.get('static_faces').get(vision_hash) def set_static_faces(vision_frame : VisionFrame, faces : List[Face]) -> None: - vision_area = crop_vision_area(vision_frame) - vision_hash = create_hash(vision_area.tobytes()) + vision_hash = create_hash(vision_frame.tobytes()) if vision_hash: FACE_STORE['static_faces'][vision_hash] = faces @@ -34,23 +30,14 @@ def clear_static_faces() -> None: def get_reference_faces() -> Optional[FaceSet]: - if FACE_STORE['reference_faces']: - return FACE_STORE['reference_faces'] - return None + return FACE_STORE.get('reference_faces') def append_reference_face(name : str, face : Face) -> None: - if name not in FACE_STORE['reference_faces']: + if name not in FACE_STORE.get('reference_faces'): FACE_STORE['reference_faces'][name] = [] FACE_STORE['reference_faces'][name].append(face) def clear_reference_faces() -> None: FACE_STORE['reference_faces'].clear() - - -def crop_vision_area(vision_frame : VisionFrame) -> VisionFrame: - height, width = vision_frame.shape[:2] - center_y, center_x = height // 2, width // 2 - vision_area = vision_frame[center_y - 16 : center_y + 16, center_x - 16 : center_x + 16] - return vision_area diff --git a/facefusion/metadata.py b/facefusion/metadata.py index df15142..a651464 100644 --- a/facefusion/metadata.py +++ b/facefusion/metadata.py @@ -4,7 +4,7 @@ METADATA =\ { 'name': 'FaceFusion', 'description': 'Industry leading face manipulation platform', - 'version': '3.3.0', + 'version': '3.3.1', 'license': 'OpenRAIL-AS', 'author': 'Henry Ruhs', 'url': 'https://facefusion.io'