$ show Bing-su/adetailer
ADetailer is an extension for the Stable Diffusion WebUI that provides automatic object detection and masking for inpainting tasks. It integrates models like YOLOv8 and MediaPipe to detect faces, hands, persons, and other objects, creates masks from these detections, and then performs inpaint operations on the masked regions using the Stable Diffusion model. The extension features configurable detection parameters, mask preprocessing options, ControlNet integration, and advanced prompting capabilities. It follows the WebUI extension architecture with proper script callbacks and UI integration.
The LLM identified 2 files worth highlighting for reuse:
This module provides a comprehensive set of image mask processing functions including dilation/erosion, offsetting, merging, inversion, filtering by area/confidence, and sorting bounding boxes. These functions are self-contained, well-tested, and could be easily extracted for use in any computer vision project requiring mask manipulation. The implementation demonstrates skill in combining OpenCV and PIL operations effectively.
This module contains two key reusable components: 1) `dynamic_denoise_strength` function that adjusts denoising strength based on bounding box size relative to image size, and 2) `_OptimalCropSize` class that calculates optimal crop dimensions for inpainting based on bounding box aspect ratio and predefined resolutions (including SDXL-specific resolutions). Both components are mathematically sound, well-documented, and could be extracted for use in other image inpainting or processing pipelines. Notably, this file has zero dependencies on the rest of the adetailer codebase, making it highly portable.