随着《中国制造2025》的提出,中国制造行业持续转型,智能化制造正在成为主流,生产质量要求也不断提高,缺陷检测作为工业生产中不可或缺的环节,对产品质量的保障和生产效率的提高尤为重要。传统的人工目视检测方法过于依赖主观判断且效率低,难以满足生产线高速运转的需要,使用机器视觉代替人工进行质量检测已经成为工业发展的必然趋势。与传统的机器学习方法相比,基于神经网络的深度学习方法在缺陷识别领域具有更高的识别准确率和工作效率。然而,工业缺陷数据存在难收集,标注成本高,随机生成难以全收集等特点,使得可供神经网络训练的数据较少,限制了深度学习方法的应用。 本文依托国家重点研发计划《缺陷甄别技能在线增强与多任务高效迁移》,以工业产品表面缺陷检测为应用背景,从数据增强、改进网络和迁移学习三个方向对小样本场景下的缺陷检测方法展开理论与应用研究,主要研究内容如下: 在数据层,本文采用小目标缺陷重构和EnlightenGAN光照增强两种策略,设计一种综合多种操作的工业缺陷数据在线增强方法。在离线增强方面,使用基于布局的图像生成模型,设计了离线数据增强框架,能够根据给定的类别、位置和大小生成仿真缺陷数据,省去标注环节,扩充数据集,为后续算法提供训练数据支持。 在模型层,本文通过引入注意力机制和改进损失函数对 YOLOv8 算法进行改进。一方面,将YOLOv8与transformer相结合,将BiFormer注意力机制融入YOLOv8的主干网络,以帮助网络更精准地识别图像中的关键区域。另一方面,针对样本不平衡、损失函数调参困难的问题,在原本的Varifocal Loss损失函数基础上进行改进,提出GH-VFL,通过梯度均衡机制的加持,有效应对了由静态损失函数和异常样本带来的挑战。 针对工业缺陷检测场景中,不同型号、不同环境数据之间域偏移的问题,本文提出了一种基于领域不变特征学习的域自适应算法 DA-YOLOv8,将域自适应网络引入到 YOLOv8 模型中,以学习域不变特征,并在基础的多尺度域自适应网络结构上进行改进。在街景数据集和发动机面板数据集上的实验证明了方法的有效性。基于该方法,本文开发了一款名为“多任务高效迁移缺陷检测平台”的软件平台,能够更好地辅助用户进行缺陷检测。
With the proposal of "Made in China 2025," the Chinese manufacturing industry is undergoing continuous transformation, with intelligent manufacturing becoming mainstream and increasing demands for production quality. Defect detection, as an indispensable part of industrial production, is crucial for ensuring product quality and improving production efficiency. Traditional manual visual inspection methods heavily rely on subjective judgment and are inefficient. They struggle to meet the needs of high-speed production lines. Substituting machine vision for manual quality inspection has become an inevitable trend in industrial development. In comparison to traditional machine learning methods, deep learning methods based on neural networks have higher accuracy and efficiency in defect recognition. However, difficulty in collecting industrial defect data, high annotation costs, and the randomness of defects make it challenging to gather sufficient data for training neural networks, limiting the application of deep learning methods. This thesis relies on the National Key Research and Development Program "Online Enhancement and Efficient Multi-Task Transfer of Defect Discrimination Skills" and focuses on the theoretical and applied research of defect detection methods under few sample scenarios in the context of industrial product surface defect detection. The main research contents are as follows: This thesis adopts two strategies, namely, copy-pasting and EnlightenGAN illumination enhancement, to design a comprehensive industrial defect data online augmentation method that integrates multiple operations. In terms of offline augmentation, a layout-based image generation model is used to design an offline data augmentation framework, which can generate simulated defect data based on given categories, positions, and sizes, eliminating the annotation process, expanding the dataset, and providing training data support for subsequent algorithms. Improvements are made to the YOLOv8 algorithm by introducing attention mechanisms and improving loss functions. On the one hand, YOLOv8 is combined with the transformer, integrating the BiFormer attention mechanism into the backbone network of YOLOv8 to help the network more accurately identify key areas in the image. On the other hand, for the problem of sample imbalance and difficulty in parameter tuning, improvements are made to the original Varifocal Loss loss function, proposing GH-VFL, which effectively addresses the challenges posed by static loss functions and outlier samples through the gradient harmonized mechanism. To address the domain shift issue between different dataset in the industrial defect detection scenario, a domain-adaptive algorithm DA-YOLOv8 based on domain-invariant feature learning is proposed. This algorithm introduces domain adaptive networks into the YOLOv8 model to learn domain-invariant features and improves upon the basic multi-scale domain adaptive network structure. Experiments on cityscapes datasets and engine datasets demonstrate the effectiveness of the method. Based on this method, a software platform named "Multi-Task Efficient Transfer Defect Detection Platform" has been developed.