From 9d169164f6c86ee80720213fa95f887377735717 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Sun, 22 Jun 2025 10:52:03 +0200 Subject: [PATCH] Remove statistics --- facefusion/benchmarker.py | 2 +- facefusion/core.py | 3 --- facefusion/statistics.py | 51 --------------------------------------- 3 files changed, 1 insertion(+), 55 deletions(-) delete mode 100644 facefusion/statistics.py diff --git a/facefusion/benchmarker.py b/facefusion/benchmarker.py index 5a01169..762fbb2 100644 --- a/facefusion/benchmarker.py +++ b/facefusion/benchmarker.py @@ -92,7 +92,7 @@ def render() -> None: headers =\ [ 'target_path', - 'benchmark_cycle_count', + 'cycle_count', 'average_run', 'fastest_run', 'slowest_run', diff --git a/facefusion/core.py b/facefusion/core.py index be6e8b0..54d70fc 100755 --- a/facefusion/core.py +++ b/facefusion/core.py @@ -23,7 +23,6 @@ from facefusion.memory import limit_system_memory from facefusion.processors.core import get_processors_modules from facefusion.program import create_program from facefusion.program_helper import validate_args -from facefusion.statistics import conditional_log_statistics from facefusion.temp_helper import clear_temp_directory, create_temp_directory, get_temp_file_path, move_temp_file, resolve_temp_frame_paths from facefusion.types import Args, ErrorCode from facefusion.vision import pack_resolution, read_image, read_static_images, read_video_frame, restrict_image_resolution, restrict_trim_frame, restrict_video_fps, restrict_video_resolution, unpack_resolution @@ -409,7 +408,6 @@ def process_image(start_time : float) -> ErrorCode: if is_image(state_manager.get_item('output_path')): seconds = '{:.2f}'.format((time() - start_time) % 60) logger.info(wording.get('processing_image_succeed').format(seconds = seconds), __name__) - conditional_log_statistics() else: logger.error(wording.get('processing_image_failed'), __name__) process_manager.end() @@ -500,7 +498,6 @@ def process_video(start_time : float) -> ErrorCode: if is_video(state_manager.get_item('output_path')): seconds = '{:.2f}'.format((time() - start_time)) logger.info(wording.get('processing_video_succeed').format(seconds = seconds), __name__) - conditional_log_statistics() else: logger.error(wording.get('processing_video_failed'), __name__) process_manager.end() diff --git a/facefusion/statistics.py b/facefusion/statistics.py deleted file mode 100644 index 2e6b518..0000000 --- a/facefusion/statistics.py +++ /dev/null @@ -1,51 +0,0 @@ -from typing import Any, Dict - -import numpy - -from facefusion import logger, state_manager -from facefusion.face_store import get_face_store -from facefusion.types import FaceSet - - -def create_statistics(static_faces : FaceSet) -> Dict[str, Any]: - face_detector_scores = [] - face_landmarker_scores = [] - statistics =\ - { - 'min_face_detector_score': 0, - 'min_face_landmarker_score': 0, - 'max_face_detector_score': 0, - 'max_face_landmarker_score': 0, - 'average_face_detector_score': 0, - 'average_face_landmarker_score': 0, - 'total_face_landmark_5_fallbacks': 0, - 'total_frames_with_faces': 0, - 'total_faces': 0 - } - - for faces in static_faces.values(): - statistics['total_frames_with_faces'] = statistics.get('total_frames_with_faces') + 1 - for face in faces: - statistics['total_faces'] = statistics.get('total_faces') + 1 - face_detector_scores.append(face.score_set.get('detector')) - face_landmarker_scores.append(face.score_set.get('landmarker')) - if numpy.array_equal(face.landmark_set.get('5'), face.landmark_set.get('5/68')): - statistics['total_face_landmark_5_fallbacks'] = statistics.get('total_face_landmark_5_fallbacks') + 1 - - if face_detector_scores: - statistics['min_face_detector_score'] = round(min(face_detector_scores), 2) - statistics['max_face_detector_score'] = round(max(face_detector_scores), 2) - statistics['average_face_detector_score'] = round(numpy.mean(face_detector_scores), 2) - if face_landmarker_scores: - statistics['min_face_landmarker_score'] = round(min(face_landmarker_scores), 2) - statistics['max_face_landmarker_score'] = round(max(face_landmarker_scores), 2) - statistics['average_face_landmarker_score'] = round(numpy.mean(face_landmarker_scores), 2) - return statistics - - -def conditional_log_statistics() -> None: - if state_manager.get_item('log_level') == 'debug': - statistics = create_statistics(get_face_store().get('static_faces')) - - for name, value in statistics.items(): - logger.debug(str(name) + ': ' + str(value), __name__)