EAAI Journal 2025 Journal Article
Enhancing anomaly detection with few-shot fine-tuned long text-to-image models
- Jiachen Liu
- Jiajia An
- Junbin Lu
- Zhuoqin Yang
- Jinbao Wang
- Ping Lu
- Yuying Wang
- Linlin Shen
Industrial anomaly detection plays a crucial role in the industrial manufacturing field. Currently, utilizing generated data to improve the performance of the anomaly detection model is an effective approach. However, most existing methods often rely on mask-guided synthesis, where the distribution of the generated defects is limited by masks that are typically random or learned by a model. In addition, the scarcity of real anomalous samples makes it difficult for generative models to capture genuine defect patterns and align with the real anomaly distribution. To tackle these issues, we propose DefectGen, the first long-text-guided few-shot text-to-image data generation pipeline for industrial anomaly detection. To improve distribution alignment under limited anomaly samples, DefectGen incorporates a Prompt Generation and Variation Module, which uses MLLMs (Multimodal Large Language Models) to expand few-shot image–text pairs into diverse and semantically rich prompts, and DoKr (Weight-Decomposed Low-Rank Adaptation with Kronecker product), a lightweight fine-tuning strategy with structured low-rank adaptation. To ensure the quality of synthetic data, DefectGen further introduces the Real-Guided Clustering Filter, which selects high-quality generated samples by comparing their features with those of real anomalies. Experiments on the MVTec AD(MVTec AnomalyDetection) dataset show that DefectGen generates more diverse and realistic synthetic anomalies and achieves a 5. 58% average improvement in anomaly classification accuracy compared to state-of-the-art methods. Code and data are available at: https: //anonymous. 4open. science/r/DefectGen-CD04/.