Common problems in AI images and how to fix them

86,383 views
Updated Categorized as Tutorial Tagged , 16 Comments on Common problems in AI images and how to fix them
Two head problems.

Two heads? Extra fingers? Here’s a guide to fix these common problems.

Stable Diffusion Software

We will use this Stable Diffusion GUI for this tutorial. See my quick start guide for setting up in Google’s cloud server.

Two-head problems

two head problems in Stable Diffusion.

If you browse AI image sites, it’s not unusual to see images with two heads connecting together in Stable Diffusion. It is usually caused by using a portrait image size. Any image size that deviates from 1:1 aspect ratio has the potential of synthesizing the dreaded two heads.

To avoid it, use image size with 1:1 aspect ratio, for example, 512×512.

Three ways to tackle the two-head problem:

  1. Generate multiple images and discard those with two heads. (It’s not a bad idea, but it can cost you time and money.)
  2. Reduce aspect ratio. The closer to 1:1 ratio, the less likely you would encounter the infamous two-head.
  3. Generate a full-body image. (See next section for techniques.)

Not showing full body

AI artists highly seek full-body portraits. But it is also an area with which Stable Diffusion can have the most problems.

A common suggestion to get a full-body image is to use the keyword “full body portrait”. But more often than not, it just doesn’t work. Below are a few examples with the “full body portrait” keyword added. You can see the keywords are completely ignored.

Positive prompt:

[Amber Heard: Ana de Armas :0.3],((Victorian)) , Feminine,((Perfect Face)), ((arms outstretched above head)), ((Aype Beven)), ((scott williams)) ((jim lee)),((Leinil Francis Yu)), ((Salva Espin)), ((oil painting)), ((Matteo Lolli)), ((Sophie Anderson)), ((Kris Anka)), (Intricate),(High Detail), (bokeh).

Negative prompt:

((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))), out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck)))

Describing the lower body

A more consistent approach is to add keywords of what you want to see in the picture. For example

  • standing
  • long dress
  • legs
  • shoes

Below are generated with adding keywords standing and long dress.

Adding “standing” and “long dress” to the positive prompt.

Now it is showing more of the body, but we can do better.

Use portrait size

Previously, I said don’t use portrait size. But there are exceptions. You do want to use portrait size if you want to generate a full body image. Below are some examples of using portrait size in addition to using “standing” and “long dress” keywords.

Changing the image to portrait size.

Garbled faces and eyes

It is fairly common to see distorted faces. In fact, it happens to other body parts, just that our brain is particularly sensitive to any asymmetry in faces.

Inpainting

Inpainting is the go-to way to messed-up faces. The main reason for generating is that not enough pixels cover the face. You can send the picture to the inpainting tab and regenerate the face at a higher resolution.

See the inpainting article for a step-by-step guide.

Automatic inpainting

If you use Stable Diffusion to generate images of people, you will find yourself doing inpainting quite a lot. The process is mechanical and time-consuming. Why not automate it? The Adetailer extension does just that.

Face Restoration

Turn on face restoration to fix faces and eyes if your GUI supports it. See my previous post for details. If you are using a free site with no built-in face restoration support, use the following sites for post-processing.

Face restoration recovers eyes and facial details.

In AUTOMATIC1111, you can enable Face Restoration on the Settings page > Face Restoration > Select Restore Faces.

Adjust the Codeformer weight to the lowest effect (highest value) you can get away with.

The drawback of this approach is that it may affect the style. The restored faces may have a slightly different style than the rest of the image.

Remember to turn it off when you are done.

Use an improved VAE

Do you know Stability AI released a patch to v1.4 and v1.5 models to fix eyes? They are called VAE. Check out this article for a guide to installing and using.

Use Hi-Res Fix

A garbled face is often caused by insufficient pixel coverage: The face is not covered by enough pixels to be rendered correctly.

To enable Hi-Res Fix, Click the Hires. Fix section on the txt2img page in AUTOMATIC1111. The default setting is good to go. Adjust the Upscaling by factor to adjust the final image size.

Messed-up finger

It’s well-known in the stable diffusion community that AI has problems getting fingers right. It is common to see distorted, too many or too few fingers.

The first fix is to include keywords that describe hands and fingers, like “beautiful hands” and “detailed fingers”. That tends to prime the AI to include hands with good details.

The second fix is to use inpainting. Create a mask in the problematic area. Use inpainting to generate multiple images and choose the one you like. I found it sufficient to reuse the same prompt as the original image.

Left: original image. Middle: inpainting mask. Right: inpainted image.

Summary

In this post, we have detailed the solutions to the problems of two heads, not showing full-body, garbled faces and fingers.

Check out this article for advanced prompt techniques.

Avatar

By Andrew

Andrew is an experienced engineer with a specialization in Machine Learning and Artificial Intelligence. He is passionate about programming, art, photography, and education. He has a Ph.D. in engineering.

16 comments

  1. Hi thanks for the info here. I got directed here because I generated an image with a person in it and I like it but the man is missing an entire leg. How can we get it to correct that?

  2. Hello,

    I generate images and I see the pictures, everything looks good, then when it is finished….. Everything is blue with a little orange.

  3. Can you not update the written dates of the articles, if you are not going to update them? How was this article written in November if the comments go back to February?

  4. what to do if target video have multiple faces and i want to change only one face?

    and also suggest me how to change multiple faces in videos

  5. i am having a problem anytime I ask example:- Batman fighting deathstroke it is showing me 2 batmans how can i fix this

      1. Thank you, Sir, your article made me work hard on Stable and missed a whole night’s sleep. inspired lol

Leave a comment

Your email address will not be published. Required fields are marked *