How to Face Swap in Stable Diffusion with ReActor Extension

Updated
How to Face Swap in Stable Diffusion with ReActor Extension
Take a face swapping journey with Stable Diffusion and the ReActor extension. This guide walks you through downloading and using it for flawless face swaps, expanding your creative horizons.

1. Introduction Face Swaps Stable Diffusion

Roop Extension

Face swapping has become a widely popular and creative trend within the Stable Diffusion community, allowing enthusiasts to generate remarkably realistic images through innovative techniques. Previously, the Roop extension held a prominent position in facilitating seamless face swaps.

How to Face Swap in Stable Diffusion with Roop Extension

As the code for Roop is no longer actively maintained, users are now seeking alternative solutions for their face-swapping endeavors, although the Roop Extension does still work perfectly.

ReActor Extension

In response to this demand, we present the ReActor Face Swapping Extension—a powerful tool designed to fill the void left by Roop. In this comprehensive guide, we will explore the steps to download and utilize the ReActor extension in Stable Diffusion for achieving lifelike face swaps. Further information can be found on the official ReActor GitHub page.

2. Advantages of the ReActor Extension over Roop

  • High-Resolution Face Swaps with Upscaling
  • Efficient CPU Performance
  • Compatibility Across SDXL and 1.5 Models
  • Automatic Gender and Age Detection
  • No NSFW Filter (Uncensored)
  • Continuous Development and Updates

In summary, the ReActor Extension stands out for high-resolution face swaps with advanced upscaling, optimized for CPU-only setups, offering versatility across SDXL and 1.5 models. It simplifies face-swapping with automatic gender and age detection, supports uncensored swaps, and excels in continuous development for evolving features and advancements in face-swapping technology.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds
20% bonus on first deposit

3. Installation Guide: Setting Up the ReActor Extension in Stable Diffusion

Do you have Roop installed?

Prior to installing the ReActor Extension, it's essential to adhere to these steps if you currently have the Roop Extension installed. If Roop is not installed, you can bypass the following steps and head to the "Installing ReActor Extension" section.

  • Ensure to deactivate the Roop Extension in the Extensions tab of the web UI by unticking the checkbox and click "Apply and restart UI".
  • Also make sure to rename the "\stable-diffusion-webui\models\roop" folder to "\stable-diffusion-webui\models\insightface"

Installing ReActor Extension

  • On Windows, download and install the Community Visual Studio.
  • Open Stable Diffusion and go to the "Extensions" tab of the web UI.
  • In the "Install from URL" tab, paste the following URL: https://github.com/Gourieff/sd-webui-reactor

how-to-face-swap-in-stable-diffusion-with-reactor-extension-installing-reactor_extension.webp

Once the installation process is finished, head to the "Installed" section. Click on "Apply and restart UI" to initiate a restart of the User Interface, ensuring the successful integration of the extension.

ReActor Extension Folder Location

Upon successful installation, you can find the downloaded extension in the "\stable-diffusion-webui\extensions" folder. There will be a folder named "sd-webui-reactor" in this directory.

ReActor Extension Installation Errors?

If you encounter any errors during the installation of the ReActor Extension, we recommend checking out the official ReActor GitHub Page. It features a comprehensive "Troubleshooting" section that explains common errors along with their solutions.

4. Exploring the ReActor Face Swapping Extension (Stable Diffusion)

Upon successful installation, observe the appearance of the ReActor expansion panel in both the "txt2img" and "img2img" tabs within the Stable Diffusion UI.

how-to-face-swap-in-stable-diffusion-with-reactor-extension-reactor_expansion_panel_nextdiffusion.webp

Face Swapping with ReActor Extension

ReActor's face-swapping process follows a two-step approach just like the Roop Extension. Initially, the AI image undergoes complete rendering, and then the face from the ReActor image is applied. This distinction becomes evident during rendering, where the image seems finalized but requires additional time for face integration. Now let's try an example!

  • Head over to the "txt2img" tab within Stable Diffusion
  • Open the ReActor Expansion panel and drag an image on the canvas

how-to-face-swap-in-stable-diffusion-with-reactor-extension-reactor_drop_image_extension_nextdiffusion.webp

  • "Enable" ReActor by checking the checkbox
  • Create both a Positive and Negative prompt
  • Click "Generate"

Note: The first face swap with the reActor extension may take longer as it unpacks the required models from a zip file, but subsequent swaps will be faster.

Face Swapped Example (Ana de Armas)

The final result is the generation of a striking face that resembles Ana de Armas, crafted based on your provided input prompt.

how-to-face-swap-in-stable-diffusion-with-reactor-extension-reactor_face_swap_example.webp

  • Positive Prompt: 30 year old woman, white silk dress, red lips, waist and up, upper body, cleavage, outdoor, tropical plants in background, white villa background, natural light, perfect light, perfect shadows, facing camera, looking in camera, dynamic pose
  • Negative Prompt: (worst quality:1.2), (low quality:1.2), (lowres:1.1), (monochrome:1.1), (greyscale), multiple views, comic, sketch, (((bad anatomy))), (((deformed))), (((disfigured))), mutation hands, mutation fingers, extra fingers, missing fingers, watermark
  • Sampling Steps: 30
  • Sampler: DDIM
  • CFG scale: 7
  • Size: 704x392
  • Model: Realistic Vision
Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

5. High-Resolution Face Swaps: Upscaling with ReActor

Using the ReActor Extension, you can enhance your face-swapped image by utilizing the upscale feature. To do this, navigate to the "Upscale" subtab within the ReActor Extension.

ReActor Upscaling Settings

You can choose to face swap first and then upscale by enabling the checkbox (recommended for optimal results). Now, you can select your preferred upscaling method, I personally recommend the 4x-UltraSharp upscaler. For more details on upscaling within Stable Diffusion:

High-Quality Upscaling Made Easy in Stable Diffusion

Here is an example of the settings, showcasing the appearance when scaling the face-swapped image with the 4x-UltraSharp upscaler and scaling it by a factor of 2.

how-to-face-swap-in-stable-diffusion-with-reactor-extension-high_quality_upscaling_nextdiffusion.webp

Upscaled Images Output Location

  • When using the "txt2img" tab: Upon image generation, the upscaled image will be visible in the default folder: "\stable-diffusion-webui\outputs\txt2img-images".
  • When using the "img2img" tab: Upon image generation, the upscaled image will be visible in the default folder: "\stable-diffusion-webui\outputs\img2img-images".

6. Face Swapping Multiple Faces with ReActor Extension

By following this tutorial you might have come across a section within the extension where you have the "Source Image" and "Target Image" sections.

how-to-face-swap-in-stable-diffusion-with-reactor-extension-multiple-face-swaps.webp

We will try to explain the sections by giving an example of the logic.

Source Image Explanation

The source image is the picture you put on the ReActor Canvas. Usually, you'll drop a photo with just one face, and the default face number is 0 for that face. But what if you put an image on the canvas with multiple faces?

Here's an example: I dropped a picture of two actresses' faces. Now, I want to assign numbers to each face, separated by commas. This way you can specify the face you want the "Target Image" to have when generating. For this example, I'll use: 0, 1 when assigning face numbers.

how-to-face-swap-in-stable-diffusion-with-reactor-extension-multiple-face-swaps_source_image_nextdiffusion.webp

Assigned faces:

  • Face number 0: Angelina Jolie
  • Face number 1: Jenna Ortega

Target Image Explanation

Here, you can enter the face numbers (assigned in the "Source Image" section) that you want for the output. For instance, if I'm generating an image with two women and I want the one on the right to have Angelina Jolie's face (Face Number 0) and the one on the left to have Jenna Ortega's face (Face Number 1), I need to assign these numbers correctly, like: 1,0, within the "Target Image."

how-to-face-swap-in-stable-diffusion-with-reactor-extension-multiple-face-swaps_target_image_next_diffusion.webp

Example Images Multiple Face Swaps

how-to-face-swap-in-stable-diffusion-with-reactor-extension-multiple-face-swaps_target_image_next_diffusion_2.webp

Important Notice!

When attempting this approach, it's important to note that if your Source Image has "X" number of faces, your output must have at least the same number of faces as the source image for it to function correctly. Ensure that you modify your prompt to guarantee that your output will have the necessary minimum faces.

Stable Diffusion in the Cloud⚡️Run Automatic1111 in your browser in under 90 seconds

7. Conclusion

In conclusion, the ReActor Extension excels in face swapping within Stable Diffusion, offering high-resolution capabilities and versatile compatibility. The installation process, especially for Roop Extension users, is pivotal. ReActor's features promise a rich creative experience, and exploring its capabilities, from simple swaps to enhanced upscaling, unveils its potential. Understanding source and target image logic is crucial, emphasizing the need for matching face numbers for successful outcomes. This guide serves as a comprehensive resource for a seamless journey with the ReActor Extension in Stable Diffusion.

Frequently Asked Questions

The ReActor Extension introduces several improvements over the Roop Extension in Stable Diffusion face swapping. Notable advantages include high-resolution face swaps with upscaling, efficient CPU utilization, compatibility with both SDXL and 1.5 models, automatic gender and age detection, uncensored options, and continuous development. Users transitioning from Roop to ReActor should follow the installation guide, ensuring a smooth switch between extensions.

Upscaling in the ReActor Extension enhances the quality of face-swapped images. To implement this feature, navigate to the "Upscale" subtab within the extension. Enable the checkbox for face swapping before upscaling for optimal results. Choose your preferred upscaling method, such as the 4x-UltraSharp upscaler, to achieve visually stunning and high-resolution outputs.

Yes, the ReActor Extension provides the flexibility to generate face-swapped images without imposing an NSFW filter. Users are encouraged to explore their creative boundaries. However, it's essential to exercise responsible and mature judgment, as highlighted in the official GitHub page. Users should understand the distinction between appropriate and inappropriate content, taking full responsibility for their actions.

The ReActor Extension is optimized to work efficiently on both CPU-only and GPU setups. This flexibility allows users to utilize the extension based on their available hardware resources. Whether you have a dedicated GPU or are relying on CPU processing, the ReActor Extension ensures a smooth face-swapping experience without compromising performance.