ComfyUI  >  Nodes  >  MTB Nodes >  Face Swap (mtb)

ComfyUI Node: Face Swap (mtb)

Class Name

Face Swap (mtb)

Category
mtb/facetools
Author
melMass (Account age: 3754 days)
Extension
MTB Nodes
Latest Updated
7/2/2024
Github Stars
0.3K

How to Install MTB Nodes

Install this extension via the ComfyUI Manager by searching for  MTB Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter MTB Nodes 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

Face Swap (mtb) Description

Facilitates high-quality face swaps using deep learning models for natural and realistic results.

Face Swap (mtb):

The Face Swap (mtb) node is designed to facilitate the swapping of faces between images using advanced deep learning models from the deepinsight/insightface library. This node allows you to seamlessly replace the face in a target image with a face from a source image, leveraging sophisticated face analysis and swapping techniques. The primary benefit of this node is its ability to perform high-quality face swaps that maintain the natural appearance and expressions of the faces involved. This tool is particularly useful for AI artists looking to create realistic face swaps for artistic projects, digital content creation, or entertainment purposes.

Face Swap (mtb) Input Parameters:

image

This parameter represents the target image in which you want to swap the face. It should be provided as a tensor. The target image is the one that will receive the new face from the source image.

reference

This parameter represents the source image containing the face you want to swap into the target image. It should be provided as a tensor and must have a batch size of 1. The source image provides the face that will be transferred to the target image.

faces_index

This parameter is a string that specifies which faces to swap in the target image. It should be a comma-separated list of indices (e.g., "0,1,2"). The indices correspond to the detected faces in the target image, allowing you to select specific faces for swapping. The default value is "0".

faceanalysis_model

This parameter specifies the face analysis model to be used for detecting and analyzing faces in the images. It should be one of the available face analysis models, such as "antelopev2", "buffalo_l", "buffalo_m", or "buffalo_sc". The face analysis model is crucial for accurately identifying and extracting facial features.

faceswap_model

This parameter specifies the face swap model to be used for performing the face swap. It should be one of the available face swap models, which are typically pre-trained models in ONNX or PTH format. The face swap model is responsible for the actual face swapping process.

preserve_alpha

This optional parameter is a boolean that determines whether to preserve the alpha channel (transparency) of the target image. If set to True, the alpha channel will be preserved. The default value is True.

Face Swap (mtb) Output Parameters:

IMAGE

The output parameter is the resulting image with the face swapped. It is returned as a tensor. This image will have the face from the source image seamlessly integrated into the target image, maintaining the natural look and feel of the original images.

Face Swap (mtb) Usage Tips:

  • Ensure that the reference image (source image) has a clear and well-lit face for the best results.
  • Use the faces_index parameter to specify which faces in the target image you want to swap, especially if there are multiple faces detected.
  • Experiment with different face analysis and face swap models to find the one that best suits your needs and provides the highest quality results.
  • If your target image has transparency, set preserve_alpha to True to maintain the alpha channel in the output image.

Face Swap (mtb) Common Errors and Solutions:

No face swap model provided

  • Explanation: This error occurs when the face swap model is not specified or loaded.
  • Solution: Ensure that you have selected and loaded a valid face swap model using the faceswap_model parameter.

No source face found

  • Explanation: This error occurs when the face analysis model fails to detect a face in the source image.
  • Solution: Verify that the source image contains a clear and well-lit face. You may also try using a different face analysis model.

No target face found for <face_num>

  • Explanation: This error occurs when the specified face index in the target image does not correspond to a detected face.
  • Solution: Check the faces_index parameter to ensure that the indices match the detected faces in the target image. Adjust the indices as needed.

Reference image must have batch size 1

  • Explanation: This error occurs when the reference image (source image) has a batch size other than 1.
  • Solution: Ensure that the reference image tensor has a batch size of 1 before passing it to the node.

Face Swap (mtb) Related Nodes

Go back to the extension to check out more related nodes.
MTB 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.