节点文献
基于深度学习的纽扣表面缺陷视觉检测系统研究
Research on Button Surface Defect Detection System Based on Deep Learning
【作者】 王伟;
【导师】 余厚云;
【作者基本信息】 南京航空航天大学 , 机械电子工程, 2021, 硕士
【摘要】 近年来,关于深度学习算法的研究十分热门。随着越来越多的高精度模型被不断提出,深度学习算法的应用领域也在不断拓宽,其中制造业当中的产品表面质量检测就是一个重要的研究方向。深度学习的本质是根据大量数据的统计特性做出预测,一般分为训练阶段与推断阶段。在训练阶段,需要大量的训练样本为深度神经网络提供用来学习的统计特征。若待检测的产品批量大、型号稳定,使用大量带标注训练样本可以取得很好的训练效果。但对于小批量、多品种产品,使用传统的深度神经网络模型是不可行的,主要原因有两个:一是样本数量非常有限,获取训练样本困难;二是需要多次训练,时间与计算资源消耗大。本文以服装制造业中的纽扣产品作为检测对象,针对纽扣产品小批量、多品种的特点,研究基于小样本的深度学习算法,解决纽扣表面缺陷视觉检测问题。论文首先根据检测系统的功能需求和技术指标,制定系统总体方案,设计并构建包括自动上料、图像采集、物料分选等在内的硬件单元,并开发信号采集、运动控制、表面缺陷检测和数据管理等软件功能模块。纽扣表面缺陷检测算法是论文的核心,该算法基于深度神经网络。在纽扣图像传入网络前,先将图像制作成数据集以方便深度神经网络的训练。首先,通过纽扣图像与背景图像的差分运算得到无背景干扰的纯纽扣图像。然后,将图像灰度化并使用最大类间方差法生成二值化图像。接下来,采用最大连通区域法提取纽扣感兴趣区域。最后,将处理后的纽扣正反面图像拼接在一起。在构建数据集的过程中,本文还通过几何变换、色彩变换和空间滤波等数据增强方法来解决网络的过拟合问题。纽扣缺陷数据集制作完成后,接下来是深度神经网络的训练与推断。为解决小批量、多品种产品的表面缺陷检测问题,本文提出了改进的深度度量学习算法。首先提出条件三元组损失函数,以加强神经网络的拟合能力。其次,在隐空间中进行缺陷判定时,摒弃了经典度量学习中基于KNN算法的归类方法,提出了基于高斯分布概率的归类模型。最后,使用支持集样本对网络进行微调。本文最终完成了缺陷检测正确率实验、算法鲁棒性实验以及检测速度实验。实验证明,本文提出的改进深度度量学习算法在提供50个正样本以及50个负样本的基础上,在树脂材质纽扣数据集上的检测正确率均在95%以上,且经K-Fold交叉验证,算法重复性误差在1.33%以内,同时,系统检测速度最高可达7.2个/秒。实验结果表明,本文提出的改进深度度量学习算法很好地解决了纽扣表面缺陷检测问题。
【Abstract】 In recent years,research on deep learning algorithms has become very popular.As more and more high-precision models are continuously proposed,the application fields of deep learning algorithms are also expanding.Among them,product surface quality inspection in the manufacturing industry is an important research direction.The essence of deep learning is to make predictions based on the statistical characteristics of a large amount of data,which is generally divided into a training phase and an inference phase.In the training phase,a large number of training samples are needed to provide the deep neural network with statistical features for learning.If the product to be tested has a large batch and a stable model,using a large number of labeled training samples can achieve good training results.However,for small batches and multi-variety products,it is not feasible to use traditional deep neural network models for two main reasons: one is that the number of samples is very limited,and it is difficult to obtain training samples;the other is that it requires multiple training,time and computing resources.Expensive.In this paper,button products in the clothing manufacturing industry are used as the inspection object.Aiming at the small batch and multi-variety characteristics of button products,deep learning algorithms based on small samples are studied to solve the problem of visual inspection of button surface defects.Based on the functional requirements and technical indicators of the inspection system,the paper first formulates the overall system plan,designs and constructs hardware units including automatic feeding,image acquisition,material sorting,etc.,and develops signal acquisition,motion control,surface defect detection and Software function modules such as data management.The button surface defect detection algorithm is the core of the paper,which is based on deep neural network.Before the button image is transferred to the network,the image is made into a data set to facilitate the training of the deep neural network.Firstly,a pure button image without background interference is obtained through the difference calculation between the button image and the background image.Then,the image is grayed out and the maximum between-class variance method is used to generate a binarized image.Next,the largest connected region method is used to extract the button region of interest.Finally,stitch the front and back images of the processed buttons together.In the process of constructing the data set,this paper also uses data enhancement methods such as geometric transformation,color transformation and spatial filtering to solve the problem of network overfitting.After the button defect data set is produced,the next step is the training and inference of the deep neural network.In order to solve the problem of surface defect detection for small batch and multi-variety products,this paper proposes an improved deep metric learning algorithm.First,a conditional triple loss function is proposed to strengthen the fitting ability of the neural network.Secondly,when the defect is judged in the hidden space,the classification method based on the KNN algorithm in the classical metric learning is abandoned,and a classification model based on the Gaussian distribution probability is proposed.Finally,use support set samples to fine-tune the network.This paper finally completed the defect detection accuracy experiment,algorithm robustness experiment and detection speed experiment.Experiments have proved that the improved depth metric learning algorithm proposed in this paper provides 50 positive samples and 50 negative samples,and the detection accuracy on resin buttons is above 95%.The algorithm has been cross-validated by K-Fold.The repeatability error is within 1.33%.At the same time,the system detection speed can reach up to 7.2 pieces/sec.The experimental results show that the improved depth metric learning algorithm proposed in this paper can solve the problem of button surface defect detection.
【Key words】 surface defect; deep metric learning; K-Fold validation; digital image processing; few-shot learning;