CN107481231A - A kind of handware defect classifying identification method based on depth convolutional neural networks - Google Patents
A kind of handware defect classifying identification method based on depth convolutional neural networks Download PDFInfo
- Publication number
- CN107481231A CN107481231A CN201710707883.3A CN201710707883A CN107481231A CN 107481231 A CN107481231 A CN 107481231A CN 201710707883 A CN201710707883 A CN 201710707883A CN 107481231 A CN107481231 A CN 107481231A
- Authority
- CN
- China
- Prior art keywords
- network
- convolutional neural
- training
- layer
- neural networks
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000007547 defect Effects 0.000 title claims abstract description 51
- 238000013527 convolutional neural network Methods 0.000 title claims abstract description 40
- 238000000034 method Methods 0.000 title claims abstract description 32
- 238000012549 training Methods 0.000 claims abstract description 47
- 238000012360 testing method Methods 0.000 claims abstract description 13
- 230000005284 excitation Effects 0.000 claims description 18
- 238000004364 calculation method Methods 0.000 claims description 14
- 230000008569 process Effects 0.000 claims description 11
- 238000011478 gradient descent method Methods 0.000 claims description 7
- 230000000644 propagated effect Effects 0.000 claims 2
- 244000287680 Garcinia dulcis Species 0.000 claims 1
- 238000012545 processing Methods 0.000 abstract description 7
- 210000002569 neuron Anatomy 0.000 description 16
- 238000011176 pooling Methods 0.000 description 12
- 238000004519 manufacturing process Methods 0.000 description 9
- 238000013528 artificial neural network Methods 0.000 description 8
- 238000001514 detection method Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 238000007689 inspection Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 238000011161 development Methods 0.000 description 4
- 230000018109 developmental process Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 239000000284 extract Substances 0.000 description 3
- 239000000463 material Substances 0.000 description 3
- 239000011159 matrix material Substances 0.000 description 3
- 238000013473 artificial intelligence Methods 0.000 description 2
- 238000013529 biological neural network Methods 0.000 description 2
- 210000004556 brain Anatomy 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 238000012706 support-vector machine Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 208000034656 Contusions Diseases 0.000 description 1
- 241000282412 Homo Species 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 230000004913 activation Effects 0.000 description 1
- 230000002411 adverse Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 201000001371 inclusion conjunctivitis Diseases 0.000 description 1
- 210000002364 input neuron Anatomy 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000000465 moulding Methods 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 239000002994 raw material Substances 0.000 description 1
- 239000004576 sand Substances 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 231100000331 toxic Toxicity 0.000 description 1
- 230000002588 toxic effect Effects 0.000 description 1
- 206010044325 trachoma Diseases 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/048—Activation functions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20084—Artificial neural networks [ANN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30164—Workpiece; Machine component
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Bioinformatics & Computational Biology (AREA)
- General Health & Medical Sciences (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
一种基于深度卷积神经网络的五金件缺陷分类识别方法,包括以下步骤;建立网络,构造一个深度卷积神经网络;训练网络,将采集到的图像分为两大类,即训练集和测试集,所述训练集占采集到图像总数的70%,所述测试集占采集到图像总数的30%;缺陷识别,将测试集中的五金件图像输入已经训练好的网络,查看输出结果,将识别结果与图像的标签进行对照,统计正确识别率和错误识别率。本算法中使用深度卷积神经网络,省去了复杂的图像处理算法,通过增加网络深度,提取到缺陷更加抽象的特征,使不同缺陷类别间具有更强的可区分性,识别率更高。
A hardware defect classification and recognition method based on a deep convolutional neural network, comprising the following steps: establishing a network to construct a deep convolutional neural network; training the network, and dividing the collected images into two categories, namely training sets and testing set, the training set accounts for 70% of the total number of images collected, and the test set accounts for 30% of the total number of images collected; for defect identification, the hardware images in the test set are input into the trained network, and the output results are checked. The recognition result is compared with the label of the image, and the correct recognition rate and false recognition rate are counted. In this algorithm, a deep convolutional neural network is used, which eliminates the need for complex image processing algorithms. By increasing the depth of the network, more abstract features of defects are extracted, so that different defect categories are more distinguishable and the recognition rate is higher.
Description
技术领域technical field
本发明涉及基于人工智能的图像处理技术领域,尤其涉及一种基于深度卷积神经网络的五金件缺陷分类识别方法。The invention relates to the technical field of image processing based on artificial intelligence, in particular to a hardware defect classification and recognition method based on a deep convolutional neural network.
背景技术Background technique
机器视觉又称计算机视觉,是研究使用相机以及计算机分别模仿人眼和大脑,以便用机器代替人做检测和判断,完成目标识别及工业检测等任务的科学。机器视觉技术集合了数字图像处理、人工智能、计算机图形学等多学科的一门应用型技术学科,在自动化生产中应用广泛。近年来,随着计算机技术的进步和神经网络理论的不断完善,推动了计算机视觉的快速发展。我国机器视觉行业迅速发展,在自动化生产检测领域中占据十分重要的地位。Machine vision, also known as computer vision, is a science that studies the use of cameras and computers to imitate human eyes and brains, so that machines can replace humans for detection and judgment, and complete tasks such as target recognition and industrial inspection. Machine vision technology is an applied technical discipline that integrates digital image processing, artificial intelligence, computer graphics and other disciplines, and is widely used in automated production. In recent years, with the advancement of computer technology and the continuous improvement of neural network theory, the rapid development of computer vision has been promoted. The rapid development of my country's machine vision industry occupies a very important position in the field of automated production inspection.
由于五金件具有易于成型、质量轻、材料易于获得、适合大批量生产等优点,在家电、机械、化工、航空等领域运用十分广泛。随着五金件的应用越来越广,快速成型加工技术的发展越来越快,人们对五金件的质量的要求也越来越高。五金件的质量主要有尺寸、外观等方面的要求。外观是保证五金件质量的一个重要环节,而实际生产中通常采用人工检测的方式进行。人工检测方式效率低下、自动化程度不高,其准确率往往与检测人员的工作经验和态度有关。目前,五金件产品生产企业越来越注重提高生产自动化水平,对生产效率的要求越来越高,人工检测方式越来越不能满足需求。此外,在生产加工过程中,由于原料物性参数变化、工艺参数不合理及加工机械性能不良等因素,五金制品会出现碰伤、砂眼、刮伤、缺料、变形、麻点、油污等等表面缺陷。这些表面缺陷不仅会破坏五金制品的外观,而且会影响其性能导致无法使用。当前五金制品的表面缺陷检测与识别主要以人工方式为主,效率不高、自动化程度低。Due to the advantages of easy molding, light weight, easy to obtain materials, and suitable for mass production, hardware parts are widely used in household appliances, machinery, chemicals, aviation and other fields. With the increasing application of hardware and the rapid development of rapid prototyping technology, people's requirements for the quality of hardware are also getting higher and higher. The quality of hardware mainly has requirements in terms of size and appearance. Appearance is an important link to ensure the quality of hardware, but manual inspection is usually used in actual production. The manual detection method is inefficient and the degree of automation is not high, and its accuracy is often related to the working experience and attitude of the testing personnel. At present, hardware product manufacturers are paying more and more attention to improving the level of production automation, and the requirements for production efficiency are getting higher and higher, and manual inspection methods are increasingly unable to meet the demand. In addition, in the process of production and processing, due to factors such as changes in the physical parameters of raw materials, unreasonable process parameters, and poor processing machinery performance, hardware products will have bruises, sand holes, scratches, lack of materials, deformation, pitting, oil stains, etc. on the surface defect. These surface defects will not only destroy the appearance of hardware products, but also affect its performance and make it unusable. At present, the detection and identification of surface defects of hardware products are mainly done manually, with low efficiency and low degree of automation.
机器视觉技术的发展和广泛应用恰恰可以解决上述问题。基于机器视觉技术的检测系统与人工检测方式相比主要有以下优点:The development and wide application of machine vision technology can just solve the above problems. Compared with the manual detection method, the detection system based on machine vision technology has the following advantages:
(1)精度高(1) High precision
机器视觉系统的测量精度可达到0.01mm精度级,远远高于受物理条件限制的人类视觉。The measurement accuracy of the machine vision system can reach 0.01mm accuracy level, which is much higher than the human vision limited by physical conditions.
(2)重复性(2) Repeatability
机器视觉系统可以高效、准确地重复完成检测任务,不会像检测人员一样感到疲劳。而人眼在重复检查产品时会因为各种因素的影响而感到细微不同,影响准确率。Machine vision systems can efficiently and accurately complete inspection tasks repeatedly without feeling fatigued like inspectors. When the human eye repeatedly checks the product, it will feel subtle differences due to the influence of various factors, which will affect the accuracy rate.
(3)实时性(3) Real-time
机器视觉系统使用计算机高效地进行图像采集、存储和处理。系统自动进行图像数据的传输,可实时反应生产现场的状况。Machine vision systems use computers to efficiently capture, store and process images. The system automatically transmits image data, which can reflect the status of the production site in real time.
(4)非接触性(4) Non-contact
机器视觉系统在检测时不必与工件接触,因此一般不会造成工件变形而产生不利影响。此外,系统可以替代检测人员在有毒、高温等恶劣环境下工作。The machine vision system does not have to be in contact with the workpiece during inspection, so it generally does not cause deformation of the workpiece to adversely affect it. In addition, the system can replace inspectors working in toxic, high-temperature and other harsh environments.
(5)成本低(5) Low cost
机器视觉系统可长时间、不间断地进行作业,能够完成相当于多个检测人员的任务。而如今人工成本越来越高,机器视觉系统能够大幅地降低生产成本。The machine vision system can work for a long time without interruption, and can complete the tasks equivalent to multiple inspectors. Now that labor costs are getting higher and higher, machine vision systems can greatly reduce production costs.
人工神经网络是生物神经网络在某种简化意义下的技术复现,作为一门学科,它的主要任务是根据生物神经网络的原理和实际应用的需要建造实用的人工神经网络,设计相应的学习算法,模拟人脑的某种智能活动,然后在技术上实现出来用以解决实际问题。在计算机视觉方面的应用也比较多,主要用来将提取到的缺陷进行分类识别。Artificial neural network is the technical reproduction of biological neural network in a simplified sense. As a discipline, its main task is to build a practical artificial neural network according to the principle of biological neural network and the needs of practical applications, and design corresponding learning Algorithms, which simulate certain intelligent activities of the human brain, are then implemented technically to solve practical problems. There are also many applications in computer vision, mainly used to classify and identify the extracted defects.
传统缺陷检测识别算法的简要流程图如图1所示。其首先需要对输入图像进行图像处理以将缺陷区域从图像中分割出来。然后对各种缺陷特征进行分析并选择合适的、区分度较高的特征。紧接着进行特征的人工提取,并将这些提取的特征输入BP神经网络或SVM(支持向量机)等常用分类器进行分类,最后在输出端给出分类识别结果。由此可见,上述传统的缺陷识别算法非常依赖缺陷区域分割的准确程度,并且需要人工地选择并提取缺陷特征。然而对于本文的五金件制品图像来说,由于其存在比较严重的噪声干扰,缺陷的准确分割需要采用复杂的图像处理流程,计算量非常大。此外,有效地选取区分度较高的特征并对其进行描述往往比较困难,需要非常专业的知识和较好的先验知识。A brief flow chart of the traditional defect detection and recognition algorithm is shown in Figure 1. It first needs to perform image processing on the input image to segment the defect area from the image. Then analyze various defect features and select appropriate features with high discrimination. Next, manual extraction of features is carried out, and these extracted features are input into common classifiers such as BP neural network or SVM (Support Vector Machine) for classification, and finally the classification and recognition results are given at the output end. It can be seen that the above-mentioned traditional defect recognition algorithm is very dependent on the accuracy of defect region segmentation, and needs to manually select and extract defect features. However, for the image of hardware products in this paper, due to the serious noise interference, the accurate segmentation of defects requires a complex image processing process, and the amount of calculation is very large. In addition, it is often difficult to effectively select and describe highly discriminative features, requiring very specialized knowledge and good prior knowledge.
卷积神经网络是由LeCun提出的一种深度神经网络,它可直接将一幅二维图像作为输入,而不需要对原始图像数据作复杂的图像预处理。卷积神经网络自动从图像中提取、组合特征,在提取特征的基础上识别视觉模式,然后在输出端给出分类结果。利用卷积神经网络进行图像识别的简要模型如下图2示,与传统缺陷识别算法相比,其无须人工地选取和描述特征,避免了大量计算。此外,卷积神经网络可以识别有变化的模式,对几何变形具有鲁棒性,能容许图像的畸变等优点。Convolutional neural network is a deep neural network proposed by LeCun, which can directly take a two-dimensional image as input without complex image preprocessing on the original image data. The convolutional neural network automatically extracts and combines features from images, recognizes visual patterns based on the extracted features, and then gives classification results at the output. The brief model of image recognition using convolutional neural network is shown in Figure 2 below. Compared with traditional defect recognition algorithms, it does not need to manually select and describe features, and avoids a lot of calculations. In addition, convolutional neural networks can recognize changing patterns, are robust to geometric deformation, and can tolerate image distortion.
发明内容Contents of the invention
本发明的目的在于解决上述问题提出一种基于深度卷积神经网络的五金件缺陷分类识别方法。The object of the present invention is to solve the above problems and propose a method for classifying and identifying hardware defects based on a deep convolutional neural network.
为了达到此目的,本发明采用以下技术方案:In order to achieve this goal, the present invention adopts the following technical solutions:
一种基于深度卷积神经网络的五金件缺陷分类识别方法,包括以下步骤:A method for classifying and identifying hardware defects based on a deep convolutional neural network, comprising the following steps:
A.建立网络,构造一个深度卷积神经网络;A. Establish a network and construct a deep convolutional neural network;
B.训练网络,将采集到的缺陷图像分为两大类,即训练集和测试集,所述训练集占采集到图像总数的70%,所述测试集占采集到图像总数的30%;B. train the network, divide the defect images collected into two categories, i.e. a training set and a test set, the training set accounts for 70% of the total number of images collected, and the test set accounts for 30% of the total number of images collected;
C.缺陷识别,将测试集中的五金件缺陷图像输入已经训练好的网络,查看输出结果,将识别结果与图像的标签进行对照,统计正确识别率和错误识别率。C. Defect recognition, input the hardware defect images in the test set into the trained network, check the output results, compare the recognition results with the labels of the images, and count the correct recognition rate and wrong recognition rate.
更优的,步骤B中所述训练网络算法包括如下步骤:More preferably, the training network algorithm described in step B includes the following steps:
步骤一、首先,将网络的权值进行初始化,并使权重分布服从于均值为0,方差为0.01的高斯分布,同时使权值大于0的个数约等于小于0的个数;Step 1. First, initialize the weights of the network, and make the weight distribution obey the Gaussian distribution with a mean value of 0 and a variance of 0.01, and at the same time make the number of weights greater than 0 approximately equal to the number of less than 0;
步骤二、训练样本去均值,所述训练样本为彩色图片,每个像素有R、G、B三个分量加和,求平均值,当五金件样本输入时,将样本所有像素的三个分量减去均值,然后输入网络;Step 2, remove the mean value of the training sample, the training sample is a color picture, and each pixel has three components of R, G, and B to sum and calculate the average value. When the hardware sample is input, the three components of all pixels of the sample are Subtract the mean and feed into the network;
步骤三、网络训练,所述网络训练采用随机梯度下降法。Step 3, network training, the network training adopts stochastic gradient descent method.
更优的,所述随机梯度下降法包括如下步骤:More preferably, the stochastic gradient descent method includes the following steps:
步骤a、前向传播,所述前向传播将训练样本逐一输入网络,经过卷积层、激励层以及分类器输出计算结果,对比标签,计算输出误差;Step a, forward propagation, the forward propagation inputs the training samples into the network one by one, outputs the calculation results through the convolution layer, the excitation layer and the classifier, compares the labels, and calculates the output error;
步骤b、反馈计算误差,根据步骤a中所述误差,从输出层依次向前,计算各层网络的误差,根据各层误差,计算权值更新量,更新权值w和偏差b;Step b, feedback calculation error, according to the error described in step a, from the output layer to forward, calculate the error of each layer of the network, according to the error of each layer, calculate the weight update amount, update the weight w and deviation b;
步骤c、将全部样本训练得到的误差平方之后,求和,再开方作为网络输出总误差,如果网络总误差大于设定阈值,将误差和计数器恢复初始值,重新训练样本,直至误差小于设定阈值。Step c, square the errors obtained from all sample training, sum them up, and take the square root as the total error of the network output. If the total error of the network is greater than the set threshold, restore the initial value of the error and counter, and retrain the samples until the error is less than the set threshold Set the threshold.
更优的,所述步骤a中假设共有m对训练样本,每次训练误差为 More optimally, in the step a, it is assumed that there are m pairs of training samples, and each training error is
更优的,所述总误差的表达式为 More preferably, the expression of the total error is
更优的,所述训练网络过程用GPU加速计算。More preferably, the training network process uses GPU to accelerate calculation.
更优的,步骤A中所述深度卷积神经网络的结构包括六个卷积层,六个激励层,三个池化层,一个全连接层;More preferably, the structure of the deep convolutional neural network described in step A includes six convolutional layers, six excitation layers, three pooling layers, and one fully connected layer;
卷积层后面连接激励层,经过连续两个卷积层和激励层之后会接一个池化层,所述深度卷积神经网络的最后一层连接分类器。An excitation layer is connected behind the convolutional layer, and a pooling layer is connected after two consecutive convolutional layers and the excitation layer, and the last layer of the deep convolutional neural network is connected to a classifier.
更优的,所述每个卷积层均由3×3的卷积单元组成。More preferably, each of the convolutional layers is composed of 3×3 convolutional units.
更优的,步骤B中所述采集到的图像为彩色图像,图像的采集方式为工业相机拍摄,并将缺陷图像输入网络。More preferably, the image collected in step B is a color image, the image is collected by an industrial camera, and the defect image is input into the network.
更优的,所述分类器为softmax分类器。More optimally, the classifier is a softmax classifier.
本发明的有益效果:Beneficial effects of the present invention:
1、一种缺陷分类识别算法,可以适合多种五金件及其他零件;1. A defect classification and recognition algorithm, which can be suitable for various hardware and other parts;
2、利用卷积神经网络和softmax分类器进行分类识别,不需要其他复杂的图像预处理算法;2. Using convolutional neural network and softmax classifier for classification and recognition, no other complex image preprocessing algorithms are required;
3、样本训练之前去均值,训练过程用GPU加速计算,减少训练时间,可以处理像素比较多的五金件缺陷图像;3. Remove the average value before the sample training, use GPU to accelerate the calculation during the training process, reduce the training time, and can process hardware defect images with more pixels;
4、用深度卷积神经网络识别,可以根据实际情况增加层数,提取缺陷更加抽象的特征,识别正确率更高;4. Using deep convolutional neural network to identify, you can increase the number of layers according to the actual situation, extract more abstract features of defects, and have a higher recognition accuracy;
5、使用Leaky ReLU激励函数,训练过程中不会拟合,计算简单有效,收敛速度快;5. Using the Leaky ReLU excitation function, it will not fit during the training process, the calculation is simple and effective, and the convergence speed is fast;
6、使用随机梯度下降法,计算量比标准梯度法要小,并且可以避免陷入局部最小值。6. Using the stochastic gradient descent method, the calculation amount is smaller than the standard gradient method, and it can avoid falling into the local minimum.
附图说明Description of drawings
图1为传统缺陷检测识别算法的简要流程图;Figure 1 is a brief flowchart of a traditional defect detection and recognition algorithm;
图2为利用卷积神经网络进行图像识别的简要模型图;Figure 2 is a brief model diagram of image recognition using a convolutional neural network;
图3为识别缺陷的卷积神经网络结构图;Figure 3 is a structural diagram of a convolutional neural network for identifying defects;
图4为卷积神经网络二维矩阵图;Fig. 4 is a two-dimensional matrix diagram of a convolutional neural network;
图5为Leaky ReLU函数图;Figure 5 is a Leaky ReLU function diagram;
图6为max-pooling二维矩阵图;Figure 6 is a two-dimensional matrix diagram of max-pooling;
图7为训练网络算法流程图。Figure 7 is a flowchart of the training network algorithm.
具体实施方式detailed description
下面结合附图并通过具体实施例方式来进一步说明本发明的技术方案。The technical solutions of the present invention will be further described below in conjunction with the accompanying drawings and through specific embodiments.
一种基于深度卷积神经网络的五金件缺陷分类识别方法,包括以下步骤:A method for classifying and identifying hardware defects based on a deep convolutional neural network, comprising the following steps:
A.建立网络,构造一个深度卷积神经网络;A. Establish a network and construct a deep convolutional neural network;
B.训练网络,将采集到的缺陷图像分为两大类,即训练集和测试集,所述训练集占采集到图像总数的70%,所述测试集占采集到图像总数的30%;B. train the network, divide the defect images collected into two categories, i.e. a training set and a test set, the training set accounts for 70% of the total number of images collected, and the test set accounts for 30% of the total number of images collected;
C.缺陷识别,将测试集中的五金件图像输入已经训练好的网络,查看输出结果,将识别结果与图像的标签进行对照,统计正确识别率和错误识别率。C. Defect recognition, input the hardware images in the test set into the trained network, check the output results, compare the recognition results with the labels of the images, and count the correct recognition rate and wrong recognition rate.
更进一步的说明,步骤B中所述训练网络算法包括如下步骤:To further illustrate, the training network algorithm described in step B includes the following steps:
步骤一、首先,将网络的权值进行初始化,并使权重分布服从于均值为0,方差为0.01的高斯分布,同时使权值大于0的个数约等于小于0的个数;Step 1. First, initialize the weights of the network, and make the weight distribution obey the Gaussian distribution with a mean value of 0 and a variance of 0.01, and at the same time make the number of weights greater than 0 approximately equal to the number of less than 0;
步骤二、训练样本去均值,所述训练样本为彩色图片,每个像素有R、G、B三个分量加和,求平均值,当五金件样本输入时,将样本所有像素的三个分量减去均值,然后输入网络;Step 2, remove the mean value of the training sample, the training sample is a color picture, and each pixel has three components of R, G, and B to sum and calculate the average value. When the hardware sample is input, the three components of all pixels of the sample are Subtract the mean and feed into the network;
步骤三、网络训练,所述网络训练采用随机梯度下降法。Step 3, network training, the network training adopts stochastic gradient descent method.
更进一步的说明,所述随机梯度下降法包括如下步骤:Further description, the stochastic gradient descent method includes the following steps:
步骤a、前向传播,所述前向传播将训练样本逐一输入网络,经过卷积层、激励层以及分类器输出计算结果,对比标签,计算输出误差Step a, forward propagation, the forward propagation inputs the training samples into the network one by one, outputs the calculation results through the convolutional layer, the excitation layer and the classifier, compares the labels, and calculates the output error
步骤b、反馈计算误差,根据步骤a中所述误差,从输出层依次向前,计算各层网络的误差,根据各层误差,计算权值更新量,更新权值w和偏差b;Step b, feedback calculation error, according to the error described in step a, from the output layer to forward, calculate the error of each layer of the network, according to the error of each layer, calculate the weight update amount, update the weight w and deviation b;
步骤c、将全部样本训练得到的误差平方之后,求和,再开方作为网络输出总误差,如果网络总误差大于设定阈值,将误差和计数器恢复初始值,重新训练样本,直至误差小于设定阈值。Step c, square the errors obtained from all sample training, sum them up, and take the square root as the total error of the network output. If the total error of the network is greater than the set threshold, restore the initial value of the error and counter, and retrain the samples until the error is less than the set threshold Set the threshold.
更进一步的说明,所述步骤a中假设共有m对训练样本,每次训练误差为 As a further illustration, in the step a, it is assumed that there are m pairs of training samples, and each training error is
更进一步的说明,所述总误差的表达式为 Further illustration, the expression of the total error is
更进一步的说明,所述训练网络过程用GPU加速计算。GPU并行加速计算,减少训练时间,可以处理像素比较多的五金件图像。To further illustrate, the process of training the network uses GPU to accelerate calculation. GPU parallel acceleration calculation reduces training time and can process hardware images with more pixels.
更进一步的说明,其特征在于:步骤A中所述深度卷积神经网络的结构包括六个卷积层,六个激励层,三个池化层,一个全连接层;卷积层后面连接激励层,经过连续两个卷积层和激励层之后会接一个池化层,所述深度卷积神经网络的最后一层连接分类器。用于识别缺陷的卷积神经网络结构图如图3所示,卷积神经网络主要有卷积层、激励层、池化层组成。所述卷积层后面连接所述激励层,经过连续两个卷积层和激励层之后会接一个池化层,这样的结构三次重复之后,得到深度卷积网络。网络的最后一层每个神经元得到的像素光栅化,即将每个得到的所有像素排成一排。然后,连接分类器,识别缺陷类别。Further description, it is characterized in that: the structure of deep convolutional neural network described in step A includes six convolutional layers, six excitation layers, three pooling layers, and one fully connected layer; After two consecutive convolutional layers and excitation layers, a pooling layer will be connected, and the last layer of the deep convolutional neural network is connected to the classifier. The convolutional neural network structure diagram for identifying defects is shown in Figure 3. The convolutional neural network mainly consists of convolutional layers, excitation layers, and pooling layers. The excitation layer is connected behind the convolutional layer, and a pooling layer is connected after two consecutive convolutional layers and the excitation layer. After repeating this structure three times, a deep convolutional network is obtained. In the last layer of the network, the pixels obtained by each neuron are rasterized, that is, all the pixels obtained by each are arranged in a row. Then, a classifier is connected to identify defect categories.
激励层神经元的输入与隐层输入类似,隐层数据x与权值w相乘再加上偏差值b得到激励层输入,即y=∑iwixi+b。将y的值输入激励函数,这里选择Leaky ReLU函数,如图5所示,计算输出结构。The input of the neurons in the excitation layer is similar to the input of the hidden layer. The hidden layer data x is multiplied by the weight w and the bias value b is added to obtain the input of the excitation layer, that is, y=∑ i w i x i +b. Input the value of y into the activation function, here select the Leaky ReLU function, as shown in Figure 5, and calculate the output structure.
池化层的作用是简化卷积层的输出。例如,池化层中的每一个神经元可能将前一层的一个2×2区域内的神经元求和。而另一个经常使用的max-pooling,该池化单元简单地将一个2×2的输入域中的最大激励输出,如图6所示,本方法采用max-pooling方法。The role of the pooling layer is to simplify the output of the convolutional layer. For example, each neuron in a pooling layer might sum over neurons in a 2×2 region of the previous layer. Another commonly used max-pooling, the pooling unit simply outputs the maximum excitation in a 2×2 input domain, as shown in Figure 6, this method uses the max-pooling method.
更进一步的说明,所述每个卷积层均由3×3的卷积单元组成。通常情况下,神经网络中输入层使用一系列神经元来表示的,在卷积神经网络中用二维矩阵来表示更加形象直观。与常规神经网络一样,输入层的神经元需要和隐藏层的神经元连接。但是,卷积神经网络不是将每一个输入神经元都与每一个隐藏神经元连接,而是仅仅在一个图像的局部区域创建连接。以大小为7X7的图像为例,假如第一个隐藏层的神经元与输入层的一个3X3的区域连接,如图4所示。这个3X3的区域就叫做局部感知域。该局部感知域的9个神经元与第一个隐藏层的同一个神经元连接,每个连接上有一个权重,因此局部感知域共有3X3个权重。如果将局部感知域沿着从左往右,从上往下的顺序滑动,就会得到对应隐藏层中不同的神经元,图4仅仅展示了第一个隐藏层的第一个神经元与输入层的连接情况。局部感知域向右滑动一个补偿(这里设定为2),就将输入层数据送给第二个隐层神经元。依次进行,便可以完成数据从输入层到隐层的传输。上面得到的第一隐藏层中的3X3个神经元都使用同样的3X3个权重,这称之为权重共享原则。另外,每个隐层神经元都共享一个偏差值b,称之为共享偏差。To further illustrate, each of the convolutional layers is composed of 3×3 convolutional units. Usually, the input layer in a neural network is represented by a series of neurons, and it is more visual and intuitive to use a two-dimensional matrix in a convolutional neural network. Like a regular neural network, neurons in the input layer need to be connected to neurons in the hidden layer. However, instead of connecting every input neuron to every hidden neuron, convolutional neural networks only create connections in local regions of an image. Taking an image of size 7X7 as an example, suppose the neurons of the first hidden layer are connected to a 3X3 area of the input layer, as shown in Figure 4. This 3X3 area is called the local perception domain. The 9 neurons of the local perceptual domain are connected to the same neuron of the first hidden layer, and each connection has a weight, so the local perceptual domain has a total of 3X3 weights. If the local perceptual domain is slid from left to right and from top to bottom, different neurons in the corresponding hidden layer will be obtained. Figure 4 only shows the first neuron and input of the first hidden layer. Layer connectivity. The local perceptual domain slides to the right for a compensation (here set to 2), and the input layer data is sent to the second hidden layer neuron. Carrying out in sequence, the transmission of data from the input layer to the hidden layer can be completed. The 3X3 neurons in the first hidden layer obtained above all use the same 3X3 weights, which is called the weight sharing principle. In addition, each neuron in the hidden layer shares a bias value b, which is called a shared bias.
更进一步的说明,步骤B中所述采集到的图像为彩色图像,图像的采集方式为工业相机拍摄,并将整幅图像输入网络。To further illustrate, the image collected in step B is a color image, the image is collected by an industrial camera, and the entire image is input into the network.
更进一步的说明,所述分类器为softmax分类器。本发明的一个实施例中,所述分类器为softmax分类器。Softmax分类器只有两层,即输入层与输出层,与神经网络相比缺少了隐藏层。根据要识别几类缺陷,设定softmax的有几个输出单元。本发明要识别砂眼、刮伤、缺料、变形、麻点、油污六类缺陷。所以softmax有6个输出单元,每个单元对应一个缺陷类别。图像输入后,经过网络运算,Softmax每个输出单元会输出一个数值,代表输入属于每一个类别的概率,我们认为输出的最大值则为输入样本的缺陷类别。To further illustrate, the classifier is a softmax classifier. In one embodiment of the present invention, the classifier is a softmax classifier. The Softmax classifier has only two layers, namely the input layer and the output layer, and lacks the hidden layer compared with the neural network. According to the types of defects to be identified, there are several output units for setting softmax. The present invention needs to identify six types of defects such as trachoma, scratch, lack of material, deformation, pitting and oil stain. So softmax has 6 output units, one for each defect category. After the image is input, after the network operation, each output unit of Softmax will output a value, representing the probability that the input belongs to each category. We think that the maximum value of the output is the defect category of the input sample.
以上结合具体实施例描述了本发明的技术原理。这些描述只是为了解释本发明的原理,而不能以任何方式解释为对本发明保护范围的限制。基于此处的解释,本领域的技术人员不需要付出创造性的劳动即可联想到本发明的其它具体实施方式,这些方式都将落入本发明的保护范围之内。The above describes the technical principles of the present invention in conjunction with specific embodiments. These descriptions are only for explaining the principles of the present invention, and cannot be construed as limiting the protection scope of the present invention in any way. Based on the explanations herein, those skilled in the art can think of other specific implementation modes of the present invention without creative work, and these modes will all fall within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710707883.3A CN107481231A (en) | 2017-08-17 | 2017-08-17 | A kind of handware defect classifying identification method based on depth convolutional neural networks |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710707883.3A CN107481231A (en) | 2017-08-17 | 2017-08-17 | A kind of handware defect classifying identification method based on depth convolutional neural networks |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107481231A true CN107481231A (en) | 2017-12-15 |
Family
ID=60600999
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710707883.3A Pending CN107481231A (en) | 2017-08-17 | 2017-08-17 | A kind of handware defect classifying identification method based on depth convolutional neural networks |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107481231A (en) |
Cited By (21)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108074231A (en) * | 2017-12-18 | 2018-05-25 | 浙江工业大学 | Magnetic sheet surface defect detection method based on convolutional neural network |
CN108333183A (en) * | 2018-01-31 | 2018-07-27 | 西安工程大学 | A kind of color based on DCGAN and DCNN knits shirt cut-parts defect inspection method |
CN108389197A (en) * | 2018-02-26 | 2018-08-10 | 上海赛特斯信息科技股份有限公司 | Transmission line of electricity defect inspection method based on deep learning |
CN108460761A (en) * | 2018-03-12 | 2018-08-28 | 北京百度网讯科技有限公司 | Method and apparatus for generating information |
CN108491867A (en) * | 2018-03-12 | 2018-09-04 | 苏州卓融新能源科技有限公司 | Image Matching based on artificial intelligence and recognition methods |
CN108596922A (en) * | 2018-05-10 | 2018-09-28 | 广东工业大学 | A kind of handware Method of Defect Segmentation and system based on convolutional neural networks |
CN108629370A (en) * | 2018-04-28 | 2018-10-09 | 广东工业大学 | A kind of classification and identification algorithm and device based on depth confidence network |
CN108764278A (en) * | 2018-04-16 | 2018-11-06 | 苏州富鑫林光电科技有限公司 | A kind of the self study industrial intelligent detecting system and method for view-based access control model |
CN108876781A (en) * | 2018-06-26 | 2018-11-23 | 广东工业大学 | Surface defect recognition method based on SSD algorithm |
CN109472790A (en) * | 2018-11-22 | 2019-03-15 | 南昌航空大学 | Method and system for defect detection of mechanical parts |
CN110314854A (en) * | 2019-06-06 | 2019-10-11 | 苏州市职业大学 | A kind of device and method of the workpiece sensing sorting of view-based access control model robot |
CN110992361A (en) * | 2019-12-25 | 2020-04-10 | 创新奇智(成都)科技有限公司 | Engine fastener detection system and detection method based on cost balance |
CN111507972A (en) * | 2020-04-20 | 2020-08-07 | 南京航空航天大学 | A Tunnel Surface Defect Detection Method Combining Convolutional Neural Networks and Support Vector Machines |
CN111699496A (en) * | 2018-03-14 | 2020-09-22 | 欧姆龙株式会社 | Neural network type image processing apparatus |
CN112396580A (en) * | 2020-11-05 | 2021-02-23 | 北京信息科技大学 | Circular part defect detection method |
CN112700446A (en) * | 2021-03-23 | 2021-04-23 | 常州微亿智造科技有限公司 | Algorithm model training method and device for industrial quality inspection |
CN112749747A (en) * | 2021-01-13 | 2021-05-04 | 上海交通大学 | Garbage classification quality evaluation method and system |
CN113298190A (en) * | 2021-07-05 | 2021-08-24 | 四川大学 | Weld image recognition and classification algorithm based on large-size unbalanced samples |
TWI745767B (en) * | 2019-10-18 | 2021-11-11 | 汎思數據股份有限公司 | Optical inspection secondary image classification method |
CN113792852A (en) * | 2021-09-09 | 2021-12-14 | 湖南艾科诺维科技有限公司 | Signal modulation mode identification system and method based on parallel neural network |
US11507801B2 (en) | 2018-07-27 | 2022-11-22 | Samsung Electronics Co., Ltd. | Method for detecting defects in semiconductor device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160163035A1 (en) * | 2014-12-03 | 2016-06-09 | Kla-Tencor Corporation | Automatic Defect Classification Without Sampling and Feature Selection |
CN106875381A (en) * | 2017-01-17 | 2017-06-20 | 同济大学 | A kind of phone housing defect inspection method based on deep learning |
-
2017
- 2017-08-17 CN CN201710707883.3A patent/CN107481231A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160163035A1 (en) * | 2014-12-03 | 2016-06-09 | Kla-Tencor Corporation | Automatic Defect Classification Without Sampling and Feature Selection |
CN106875381A (en) * | 2017-01-17 | 2017-06-20 | 同济大学 | A kind of phone housing defect inspection method based on deep learning |
Non-Patent Citations (4)
Title |
---|
"《Java数字图像处理:编程技巧与应用实践》" * |
BIXIWEN_LIU: "神经网络八:权重初始化", 《HTTP://BLOG.CSDN.NET/BINXIWEN_LIU/》 * |
邓星: "基于深度学习与SVM的电弧熔积表面缺陷检测与分类", 《万方学位论文数据库》 * |
颜伟鑫: "深度学习及其在工件缺陷自动检测中的应用研究", 《中国优秀硕士论文全文数据库》 * |
Cited By (29)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108074231B (en) * | 2017-12-18 | 2020-04-21 | 浙江工业大学 | A method for surface defect detection of magnetic sheet based on convolutional neural network |
CN108074231A (en) * | 2017-12-18 | 2018-05-25 | 浙江工业大学 | Magnetic sheet surface defect detection method based on convolutional neural network |
CN108333183A (en) * | 2018-01-31 | 2018-07-27 | 西安工程大学 | A kind of color based on DCGAN and DCNN knits shirt cut-parts defect inspection method |
CN108333183B (en) * | 2018-01-31 | 2021-03-16 | 西安工程大学 | Yarn-dyed shirt cut piece defect detection method based on DCGAN and DCNN |
CN108389197A (en) * | 2018-02-26 | 2018-08-10 | 上海赛特斯信息科技股份有限公司 | Transmission line of electricity defect inspection method based on deep learning |
CN108389197B (en) * | 2018-02-26 | 2022-02-08 | 上海赛特斯信息科技股份有限公司 | Defect detection method of transmission line based on deep learning |
CN108460761A (en) * | 2018-03-12 | 2018-08-28 | 北京百度网讯科技有限公司 | Method and apparatus for generating information |
CN108491867A (en) * | 2018-03-12 | 2018-09-04 | 苏州卓融新能源科技有限公司 | Image Matching based on artificial intelligence and recognition methods |
CN111699496B (en) * | 2018-03-14 | 2023-08-29 | 欧姆龙株式会社 | Neural network type image processing device, appearance inspection device, and appearance inspection method |
CN111699496A (en) * | 2018-03-14 | 2020-09-22 | 欧姆龙株式会社 | Neural network type image processing apparatus |
CN108764278A (en) * | 2018-04-16 | 2018-11-06 | 苏州富鑫林光电科技有限公司 | A kind of the self study industrial intelligent detecting system and method for view-based access control model |
CN108629370A (en) * | 2018-04-28 | 2018-10-09 | 广东工业大学 | A kind of classification and identification algorithm and device based on depth confidence network |
CN108629370B (en) * | 2018-04-28 | 2022-05-10 | 广东工业大学 | Classification recognition algorithm and device based on deep belief network |
CN108596922A (en) * | 2018-05-10 | 2018-09-28 | 广东工业大学 | A kind of handware Method of Defect Segmentation and system based on convolutional neural networks |
CN108876781A (en) * | 2018-06-26 | 2018-11-23 | 广东工业大学 | Surface defect recognition method based on SSD algorithm |
US11507801B2 (en) | 2018-07-27 | 2022-11-22 | Samsung Electronics Co., Ltd. | Method for detecting defects in semiconductor device |
CN109472790A (en) * | 2018-11-22 | 2019-03-15 | 南昌航空大学 | Method and system for defect detection of mechanical parts |
CN110314854A (en) * | 2019-06-06 | 2019-10-11 | 苏州市职业大学 | A kind of device and method of the workpiece sensing sorting of view-based access control model robot |
TWI745767B (en) * | 2019-10-18 | 2021-11-11 | 汎思數據股份有限公司 | Optical inspection secondary image classification method |
CN110992361A (en) * | 2019-12-25 | 2020-04-10 | 创新奇智(成都)科技有限公司 | Engine fastener detection system and detection method based on cost balance |
CN111507972A (en) * | 2020-04-20 | 2020-08-07 | 南京航空航天大学 | A Tunnel Surface Defect Detection Method Combining Convolutional Neural Networks and Support Vector Machines |
CN112396580A (en) * | 2020-11-05 | 2021-02-23 | 北京信息科技大学 | Circular part defect detection method |
CN112396580B (en) * | 2020-11-05 | 2024-02-02 | 北京信息科技大学 | Method for detecting defects of round part |
CN112749747B (en) * | 2021-01-13 | 2022-11-11 | 上海交通大学 | Method and system for quality assessment of garbage classification |
CN112749747A (en) * | 2021-01-13 | 2021-05-04 | 上海交通大学 | Garbage classification quality evaluation method and system |
CN112700446A (en) * | 2021-03-23 | 2021-04-23 | 常州微亿智造科技有限公司 | Algorithm model training method and device for industrial quality inspection |
CN113298190A (en) * | 2021-07-05 | 2021-08-24 | 四川大学 | Weld image recognition and classification algorithm based on large-size unbalanced samples |
CN113792852A (en) * | 2021-09-09 | 2021-12-14 | 湖南艾科诺维科技有限公司 | Signal modulation mode identification system and method based on parallel neural network |
CN113792852B (en) * | 2021-09-09 | 2024-03-19 | 湖南艾科诺维科技有限公司 | Signal modulation mode identification system and method based on parallel neural network |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107481231A (en) | A kind of handware defect classifying identification method based on depth convolutional neural networks | |
Kumar et al. | Resnet-based approach for detection and classification of plant leaf diseases | |
Wang et al. | Integrated model of BP neural network and CNN algorithm for automatic wear debris classification | |
Azizah et al. | Deep learning implementation using convolutional neural network in mangosteen surface defect detection | |
CN107133616B (en) | Segmentation-free character positioning and identifying method based on deep learning | |
CN104850858B (en) | A kind of injection-molded item defects detection recognition methods | |
CN108918536B (en) | Tire mold surface character defect detection method, device, equipment and storage medium | |
CN112085735A (en) | Aluminum image defect detection method based on self-adaptive anchor frame | |
CN107194559A (en) | A kind of work stream recognition method based on Three dimensional convolution neutral net | |
CN110119687A (en) | Detection method based on the road surface slight crack defect that image procossing and convolutional neural networks combine | |
CN106920243A (en) | The ceramic material part method for sequence image segmentation of improved full convolutional neural networks | |
CN108038853A (en) | Ceramic tile surface defect identification method based on convolutional neural network and active learning | |
CN108629370B (en) | Classification recognition algorithm and device based on deep belief network | |
Alipasandi et al. | Classification of three varieties of peach fruit using artificial neural network assisted with image processing techniques. | |
CN108876781A (en) | Surface defect recognition method based on SSD algorithm | |
CN107657249A (en) | Method, apparatus, storage medium and the processor that Analysis On Multi-scale Features pedestrian identifies again | |
CN106228177A (en) | Daily life subject image recognition methods based on convolutional neural networks | |
CN107607554A (en) | A kind of Defect Detection and sorting technique of the zinc-plated stamping parts based on full convolutional neural networks | |
CN107341506A (en) | A kind of Image emotional semantic classification method based on the expression of many-sided deep learning | |
CN103927534A (en) | Sprayed character online visual detection method based on convolutional neural network | |
CN109190643A (en) | Based on the recognition methods of convolutional neural networks Chinese medicine and electronic equipment | |
CN109446889A (en) | Object tracking method and device based on twin matching network | |
CN107292885A (en) | A kind of product defects classifying identification method and device based on autocoder | |
CN110458027A (en) | A fresh meat grading method, system and device based on marbling | |
CN117557784B (en) | Target detection method, target detection device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171215 |