ComfyUI > Nodes > ComfyUI-FaceChain

ComfyUI Extension: ComfyUI-FaceChain

Repo Name

ComfyUI-FaceChain

Author
THtianhao (Account age: 3700 days)
Nodes
View all nodes(11)
Latest Updated
2024-06-25
Github Stars
0.1K

How to Install ComfyUI-FaceChain

Install this extension via the ComfyUI Manager by searching for ComfyUI-FaceChain
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-FaceChain in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI-FaceChain Description

ComfyUI-FaceChain enhances reasoning speed and offers advanced custom process controls, making it a powerful tool for efficient and tailored operations within the ComfyUI framework.

ComfyUI-FaceChain Introduction

ComfyUI-FaceChain is an advanced extension designed to enhance the capabilities of AI artists by providing tools for generating and manipulating human portraits. Adapted from the original FaceChain project, this extension focuses on improving the processes involved in face detection, cropping, fusion, and segmentation. ComfyUI-FaceChain allows you to create identity-preserved portraits with high authenticity and controllability, making it an invaluable tool for artists looking to generate realistic and stylistically diverse human images.

How ComfyUI-FaceChain Works

ComfyUI-FaceChain operates by leveraging advanced AI models to detect, crop, and manipulate faces within images. The extension uses a series of nodes, each responsible for a specific task in the workflow. For example, one node might detect and crop faces, while another node handles the fusion of faces with different styles. By breaking down these tasks into manageable steps, ComfyUI-FaceChain ensures that each part of the process is optimized for the best possible results.

Imagine you have a photo and you want to change the style of the face while keeping the identity intact. ComfyUI-FaceChain detects the face, crops it out, applies the desired style, and then seamlessly integrates the modified face back into the original image. This modular approach allows for high flexibility and customization, enabling artists to experiment with different styles and settings easily.

ComfyUI-FaceChain Features

FC StyleLoraLoad

This feature allows you to load checkpoints and style LoRas (Low-Rank Adaptations) used by FaceChain. You can download and merge them to provide relevant prompts for your workflow.

FC FaceDetectCrop

This node detects faces in an image and crops them. It offers different modes for cropping:

  • Normal Mode: Crops according to the face's dimensions.
  • Square 512 Mode: Scales the face to a 512x512 square. Parameters:
  • mode: Choose between normal and square 512 modes.
  • face_index: Select which face to crop if multiple faces are detected.
  • crop_ratio: Adjust the proportion of the face to be cropped (effective in normal mode).

FC FaceFusion

This feature uses a model scope to fuse faces, allowing for the blending of different facial features and styles.

FC FaceSegment

This node segments the face and body to create masks, which can be used for further manipulation.

Parameters:

  • ksize: Adjusts the expansion of the face's edges.
  • ksize1: Another parameter for edge expansion.
  • include_neck: Determines whether the neck is included in the segmented image.

FC FaceSegAndReplace

Similar to FaceFusion, this feature performs face fusion and replaces the original image, making it ideal for images with multiple people.

FC RemoveCannyFace

This node removes parts of the face detected by the Canny edge detection algorithm, useful for refining the final image.

FC ReplaceByMask

Replaces parts of the image based on a mask, allowing for precise control over which areas are modified.

FC MaskOP

Performs operations on masks, such as blurring, erosion, and dilation.

Parameters:

  • mode: Choose between blur, erosion, and dilation.
  • kernel: Adjust the strength of the operation.

FC FCCropToOrigin

Works in conjunction with FC FaceDetectCrop in square 512 mode to paste the cropped image back onto the target image based on the mask.

Parameters:

  • origin_image: The original image.
  • origin_box: The bounding box of the original image.
  • origin_mask: The mask cropped from the original image.
  • paste_image: The image to be pasted, which must match the origin_mask.

ComfyUI-FaceChain Models

ComfyUI-FaceChain utilizes several models to achieve its functionality:

  1. Face Detection Model (DamoFD): Detects faces in images.
  2. Human Parsing Model (M2FP): Segments human figures in images.
  3. Skin Retouching Model (ABPN): Enhances skin textures.
  4. Face Fusion Model: Blends facial features.
  5. FaceChain FACT Model: Generates high-quality, identity-preserved portraits.
  6. Face Attribute Recognition Model (FairFace): Recognizes facial attributes. Each model serves a specific purpose, from detecting and segmenting faces to enhancing and blending them, ensuring high-quality results.

Troubleshooting ComfyUI-FaceChain

Common Issues and Solutions

  1. Faces Not Detected:
  • Ensure the image quality is high and the faces are clearly visible.
  • Adjust the face detection parameters.
  1. Cropping Issues:
  • Verify the cropping mode and parameters.
  • Use the face_index parameter to select the correct face if multiple faces are present.
  1. Fusion Artifacts:
  • Check the style and fusion settings.
  • Experiment with different models and parameters to achieve the desired effect.

Frequently Asked Questions

  • How do I load a new style?
  • Use the FC StyleLoraLoad node to load and merge new style LoRas.
  • Can I process multiple faces in one image?
  • Yes, use the face_index parameter to select and process each face individually.
  • What if the output image looks unnatural?
  • Adjust the fusion and segmentation parameters to refine the results.

Learn More about ComfyUI-FaceChain

For additional resources, tutorials, and community support, consider the following:

ComfyUI-FaceChain Related Nodes

RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.