ComfyUI Face Swap Workflow

详情

下载文件

模型描述

(如果在安装自定义节点/依赖项时遇到问题,请留言,我会尽力协助您!)

这个简单的流程包含两个主要步骤:首先,将源图像中的面部替换到输入图像(通常较模糊)上,然后对脸部进行修复以使其更清晰。您可以根据喜好自由调整保真度数值;我最初已将其默认设置为 1.000。

如果您觉得我的工作有帮助,不妨买杯咖啡支持一下,非常感谢!https://www.buymeacoffee.com/meap

前提条件(自定义节点):

您可以通过 ComfyUI Manager 安装以下任一自定义节点,或使用 Git 克隆:

  1. ReActor Node for ComfyUIhttps://github.com/Gourieff/comfyui-reactor-node

  2. Facerestore CF (Code Former)https://github.com/mav-rik/facerestore_cf


安装指南(来自各自 GitHub 页面):

ReActor:

  1. 进入 ComfyUI\custom_nodes 目录。

  2. 打开控制台并运行以下命令:

    git clone https://github.com/Gourieff/comfyui-reactor-node

  3. 运行 install.bat

  4. 启动 ComfyUI,在菜单的 "image/postprocessing" 下找到 ReActor 节点,或使用搜索功能。

Facerestore CF:

  • 将此节点克隆到 ComfyUI/custom_nodes 文件夹:

  • cd ComfyUI/custom_nodes

  • git clone https://github.com/mav-rik/facerestore_cf.git

  • 如果您使用的是便携式 Windows 版本的 ComfyUI,请运行 embedded_install.bat。非便携式 Windows 用户可运行 install.bat。Linux 和 macOS 用户可运行 install.sh。若安装失败,请手动安装 opencv-python 以解决“未找到 cv2”的错误。

面部修复模型

这些模型用于面部修复。如果您使用的是 automatic1111,可能已拥有这些模型;若没有,请使用以下下载链接。只需将它们放入 models/facerestore_models/ 文件夹中。

https://github.com/TencentARC/GFPGAN/releases/ https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth

https://github.com/sczhou/CodeFormer/releases/ https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth

人脸检测模型

面部修复模型仅适用于裁剪后的人脸图像。人脸检测模型用于将检测到的每个人脸区域裁剪后传送给面部修复模型。首次使用时,这些模型会自动下载并存放到 models/facedetection 文件夹中。以下是手动下载链接:

https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_mobilenet0.25_Final.pth https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/yolov5l-face.pth https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/yolov5n-face.pth

此外,以下模型也会被下载并放入 facedetection 文件夹,用于将修复后的人脸重新融合回原始图像:

https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/parsing_parsenet.pth

此模型生成的图像

未找到图像。