Jarvislabs.ai

Face Restoration

Restoring faces in Automatic1111

Say goodbye to disfigured faces! This documentation will show you how to fix distorted and unnatural faces in your Automatic1111 images.

There are three ways that you can use to restore faces in Automatic1111.

  • Settings
  • Inpainting
  • Upscaling

Image

This is my image that I have generated in Automatic1111.

Imagewithimproperface

Positive Prompt

Portrait of a girl, white dress,blonde hair, street background

Negative Prompt

bad anatomy, bad hands, three hands, three legs, bad arms, missing legs, missing arms

Other Settings

Steps: 20
Sampler: DPM++ 2M Karras
Face Restoration: None
CFG scale: 7
Seed: 1412082313
Size: 512x512
Model hash: 345033419b
Model: portrait_10
Version: v1.6.0-2-g4afaaf8a

You can see that the face is disfigured and not good.

Settings

Automatic1111 offers a built-in "Face Restoration" setting that can significantly improve the quality of generated faces. This setting utilizes additional models within the diffusion process to refine facial features and minimize artifacts.

In Automatic1111 you can see settings option on the top.

JITcHpS.md.avif

Navigate to settings. In settings you can see face restoration in the sidebar. Click it.

JITExKg.md.jpg

You can choose whatever face restoration model and choose your own model weight based on how much you want to fix the face in your image.

GFPGAN

It's a very basic image blend - it's the same as having opacity control over that layer. If you want to control the intensity of the face correction, then you can play with the codeformer weight, but there is no such control for GFPGAN.

Codeformer

A Transformer-based prediction network, named CodeFormer, to model global composition and context of the low-quality faces for code prediction, enabling the discovery of natural faces that closely approximate the target faces even when the inputs are severely degraded.

JI7ZpKx.md.avif

Now let's compare the results from CoderFormer and GFPGAN.

JIuJN1f.md.avif

From the above pictures we can see that CodeFormer has actually done a good job trying to get the facial features right. GFPGAN is known for making the facial structure right. Since each algorithm has its own advantages and disadvantages, it is recommended to try both and check which one works best for your use case.

Result

JIuFI4a.md.avif

Positive Prompt

Portrait of a girl, white dress,blonde hair, street background

Negative Prompt

bad anatomy, bad hands, three hands, three legs, bad arms, missing legs, missing arms

Other Settings

Steps: 20
Sampler: DPM++ 2M Karras
Face Restoration: CodeFormers
CFG scale: 7
Seed: 1412082313
Size: 512x512
Model hash: 345033419b
Model: portrait_10
Version: v1.6.0-2-g4afaaf8a

Inpainting

Inpainting is a technique of filling in missing regions of images that involves filling in the missing or damaged parts of an image, or removing the undesired object to construct a complete image. Using this feature we can fix our generated image's face.

To inpaint your generated image you just have to simply press the inpaint button below your generated image.

JI7TNYQ.md.avif

After pressing the inpaint button. You'll be redirected to inpaint window. Now you can paint the part of your generated image to restore or regenerate.

JI771st.md.avif

These are the settings that I have used to inpaint the image. JI7lyPI.md.avif

Comparison

JI7GaV4.md.avif

Upscaling

You can also restore faces in your image while upscaling it. To upscale you image go to the extras tab.

JI7sycN.md.avif

After navigating to the extras tab you can see that we have the face restoration options like GFPGAN visibility and CodeFormers visibility. You can select the visibility of any face restoration model you want.

JI7tv5B.md.avif

Comparison

JIY9Cfn.md.avif

There you go, you restored the faces in your image as well as upscaling it.

References

GFPGAN check it out to learn about it.

CODEFORMERS learn more about codeformers.

Previous
Image2Image