ComfyUI  >  Tutorials  >  Guide to Using ComfyUI Reactor for Video Face Swapping

Hey AI animation lovers! We're setting off on a thrilling journey into the world of ComfyUI face swapping. Here, we present to you the ComfyUI Reactor workflow, enabling you to swap either a single face or multiple faces in a video!

We will cover:

  1. Roop vs. Reactor
  2. What is ComfyUI Reactor?
  3. How to Use Reactor in ComfyUI?
    • Setting Up Your Images
    • Face Swap Model
    • Face Detection
    • Face Restore
    • Face Restore Visibility & CodeFormer Weight (Fidelity)
    • Detect Genders
    • Introducing Face Index for Single or Multiple Face Swaps in Video
  4. Smart Frame Interpolation if needed
  5. Resize and Refine if needed
Access ComfyUI Workflow
Dive directly into <ReActor | Fast Face Swap> workflow, fully loaded with all essential customer nodes and models, allowing for seamless creativity without manual setups!
Get started for Free

1. Roop vs. Reactor

I guess some of you had used the Roop extension in Automatic 1111 for these kinds of creative experiments, but the code for Roop is discontinued. Motion designers and animators are embracing the new champion of face swapping – ReActor in ComfyUI. This tool isn't just an upgrade from Roop; it's a complete revolution. ReActor has transformed face swapping into a seamless and exciting part of your creative toolkit.

So, why is ReActor the new go-to for face swapping? Here's the rundown:

  • High-Resolution Face Swaps with Upscaling: Say goodbye to blurry images and hello to crystal-clear, sharp visuals.
  • CPU-Friendly: No need for a high-end GPU, making it accessible for more users.
  • Universal Compatibility: Works like a charm with SDXL and 1.5 Models – it's like having a universal remote for face swapping!
  • Smart Detection: Automatic gender and age detection means it knows exactly who's who in your video.
  • Uncensored Creation: With no NSFW filter, your creativity can truly run wild.
  • Continuous Improvements: ReActor keeps getting smarter and better, just like a fine wine that ages gracefully.

Now, let's do more than just talk about it; let's dive into how to use Reactor in ComfyUI and how to set up the parameters in Reactor! With ReActor, your creative possibilities are endless.

2. What is ComfyUI Reactor?

ComfyUI Reactor is a fast and simple face swap extension node for ComfyUI. It leverages multiple models to facilitate face detection, face swapping, and face restoration, all while maintaining ease of use.

3. How to Use Reactor in ComfyUI?

Alright, let's dive into the exciting process of crafting your workflow. With Reactor, you'll be able to add some incredible face swap effects to your animations.

3.1 Setting Up Your Images

First things first, you need to pick your 'source image' - think of this as the face donor. Then, choose your 'input image' – that's the lucky recipient of the new face.

Guide to Setting Source and Input Images for Fast Face Swapping with ReActor in ComfyUI

3.2 Face Swap Model

We’ve already download inswapper_128.onnx Model, pre-trained models inswapper_128.onnx, which are provided by InsightFace.

3.3 Face Detection

Face Detection is like having a digital detective that spots faces in both your source and input images. We've got a variety of detectives - resnet50, mobile0.25, YOLOv5l, and YOLOv5n. But our go-to is the retinaface_resnet50. Its performance well.

3.4 Face Restore

Here, you can pick a model for face restoration. Some prefer GF PGN, but give Code Forer a try - it’s also great!

3.5 Face Restore Visibility & CodeFormer Weight (Fidelity)

These settings are like tuning your guitar. The default settings are 1.00 for visibility and 0.75 for CodeFormer weight, but don't hesitate to play around and see what tunes you can create.

3.6 Detect Genders? Maybe Not

The 'detect genders' option decides if you want the model to figure out the gender in the images. ReActor will swap a face only if it meets the given condition. In my experience, setting it to 'no' gives great results. maybe It's like telling the model, "All eyes on the face, model babe!"

Instructions for Configuring ReActor (Fast Face Swap) in ComfyUI

3.7 Introducing Face Index

Face Index helps the system identify each face in your images. The faces are tagged from left to right and top to bottom in their respective images. This way, the system knows exactly who's who.

3.7.1 Setting Up for a Single Face Swap

Got just one face to swap? Easy! Both the source face and the input face will have an index of 0.

How to Set the Face Index for Swapping a Single Face Using ReActor (Fast Face Swap) in ComfyUI

3.7.2 Setting Up for Multiple Faces

Now, if you're feeling ambitious and want to swap multiple faces, here's how it's done:

Multiple Faces Swap in Separate Images
  • When dealing with the character on the left in your animation, set both the Source and Input Face Index to 0. This instructs the Reactor to, "Utilize the Source Image for substituting the left character in the input image."
  • For the character positioned on the right, adjust the Source Index to 0 and the Input Face Index to 1. This directs the Reactor to, "Employ the Source Image for replacing the right character in the input image."
  • Remember, if each character is in a separate image, you'll need two sets of Reactor nodes.
How to Set the Face Index for Swapping Multiple Faces with Different Source Images Using ReActor (Fast Face Swap) in ComfyUI
Multiple Faces Swap in One Image
  • If you have an image with two characters, one Reactor node will do the trick.
  • Here's where it gets fun. You can mix and match faces. Let's say you want to swap the second face in the input image (that's index = 1) with the first face in the source image (index = 0), and you want to swap the first face in the input image (that's index = 0) with the second face in the source image (index = 1). All you need to do is set your indices like this: Source - 0,1; Input - 1,0.
How to Set the Face Index for Swapping Multiple Faces with a Single Source Image Using ReActor (Fast Face Swap) in ComfyUI

4. Smart Frame Interpolation if needed

Here's a handy tip - consider using a frame interpolator. Imagine it as a time machine for your video frames. It works wonders by reducing the number of frames you need to process initially and then brilliantly reconstructs them later. This is particularly useful if you've had to compromise on your video's quality for the sake of speedier processing. Think of this step as a magic wand that helps you recapture some of that lost clarity and detail.

Enhancing Videos or Animations Using Frame Interpolator in ComfyUI

5. Resize and Refine if needed

You can also resize your video images before passing them to the interpolator. While it's difficult to achieve the quality of the original file, it's certainly better than nothing.

Resizing Videos or Animations with the Resize Feature in ComfyUI
Access ComfyUI Workflow
Dive directly into <ReActor | Fast Face Swap> workflow, fully loaded with all essential customer nodes and models, allowing for seamless creativity without manual setups!
Get started for Free

Author: RunComfy Editors

Our team of editors had been working with AI for more than 15 years, starting with NLP/Vision in the age of RNN/CNN. We had amassed tremendous amount of experiences on AI Chatbot/Art/Animation, such as BERT/GAN/Transformer, etc. Talk to us if you need help on AI art, animation and video.

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.