TL;DR
This paper introduces DiffDoctor, a novel two-stage approach to reduce artifacts in images generated by diffusion models. It first trains a robust artifact detector to pinpoint defect locations and then uses this pixel-level feedback to fine-tune the diffusion model, leading to significantly fewer artifacts without compromising image quality.
What Problem Does This Paper Address?
Despite impressive advancements, text-to-image diffusion models often produce undesirable artifacts – distorted, unreasonable, or unwanted content in generated images. Existing methods to fix these artifacts typically rely on image-level quality scores or human feedback, which are coarse and overlook the specific locations of defects. This paper argues that effective problem-solving requires identifying where artifacts occur before attempting to fix them, addressing the limitation of current methods that treat the image as a whole rather than focusing on granular defect localization.
Methods
DiffDoctor employs a two-stage "diagnose-then-treat" pipeline:
- Diagnose (Artifact Detection): The first stage focuses on building a highly accurate artifact detector. This involves:
- Data Collection & Augmentation: Creating a large dataset (over 1 million images) of flawed synthesized images. A key innovation is a class-balancing strategy to address imbalances in existing datasets (e.g., overrepresentation of hand/face artifacts). This includes using real images as negative samples, actively labeling hard-to-detect cases, and semi-supervised learning with pseudo-labels generated by an evolving artifact detector.
- Human-in-the-Loop: An efficient annotation process that leverages human expertise for challenging cases and automated labeling for simpler ones.
- Model Architecture: Using SegFormer-b5 as the backbone for the artifact detector, outputting pixel-level confidence maps.
- Treat (Diffusion Model Optimization): The trained artifact detector then provides pixel-level feedback to fine-tune the diffusion model.
- Pixel-Aware Loss: A novel pixel-level loss function ($L_{pixel}$) is introduced, which directly penalizes high artifact confidence at each pixel location in synthesized images. This loss is back-propagated through the artifact detector to update the diffusion model.
- Offline Regularization: To prevent model collapse (a common issue when optimizing diffusion models), an optional offline regularization term ($L_{offline}$) is incorporated, based on rectified flow loss, to keep the updated model close to the original distribution.
- Gradient Truncation: Gradients are truncated in the last few denoising steps to save memory during training.
Datasets
- Training Artifact Detector:
- A newly collected dataset of over 1 million flawed synthesized images.
- Real images from COCO [14] for evaluating false positive rates on real photos.
- Existing datasets like RichHF [13] and PAL4VST [37] were used as a foundation but found to have data imbalance issues.
- Training Diffusion Model (Treating):
- A set of 3000 complex text prompts generated by Qwen [2] for synthesizing images.
- A benchmark set of 100 prompts for evaluation.
- LAION-Aesthetics V2 6.5+ Dataset [22] for optional offline regularization.
Key Insights and Ideas
- Diagnose-then-Treat Paradigm: The core idea is that identifying where artifacts are is crucial before attempting to fix them. This granular approach is more effective than image-level feedback.
- Data Imbalance is Critical: Existing artifact datasets suffer from severe class imbalance, leading artifact detectors to learn shortcuts and produce high false positive rates. A careful class-balancing strategy is essential for a robust detector.
- Pixel-Level Feedback is Powerful: Directly using pixel-level artifact confidence maps to guide diffusion model optimization allows for precise correction of defects without drastically altering image quality or content.
- Preventing Model Collapse: Combining pixel-aware treating with offline regularization and early stopping is key to maintaining image quality and preventing the diffusion model from degenerating into overly smooth or blurry outputs.
- Generalizability: DiffDoctor is shown to be effective not only for standard text-to-image models but also for customized generation tasks like DreamBooth.
Key Results
- Artifact Reduction: DiffDoctor significantly reduces artifact frequencies (e.g., from 82.66% to 22.00% on FLUX.1).
- Quality Preservation: The method maintains or even improves image quality metrics like ImageReward and CLIP-T scores, indicating that artifact reduction doesn't come at the cost of overall image appeal or text-image consistency.
- Improved Artifact Detector: The proposed artifact detector, trained on 1M+ balanced samples, significantly outperforms existing methods (PAL4VST, RichHF) on a custom benchmark, showing lower MSE and KL divergence (indicating better accuracy and fewer false positives/negatives).
- User Studies: User studies confirmed that DiffDoctor-treated images were preferred for artifact reduction, with winning rates significantly higher than baseline models.
- Effectiveness Across Models: DiffDoctor demonstrated improvements on FLUX.1, SDXL, and Kolors, and was also effective for DreamBooth fine-tuning.
Limitations and Future Work
- Complex Artifacts: The current artifact detector struggles with semantically challenging artifacts that require complex reasoning (e.g., objects defying physical laws). Future work could focus on developing more sophisticated artifact detectors capable of such reasoning.
- Model Collapse: While mitigated, model collapse remains a challenge. The paper notes that the trade-off between image layout changes and stable training time with regularization is an area for further exploration.
Summary updated