Anzhc/aadetailer-reforge

Auto detecting, masking and inpainting with detection model.

Python

25

712 commits

updated May 2, 2026

See the code

README

AADetailer-ReForge

A small fork with new features and modifications, verified to work with up-to-date ReForge only. (It can potentially work with other webUIs, but i am not promising to maintain them for anything other than ReForge)

Fix for newer Ultralytics included.

Current additional features:

  • Automatically include loras If loras are present in prompt, they will be automatically added. If their name include main trigger, it can be included too. Schema for trigger in name: <lora:lora name (trigger) blah blah:1> - basically what is inside () is considered trigger.
  • Autotag before inpaint (Autotags crop area, so inpaint is stable, and doesn't require re-prompting each gen)
  • Reworked resolution, now based on scaling. (Define a scale(multiplier) for resolution over base, so it's always bigger than original)

Potential future features:

  • Class-based detection support for YOLOs.

ADetailer

ADetailer is an extension for the stable diffusion webui that does automatic masking and inpainting. It is similar to the Detection Detailer.

Install

You can install it directly from the Extensions tab.

download this repo and put it in your expensions(replace original adetailer)

Options

Model, Prompts
ADetailer modelDetermine what to detect.None = disable
ADetailer model classesComma separated class names to detect. only available when using YOLO World modelsIf blank, use default values.
default = COCO 80 classes
ADetailer prompt, negative promptPrompts and negative prompts to applyIf left blank, it will use the same as the input.
Skip img2imgSkip img2img. In practice, this works by changing the step count of img2img to 1.img2img only
Apply only on hires.fixSkips lowres images, saving a lot of time. Applies only on hires pass.
Append main prompt LoRAsAppend loras to adetailer prompt automatically.
Append LoRA triggersAlso add triggers, if any are present in lora name.Loras must follow this naming convention for trigger to work: <lora:lora name (trigger) blah blah:1>
Autotagging
Enable AutotaggingExtend prompt by adding tags detected by WDv3 large tagger.
Detection
Detection model confidence thresholdOnly objects with a detection model confidence above this threshold are used for inpainting.
Mask min/max ratioOnly use masks whose area is between those ratios for the area of the entire image.
Mask only the top k largestOnly use the k objects with the largest area of the bbox.0 to disable

If you want to exclude objects in the background, try setting the min ratio to around 0.01.

Mask Preprocessing
Mask x, y offsetMoves the mask horizontally and vertically by
Mask erosion (-) / dilation (+)Enlarge or reduce the detected mask.opencv example
Mask merge modeNone: Inpaint each mask
Merge: Merge all masks and inpaint
Merge and Invert: Merge all masks and Invert, then inpaint

Applied in this order: x, y offset → erosion/dilation → merge/invert.

Inpainting

Each option corresponds to a corresponding option on the inpaint tab. Therefore, please refer to the inpaint tab for usage details on how to use each option.

ControlNet Inpainting

You can use the ControlNet extension if you have ControlNet installed and ControlNet models.

Support inpaint, scribble, lineart, openpose, tile, depth controlnet models. Once you choose a model, the preprocessor is set automatically. It works separately from the model set by the Controlnet extension.

If you select Passthrough, the controlnet settings you set outside of ADetailer will be used.

Advanced Options

API request example: wiki/REST-API

[SEP], [SKIP], [PROMPT] tokens: wiki/Advanced

Media

Model

ModelTargetmAP 50mAP 50-95
face_yolov8n.pt2D / realistic face0.6600.366
face_yolov8s.pt2D / realistic face0.7130.404
hand_yolov8n.pt2D / realistic hand0.7670.505
person_yolov8n-seg.pt2D / realistic person0.782 (bbox)
0.761 (mask)
0.555 (bbox)
0.460 (mask)
person_yolov8s-seg.pt2D / realistic person0.824 (bbox)
0.809 (mask)
0.605 (bbox)
0.508 (mask)
mediapipe_face_fullrealistic face--
mediapipe_face_shortrealistic face--
mediapipe_face_meshrealistic face--

The YOLO models can be found on huggingface Bingsu/adetailer and Anzhc/Anzhcs_YOLOs

For a detailed description of the YOLO8 model, see: https://docs.ultralytics.com/models/yolov8/#overview

YOLO World model: https://docs.ultralytics.com/models/yolo-world/

Additional Model

Put your ultralytics yolo model in models/adetailer. The model name should end with .pt.

It must be a bbox detection or segment model and use all label.

How it works

ADetailer works in three simple steps.

  1. Create an image.
  2. Detect object with a detection model and create a mask image.
  3. Inpaint using the image from 1 and the mask from 2.

Development

AADetailer is developed and tested using the SDXL model, for the latest version of ReForge repository only.

License

ADetailer is a derivative work that uses two AGPL-licensed works (stable-diffusion-webui, ultralytics) and is therefore distributed under the AGPL license.

See Also

Anzhc/aadetailer-reforge

Auto detecting, masking and inpainting with detection model.

Python

25

712 commits

updated May 2, 2026

See the code

README

AADetailer-ReForge

A small fork with new features and modifications, verified to work with up-to-date ReForge only. (It can potentially work with other webUIs, but i am not promising to maintain them for anything other than ReForge)

Fix for newer Ultralytics included.

Current additional features:

  • Automatically include loras If loras are present in prompt, they will be automatically added. If their name include main trigger, it can be included too. Schema for trigger in name: <lora:lora name (trigger) blah blah:1> - basically what is inside () is considered trigger.
  • Autotag before inpaint (Autotags crop area, so inpaint is stable, and doesn't require re-prompting each gen)
  • Reworked resolution, now based on scaling. (Define a scale(multiplier) for resolution over base, so it's always bigger than original)

Potential future features:

  • Class-based detection support for YOLOs.

ADetailer

ADetailer is an extension for the stable diffusion webui that does automatic masking and inpainting. It is similar to the Detection Detailer.

Install

You can install it directly from the Extensions tab.

download this repo and put it in your expensions(replace original adetailer)

Options

Model, Prompts
ADetailer modelDetermine what to detect.None = disable
ADetailer model classesComma separated class names to detect. only available when using YOLO World modelsIf blank, use default values.
default = COCO 80 classes
ADetailer prompt, negative promptPrompts and negative prompts to applyIf left blank, it will use the same as the input.
Skip img2imgSkip img2img. In practice, this works by changing the step count of img2img to 1.img2img only
Apply only on hires.fixSkips lowres images, saving a lot of time. Applies only on hires pass.
Append main prompt LoRAsAppend loras to adetailer prompt automatically.
Append LoRA triggersAlso add triggers, if any are present in lora name.Loras must follow this naming convention for trigger to work: <lora:lora name (trigger) blah blah:1>
Autotagging
Enable AutotaggingExtend prompt by adding tags detected by WDv3 large tagger.
Detection
Detection model confidence thresholdOnly objects with a detection model confidence above this threshold are used for inpainting.
Mask min/max ratioOnly use masks whose area is between those ratios for the area of the entire image.
Mask only the top k largestOnly use the k objects with the largest area of the bbox.0 to disable

If you want to exclude objects in the background, try setting the min ratio to around 0.01.

Mask Preprocessing
Mask x, y offsetMoves the mask horizontally and vertically by
Mask erosion (-) / dilation (+)Enlarge or reduce the detected mask.opencv example
Mask merge modeNone: Inpaint each mask
Merge: Merge all masks and inpaint
Merge and Invert: Merge all masks and Invert, then inpaint

Applied in this order: x, y offset → erosion/dilation → merge/invert.

Inpainting

Each option corresponds to a corresponding option on the inpaint tab. Therefore, please refer to the inpaint tab for usage details on how to use each option.

ControlNet Inpainting

You can use the ControlNet extension if you have ControlNet installed and ControlNet models.

Support inpaint, scribble, lineart, openpose, tile, depth controlnet models. Once you choose a model, the preprocessor is set automatically. It works separately from the model set by the Controlnet extension.

If you select Passthrough, the controlnet settings you set outside of ADetailer will be used.

Advanced Options

API request example: wiki/REST-API

[SEP], [SKIP], [PROMPT] tokens: wiki/Advanced

Media

Model

ModelTargetmAP 50mAP 50-95
face_yolov8n.pt2D / realistic face0.6600.366
face_yolov8s.pt2D / realistic face0.7130.404
hand_yolov8n.pt2D / realistic hand0.7670.505
person_yolov8n-seg.pt2D / realistic person0.782 (bbox)
0.761 (mask)
0.555 (bbox)
0.460 (mask)
person_yolov8s-seg.pt2D / realistic person0.824 (bbox)
0.809 (mask)
0.605 (bbox)
0.508 (mask)
mediapipe_face_fullrealistic face--
mediapipe_face_shortrealistic face--
mediapipe_face_meshrealistic face--

The YOLO models can be found on huggingface Bingsu/adetailer and Anzhc/Anzhcs_YOLOs

For a detailed description of the YOLO8 model, see: https://docs.ultralytics.com/models/yolov8/#overview

YOLO World model: https://docs.ultralytics.com/models/yolo-world/

Additional Model

Put your ultralytics yolo model in models/adetailer. The model name should end with .pt.

It must be a bbox detection or segment model and use all label.

How it works

ADetailer works in three simple steps.

  1. Create an image.
  2. Detect object with a detection model and create a mask image.
  3. Inpaint using the image from 1 and the mask from 2.

Development

AADetailer is developed and tested using the SDXL model, for the latest version of ReForge repository only.

License

ADetailer is a derivative work that uses two AGPL-licensed works (stable-diffusion-webui, ultralytics) and is therefore distributed under the AGPL license.

See Also

Languages

Python

100.0%