***Flux Klein Swap Anyting (head, face, body etc..) ***
About Native Workflow; FIRST OF ALL UPDATE YOUR COMFYUI !!!
This has been the best node I've tried so far. In my tests, I saw that the 3.1 model made much better choices. Instead of person mask, I put the Sam3.1 text option where the prompt is entered. You can download the model from here and put it in the checkpoint folder; https://huggingface.co/Comfy-Org/sam3.1/tree/main/checkpoints
____________________________________________________________
About V2; Only python 3.12. If anyone runs this node on Python 3.13, can they share it with me?
I use a different node that performs the same function in place of the original Sam3 node. yolain/ComfyUI-Easy-Sam3.
Please upgrade your photobuf and mediapipe for "personmask" ( python_embeded\python.exe -m pip install --upgrade mediapipe protobuf google-cloud-videointelligence )
______________________________________________________________
In this workflow, you can easily swap anything you want with high CONSISTENCY* and without node complexity. The chance of facial mixing is ZERO. Although Flux Klein is not as consistent as qwen in terms of character consistency, I believe it performed well in this workflow.
Here, I utilized the advanced SAM3 model. You can easily swap faces, heads, just hair, or a part of an object. Simply type what you want to mask into the SAM3 Text Prompt panel. For example, "woman's head" or "man's hat." Everything you type in the prompt will be masked.
Just upload the relevant images to the corresponding "load image" section. You can use any checkpoint you like.
Those experiencing Tensor issues. They should first perform the comfyui update.
There are two files in the zip. One is for those experiencing tensor issues. Of course, first try installing the "normal" version. The normal version works better for "outfit swapping." If you encounter problems, install the second "tensor fix" file.
Thanks, @nroonarij129 found a solution to the tensor error problem.
***((1: Unpack the Subgraph "Person Mask".
2: Double left click on the Comfy UI canvas to bring up the Node Search Menu. Search for and add a new node, "LayerUtility: ImageRemoveAlpha".
3: Connect a new spaghetti string from the "img" output of the LayerMask: PersonMask Ultra V2 node, to the RGBA_image input of the new node you just added (LayerUtility: ImageRemoveAlpha).
4. Connect the RGB_Image output from the new node, LayerUtility: ImageRemoveAlpha, to the Draw Mask on Image node.***
I'm new to this, and this is my first workflow. I hope I haven't done anything wrong.
☕ Buy Me a Coffee:
🔗 https://buymeacoffee.com/ugurdoyduk
* HEAD OR FACE SWAP
Prompt Sam3 text2; "The woman's head"
Prompt Sam3 Text1; "The woman's face"
Leave Clip Text Encode blank. No matter what prompt I wrote, it caused problems with face and body colours and created disproportionate heads.
* OUTFIT CLOTHING
(When changing outfits, img1 becomes the location of your model, while image2 becomes the location of the reference outfit.)
Prompt Sam3 text2; "outfit"
Prompt Sam3 Text1; "clothe"
"Style the woman in image1, with every article of clothing in image2"
* FOOD, ITEMS, THINGS SWAP
(Bypass ToolYoloCropper)
Specify what will be exchanged in Sam3 text2 and text1.
Replace the masked area with the " your object for example chocolate" in image2. Keep everything else the same.
Ensure the replaced object fits perfectly into the area in a balanced manner. Make sure it complies with the laws of physics.
Description
New Native Node. With Sam3.1 Model.
FAQ
Comments (12)
Thank for your workflow but i receive error:
DrawMaskOnImage:
Runtime error: The size of tensor a (4) must match the size of tensor b(3) at non singleton dimension 2
Any idea , the only thing i change is model diffusion by quantization of him.
Great workflow! The workflow is clear and easy to follow. I noticed that most of the time after face swap, the result doesn’t look very similar to the original face. I’m not sure if some settings are off—maybe there’s something like a mask opacity setting?
Anyone have any tricks on how to change the face of only one person when there are multiple faces in the photo? The workflow keeps trying to change all faces. Otherwise, awesome workflow.
Right-click on the image where you want to swap faces, select the "Mask" option, and use the brush to paint over the face of the person whose face you want to swap. I’ve never used this workflow before, but this is the standard method.
@cromtiersen262 thanks friend!
I've encountered some problems and would like to ask the poster for help:TypeError: patched_forward_orig() got an unexpected keyword argument 'timestep_zero_index'
Thank you very much!
Not working
Hello
does this only do face swap ? Can we do other stuff ? for example transferring a makeup. or changing the face expression to the other image
Not only the face swap. It can swap Clothe, object etc. Can't swap what you say :)
I don't have this workflow working. An error has occurred.
The error message is "RuntimeError: mat1 and mat2 shapes cannot be multiplied (512x12288 and 7680x3072)" 야.
I asked Google Gemini.
"It is responsible for face replacement and masking on the workflow, and consequently, the sections that are incompatible with the FLUX model are the following nodes: "Face or Outfit Prompt (Node 286)": This node processes the input of prompts to replace faces or clothes. "Sam3.1 Prompt Section A (Node 265) & Section B (Node 266)": These nodes use the 'Segment Anything Model (SAM)' to mask the replacement area. "Load Checkpoint (Sam3.1) (Node 255)": The most fundamental cause. Here, we are loading the "sam3.1_multiplex_fp16.safetensors" model, which has an SDXL-based architecture, not dedicated to FLUX. This causes the error because the data structure (mat1) and operation of the FLUX model are not possible."
They gave me this answer. I hope you can refer to it.
You just HAD to use some garbage custom node, don't you?
Which one?





