[go: up one dir, main page]

CN111738991A - A method of creating a digital radiographic inspection model for weld defects - Google Patents

A method of creating a digital radiographic inspection model for weld defects Download PDF

Info

Publication number
CN111738991A
CN111738991A CN202010499827.7A CN202010499827A CN111738991A CN 111738991 A CN111738991 A CN 111738991A CN 202010499827 A CN202010499827 A CN 202010499827A CN 111738991 A CN111738991 A CN 111738991A
Authority
CN
China
Prior art keywords
model
image
weld
original
deep learning
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
Application number
CN202010499827.7A
Other languages
Chinese (zh)
Inventor
郑玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xi'an Digital Information Technology Co ltd
Original Assignee
Xi'an Digital Information Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Xi'an Digital Information Technology Co ltd filed Critical Xi'an Digital Information Technology Co ltd
Priority to CN202010499827.7A priority Critical patent/CN111738991A/en
Publication of CN111738991A publication Critical patent/CN111738991A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • G06T2207/20032Median filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30108Industrial image inspection
    • G06T2207/30152Solder

Landscapes

  • Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Analysing Materials By The Use Of Radiation (AREA)
  • Image Analysis (AREA)

Abstract

The invention provides a method for creating a digital ray detection model of weld defects, which extracts a weld in an image by using a digital image processing technology; expanding the number of samples of the welding seam image by applying an image enhancement technology; the model is trained by utilizing the built deep learning model and the designed loss function, so that the defect rule can be learned from the existing defect image, all images to be detected can be more flexibly batch-processed by using the deep neural network, the model is more flexible and more stable in performance, and higher recall rate and certain accuracy rate of the model are ensured; and the model is convenient to call and use by packaging and storing the model. Reduce artificial work load, improve work efficiency.

Description

一种焊缝缺陷的数字射线检测模型的创建方法A method of creating a digital radiographic inspection model for weld defects

技术领域technical field

本发明涉及图像检测模型创建方法技术领域,特别是涉及一种焊缝缺陷的数字射线检测模型的创建方法。The invention relates to the technical field of image detection model creation methods, in particular to a creation method of a digital ray detection model for weld defects.

背景技术Background technique

近年来,人工智能给计算机视觉领域带来了新的发展,尤其是在图像分类和目标检测方面。常用的图像分类模型如Alexnet、VGG、Resnet等都能够处理极其复杂的图像数据,常用于公开数据集的分类,这些模型的性能和精度得到了不断提升。然而实际生产中的数据并不如常见的公开数据集一样容易分辨,比如在焊缝检测领域就存在着评片困难的问题。在焊接接头中存在着一定梳理的缺陷,如裂纹、气孔、夹渣、未焊透、未熔合等,这些缺陷的存在会降低焊接强度,引起应力集中,造成焊接结构破坏。以上均会影响到焊接结构的完整性及安全性,需要评片人员对拍摄的焊缝图像进行判断,从而筛选出存在缺陷的图像。但是这种依靠于人工的检测方式受检测人员的专业知识、身体疲劳情况等影响较大,需要采用更加客观智能的缺陷图像检测方法。目前也存在一些用于射线焊缝图像自动识别与分类的方法,如基于图像差分的方法,基于边缘检测的方法,基于模板匹配的相似缺陷检测算法等,这些基于传统图像处理的方法较大程度还是依靠人的知识去判断,且极不稳定,对图像分辨率和对比度要求较高,而现有的应用于公开数据集的神经网络模型对于这种特征不明显的图像识别效果较差,不能满足缺陷检测对于高召回率的要求。In recent years, artificial intelligence has brought new developments to the field of computer vision, especially in image classification and object detection. Commonly used image classification models such as Alexnet, VGG, Resnet, etc. can handle extremely complex image data, and are often used to classify public datasets. The performance and accuracy of these models have been continuously improved. However, the data in actual production is not as easy to distinguish as the common public data sets. For example, in the field of weld inspection, there is a problem of difficulty in evaluating films. There are certain combing defects in welded joints, such as cracks, pores, slag inclusions, incomplete penetration, lack of fusion, etc. The existence of these defects will reduce the welding strength, cause stress concentration, and cause damage to the welded structure. All of the above will affect the integrity and safety of the welded structure, and the film reviewers need to judge the photographed weld images, so as to screen out the images with defects. However, this manual detection method is greatly affected by the professional knowledge and physical fatigue of the inspector, and a more objective and intelligent defect image detection method needs to be adopted. At present, there are also some methods for automatic identification and classification of ray weld images, such as methods based on image difference, methods based on edge detection, and similar defect detection algorithms based on template matching, etc. These methods based on traditional image processing are to a large extent It still relies on human knowledge to judge, and it is extremely unstable and requires high image resolution and contrast. The existing neural network models applied to public datasets have poor performance in recognizing such images with inconspicuous features and cannot be used. Meet the requirements of defect detection for high recall rate.

发明内容SUMMARY OF THE INVENTION

本发明实施例的目的在于提供一种焊缝缺陷的数字射线检测模型的创建方法,以解决现有技术中用于公开数据集的神经网络模型对于这种特征不明显的图像效果较差,而且不能满足缺陷检测对于高召回率的要求的问题。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a method for creating a digital ray detection model for weld defects, so as to solve the problem that the neural network model used for public data sets in the prior art has a poor effect on such images with insignificant features, and The problem that cannot meet the requirements of defect detection for high recall rate. The specific technical solutions are as follows:

本发明实施例提供了一种焊缝缺陷的数字射线检测模型的创建方法,包括:An embodiment of the present invention provides a method for creating a digital radiographic detection model for weld defects, including:

S110.获取原图片;S110. Obtain the original picture;

S120.利用预定方法,提取出所述原图像中的焊缝,获得焊缝图像;S120. Using a predetermined method, extract the weld seam in the original image to obtain a weld seam image;

S130.利用数据增强算法对所述焊缝图像进行样本扩充,得到基于所述焊缝图像的多个样本图;S130. Use a data enhancement algorithm to perform sample expansion on the weld image to obtain multiple sample maps based on the weld image;

S140.利用所述样本图训练卷积神经网络,构建获得适用于焊缝缺陷检测的深度学习模型;S140. Use the sample graph to train a convolutional neural network to construct and obtain a deep learning model suitable for weld defect detection;

S150.利用损失函数校准所述深度学习模型,计算得到所述深度学习模型的准确率与召回率;S150. Use a loss function to calibrate the deep learning model, and calculate the accuracy and recall of the deep learning model;

S160.重复步骤S110-S150,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准;其中,所述预定标准包括:预定准确率、预定召回率;S160. Repeat steps S110-S150, and use at least two of the original pictures to train the deep learning model to obtain a basic model, so that the basic model meets a predetermined standard; wherein, the predetermined standard includes: a predetermined accuracy rate, predetermined recall rate;

S170.保存所述基础模型,并对所述基础模型进行接口封装,得到焊缝缺陷的数字射线检测模型。S170. Save the basic model, and perform interface encapsulation on the basic model to obtain a digital ray detection model for weld defects.

可选的,所述预定方法为:Optionally, the predetermined method is:

获取所述原图片的感兴趣区域,并勾勒所述感兴趣区域;Obtain the region of interest of the original image, and outline the region of interest;

利用边缘检测方法从所述感兴趣区域中提取焊缝图像。Weld seam images are extracted from the region of interest using edge detection methods.

可选的,所述边缘检测方法包括:Optionally, the edge detection method includes:

对所述感兴趣区域沿长度方向切片,获得多个片段图像;Slicing the region of interest along the length direction to obtain a plurality of segment images;

对所述片段图像进行开运算,得到连贯图像片段;performing an open operation on the segment images to obtain consecutive image segments;

对所述连贯图像片段进行进行限制对比度的局部直方图均衡化,再进行中值滤波,得到平滑图像片段;performing local histogram equalization with limited contrast on the continuous image segments, and then performing median filtering to obtain smooth image segments;

采用离散的一阶差分算子计算所述平滑图像片段的图像亮度函数的Y轴的一阶梯度近似值;Using a discrete first-order difference operator to calculate a first-order gradient approximation of the Y-axis of the image brightness function of the smoothed image segment;

将所述一阶梯度近似值转化为二值化图像;converting the first-order gradient approximation into a binarized image;

对所述二值化图像进行灰度翻转,并利用边缘检测算子进行边缘检测,得到焊缝轮廓图像;Perform grayscale inversion on the binarized image, and use an edge detection operator to perform edge detection to obtain a weld outline image;

记录所述焊缝轮廓图像的Y轴坐标,并根据所述焊缝轮廓图像的Y轴坐标对所述感兴趣区域进行裁剪,从所述感兴趣区域中提取焊缝图像。The Y-axis coordinate of the weld outline image is recorded, the region of interest is cropped according to the Y-axis coordinate of the weld outline image, and the weld image is extracted from the region of interest.

可选的,所述损失函数为:Optionally, the loss function is:

Loss=-[ytlogyp+w*(1-yt)log(1-yp)]Loss=-[y t logy p +w*(1-y t )log(1-y p )]

式中,w为偏执、(x,y)为样本点、假设某个样本点的真实标签为yt,该样本点取yt=1的概率为yp,Loss为损失函数,yp的取值在(0,1)之间。In the formula, w is paranoia, (x, y) is the sample point, assuming that the true label of a sample point is y t , the probability that the sample point takes y t =1 is y p , Loss is the loss function, and the value of y p The value is between (0, 1).

可选的,步骤S160中,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准包括:Optionally, in step S160, the deep learning model is trained by using at least two of the original pictures to obtain a basic model, and making the basic model meet a predetermined standard includes:

获取多个无缺陷原图像,并获取与所述无缺陷原图像数量相等的缺陷原图像;Acquiring a plurality of defect-free original images, and acquiring defective original images equal to the number of the defect-free original images;

将所述无缺陷原图像与所述缺陷原图像作为模型训练集,并从所述模型训练集中随机获取原图像,并将原图像置于所述深度学习模型中进行训练;Using the defect-free original image and the defective original image as a model training set, and randomly acquiring the original image from the model training set, and placing the original image in the deep learning model for training;

直至所述基础模型达到预定标准为止。until the base model reaches a predetermined standard.

可选的,步骤S160中,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准包括:Optionally, in step S160, the deep learning model is trained by using at least two of the original pictures to obtain a basic model, and making the basic model meet a predetermined standard includes:

从数据库中随机选择所述基础模型进行一次训练所选取的样本数量一半的无缺陷原图像,并且从数据库中随机选取与所述无缺陷原图像数量相等的缺陷原图像;Randomly selects the basic model from the database and randomly selects half the number of samples without defects from the database, and randomly selects the original images with defects equal to the number of the original images without defects from the database;

将所述无缺陷原图像与所述缺陷原图像作为模型训练集,并从所述模型训练集中随机获取原图像,并将原图像置于所述深度学习模型中进行训练;Using the defect-free original image and the defective original image as a model training set, and randomly acquiring the original image from the model training set, and placing the original image in the deep learning model for training;

直至所述基础模型达到预定标准为止。until the base model reaches a predetermined standard.

可选的,所述基础模型包括:模型的结构、对所述深度学习模型进行训练后的权重。Optionally, the basic model includes: the structure of the model, and the weights after training the deep learning model.

本发明实施例提供了一种焊缝缺陷的数字射线检测模型的创建方法,运用数字图像处理技术提取出图像中的焊缝;通过运用图像增强技术对焊缝图像进行样本数量的扩充;利用搭建的深度学习模型和设计的损失函数来训练模型,能够从现有的缺陷图像中学习缺陷规律,使用深度神经网络能够更加灵活的对所有待测图像进行批处理,更灵活且性能更加稳定,保证模型较高的召回率和一定的准确率;通过对模型的封装保存方便对模型的调用和使用。减少人为工作量,提高工作效率。The embodiment of the present invention provides a method for creating a digital ray detection model for weld defects, which uses digital image processing technology to extract welds in an image; expands the number of samples of weld images by using image enhancement technology; The deep learning model and the designed loss function are used to train the model, which can learn the defect rules from the existing defect images. Using the deep neural network can more flexibly batch batch all the images to be tested, which is more flexible and has more stable performance. The model has a high recall rate and a certain accuracy rate; it is convenient to call and use the model by encapsulating and saving the model. Reduce manual workload and improve work efficiency.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to illustrate the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that are required in the description of the embodiments or the prior art.

图1为本发明实施例提供的一种焊缝缺陷的数字射线检测模型的创建方法流程图;1 is a flowchart of a method for creating a digital radiographic detection model for weld defects provided by an embodiment of the present invention;

图2为本发明实施例提供的焊缝提取流程图;FIG. 2 is a flowchart of weld extraction provided by an embodiment of the present invention;

图3为本发明实施例提供的深度神经网络模型结构图;3 is a structural diagram of a deep neural network model provided by an embodiment of the present invention;

图4为本发明实施例提供的两种训练策略流程图;4 is a flowchart of two training strategies provided by an embodiment of the present invention;

图5为本发明实施例提供的带有勾勒线条的原图像;5 is an original image with outline lines provided by an embodiment of the present invention;

图6为本发明实施例提供的焊缝提取流程示意图;6 is a schematic diagram of a welding seam extraction process provided by an embodiment of the present invention;

图7为本发明实施例提供的最终提取到的焊缝图;FIG. 7 is a final extracted weld diagram provided by an embodiment of the present invention;

图8为本发明实施例提供的卷积层拼接示意图;8 is a schematic diagram of convolutional layer splicing provided by an embodiment of the present invention;

图9为本发明实施例提供的现有的交叉熵函数错误敏感度表格;FIG. 9 is an existing cross-entropy function error sensitivity table provided by an embodiment of the present invention;

图10为本发明实施例提供的现有的交叉熵函数错误敏感度三维图;10 is a three-dimensional diagram of error sensitivity of an existing cross-entropy function provided by an embodiment of the present invention;

图11为本发明实施例提供的不同偏执下交叉熵函数的错误敏感度三维图;11 is a three-dimensional diagram of error sensitivity of cross-entropy functions under different paranoia provided by an embodiment of the present invention;

图12为本发明实施例提供的策略1的图像模型训练拟合图;12 is an image model training fitting diagram of Strategy 1 provided by an embodiment of the present invention;

图13为本发明实施例提供的策略2的图像模型训练拟合图;13 is an image model training fitting diagram of Strategy 2 provided by an embodiment of the present invention;

图14为本发明实施例提供的召回率的图像模型训练拟合图;14 is a training fitting diagram of an image model of recall provided by an embodiment of the present invention;

图15为本发明实施例提供的基础模型终止训练时的训练结果图标。FIG. 15 is a training result icon when the basic model provided by an embodiment of the present invention terminates training.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行描述。The technical solutions in the embodiments of the present invention will be described below with reference to the accompanying drawings in the embodiments of the present invention.

本发明实施例的目的在于提供一种焊缝缺陷的数字射线检测方法、系统及服务器,以解决现有技术中用于公开数据集的神经网络模型对于这种特征不明显的图像效果较差,而且不能满足缺陷检测对于高召回率的要求的问题。The purpose of the embodiments of the present invention is to provide a digital ray detection method, system and server for welding seam defects, so as to solve the problem that the neural network model used for public data sets in the prior art has a poor effect on such images with insignificant features, Moreover, it cannot meet the problem that defect detection requires a high recall rate.

实施例1Example 1

请参见图1,本发明实施例提供了一种焊缝缺陷的数字射线检测模型的创建方法,包括:Referring to FIG. 1, an embodiment of the present invention provides a method for creating a digital ray inspection model for weld defects, including:

S110.获取原图片;上述原图片可以直接从数据库中获得,具体到本申请,上述原图片为带有焊缝的原图片,具体上述焊缝是否有缺陷,都可以作为本方案的上述原图片。S110. Obtain the original picture; the above original picture can be obtained directly from the database. Specifically, in this application, the above original picture is the original picture with the welding seam. Specifically, whether the above welding seam is defective can be used as the above original picture of this solution. .

S120.利用预定方法,提取出所述原图像中的焊缝,获得焊缝图像。S120. Using a predetermined method, extract the weld seam in the original image to obtain a weld seam image.

S130.利用数据增强算法对所述焊缝图像进行样本扩充,得到基于所述焊缝图像的多个样本图;利用数据增强算法对已有的正负类样本进行扩充,从而增大样本的容量。针对焊缝图像的特点,采用图像翻转对称的技术对原始焊缝图像进行扩充。S130. Use a data enhancement algorithm to perform sample expansion on the weld image to obtain multiple sample maps based on the weld image; use a data enhancement algorithm to expand the existing positive and negative samples, thereby increasing the capacity of the samples . According to the characteristics of the weld image, the original weld image is expanded by using the image inversion symmetry technique.

S140.利用所述样本图训练卷积神经网络,构建获得适用于焊缝缺陷检测的深度学习模型;根据数据特点构建深度学习模型适用于焊缝缺陷检测。S140. Use the sample graph to train a convolutional neural network to construct and obtain a deep learning model suitable for weld defect detection; construct a deep learning model suitable for weld defect detection according to data characteristics.

具体的,针对焊缝图像对比度低,缺陷较小,特征不明显等问题,本发明采用拼接的方式进行特征融合,设计模块中将特征在channel维度拼接在一起,形成更厚的特征,设计的block如图8所示。来自上一层的数据进入该模块后分别通过两个各自独立且规格不同的卷积核提取特征,将获得的特征在维度尺度上直接拼接起来形成新的特征,将该特征放入dropout层,该层的存在在一定程度上避免了模型的过拟合,然后进入BN层进行归一化处理,最后经过池化层形成经过该模块后的特征数据。利用该模块构建起深度神经网络请参见图3。Specifically, in view of the problems of low contrast of the weld image, small defects, and inconspicuous features, the present invention adopts the method of splicing to perform feature fusion. In the design module, the features are spliced together in the channel dimension to form thicker features. The block is shown in Figure 8. After the data from the previous layer enters the module, the features are extracted through two independent convolution kernels with different specifications, and the obtained features are directly spliced together in the dimension scale to form new features, and the features are put into the dropout layer. The existence of this layer avoids the overfitting of the model to a certain extent, and then enters the BN layer for normalization, and finally passes through the pooling layer to form the feature data after this module. Use this module to build a deep neural network, see Figure 3.

S150.利用损失函数校准所述深度学习模型,计算得到所述深度学习模型的准确率与召回率;为使模型保证较高的召回率,采用设计的保证高召回率的损失函数用于模型训练。S150. Use a loss function to calibrate the deep learning model, and calculate the accuracy and recall of the deep learning model; in order to ensure a higher recall rate for the model, a designed loss function that guarantees a high recall rate is used for model training .

S160.重复步骤S110-S150,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准;其中,所述预定标准包括:预定准确率、预定召回率;采用不同的训练方式,使得即使在数据量太大,以至于内存放不下时也可以使模型稳定训练。S160. Repeat steps S110-S150, and use at least two of the original pictures to train the deep learning model to obtain a basic model, so that the basic model meets a predetermined standard; wherein, the predetermined standard includes: a predetermined accuracy rate, Predetermined recall; different training methods are used to enable stable training of the model even when the amount of data is too large to fit in memory.

S170.保存所述基础模型,并对所述基础模型进行接口封装,得到焊缝缺陷的数字射线检测模型。对训练好的模型进行封装保存,方便来自远程服务器的调用。S170. Save the basic model, and perform interface encapsulation on the basic model to obtain a digital ray detection model for weld defects. Encapsulate and save the trained model to facilitate calls from remote servers.

具体的,本发明实施例提供了一种焊缝缺陷的数字射线检测模型的创建方法,运用数字图像处理技术提取出图像中的焊缝;通过运用图像增强技术对焊缝图像进行样本数量的扩充;利用搭建的深度学习模型和设计的损失函数来训练模型,能够从现有的缺陷图像中学习缺陷规律,使用深度神经网络能够更加灵活的对所有待测图像进行批处理,更灵活且性能更加稳定,保证模型较高的召回率和一定的准确率;通过对模型的封装保存方便对模型的调用和使用。减少人为工作量,提高工作效率。Specifically, an embodiment of the present invention provides a method for creating a digital ray detection model for weld defects, which uses digital image processing technology to extract welds in an image; and uses image enhancement technology to expand the number of samples in the weld image. ;Using the built deep learning model and the designed loss function to train the model, can learn the defect rules from the existing defect images, and use the deep neural network to more flexibly batch all the images to be tested, which is more flexible and has better performance. Stable, to ensure a high recall rate and a certain accuracy of the model; it is convenient to call and use the model by encapsulating and saving the model. Reduce manual workload and improve work efficiency.

与现有的焊缝缺陷检测算法相比,本算法有以下优点:Compared with the existing weld defect detection algorithms, this algorithm has the following advantages:

1.对比于传统图像处理算法具有更高的效率且更灵活1. Compared with traditional image processing algorithms, it has higher efficiency and more flexibility

通过传统的图像处理技术如图像差分、模板匹配等来进行的焊缝缺陷检测在一定程度上依赖于人的专业知识进行图像对比,不能真正实现端到端的检测,而本发明使用深度学习方法作为核心检测算法,能够从现有的缺陷图像中学习缺陷规律,使用深度神经网络能够更加灵活的对所有待测图像进行批处理,更灵活且性能更加稳定。Weld defect detection through traditional image processing techniques such as image difference, template matching, etc. relies on human expertise to perform image comparison to a certain extent, and cannot truly achieve end-to-end detection. The core detection algorithm can learn the defect rules from the existing defect images. Using the deep neural network can more flexibly batch batch all the images to be tested, which is more flexible and has more stable performance.

2.对比于现有深度学习模型具有更高的召回率和准确率2. Compared with existing deep learning models, it has higher recall rate and accuracy rate

现有深度学习模型没有针对焊缝图像的,因而本发明使用的算法具有更强的针对性,故具有更高的精度,尤其是本算法设计了保高召回率的损失函数,所以在保证较高召回率的同时能够保证一定的准确率,能够更加符合生产实践的要求。The existing deep learning model is not aimed at welding seam images, so the algorithm used in the present invention has stronger pertinence, so it has higher precision, especially the loss function designed to ensure a high recall rate in this algorithm, so it can guarantee a higher recall rate. The high recall rate can also ensure a certain accuracy rate, which can better meet the requirements of production practice.

实施例2Example 2

在上述实施例1的基础上,本实施例结合图2-图15,对本方案做进一步详细描述。具体如下:On the basis of the foregoing Embodiment 1, this embodiment further describes the solution in detail with reference to FIGS. 2 to 15 . details as follows:

进一步的,所述预定方法为:Further, the predetermined method is:

获取所述原图片的感兴趣区域,并勾勒所述感兴趣区域;Obtain the region of interest of the original image, and outline the region of interest;

利用边缘检测方法从所述感兴趣区域中提取焊缝图像。Weld seam images are extracted from the region of interest using edge detection methods.

具体的,先就是要从图像中提取出感兴趣的区域,也就是焊缝。Specifically, the first is to extract the region of interest from the image, that is, the weld.

在图像处理中很重要的是ROI(region of interest),感兴趣区域。机器视觉、图像处理中,从被处理的图像以方框、圆、椭圆、不规则多边形等方式勾勒出需要处理的区域,称为感兴趣区域,ROI。在Halcon、OpenCV、Matlab等机器视觉软件上常用到各种算子(Operator运算符号)和函数来求得感兴趣区域ROI,并进行图像的下一步处理。在下面的焊缝图像中,用矩形框线框选的部分,请参见图5。The most important thing in image processing is the ROI (region of interest), the region of interest. In machine vision and image processing, the region to be processed is outlined from the processed image in the form of boxes, circles, ellipses, irregular polygons, etc., which is called region of interest, ROI. Various operators (Operator operation symbols) and functions are commonly used in machine vision software such as Halcon, OpenCV, and Matlab to obtain the ROI of the region of interest, and perform the next processing of the image. In the image of the weld seam below, the section is framed with a rectangular frame, see Figure 5.

进一步的,所述边缘检测方法包括:Further, the edge detection method includes:

对所述感兴趣区域沿长度方向切片,获得多个片段图像;Slicing the region of interest along the length direction to obtain a plurality of segment images;

对所述片段图像进行开运算,得到连贯图像片段;performing an open operation on the segment images to obtain consecutive image segments;

对所述连贯图像片段进行进行限制对比度的局部直方图均衡化,再进行中值滤波,得到平滑图像片段;performing local histogram equalization with limited contrast on the continuous image segments, and then performing median filtering to obtain smooth image segments;

采用离散的一阶差分算子计算所述平滑图像片段的图像亮度函数的Y轴的一阶梯度近似值;Using a discrete first-order difference operator to calculate a first-order gradient approximation of the Y-axis of the image brightness function of the smoothed image segment;

将所述一阶梯度近似值转化为二值化图像;converting the first-order gradient approximation into a binarized image;

对所述二值化图像进行灰度翻转,并利用边缘检测算子进行边缘检测,得到焊缝轮廓图像;Perform grayscale inversion on the binarized image, and use an edge detection operator to perform edge detection to obtain a weld outline image;

记录所述焊缝轮廓图像的Y轴坐标,并根据所述焊缝轮廓图像的Y轴坐标对所述感兴趣区域进行裁剪,从所述感兴趣区域中提取焊缝图像,请参见图7,图7为最终提取到的焊缝图。Record the Y-axis coordinate of the weld outline image, and crop the region of interest according to the Y-axis coordinate of the weld outline image, and extract the weld image from the region of interest, see FIG. 7 , Figure 7 is the final extracted weld image.

具体的,为了使模型能够更精准的训练,也就是说使神经网络只处理矩形框线框起来的部分,对于图像的其他部分当做干扰处理,首先要做的就是提取出焊缝,主要使用的技术是边缘检测。Specifically, in order to enable the model to be trained more accurately, that is to say, the neural network only processes the part framed by the rectangular frame, and treats other parts of the image as interference processing. The first thing to do is to extract the weld seam, which is mainly used The technique is edge detection.

边缘检测主要是依据图像的梯度变化而得出要检测的图形的形状,基于边缘检测的分析不易受整体光照强度变化的影响,许多图像理解方法都以边缘为基础。边缘检测强调的是图像对比度,检测对比度即亮度上的差别,可以增强图像中的边界特征,这些边界出现正是图像亮度上的差别。目标边界实际上是亮度级的阶梯变化,而边缘是阶梯变化的位置。可以使用一阶微分使边缘变化增强检测边缘位置,常用的算子有Sobel,Canny等。Edge detection is mainly based on the gradient change of the image to obtain the shape of the image to be detected. The analysis based on edge detection is not easily affected by changes in the overall light intensity. Many image understanding methods are based on edges. Edge detection emphasizes the contrast of the image. Detecting the contrast, that is, the difference in brightness, can enhance the boundary features in the image, and the appearance of these boundaries is the difference in the brightness of the image. The target boundary is actually the step change in brightness level, and the edge is the location of the step change. The first-order differential can be used to enhance the edge change to detect the edge position. The commonly used operators are Sobel, Canny, etc.

由于图像本身的对比度不是特别明显所以需要对图像进行一些增强对比度的操作,具体的流程请参见图2。Since the contrast of the image itself is not particularly obvious, it is necessary to perform some operations to enhance the contrast of the image. Please refer to Figure 2 for the specific process.

请参见图6,图6中,从左到右依次为对切片进行开运算后,二值化,对二值化图进行边缘检测的图像。焊缝在图像中的位置一般是横穿图像,但是图像中除了焊缝还会有其他的干扰,所以需要对图像进行切片,使得干扰尽可能小一些。切片后的图像由于对比度不高而且存在毛刺,所以进行图像的开运算,也就是先进行图像的腐蚀在进行图像的膨胀,这样得到的图像就会更加连贯,具有较少的毛刺干扰。对开运算后的图像进行限制对比度的局部直方图均衡化,再进行中值滤波,使图像更加平滑,使用Sobel算子计算图像的y轴的梯度,将梯度值转化为二值化图像,这样焊缝的边缘更加清晰。最后对图像进行灰度翻转,利用Canny算子进行边缘检测,筛选出符合条件的contours,记录焊缝在y轴的位置,从而对原图进行裁剪,实现焊缝提取。Please refer to FIG. 6 . In FIG. 6 , from left to right, the slices are binarized after the opening operation is performed, and the edge detection is performed on the binarized image. The position of the weld in the image is generally across the image, but there will be other disturbances in the image besides the weld, so the image needs to be sliced to make the disturbance as small as possible. Since the sliced image has low contrast and there are burrs, the image opening operation is performed, that is, the image is eroded first and then the image is expanded, so that the obtained image will be more coherent and have less burr interference. Perform local histogram equalization to limit the contrast of the image after the opening operation, and then perform median filtering to make the image smoother. Use the Sobel operator to calculate the gradient of the y-axis of the image, and convert the gradient value into a binarized image, so that The edges of the welds are sharper. Finally, the grayscale of the image is flipped, and the Canny operator is used to perform edge detection, filter out the contours that meet the conditions, and record the position of the weld on the y-axis, so as to cut the original image and realize the weld extraction.

进一步的,所述损失函数为:Further, the loss function is:

Loss=-[ytlogyp+w*(1-yt)log(1-yp)]Loss=-[y t logy p +w*(1-y t )log(1-y p )]

式中,w为偏执、(x,y)为样本点、假设某个样本点的真实标签为yt,该样本点取yt=1的概率为yp,Loss为损失函数,yp的取值在(0,1)之间。In the formula, w is paranoia, (x, y) is the sample point, assuming that the true label of a sample point is y t , the probability that the sample point takes y t =1 is y p , Loss is the loss function, and the value of y p The value is between (0, 1).

具体的,请参见图9,为了保证模型在具有较高的召回率的基础上提高模型的准确率,本发明对传统的交叉熵函数进行修改增加偏置项,现有的交叉熵函数为:Specifically, please refer to FIG. 9. In order to ensure that the model has a higher recall rate and improve the accuracy of the model, the present invention modifies the traditional cross-entropy function and adds a bias term. The existing cross-entropy function is:

Loss=-[ytlogyp+(1-yt)log(1-yp)]Loss=-[y t logy p +(1-y t )log(1-y p )]

式中,(x,y)为样本点、假设某个样本点的真实标签为yt,该样本点取yt=1的概率为yp,Loss为损失函数,yp的取值在(0,1)之间。传统的交叉熵函数对于假正类和假负类的错误敏感度是一致的,请参见图10,图10中也显示loss函数是关于两者之间是对称的,而本发明实施例提供的算法修改该交叉熵函数为:In the formula, (x, y) is the sample point, assuming that the real label of a sample point is y t , the probability that the sample point takes y t =1 is y p , Loss is the loss function, and the value of y p is in ( 0, 1) between. The error sensitivity of the traditional cross-entropy function to the false positive class and the false negative class is the same, please refer to Fig. 10. Fig. 10 also shows that the loss function is symmetric between the two, and the embodiment of the present invention provides The algorithm modifies the cross entropy function as:

Loss=-[ytlogyp+w*(1-yt)log(1-yp)]Loss=-[y t logy p +w*(1-y t )log(1-y p )]

给该交叉熵函数乘以一个偏执w,按照表面意思理解就是给两类错误给予不一样的惩罚,如图11所示,可以从图11中看出当w<1时对于把1判断为0这类错误的惩罚比另一重要大,而且w越小,这种偏置就越明显;而当w=1时,对于两种错误的惩罚是一样的;当w>1时,给把0判为1的错误加了巨大惩罚,而且这种幅度比小于1时更为剧烈。Multiplying the cross-entropy function by a paranoid w, according to the superficial understanding, is to give different penalties to the two types of errors, as shown in Figure 11, it can be seen from Figure 11 that when w < 1, 1 is judged as 0. The penalty for this type of error is more important than the other, and the smaller w is, the more obvious this bias is; and when w = 1, the penalty for the two errors is the same; when w > 1, give 0 An error of 1 imposes a huge penalty, and the magnitude is more severe than when it is less than 1.

由此,为了减少把有缺陷的图像判为无缺陷的情况发生,利用上述机理,在损失函数中添加偏置,使模型最终获得较高的召回率。Therefore, in order to reduce the occurrence of defective images judged as non-defective, the above mechanism is used to add a bias to the loss function, so that the model finally obtains a higher recall rate.

进一步的,请参见图4,步骤S160中,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准包括:Further, referring to FIG. 4, in step S160, the deep learning model is trained by using at least two of the original pictures to obtain a basic model, and making the basic model meet a predetermined standard includes:

获取多个无缺陷原图像,并获取与所述无缺陷原图像数量相等的缺陷原图像;Acquiring a plurality of defect-free original images, and acquiring defective original images equal to the number of the defect-free original images;

将所述无缺陷原图像与所述缺陷原图像作为模型训练集,并从所述模型训练集中随机获取原图像,并将原图像置于所述深度学习模型中进行训练;Using the defect-free original image and the defective original image as a model training set, and randomly acquiring the original image from the model training set, and placing the original image in the deep learning model for training;

直至所述基础模型达到预定标准为止。until the base model reaches a predetermined standard.

作为本实施例训练基础模型的策略1,程序训练开始前从无缺陷图像中随机选取和缺陷样本数量一样的图像放进模型训练,这样保证了正负样本1:1,有利于模型学习特征,请参见图12,从图12可以看到,模型在50个epoch左右发生了轻微的过拟合,但整体表现还是良好的,但是考虑到这种情况下训练的模型只是使用了和缺陷图像数目一样的正常图像,会有大量的数据被浪费,虽然在采样过程中的随机性可能会缓解这种浪费,但对于一个模型而言,每个数据进入模型训练的概率应该是一样的。As the strategy 1 for training the basic model in this embodiment, images with the same number of defective samples are randomly selected from the non-defective images and put into the model training before the program training starts, which ensures that the positive and negative samples are 1:1, which is beneficial to the model learning features. Please refer to Figure 12. From Figure 12, it can be seen that the model has a slight overfitting at around 50 epochs, but the overall performance is still good, but considering that the model trained in this case only uses and the number of defective images For the same normal image, a large amount of data will be wasted. Although the randomness in the sampling process may alleviate this waste, for a model, the probability of each data entering the model training should be the same.

进一步的,请参见图4,步骤S160中,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准包括:Further, referring to FIG. 4, in step S160, the deep learning model is trained by using at least two of the original pictures to obtain a basic model, and making the basic model meet a predetermined standard includes:

从数据库中随机选择所述基础模型进行一次训练所选取的样本数量一半的无缺陷原图像,并且从数据库中随机选取与所述无缺陷原图像数量相等的缺陷原图像;Randomly selects the basic model from the database and randomly selects half the number of samples without defects from the database, and randomly selects the original images with defects equal to the number of the original images without defects from the database;

将所述无缺陷原图像与所述缺陷原图像作为模型训练集,并从所述模型训练集中随机获取原图像,并将原图像置于所述深度学习模型中进行训练;Taking the defect-free original image and the defective original image as a model training set, randomly acquiring the original image from the model training set, and placing the original image in the deep learning model for training;

直至所述基础模型达到预定标准为止。until the base model reaches a predetermined standard.

具体的,本发明实施例还提供了另一种训练基础模型的策略,策略2:在每个batch_size中随机从所有正常的图像中选取二分之一batch_size的图像进行训练,这种策略在保证正负样本比例均衡的情况下还使得每张图像都有了进入模型训练的机会,请参见图13,从图13中可以看出,在80个epoch的时候才发生了学习行为,这个时候其实刚好是所有的数据都可能进入模型学习过了,而且模型的过拟合也发生的比较晚大约在110个epoch左右。Specifically, the embodiment of the present invention also provides another strategy for training the basic model, strategy 2: randomly select half batch_size images from all normal images for training in each batch_size. The balanced ratio of positive and negative samples also allows each image to have the opportunity to enter the model training. Please refer to Figure 13. It can be seen from Figure 13 that the learning behavior occurs at 80 epochs. It happens that all the data may have entered the model for learning, and the overfitting of the model also occurs relatively late, about 110 epochs.

最终训练后的召回率图像如图14所示,其中最上方的线代表召回率,中间的线代表f1_score,最下方的线代表的是准确率,可以看到,由于我们的loss函数增加了把缺陷图像判为无缺图像的惩罚,模型在一开始的时候倾向于把所有的图像都判为缺陷图像,这样模型获得了较高的召回率1.0,而随着训练过程的进行,模型为了寻求更小的loss不得不在保证不把缺陷图像判为无缺图像的基础上尽可能的把无缺的图像给找出来,所以发生了准确率的提高,由于准确率和召回率本身就是矛盾的存在,所以会损失一些召回率,最终模型达到要求的时候停止训练,即召回率与准确率拟合时,停止训练,此时得到训练结果,如图15所示。The final recall image after training is shown in Figure 14, where the top line represents the recall rate, the middle line represents f1_score, and the bottom line represents the accuracy rate. It can be seen that since our loss function increases the Defective images are judged as no-defective images. At the beginning, the model tends to judge all images as defective images, so that the model obtains a higher recall rate of 1.0. As the training process proceeds, the model seeks more The small loss has to find the perfect image as much as possible on the basis of ensuring that the defective image is not judged as the perfect image, so the accuracy rate is improved. Since the accuracy rate and the recall rate are contradictory, so the Lose some recall rate, and stop training when the final model meets the requirements, that is, when the recall rate and accuracy rate are fitted, stop training, and get the training result at this time, as shown in Figure 15.

进一步的,所述基础模型包括:模型的结构、对所述深度学习模型进行训练后的权重。Further, the basic model includes: the structure of the model and the weights after training the deep learning model.

具体的,训练完成的模型需要进行保存,保存的部分包括模型的结构和训练后的权重,当有需求测试时,调用保存的模型即可,为此进行接口封装,建模型和权重封装完毕,方便直接调用。Specifically, the model after training needs to be saved. The saved part includes the structure of the model and the weight after training. When there is a need for testing, the saved model can be called. For this purpose, the interface is encapsulated, and the model building and weight encapsulation are completed. Easy to call directly.

本发明实施例提供了一种焊缝缺陷的数字射线检测模型的创建方法,运用数字图像处理技术提取出图像中的焊缝;通过运用图像增强技术对焊缝图像进行样本数量的扩充;利用搭建的深度学习模型和设计的损失函数来训练模型,能够从现有的缺陷图像中学习缺陷规律,使用深度神经网络能够更加灵活的对所有待测图像进行批处理,更灵活且性能更加稳定,保证模型较高的召回率和一定的准确率;通过对模型的封装保存方便对模型的调用和使用。减少人为工作量,提高工作效率。The embodiment of the present invention provides a method for creating a digital ray detection model for weld defects, which uses digital image processing technology to extract welds in an image; expands the number of samples of weld images by using image enhancement technology; The deep learning model and the designed loss function are used to train the model, which can learn the defect rules from the existing defect images. Using the deep neural network can more flexibly batch batch all the images to be tested, which is more flexible and has more stable performance. The model has a high recall rate and a certain accuracy rate; it is convenient to call and use the model by encapsulating and saving the model. Reduce manual workload and improve work efficiency.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to the partial descriptions of the method embodiments.

以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (7)

1.一种焊缝缺陷的数字射线检测模型的创建方法,其特征在于,包括:1. a method for creating a digital radiographic detection model for weld defects, comprising: S110.获取原图片;S110. Obtain the original picture; S120.利用预定方法,提取出所述原图像中的焊缝,获得焊缝图像;S120. Using a predetermined method, extract the weld seam in the original image to obtain a weld seam image; S130.利用数据增强算法对所述焊缝图像进行样本扩充,得到基于所述焊缝图像的多个样本图;S130. Use a data enhancement algorithm to perform sample expansion on the weld image to obtain multiple sample maps based on the weld image; S140.利用所述样本图训练卷积神经网络,构建获得适用于焊缝缺陷检测的深度学习模型;S140. Use the sample graph to train a convolutional neural network to construct and obtain a deep learning model suitable for weld defect detection; S150.利用损失函数校准所述深度学习模型,计算得到所述深度学习模型的准确率与召回率;S150. Use a loss function to calibrate the deep learning model, and calculate the accuracy and recall of the deep learning model; S160.重复步骤S110-S150,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准;其中,所述预定标准包括:预定准确率、预定召回率;S160. Repeat steps S110-S150, and use at least two of the original pictures to train the deep learning model to obtain a basic model, so that the basic model meets a predetermined standard; wherein, the predetermined standard includes: a predetermined accuracy rate, predetermined recall rate; S170.保存所述基础模型,并对所述基础模型进行接口封装,得到焊缝缺陷的数字射线检测模型。S170. Save the basic model, and perform interface encapsulation on the basic model to obtain a digital ray detection model for weld defects. 2.根据权利要求1所述的焊缝缺陷的数字射线检测模型的创建方法,其特征在于,所述预定方法为:2. The method for creating a digital radiographic inspection model for weld defects according to claim 1, wherein the predetermined method is: 获取所述原图片的感兴趣区域,并勾勒所述感兴趣区域;Obtain the region of interest of the original image, and outline the region of interest; 利用边缘检测方法从所述感兴趣区域中提取焊缝图像。Weld seam images are extracted from the region of interest using edge detection methods. 3.根据权利要求2所述的焊缝缺陷的数字射线检测模型的创建方法,其特征在于,所述边缘检测方法包括:3. The method for creating a digital radiographic detection model for weld defects according to claim 2, wherein the edge detection method comprises: 对所述感兴趣区域沿长度方向切片,获得多个片段图像;Slicing the region of interest along the length direction to obtain a plurality of segment images; 对所述片段图像进行开运算,得到连贯图像片段;performing an open operation on the segment images to obtain consecutive image segments; 对所述连贯图像片段进行进行限制对比度的局部直方图均衡化,再进行中值滤波,得到平滑图像片段;performing local histogram equalization with limited contrast on the continuous image segments, and then performing median filtering to obtain smooth image segments; 采用离散的一阶差分算子计算所述平滑图像片段的图像亮度函数的Y轴的一阶梯度近似值;Using a discrete first-order difference operator to calculate a first-order gradient approximation of the Y-axis of the image brightness function of the smoothed image segment; 将所述一阶梯度近似值转化为二值化图像;converting the first-order gradient approximation into a binarized image; 对所述二值化图像进行灰度翻转,并利用边缘检测算子进行边缘检测,得到焊缝轮廓图像;Perform grayscale inversion on the binarized image, and use an edge detection operator to perform edge detection to obtain a weld outline image; 记录所述焊缝轮廓图像的Y轴坐标,并根据所述焊缝轮廓图像的Y轴坐标对所述感兴趣区域进行裁剪,从所述感兴趣区域中提取焊缝图像。The Y-axis coordinate of the weld outline image is recorded, the region of interest is cropped according to the Y-axis coordinate of the weld outline image, and the weld image is extracted from the region of interest. 4.根据权利要求1所述的焊缝缺陷的数字射线检测模型的创建方法,其特征在于,所述损失函数为:4. The method for creating a digital radiographic detection model for weld defects according to claim 1, wherein the loss function is: Loss=-[ytlogyp+w*(1-yt)log(1-yp)]Loss=-[y t logy p +w*(1-y t )log(1-y p )] 式中,w为偏执、(x,y)为样本点、假设某个样本点的真实标签为yt,该样本点取yt=1的概率为yp,Loss为损失函数,yp的取值在(0,1)之间。In the formula, w is paranoia, (x, y) is the sample point, assuming that the true label of a sample point is y t , the probability that the sample point takes y t =1 is y p , Loss is the loss function, and the value of y p The value is between (0, 1). 5.根据权利要求1所述的焊缝缺陷的数字射线检测模型的创建方法,其特征在于,步骤S160中,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准包括:5. The method for creating a digital ray detection model for weld defects according to claim 1, wherein in step S160, at least two of the original pictures are used to train the deep learning model to obtain a basic model, Bringing the base model to predetermined criteria includes: 获取多个无缺陷原图像,并获取与所述无缺陷原图像数量相等的缺陷原图像;Acquiring a plurality of defect-free original images, and acquiring defective original images equal to the number of the defect-free original images; 将所述无缺陷原图像与所述缺陷原图像作为模型训练集,并从所述模型训练集中随机获取原图像,并将原图像置于所述深度学习模型中进行训练;Using the defect-free original image and the defective original image as a model training set, and randomly acquiring the original image from the model training set, and placing the original image in the deep learning model for training; 直至所述基础模型达到预定标准为止。until the base model reaches a predetermined standard. 6.根据权利要求1所述的焊缝缺陷的数字射线检测模型的创建方法,其特征在于,步骤S160中,利用至少两个所述原图片对所述深度学习模型进行训练,得到基础模型,使所述基础模型达到预定标准包括:6. The method for creating a digital radiographic detection model for weld defects according to claim 1, wherein in step S160, at least two of the original pictures are used to train the deep learning model to obtain a basic model, Bringing the base model to predetermined criteria includes: 从数据库中随机选择所述基础模型进行一次训练所选取的样本数量一半的无缺陷原图像,并且从数据库中随机选取与所述无缺陷原图像数量相等的缺陷原图像;Randomly selects the basic model from the database and randomly selects half the number of samples without defects from the database, and randomly selects the original images with defects equal to the number of the original images without defects from the database; 将所述无缺陷原图像与所述缺陷原图像作为模型训练集,并从所述模型训练集中随机获取原图像,并将原图像置于所述深度学习模型中进行训练;Using the defect-free original image and the defective original image as a model training set, and randomly acquiring the original image from the model training set, and placing the original image in the deep learning model for training; 直至所述基础模型达到预定标准为止。until the base model reaches a predetermined standard. 7.根据权利要求1所述的焊缝缺陷的数字射线检测模型的创建方法,其特征在于,所述基础模型包括:模型的结构、对所述深度学习模型进行训练后的权重。7 . The method for creating a digital ray detection model for weld defects according to claim 1 , wherein the basic model comprises: the structure of the model and the weights after training the deep learning model. 8 .
CN202010499827.7A 2020-06-04 2020-06-04 A method of creating a digital radiographic inspection model for weld defects Pending CN111738991A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010499827.7A CN111738991A (en) 2020-06-04 2020-06-04 A method of creating a digital radiographic inspection model for weld defects

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010499827.7A CN111738991A (en) 2020-06-04 2020-06-04 A method of creating a digital radiographic inspection model for weld defects

Publications (1)

Publication Number Publication Date
CN111738991A true CN111738991A (en) 2020-10-02

Family

ID=72649254

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010499827.7A Pending CN111738991A (en) 2020-06-04 2020-06-04 A method of creating a digital radiographic inspection model for weld defects

Country Status (1)

Country Link
CN (1) CN111738991A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112184693A (en) * 2020-10-13 2021-01-05 东北大学 Intelligent detection method for weld defects of ray industrial negative
CN112184704A (en) * 2020-10-28 2021-01-05 广西科技大学 Welding seam processing method based on convolutional neural network

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809723A (en) * 2015-04-13 2015-07-29 北京工业大学 Three-dimensional liver CT (computed tomography) image automatically segmenting method based on hyper voxels and graph cut algorithm
CN109636772A (en) * 2018-10-25 2019-04-16 同济大学 The defect inspection method on the irregular shape intermetallic composite coating surface based on deep learning
CN109900706A (en) * 2019-03-20 2019-06-18 易思维(杭州)科技有限公司 A kind of weld seam and weld defect detection method based on deep learning
CN109995964A (en) * 2019-02-21 2019-07-09 西安万像电子科技有限公司 Image processing method and device
CN110047073A (en) * 2019-05-05 2019-07-23 北京大学 A kind of X-ray weld image fault grading method and system
CN110814465A (en) * 2019-11-28 2020-02-21 华东交通大学理工学院 Universal method for automatically extracting welding seam contour

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809723A (en) * 2015-04-13 2015-07-29 北京工业大学 Three-dimensional liver CT (computed tomography) image automatically segmenting method based on hyper voxels and graph cut algorithm
CN109636772A (en) * 2018-10-25 2019-04-16 同济大学 The defect inspection method on the irregular shape intermetallic composite coating surface based on deep learning
CN109995964A (en) * 2019-02-21 2019-07-09 西安万像电子科技有限公司 Image processing method and device
CN109900706A (en) * 2019-03-20 2019-06-18 易思维(杭州)科技有限公司 A kind of weld seam and weld defect detection method based on deep learning
CN110047073A (en) * 2019-05-05 2019-07-23 北京大学 A kind of X-ray weld image fault grading method and system
CN110814465A (en) * 2019-11-28 2020-02-21 华东交通大学理工学院 Universal method for automatically extracting welding seam contour

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
RAYMONE1125: "UNET", 《HTTPS://WWW.CNBLOGS.COM/KLAUSAGE/P/12640788.HTML》, pages 1 - 11 *
YAOSHIANG HO等: "The Real-World-Weight Cross-Entropy Loss Function: Modeling the Costs of Mislabeling", 《IEEE》, pages 4806 - 4813 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112184693A (en) * 2020-10-13 2021-01-05 东北大学 Intelligent detection method for weld defects of ray industrial negative
CN112184693B (en) * 2020-10-13 2023-10-24 东北大学 Intelligent detection method for welding line defects of ray industrial negative film
CN112184704A (en) * 2020-10-28 2021-01-05 广西科技大学 Welding seam processing method based on convolutional neural network
CN112184704B (en) * 2020-10-28 2022-06-14 广西科技大学 Welding seam processing method based on convolutional neural network

Similar Documents

Publication Publication Date Title
CN112150410B (en) Automatic detection method and system for weld defects
CN114240821A (en) A Weld Defect Detection Method Based on Improved YOLOX
WO2024002187A1 (en) Defect detection method, defect detection device, and storage medium
CN109239102A (en) A kind of flexible circuit board open defect detection method based on CNN
CN107966447A (en) A kind of Surface Flaw Detection method based on convolutional neural networks
CN115156093A (en) Battery shell defect detection method, system and device
CN114372955A (en) Casting defect X-ray diagram automatic identification method based on improved neural network
CN115861170A (en) Surface defect detection method based on improved YOLO V4 algorithm
CN114332004A (en) Method and device for detecting surface defects of ceramic tiles, electronic equipment and storage medium
CN113870236A (en) A non-destructive testing method for composite material defects based on deep learning algorithm
CN114663658B (en) Small sample AOI surface defect detection method with cross-domain migration capability
JP2021143884A (en) Inspection device, inspection method, program, learning device, learning method, and trained dataset
CN116152498A (en) Data-driven Semantic Segmentation Network and Training Method for Metal Surface Defects
CN111738991A (en) A method of creating a digital radiographic inspection model for weld defects
CN114387213A (en) Automobile sheet metal part surface defect detection method based on deep migration learning
CN114429445A (en) A Method of PCB Defect Detection and Recognition Based on MAIRNet
CN116309509A (en) Solder joint defect detection method, device, electronic device and readable storage medium
CN116228679A (en) Composite material defect infrared nondestructive inspection method and system based on U-Net neural network
CN114612468B (en) Equipment external defect detection method based on positive sample
CN109886936B (en) A low-contrast defect detection method and device
CN115294039A (en) Steel coil end surface defect detection method
CN115018764A (en) A method for detecting surface defects of flywheel disc semi-finished products based on neural network
CN115393290A (en) Edge defect detection method, device and equipment
CN114648522A (en) Method, system, equipment and storage medium for detecting defects of circumferential weld of small-diameter pipe
CN117495846B (en) Image detection method, 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: 20201002