Tensor.Art
Create

All you need to know about adetailer


Updated:

Hello everyone, it's me again

I have been planning to write this article for a long time age to share my experiences using the Enhance feature (or in other words “After detailer”). In this article, I will only refer to Adetailer as true to the nature of Stable Diffusion.

If you do not feel satisfied with this feature, then maybe the following article will be somewhat useful for you.

So what is Adetailer?

As mentioned above, Adetailer is short for the phrase "After Detailer".

Sometimes the AI will make some weird or worst looking details in the image, often parts that are difficult for AI to recognize such as nose, skin, hands and in some rare cases are some parts of the body.
So when you use the Adetailer feature after the image has been created by AI, the AI will re-run one more time with Adetailer models to fix these details.


To make it easier to understand, I will use the Comfyui Workflow environment to analyze for you.

After you turn on the Adetailer feature, in this case let say I want to fix the face.

Then the AI will work normally as always, they will still create images. As you can see, the details in the face are very bad. However, after the image is finally made, The AI will connect to Adetailer's model (here I am choosing face_yolo8m model) to determine which is the subject's face in the original photo.

From there, it will recreate the details again within certain areas, and here we are talking about correcting the details of the face.

And here is the result



So what are the parameters that you need to pay attention to here?

Although there are still not many options in Tungsten except "level of denoising: (to tell the AI how much level of reconstruction of details you want , recommend using level at 0.1~0.4)" , I will still explain some of it for you to understand.


guide_size: This feature attempt detail recovery only when the size of the detected mask is smaller than this value. If the size is larger, this feature increase the resolution and attempt detail recovery.

guide_size_for: This parameter determines whether guide_size is used based on the size of the detected face (bbox) or the size of the crop area that includes the face and is broadly cropped by crop_factor.

max_size: The guide_size increases the scale so that the shorter side reaches the guide_size. For masks with elongated shapes, this can cause a significant scale up. The max_size limits the maximum size of one side.

feather: When compositing the recovered details onto the original image, this feature use a gradient to composite it so that the boundaries are not visible. The thickness of this gradient is determined.

force_inpaint: force_inpaint will try to force regeneration even if it is smaller than guide_size . This function is useful when you simply want to change to another type of prompt other than the function to save details. However, in this case, upscale is forcibly fixed to 1.

noise_mask: The decision to limit the area to be regenerated using KSampler with a mask depends on whether the noise_mask is enabled or disabled. When noise_mask is enabled, only the masked area of the image is regenerated, whereas when it is disabled, the image generation occurs for the entire cropped area, with only the mask area being cut and pasted.

threshold: Detect only those object whose recognized confidence is above this set value.

dilation: Expand the detected mask area.

crop_factor: Determine how many times the surrounding area should be included in the detail recovery process based on the detected mask area. If this value is small, the restoration may not work well because the surrounding context cannot be known.

So should you always use Adtailer or not?

Of course not, even with older models of Stable Diffusion 1.5

Why? And in any case, you don't need to use it.

1. In case of creating portrait/upperbody photos

2. In case of using celebrity or real person lora, it will cause the face to become inaccurate compared to the original.

3. Landscape photos.

With SDXL, deformities rarely occur unless the models are poorly trained, or LoRa with low size under 200mb which often produces poor resolution.
A few small notes

1. Do not use Adetailer more than 0.5, to avoid deformity of the face or hands, and furthermore save a lot of time

2. The further the face and hands are from the viewer's perspective, the level of denoising must also increase

For example, for portrait photos, it is not necessary, upperbody photos should only be at 0.2 ~ 0.3. As for full body view, it will be 0.4

2. Usually with SD1.5 models, Adetailer hands are almost useless due to low quality/ low resolution data it have.

3. Please check your prompt carefully before using Adetailer, because as mentioned above the AI will run again according to your prompt. Make sure none of the prompts have a weight index like (prompt:1.8) or (((((((prompt))))))) because doing so will make the AI focus on reproducing what you wrote here. in quotes instead of reconstructing the face or hand

2
0

Comments