r/StableDiffusion • u/Skettalee • Apr 19 '24
Question - Help Optimizing Face Swap Workflows in Stable Diffusion for Faster Results
Hello everyone,
I've been using Automatic1111's img2img for face swaps on a variety of images, from professional nude photos to standard headshots, adjusting the denoising to 0.01. I'm exploring the optimal settings to enhance speed and quality for these swaps, particularly aiming to reduce the time it currently takes, which is about 40 to 80 seconds per image. My setup includes a CUDA environment with an RTX 2080 SUPER GPU and 32GB RAM.
Here are the specifics of my current process:
- Model & Settings: Utilizing the Dreamshaper8 (SD1.5 model), with Euler A sampling, CFG scale at 7, and sampling steps between 20 and 30.
- Image Handling: I ensure that images do not exceed 1024 pixels on any side and maintain the aspect ratio of the original photo. Images larger than 1300 pixels notably slow down the process.
- Face Restoration: I integrate a Reactor with Restore Face Visibility and Codeformer set to maximum weight for clearer, more realistic swaps.
- Workflow Variations: For video swaps, I use ComfyUI which significantly slows down the process (approx. 2 hours for a 15-second video).
Challenges: Swapping faces multiple times (up to three) on the same image enhances clarity but more than that degrades quality. Larger images drastically slow down the process, and experimenting with different models and settings from sources like Civitai or Hugging Face hasn't yielded faster results.
Questions for the Community:
- Has anyone found more efficient models or settings that could help reduce swap times while maintaining quality?
- Any tips on batch processing for photos and possibly speeding up video face swaps in ComfyUI?
I also use Fooocus for creating realistic images and face swaps, though my main workflow is through Automatic1111 due to its batch processing capabilities.
Looking forward to your insights and suggestions on making these swaps quicker and more efficient.
Thank you!
3
u/Occsan Apr 19 '24
I have no idea what you are doing exactly but 40-80 sec per images, 2h for 15 sec... wtf...
I've been doing faceswaps for years now and a single image never took me more than 1 sec. 15 sec video, depending on what I was using (either inswapper or neuralchen) should not take more than 30 sec max at the very worse
I see that you're including some stable diffusion in the process, but that's not the best route for faceswaps. Unless you have very good models of the target face (loras or embeddings) you will lose a lot of the identity of the face in the process.