Enhancing portrait generation with an improved detection model YOLOv8-DFA and ADetailer for image synthesis
摘要
Stable Diffusion models often suffer from feature drift in portrait generation due to facial missing detection or false detection. This paper proposes a detection-generation collaborative framework: an improved detector, YOLOv8-DFA, produces high-fidelity facial masks; these masks are fed to the ADetailer module of Stable Diffusion to inpaint the corresponding regions. Dual-channel attention CNA and Fourier convolution FSAS are introduced to improve detection accuracy under complex lighting conditions and occlusion scenarios. Furthermore, an adaptive threshold focal loss and dynamically adjusted loss weights are designed to alleviate the problems of class imbalance and catastrophic forgetting. On the STEM dataset, YOLOv8-DFA improves the absolute mAP@0.5 by 5.6 percentage points while adding merely 0.3% extra FLOPs over the baseline YOLOv8n. When the detector is integrated with ADetailer, the resulting portraits retain identity-specific details under blur, side lighting and occlusion, among other adverse conditions.