ComfyUI-FaceChain

ComfyUI-FaceChain
★ 147

人脸处理加速推理流程可控模型适配
基于 facechain 的 ComfyUI 官方实现,大幅提升推理速度,拆分并强化流程,提供灵活可控的人脸链式处理。
💡 用于加速并可视化定制的人脸生成与编辑流程。
🍴 15 Forks💻 Python🔄 2025-04-28
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/51137d50651f
📦 requirements.txt
aliyun-python-sdk-core-v3>=2.13.10
python-slugify>=8.0.1
onnxruntime-gpu
timm
modelscope
controlnet_aux>=0.0.6
mmdet>=2.26.0
mediapipe
transformers
insightface
sentencepiece
pysoundfile
soundfile
workflow_inpaiting_inference.png
workflow_face_detect_crop.png
workflow_face_fusion.png
workflow_face_segment.png
workflow_face_seg_and_replace.png
workflow_remove_canny_face.png
workflow_replace_by_mask.png
workflow_mask_op.png
workflow_crop_to_origin.png
📄 README

ComfyUI-FaceChain

This project is adapted from facechain and involves the breakdown and improvement of the processes of facechain.

English | 简体中文

Contact

If you have any questions or suggestions, you can reach us through the following channels:

  • Email: tototianhao@gmail.com
  • Telegram: https://t.me/+JoFE2vqHU4phZjg1
  • WeChat Group:
  • Steps

  • Install ComfyUI first.
  • After a successful installation of ComfyUI, navigate to the custom_nodes directory at ComfyUI/custom_nodes/.
  • cd custom_nodes

  • Clone this project into the custom_nodes directory.
  • git clone https://github.com/THtianhao/ComfyUI-FaceChain

  • Restart ComfyUI.
  • ComfyUI Workflow

    Facechain Workflow Location: workflow_inpaiting_inference.png

    Drag the workflow directly into ComfyUI.

    Node Introduction

    FC StyleLoraLoad

    > The workflow can load the checkpoints and style Lora used by facechain, download them first, and then merge them, providing relevant prompts.

    > Workflow: ./workflow/workflow_inference.json

    FC FaceDetectCrop

    > Detects faces and crops them.

    Parameter Description:

  • mode: Cropping mode, normal mode crops according to the face, square 512 width height will scale the face to 512.
  • face_index: Index of the face, if there are multiple faces, retrieve them based on the index.
  • crop_ratio: Only effective in normal mode, crops the face proportionally, 1.0 is 1x the face.
  • FC FaceFusion

    > Fusion using model scope model.

    FC FaceSegment

    > Segmentation using model scope model to obtain masks for the face and body.

    Parameter Description:

  • ksize: Expansion parameter for segmenting the edges of the face.
  • ksize1: Expansion parameter for segmenting the edges of the face.
  • include_neck: Whether the segmented image includes the neck.
  • FC FaceSegAndReplace

    > Performs face fusion and replaces the original image, similar to facefusion but mainly used for multiple people.

    FC RemoveCannyFace

    > Removes the Canny-detected parts of the face.

    FC ReplaceByMask

    > Replaces the image based on the mask.

  • FC MaskOP
  • > Operations on the mask.

    Parameter Description:

  • mode: Provides three operations, blur, erosion, dilation.
  • kernel: The kernel used for the operation, the larger the kernel, the stronger the operation.
  • FC FCCropToOrigin
  • > Currently, it can only be used in conjunction with FC FaceDetectCrop in square 512 width height mode. Pastes the cropped image onto the target image based on the mask.

    Parameter Description:

  • origin_image: Original image.
  • origin_box: Bounding box of the original image.
  • origin_mask: Mask cropped from the original image.
  • paste_image: Pasting image, must be consistent with the origin_mask, hence the need for FC FaceDetectCrop in square 512 width height mode.
  • Contribution

    If you find any issues or have suggestions for improvement, feel free to contribute. Follow these steps:

  • Branch out a new feature branch: git checkout -b feature/your-feature-name
  • Make your changes and commit: git commit -m "Add new feature"
  • Push to your remote branch: git push origin feature/your-feature-name
  • Create a Pull Request (PR).
  • License

    This project is licensed under the MIT License. See the LICENSE file for details.

    Join us and contribute to the development of EasyPhoto ComfyUI Plugin!