ComfyUI-ReActor
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
ReActorFaceSwap
ReActorFaceSwap Node Documentation
Overview
The ReActorFaceSwap node is part of the ComfyUI-ReActor extension designed to perform face swapping using advanced AI techniques. It allows users to interchange faces between images or apply pre-saved face models to new images, offering features for detection, gender specification, and face restoration. This node is designed to handle multiple faces and integrate seamlessly into ComfyUI workflows.
Features
- Advanced Face Swapping: Utilizes state-of-the-art models to swap faces in images accurately.
- Face Restoration: Integrates face restoration capabilities to enhance the quality of the swapped face.
- Gender and Index Detection: Provides options to filter faces based on gender and indexes, ensuring precise control over which faces are swapped.
- NSFW Detection: Includes a nudity detector to prevent the use of 18+ content.
Inputs
-
Enabled:
- Type: Boolean
- Description: Enables or disables the face swap process.
- Default: On (True)
-
Input Image:
- Type: Image
- Description: The image that serves as the target for face swapping (known as the "input image").
-
Swap Model:
- Type: Dropdown (Model Selection)
- Options: Various face swap models
- Description: Selects the model used for swapping faces.
-
Face Detection:
- Type: Dropdown
- Options: retinaface_resnet50, retinaface_mobile0.25, YOLOv5l, YOLOv5n
- Description: Selects the method used to detect faces in the image.
-
Face Restore Model:
- Type: Dropdown (Model Selection)
- Description: Selects the face restoration model to improve the quality of swapped faces.
-
Face Restore Visibility:
- Type: Float (Range: 0.1 to 1.0)
- Description: Sets the visibility of the restored face in the final output.
-
Codeformer Weight:
- Type: Float (Range: 0.0 to 1.0)
- Description: Determines the interpolation weight for the Codeformer face restoration model.
-
Detect Gender (Input / Source):
- Type: Dropdown
- Options: No, Female, Male
- Description: Filters detected faces based on specified gender in both the input and source images.
-
Input / Source Faces Index:
- Type: String
- Description: Specifies the indexes of faces in both the input and source images for swapping.
-
Console Log Level:
- Type: Integer (0, 1, 2)
- Description: Sets the verbosity of console logs generated during the process.
-
Source Image:
- Type: Image (Optional)
- Description: The image containing the face(s) to swap onto the input image.
-
Face Model:
- Type: Face Model (Optional)
- Description: Uses a pre-saved face model instead of an alternative source image.
-
Face Boost:
- Type: Face Boost (Optional)
- Description: Allows additional improvement to face quality using specific boosting models.
Outputs
-
Swapped Image (IMAGE):
- Description: The final image with the faces swapped.
-
Face Model (FACE_MODEL):
- Description: The face model generated during the swapping process, useful for future swaps.
-
Original Image (IMAGE):
- Description: The untouched original image with a bypass connection for workflow continuity.
Usage in ComfyUI Workflows
Workflow Integration
- Preparation: Start by obtaining an appropriate image to act as the target for face swapping.
- Node Configuration: Use the ComfyUI to place the
ReActorFaceSwapnode into your workflow. Connect your image source node (e.g.,Load Image) to theInput Imageinput of the node. - Optional Connections: Connect a source image or a pre-saved face model to the node's optional inputs for enhanced custom scenarios.
- Output Handling: The swapped image generated by the node can be directed to other nodes for further processing, like exporting or applying additional filters.
Example Use-Cases
- Basic Face Swap: Use
ReActorFaceSwapto modify faces in personal photos by connecting appropriate input images and obtaining a naturally altered output. - Character Creation: Combine several nodes to generate unique characters by swapping various pre-saved face models across a batch of character templates.
- Video Enhancement: Process individual frames of a video with this node for a seamless face swap in motion pictures.
Special Considerations
- Ethical Use: It is critical to adhere to laws and ethical guidelines regarding face swapping, especially when handling images of real individuals.
- Model Selection: Choosing the appropriate models for both swapping and face restoration significantly influences the resulting image quality.
- Performance: Given the complexity of the operations, ensure that your system has adequate resources to handle intensive computations efficiently.
- Nudity Detector: A built-in NSFW detector ensures that content adheres to SFW (Safe for Work) standards automatically.
This node is a powerful tool in the ComfyUI extension, delivering fast and accurate face-swapping capabilities to enhance creative workflows responsibly.