ComfyUI Reactor is a quick and easy face-changing expansion node for ComfyUI. It utilizes multiple models to facilitate face detection, face swaps and recovery while maintaining ease of use.
First, you need to select "Source Image" - consider it as a face donor. Then, select your "Input Image" – this is the lucky receiver of your new face.
We have downloaded the inswapper_128.onnx model, i.e. the pre-trained model inswapper_128.onnx, provided by InsightFace.
Face detection is like having a digital detective that can recognize faces in both source and input images. We have all kinds of detectives - resnet50, mobile0.25, YOLOv5l and YOLOv5n. But our first choice is retinaface_resnet50. It performs very well.
Here you can choose a model for facial repair. Some people prefer GF PGN, but give Code Forer a try - it's great too!
These settings are like adjusting the guitar. The default setting is Visibility 1.00 and CodeFormer weight 0.75, but don't hesitate to try it out and see what tunes you can create.
The Detection Gender option determines whether you want the model to determine the gender in the image. ReActors exchange faces only when a given condition is met. In my experience, setting it to No will have a good effect. Maybe it's like telling the model, "Everyone's eyes are focused on the face, model baby!"
Face index helps the system recognize each face in the image. Faces are marked from left to right, from top to bottom in their respective images. In this way, the system can know exactly who is who.
Just exchange a face? Simple! The indexes of both the source face and the input face are 0.
Now, if you are ambitious and want to swap multiple faces, you can follow these steps:
1. When processing the character on the left in the animation, set both the source and input surface index to 0. This will instruct Reactor to "replace the left-hand character in the input image with the source image". 2. For characters on the right, adjust the source index to 0 and the input face index to 1. This will instruct Reactor to "replace the right character in the input image with the source image". 3. Remember that if each character is in a separate image, you need two sets of Reactor nodes.
1. If you have an image with two characters, a Reactor node will solve the problem. 2. The interesting place is here. You can mix and match faces. Suppose you want to swap the second face in the input image (index = 1) with the first face in the source image (index = 0) and you want to swap the first face in the input image (index = 0) with the second face in the source image (index = 1). All you need to do is set your index like this: Source - 0,1; Input - 1,0.
Here is a practical trick - consider using a frame interpolator. Imagine it's a time machine for video frames. It produces miracles by reducing the number of frames that need to be processed initially and then rebuilding them well later. This is especially useful if you have to sacrifice video quality in order to speed up processing. Think of this step as a magic wand to help you regain some of the lost clarity and detail.
You can also resize the video image before passing it to the interpoler. Although it is difficult to achieve the quality of the original file, it is better than nothing.