[facefusion] Next generation face swapper and enhancer.

源码阅读笔记

https://docs.facefusion.io/

特点:多平台,支持cpu only.

未来几个月,UI会重大升级,以及支持audio。

 

$ python run.py -s test.png -t test.mp4 -o . --log-level debug --headless
Analysing:
100%|========================================================================================================================================================| 73/73 [00:00<00:00, 94.26frame/s, rate=0] [FACEFUSION.CORE] Clearing temporary resources [FACEFUSION.CORE] Creating temporary resources [FACEFUSION.CORE] Extracting frames with a resolution of 1088x832 and 18.0 frames per second [FACEFUSION.CORE] Extracting frames succeed [FACEFUSION.PROCESSORS.FRAME.MODULES.FACE_SWAPPER] Processing Processing: 100%|===============================================================================| 73/73 [03:52<00:00, 3.18s/frame, execution_providers=['cpu'], execution_thread_count=4, execution_queue_count=1] [FACEFUSION.CORE] Merging video with a resolution of 1088x832 and 18.0 frames per second [FACEFUSION.CORE] Merging video succeed [FACEFUSION.CORE] Restoring audio skipped [FACEFUSION.CORE] Clearing temporary resources [FACEFUSION.CORE] Processing to video succeed in 243.26 seconds [FACEFUSION.STATISTICS] min_face_detector_score: 0.84 [FACEFUSION.STATISTICS] min_face_landmarker_score: 0.8 [FACEFUSION.STATISTICS] max_face_detector_score: 0.86 [FACEFUSION.STATISTICS] max_face_landmarker_score: 0.87 [FACEFUSION.STATISTICS] average_face_detector_score: 0.85 [FACEFUSION.STATISTICS] average_face_landmarker_score: 0.81 [FACEFUSION.STATISTICS] total_face_landmark_5_fallbacks: 0 [FACEFUSION.STATISTICS] total_frames_with_faces: 76 [FACEFUSION.STATISTICS] total_faces: 76

 

 

 

def run(program : ArgumentParser) -> None:

    apply_args(program)
    logger.init(facefusion.globals.log_level)

    if facefusion.globals.system_memory_limit > 0:
        limit_system_memory(facefusion.globals.system_memory_limit)

    if not pre_check() or not content_analyser.pre_check() or not face_analyser.pre_check() or not face_masker.pre_check():
        return

    for frame_processor_module in get_frame_processors_modules(facefusion.globals.frame_processors):
        if not frame_processor_module.pre_check():
            return

    if facefusion.globals.headless:
        conditional_process()  # 相当于自动点击了"start" 按钮 ~
    else:
        import facefusion.uis.core as ui

        for ui_layout in ui.get_ui_layouts_modules(facefusion.globals.ui_layouts):
            if not ui_layout.pre_check():
                return
        ui.launch()

 

posted @ 2024-05-23 12:45  郝壹贰叁  阅读(161)  评论(0编辑  收藏  举报