Update October 2023: ReActor is now replacing Roop as the best face swapper for Stable Diffusion. Why?
- ReActor Supports high resolution with upscaling
- Works great for CPU only (if you don't have a fancy GPU)
- SDXL and 1.5 Models compatible
- Automatically detects Gender and age of characters
- Uncensored
- And still actively being developed
Introduction
Today we are going to be diving into the Roop ReActor extension to see how we can swap faces!
It is super simple to use, and you only need one input photo to get dramatic results like this:
For anyone running it locally, there a few extra installation steps which we will go through below. If you're using Think Diffusion, you can skip the Visual Studio and Roop installation steps since everything is pre-installed.
Installing Visual Studio
Firstly, we need to install Visual Studio to download and install Visual Studio as we need access to the Python and C++ packages:
- Download the free community edition: Visual Studio
- When installing Visual Studio, make sure to enable Python development, Desktop development with C++ and Visual Studio extension development
- The next step is to open a command window and run the following command pip install insightface==0.7.3
Installing Roop
We are now ready to install Roop as an extension.
- Head over to the extensions tab
- And then within the install from url tab...
- Copy and paste the following: https://github.com/s0md3v/sd-webui-roop
- And click Install
- Once installed, you will need to close down your instance of Stable Diffusion and relaunch the webui-user.bat file. Congratulations, you now have Roop installed as an extension!
Using Roop
Let's first create the image onto which we will then swap a face on. I'm going to make my own and use my face so I don't get sued 😅
- (1) Set the Stable Diffusion Checkpoint to dreamshaper_6
- (2) We can now go into the text2img tab and we will create a few images.
- (3) Positive Prompt: A man standing, front facing, the camera, modelshoot style, (extremely detailed CG unity 8k wallpaper), full head shot, professional majestic oil painting by Ed Blinkley, Atey Ghailan, Studio Ghibly, by Jeremy Mann, Greg Manchess, Antonio Moro, trending on artstation, trending on CGSociety, Intricate, High Detail, Sharp focus, dramatic, photorealistic painting art by MidJourney and Greg Rutowski
- (4) Negative Prompt: Watermark, Text, censored, deformed, bad anatomy, disfigured, poorly drawn face, mutated, extra limb, ugly, poorly drawn hands, missing limb, floating limbs, disconnected limbs, disconnected head, malformed hands, long neck, mutated hands and fingers, bad hands, missing fingers, cropped, worst quality, low quality, mutation, poorly drawn, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, missing fingers, fused fingers, abnormal eye proportion, Abnormal hands, abnormal legs, abnormal feet, abnormal fingers
- (5) the sampling method to DPM++ 2M Karras
- (6) the sampling steps to 30
- (7a) and the CFG scale to 11
- Here is the outputted image
- Once we find an image we like, we can use the seed value of that image by entering into the Seed textbox
We can then use Roop ReActor to change the face!
- (1) Drop down the
RoopReActor section - (2) Upload an image of the face you want to swap into our original image
- (3) And select enable to ensure the
RoopReActor is activated ✅
- We can now click generate to swap the face!
Twice the fun - swap 2 faces
We can also change more than 1 persons face in an image. We will generate 2 people in an image using the following settings:
- (1) Set the Stable Diffusion Checkpoint to dreamshaper_6
- (2) Positive Prompt: (2 men standing:1.2), front facing, the camera, modelshoot style, (extremely detailed CG unity 8k wallpaper), full head shot of 2 men, professional majestic oil painting by Ed Blinkley, Atey Ghailan, Studio Ghibly, by Jeremy Mann, Greg Manchess, Antonio Moro, trending on artstation, trending on CGSociety, Intricate, High Detail, Sharp focus, dramatic, photorealistic paniting art by MidJourney and Greg Rutowski
- (3) Negative Prompt: Watermark, Text, censored, deformed, bad anatomy, disfigured, poorly drawn face, mutated, extra limb, ugly, poorly drawn hands, missing limb, floating limbs, disconnected limbs, disconnected head, malformed hands, long neck, mutated hands and fingers, bad hands, missing fingers, cropped, worst quality, low quality, mutation, poorly drawn, huge calf, bad hands, fused hand, missing hand, disappearing arms, disappearing thigh, disappearing calf, disappearing legs, missing fingers, fused fingers, abnormal eye proportion, Abnormal hands, abnormal legs, abnormal feet, abnormal fingers
- (4) the sampling method to DPM++ 2M Karras
- (5) the sampling steps to 30
- (6) the CFG scale to 11
- Set the Seed to the same value as your original image
- Drop down the Roop section,
- Upload an image of the face you want to swap into our original image. This time I will upload a picture of a young lady.
- And select Enable ✅ to ensure the Roop is activated.
- Type in 0, 1 in the comma separated face number(s) top indicate that we want to change 2 faces (0 and 1)
Hit generate to see our results! Pretty cool!
Start with an existing photo as a base
If you’d like to face swap into an existing picture, not a a problem.
Again, if you're running SD locally, you'll have to install Visual Studio and Roop with the steps above first before continuing. If you're using Think Diffusion, no need since everything is pre-installed.
Click over to the Img2img tab and upload the picture of your choice. No need for any prompts.
Sliding below the uploaded image here are the next settings:
- (1) Since my original image is a certain size, I'm selecting Crop and Resize
- (2) DPM++ 2M Karras as Sampling method
- (3) Clicking Restore faces ✅
- (4) Resizing to the dimensions of the image that was just uploaded
- (5) CFG of 11
- (6) and the Denoising strength as 0, which is important so SD doesn't try to reimagine the original image.
Now make sure the Roop tab is open.
- Upload the photo of your choice
- Click Enable to make sure Roop is activated ✅
- Under face number(s) put 0 if it's not there already.
Hit Generate, And there he is!
If you’re having issues with installation or slow hardware, you can try any of these workflows on a more powerful GPU in your browser with ThinkDiffusion.
If you’d like to have more control over your character art before you start swapping faces, check out my post to using OpenPose here. Let me know what and who you're swapping, and try not to get too creepy ok??
Member discussion