[go: up one dir, main page]

CN115830004A - Surface defect detection method, device, computer equipment and storage medium - Google Patents

Surface defect detection method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN115830004A
CN115830004A CN202211689323.7A CN202211689323A CN115830004A CN 115830004 A CN115830004 A CN 115830004A CN 202211689323 A CN202211689323 A CN 202211689323A CN 115830004 A CN115830004 A CN 115830004A
Authority
CN
China
Prior art keywords
image
standard
defect
detected
sample
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
CN202211689323.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.)
Luster LightTech Co Ltd
Original Assignee
Luster LightTech 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 Luster LightTech Co Ltd filed Critical Luster LightTech Co Ltd
Priority to CN202211689323.7A priority Critical patent/CN115830004A/en
Publication of CN115830004A publication Critical patent/CN115830004A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The application provides a surface defect detection method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring a surface image to be detected and a standard surface image of a product to be detected; performing image segmentation on the surface image to be detected and the standard surface image to obtain at least one to-be-detected image block corresponding to the surface image to be detected and at least one standard image block corresponding to the standard surface image; inputting the image block to be detected and the standard image block into a defect segmentation model trained in advance to obtain at least one defect segmentation image block; each defect division image block is used for representing pixel difference information between one to-be-detected image block and one standard image block; and dividing the image block based on the defects, and determining whether the product to be detected has surface defects. So, this application utilizes the defect segmentation model that trains well to carry out the defect and cuts apart to this judges whether there is surface defect in waiting to examine the product, has improved the detection efficiency that surface defect detected and the degree of accuracy of testing result.

Description

表面缺陷检测方法、装置、计算机设备和存储介质Surface defect detection method, device, computer equipment and storage medium

技术领域technical field

本申请涉及印刷品检测技术领域,尤其涉及一种表面缺陷检测方法、装置、计算机设备和存储介质。The present application relates to the technical field of printed matter detection, and in particular to a surface defect detection method, device, computer equipment and storage medium.

背景技术Background technique

随着工业产品的用户和生产企业对产品质量的要求越来越高,产品在满足使用性能外,还需要有良好的表面质量。然而,在产品制造过程中,表面缺陷往往是不可避免的,因此,有必要对产品进行表面缺陷检测。其中,表面缺陷检测是指检测产品表面的划痕、异物遮挡、褶皱、斑痕、颜色污染、孔洞等缺陷,从而获得被检产品表面存在缺陷的类型、轮廓、位置、大小等一系列信息。As users and manufacturers of industrial products have higher and higher requirements for product quality, the product needs to have good surface quality in addition to meeting the performance requirements. However, in the process of product manufacturing, surface defects are often unavoidable, therefore, it is necessary to detect surface defects on products. Among them, surface defect detection refers to the detection of scratches, foreign matter covering, wrinkles, spots, color pollution, holes and other defects on the surface of the product, so as to obtain a series of information such as the type, outline, position and size of the defects on the surface of the inspected product.

在印刷品表面缺陷检测中,通常采用人工检测的方式,该方式中,首先按照预设的抽检率,随机在一批印刷品中进行随机抽取,然后人工观察抽取的印刷品的表面是否存在缺陷。但人工检测存在准确度低、实时性差、效率低、劳动强度大、且检测结果受人工经验和主观因素的影响较大的问题。In the detection of surface defects of printed matter, manual detection is usually used. In this method, random sampling is first performed from a batch of printed matter according to the preset sampling rate, and then the surface of the extracted printed matter is manually observed for defects. However, manual detection has the problems of low accuracy, poor real-time performance, low efficiency, high labor intensity, and the detection results are greatly affected by manual experience and subjective factors.

发明内容Contents of the invention

本申请提供了一种表面缺陷检测方法、装置、计算机设备和存储介质,能够提高产品表面缺陷的检测效率。The present application provides a surface defect detection method, device, computer equipment and storage medium, which can improve the detection efficiency of product surface defects.

第一方面,本申请提供一种表面缺陷检测方法,包括:In a first aspect, the present application provides a surface defect detection method, comprising:

获取待检产品的待检表面图像和标准表面图像;Obtain the surface image and standard surface image of the product to be inspected;

对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块;待检图像块和标准图像块的数目相同,且待检图像块和标准图像块在对应的表面图像中所处的图像区域也相同;performing image segmentation on the surface image to be inspected and the standard surface image, obtaining at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image; the number of image blocks to be inspected and the standard image block are the same, and The image areas where the image block to be checked and the standard image block are located in the corresponding surface image are also the same;

将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,获取至少一个缺陷分割图像块;每个缺陷分割图像块用于表示一个待检图像块和一个标准图像块之间的像素差异信息;Input the image block to be inspected and the standard image block into the pre-trained defect segmentation model to obtain at least one defect segmented image block; each defect segmented image block is used to represent the difference between an image block to be inspected and a standard image block pixel difference information;

基于缺陷分割图像块,确定待检产品是否存在表面缺陷。Segment image blocks based on defects to determine whether there are surface defects in the product to be inspected.

在一种可能的实现方式中,对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块,包括:In a possible implementation, image segmentation is performed on the surface image to be inspected and the standard surface image, and at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image are obtained, including:

对待检表面图像和标准表面图像中相同位置的像素进行像素值相减操作,得到中间表面图像;Subtract the pixel values of the pixels at the same position in the surface image to be inspected and the standard surface image to obtain an intermediate surface image;

对中间表面图像进行连通区域分析,获取至少一个候选缺陷特征图;Perform connected region analysis on the intermediate surface image to obtain at least one candidate defect feature map;

按照候选缺陷特征图在中间表面图像中对应的区域位置信息,对待检表面图像和标准表面图像进行图像分割,得到待检图像块和标准图像块。According to the region position information corresponding to the candidate defect feature map in the intermediate surface image, image segmentation is performed on the surface image to be inspected and the standard surface image to obtain image blocks to be inspected and standard image blocks.

在一种可能的实现方式中,基于缺陷分割图像块,确定待检产品是否存在表面缺陷,包括:In a possible implementation, the image block is segmented based on the defect to determine whether there is a surface defect in the product to be inspected, including:

获取缺陷分割图像块和候选缺陷特征图之间的像素交集信息;Obtain pixel intersection information between defect segmentation image blocks and candidate defect feature maps;

若像素交集信息为空,则确定待检产品表面不存在表面缺陷;If the pixel intersection information is empty, it is determined that there is no surface defect on the surface of the product to be inspected;

若像素交集信息不为空,则确定待检产品表面存在表面缺陷。If the pixel intersection information is not empty, it is determined that there are surface defects on the surface of the product to be inspected.

在一种可能的实现方式中,缺陷分割模型包括编码器和解码器;In a possible implementation, the defect segmentation model includes an encoder and a decoder;

则将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,获取至少一个缺陷分割图像块,包括:Then input the image block to be inspected and the standard image block into the pre-trained defect segmentation model to obtain at least one defect segmentation image block, including:

将待检图像块和标准图像块输入至编码器中,通过编码器获取待检图像块在预设的多种分辨率下的第一多尺度特征图和标准图像块在多种分辨率下的第二多尺度特征图;Input the image block to be checked and the standard image block into the encoder, and obtain the first multi-scale feature map of the image block to be checked at various preset resolutions and the first multi-scale feature map of the standard image block at various resolutions through the encoder The second multi-scale feature map;

将第一多尺度特征图和第二多尺度特征图输入至解码器中,通过解码器对第一多尺度特征图和第二多尺度特征图进行特征融合处理,输出缺陷分割图像块。The first multi-scale feature map and the second multi-scale feature map are input into the decoder, and the feature fusion processing is performed on the first multi-scale feature map and the second multi-scale feature map through the decoder, and the defect segmentation image block is output.

在一种可能的实现方式中,获取待检产品的待检表面图像和标准表面图像,包括:In a possible implementation manner, obtaining the surface image to be inspected and the standard surface image of the product to be inspected includes:

获取待检产品的初始待检图像和初始标准图像;Obtain the initial image to be inspected and the initial standard image of the product to be inspected;

基于初始标准图像,对初始待检图像进行图像配准处理,得到中间待检图像;Based on the initial standard image, image registration processing is performed on the initial image to be inspected to obtain an intermediate image to be inspected;

对中间待检图像和初始标准图像分别进行图像预处理,得到待检表面图像和标准表面图像。Image preprocessing is performed on the intermediate image to be inspected and the initial standard image to obtain the surface image to be inspected and the standard surface image.

在一种可能的实现方式中,对中间待检图像和初始标准图像分别进行图像预处理,得到待检表面图像和标准表面图像,包括:In a possible implementation, image preprocessing is performed on the intermediate image to be inspected and the initial standard image respectively to obtain the surface image to be inspected and the standard surface image, including:

对中间待检图像和初始标准图像进行边缘检测,获取中间待检图像的第一边缘信息和初始标准图像的第二边缘信息;Edge detection is performed on the intermediate image to be inspected and the initial standard image, and the first edge information of the intermediate image to be inspected and the second edge information of the initial standard image are acquired;

基于第一边缘信息,对中间待检图像进行边缘膨胀处理,得到待检表面图像;Based on the first edge information, edge expansion processing is performed on the intermediate image to be inspected to obtain a surface image to be inspected;

基于第二边缘信息,对初始标准图像进行边缘膨胀处理,得到标准表面图像。Based on the second edge information, edge expansion processing is performed on the initial standard image to obtain a standard surface image.

在一种可能的实现方式中,缺陷分割模型的训练过程包括:In a possible implementation manner, the training process of the defect segmentation model includes:

获取已检产品的训练样本图像;训练样本图像包括一个标准样本图像和多个缺陷样本图像,每个样本图像携带一个样本标签,样本标签用于表示样本图像是否存在表面缺陷;Obtain the training sample image of the inspected product; the training sample image includes a standard sample image and multiple defect sample images, each sample image carries a sample label, and the sample label is used to indicate whether the sample image has surface defects;

根据训练样本图像,生成多个训练样本对;每个训练样本对包括两个样本图像;Generate a plurality of training sample pairs according to the training sample images; each training sample pair includes two sample images;

将多个训练样本对输入至待训练的初始缺陷分割模型中,根据初始缺陷分割模型的输出,计算初始缺陷分割模型的目标损失函数的训练损失值;Input a plurality of training sample pairs into the initial defect segmentation model to be trained, and calculate the training loss value of the target loss function of the initial defect segmentation model according to the output of the initial defect segmentation model;

若训练损失值不满足预设的收敛条件,则调整初始缺陷分割模型的参数,并再次将多个训练样本对输入至调整参数后的初始缺陷分割模型,直到训练损失值满足预设的收敛条件,则结束训练,得到训练好的缺陷分割模型。If the training loss value does not meet the preset convergence conditions, adjust the parameters of the initial defect segmentation model, and input multiple training sample pairs into the adjusted initial defect segmentation model again until the training loss value meets the preset convergence conditions , then end the training and get the trained defect segmentation model.

在一种可能的实现方式中,根据训练样本图像,生成多个训练样本,包括:In a possible implementation, multiple training samples are generated according to the training sample images, including:

将标准样本图像依次与多个缺陷样本图像进行组合,得到多个初始样本对;Combining the standard sample image with multiple defect sample images in turn to obtain multiple initial sample pairs;

对多个初始样本对随机进行数据增强处理,得到多个训练样本对;Randomly perform data enhancement processing on multiple initial sample pairs to obtain multiple training sample pairs;

其中,数据增强处理包括以下至少一种:Among them, data enhancement processing includes at least one of the following:

将初始样本对中的两张样本图像进行随机交换,得到多个第一样本对;Randomly exchanging the two sample images in the initial sample pair to obtain multiple first sample pairs;

按照预设的像素偏移范围,对初始样本对中的任一个样本图像进行像素偏移处理,得到多个第二样本对;Perform pixel offset processing on any sample image in the initial sample pair according to a preset pixel offset range to obtain a plurality of second sample pairs;

将初始样本对中的标准样本图像随机复制为缺陷样本图像,得到多个第三样本对;Randomly copying the standard sample image in the initial sample pair as a defective sample image to obtain a plurality of third sample pairs;

将预先提取的图像缺陷粘贴至初始样本对的标准样本图像中,得到多个第四样本对;Paste the pre-extracted image defects into the standard sample image of the initial sample pair to obtain a plurality of fourth sample pairs;

多个训练样本对包括初始样本对、第一样本对、第二样本对、第三样本对和第四样本对中的至少一种样本对。The plurality of training sample pairs includes at least one sample pair among an initial sample pair, a first sample pair, a second sample pair, a third sample pair, and a fourth sample pair.

在一种可能的实现方式中,初始缺陷分割模型的目标损失函数包括Dice损失函数和交叉熵损失函数,且Dice损失函数和交叉熵损失函数在目标损失函数中的计算系数不同。In a possible implementation manner, the target loss function of the initial defect segmentation model includes a Dice loss function and a cross-entropy loss function, and the calculation coefficients of the Dice loss function and the cross-entropy loss function in the target loss function are different.

在一种可能的实现方式中,若待检产品为印刷品,则表面缺陷包括浅粘花缺陷。In a possible implementation manner, if the product to be inspected is a printed matter, the surface defects include shallow sticking defects.

第二方面,本申请提供了一种表面缺陷检测装置,包括:In a second aspect, the present application provides a surface defect detection device, comprising:

图像获取模块,用于获取待检产品的待检表面图像和标准表面图像;The image acquisition module is used to obtain the surface image to be inspected and the standard surface image of the product to be inspected;

图像分割模块,用于对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块;待检图像块和标准图像块的数目相同,且待检图像块和标准图像块在对应的表面图像中所处的图像区域也相同;The image segmentation module is used to perform image segmentation on the surface image to be inspected and the standard surface image, and obtain at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image; the image block to be inspected and the standard image The number of blocks is the same, and the image areas where the image blocks to be checked and the standard image blocks are located in the corresponding surface images are also the same;

缺陷分割模块,用于将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,获取至少一个缺陷分割图像块;每个缺陷分割图像块用于表示一个待检图像块和一个标准图像块之间的像素差异信息;The defect segmentation module is used to input the image block to be inspected and the standard image block into the pre-trained defect segmentation model to obtain at least one defect segmented image block; each defect segmented image block is used to represent an image block to be inspected and a Pixel difference information between standard image blocks;

缺陷检测模块,用于基于缺陷分割图像块,确定待检产品是否存在表面缺陷。The defect detection module is used for segmenting image blocks based on defects to determine whether there are surface defects in the product to be inspected.

第三方面,本申请提供了一种计算机设备,该设备包括存储器和处理器,存储器存储有计算机程序,处理器从存储器中调用并执行计算机程序时实现上述第一方面中任一项所示的表面缺陷检测方法的步骤。In a third aspect, the present application provides a computer device, which includes a memory and a processor, the memory stores a computer program, and when the processor invokes and executes the computer program from the memory, it realizes any one of the above-mentioned first aspects. The steps of the surface defect detection method.

第四方面,本申请提供了一种计算机存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述第一方面中任一项所示的表面缺陷检测方法的步骤。In a fourth aspect, the present application provides a computer storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the surface defect detection method shown in any one of the above-mentioned first aspects are implemented.

第五方面,本申请提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述第一方面中任一项所示的表面缺陷检测方法的步骤。In a fifth aspect, the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the surface defect detection method shown in any one of the above-mentioned first aspects are implemented.

本申请提供的技术方案至少可以达到以下有益效果:The technical solution provided by this application can at least achieve the following beneficial effects:

本申请提供的表面缺陷检测方法、装置、计算机设备和存储介质,对于获取待检产品的待检表面图像和标准表面图像的,先对待检表面图像和标准表面图像进行图像分割,得到待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块。其中,待检图像块和标准图像块的数目相同,且待检图像块和标准图像块在对应的表面图像中所处的图像区域也相同。然后,将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,通过缺陷分割模型获取一个待检图像块和一个标准图像块对应的缺陷分割图像块,该缺陷分割图像块可以反映该待检图像块和标准图像块之间的像素差异信息。最后,基于缺陷分割图像块,确定待检产品是否存在表面缺陷。由此可见,本申请利用训练好的缺陷分割模型进行缺陷分割,较人工检测而言,检测效率更高。而且,缺陷分割模型为双输入的神经网络模型,其输入包括一个标准表面图像对应的标准图像块和待检表面图像对应的标准图像块,解决深度学习模型泛化能力弱的问题,无需针对不同的场景、不同的产品进行模型训练,减少了模型训练成本。双输入的缺陷分割模型即使遇到不存在于训练数据集中的产品,也可以保持较好的缺陷检测结果。此外,本申请预先对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块,之后再通过缺陷分割模型对各图像块进行处理,减少了图像处理过程中的资源消耗量,降低了缺陷分割模型对图像块进行缺陷分割时对计算机设备的计算性能要求,使得该表面缺陷检测方法可以在低端运算设备上实现高速实时运算,提高了表面缺陷检测效率。The surface defect detection method, device, computer equipment, and storage medium provided by this application, for obtaining the surface image to be inspected and the standard surface image of the product to be inspected, first perform image segmentation on the surface image to be inspected and the standard surface image to obtain the surface to be inspected At least one to-be-checked image block corresponding to the image and at least one standard image block corresponding to the standard surface image. Wherein, the numbers of the image blocks to be inspected and the standard image blocks are the same, and the image areas where the image blocks to be inspected and the standard image blocks are located in the corresponding surface images are also the same. Then, the image block to be inspected and the standard image block are input into the pre-trained defect segmentation model, and a defect segmented image block corresponding to an image block to be inspected and a standard image block is obtained through the defect segmentation model, and the defect segmented image block can be It reflects the pixel difference information between the image block to be checked and the standard image block. Finally, image blocks are segmented based on defects to determine whether there are surface defects in the product to be inspected. It can be seen that the present application utilizes a trained defect segmentation model for defect segmentation, which is more efficient than manual detection. Moreover, the defect segmentation model is a double-input neural network model, and its input includes a standard image block corresponding to a standard surface image and a standard image block corresponding to a surface image to be inspected, which solves the problem of weak generalization ability of the deep learning model and does not need to target different Model training for different scenarios and different products reduces the cost of model training. The defect segmentation model with two inputs can maintain good defect detection results even when encountering products that do not exist in the training dataset. In addition, the application performs image segmentation on the surface image to be inspected and the standard surface image in advance, obtains at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image, and then uses the defect segmentation model to classify each Image blocks are processed, which reduces the resource consumption in the image processing process and reduces the computing performance requirements for computer equipment when the defect segmentation model performs defect segmentation on image blocks, so that the surface defect detection method can be realized on low-end computing devices High-speed real-time calculation improves the efficiency of surface defect detection.

附图说明Description of drawings

图1是本申请一示例性实施例示出的一种计算机设备的结构示意图;FIG. 1 is a schematic structural diagram of a computer device shown in an exemplary embodiment of the present application;

图2是本申请一示例性实施例示出的一种表面缺陷检测方法的流程示意图;Fig. 2 is a schematic flow chart of a surface defect detection method shown in an exemplary embodiment of the present application;

图3是本申请一示例性实施例示出的一种图像处理流程示意图;Fig. 3 is a schematic diagram of an image processing flow shown in an exemplary embodiment of the present application;

图4是本申请一示例性实施例示出的一种缺陷检测模型的结构示意图;Fig. 4 is a schematic structural diagram of a defect detection model shown in an exemplary embodiment of the present application;

图5是本申请一示例性实施例示出的一种缺陷分割模型的训练流程示意图;Fig. 5 is a schematic diagram of a training process of a defect segmentation model shown in an exemplary embodiment of the present application;

图6是本申请一示例性实施例示出的一种生成训练样本对的流程示意图;Fig. 6 is a schematic flow chart of generating training sample pairs shown in an exemplary embodiment of the present application;

图7是本申请一示例性实施例示出的另一种表面缺陷检测方法的流程示意图;Fig. 7 is a schematic flowchart of another surface defect detection method shown in an exemplary embodiment of the present application;

图8是本申请一示例性实施例示出的一种表面缺陷检测装置的结构示意图;Fig. 8 is a schematic structural diagram of a surface defect detection device shown in an exemplary embodiment of the present application;

图9是本申请一示例性实施例示出的另一种表面缺陷检测装置的结构示意图。Fig. 9 is a schematic structural diagram of another surface defect detection device shown in an exemplary embodiment of the present application.

具体实施方式Detailed ways

为使本申请的目的、技术方案及优点更加清楚明白,下面将结合附图及实施例,对本申请的技术方案做进一步详细说明。In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be further described in detail below in conjunction with the drawings and embodiments.

在对本申请实施例提供的表面缺陷检测方法进行解释说明之前,先对本申请实施例的应用场景和实施环境进行介绍。Before explaining the surface defect detection method provided by the embodiment of the present application, the application scenario and implementation environment of the embodiment of the present application will be introduced first.

随着工业产品的用户和生产企业对产品质量的要求越来越高,工业产品除了要满足使用性能外,还要有良好的外观,即良好的表面质量。然而,在产品制造过程中,表面缺陷的产生往往是不可避免的。其中,缺陷一般可以理解为与正常产品相比的表面缺失、表面缺陷或面积偏差。而表面缺陷检测是指检测产品表面的划痕、缺陷、异物遮挡、颜色污染、孔洞等缺陷,从而获得待检产品的表面缺陷的缺陷类型、轮廓、位置、大小等一系列能够描述该缺陷的信息。As users and manufacturers of industrial products have higher and higher requirements for product quality, industrial products must not only meet the performance requirements, but also have a good appearance, that is, a good surface quality. However, in the process of product manufacturing, the generation of surface defects is often unavoidable. Among them, defects can generally be understood as surface defects, surface defects or area deviations compared with normal products. The surface defect detection refers to the detection of scratches, defects, foreign body occlusion, color pollution, holes and other defects on the surface of the product, so as to obtain a series of defect types, contours, positions, and sizes of the surface defects of the product to be inspected that can describe the defect. information.

而且,表面缺陷不仅影响产品的美观和舒适度,而且一般也会对产品的使用性能带来不良影响,所以生产企业对产品的表面缺陷检测非常重视,以便及时发现表面缺陷,从而有效控制产品质量。进一步地,还可以根据表面缺陷检测结果,分析生产工艺中存在的技术/操作问题,从而杜绝或减少缺陷产品的产生,防止潜在的贸易纠纷,维护企业荣誉。Moreover, surface defects not only affect the beauty and comfort of the product, but also generally have a negative impact on the performance of the product. Therefore, manufacturers attach great importance to the detection of surface defects in order to find surface defects in time and effectively control product quality. . Furthermore, it is also possible to analyze the technical/operational problems in the production process based on the surface defect detection results, so as to eliminate or reduce the generation of defective products, prevent potential trade disputes, and maintain corporate reputation.

人工检测是产品表面缺陷的传统检测方法,但该方法抽检率低、准确性不高、实时性差、效率低、劳动强度大、受人工经验和主观因素的影响大。Manual inspection is a traditional detection method for product surface defects, but this method has low sampling rate, low accuracy, poor real-time performance, low efficiency, high labor intensity, and is greatly affected by manual experience and subjective factors.

此外,基于传统图像处理算法在印刷品的浅粘花缺陷检测过程中,存在误报、漏检的情况,需要人工反复调整参数。而基于深度学习的单图像输入的表面缺陷检测方法,则存在推理速度慢、泛化能力弱等问题;且针对不同的场景、不同类型的产品都需要训练特定的神经网络模型,增加了检测成本。In addition, based on the traditional image processing algorithm, there are false positives and missed detections in the process of shallow sticky defect detection of printed matter, and it is necessary to manually adjust the parameters repeatedly. However, the surface defect detection method based on single image input based on deep learning has problems such as slow reasoning speed and weak generalization ability; and for different scenarios and different types of products, specific neural network models need to be trained, which increases the detection cost. .

虽然基于深度学习的表面缺陷检测技术可以很大程度上克服上述人工检测的弊端,但待检产品的类型是多种多样的,且随着工艺的提高,表面缺陷也比较细微。因此,如何构建一个稳定、高效的基于机器视觉的表面缺陷检测方法,成为目前机器视觉在表面缺陷检测领域应用时所面临的最大难题。Although the surface defect detection technology based on deep learning can largely overcome the above-mentioned drawbacks of manual detection, the types of products to be inspected are diverse, and with the improvement of the process, the surface defects are also relatively subtle. Therefore, how to construct a stable and efficient surface defect detection method based on machine vision has become the biggest problem facing the application of machine vision in the field of surface defect detection.

基于此,本申请提供了一种表面缺陷检测方法、装置、计算机设备和存储介质,采用深度学习技术配合合适的数据增强处理、训练策略来训练缺陷分割模型,并在实际检测时通过缺陷分割模型对图像预处理后的待检图像块和标准图像块进行对比分析,从而确定待检产品是否存在表面缺陷。如此,本申请训练得到的缺陷分割模型具备很强的稳定性、泛化性以及高效性,因此,结合图像预处理和缺陷分割模型,可以提高待检产品表面缺陷的检测效率,且在多种产品、多场景下均能可以达到稳定的检测效果。Based on this, this application provides a surface defect detection method, device, computer equipment and storage medium, using deep learning technology with appropriate data enhancement processing and training strategies to train the defect segmentation model, and through the defect segmentation model during actual detection Compare and analyze the pre-processed image block and the standard image block to determine whether there are surface defects in the product to be inspected. In this way, the defect segmentation model trained in this application has strong stability, generalization and high efficiency. Therefore, combined with image preprocessing and defect segmentation model, the detection efficiency of surface defects of the product to be inspected can be improved, and in a variety of Products and multiple scenarios can achieve stable detection results.

在一个示例性实施例中,本申请可以利用计算机设备对待检产品的待检表面图像,以及该待检产品的标准表面图像进行图像预处理,并通过预先训练好的缺陷分割模型分析待检表面图像和标准表面图像的像素差异,从而确定待检产品是否存在表面缺陷。In an exemplary embodiment, the applicant can use computer equipment to perform image preprocessing on the surface image of the product to be inspected and the standard surface image of the product to be inspected, and analyze the surface to be inspected through a pre-trained defect segmentation model The pixel difference between the image and the standard surface image, so as to determine whether there are surface defects in the product to be inspected.

在一种可能的实现方式中,该计算机设备的结构如图1所示,该计算机设备100包括至少一个处理器110、存储器120、通信总线130,以及至少一个通信接口140。In a possible implementation manner, the computer device has a structure as shown in FIG. 1 , and the computer device 100 includes at least one processor 110 , a memory 120 , a communication bus 130 , and at least one communication interface 140 .

其中,处理器110可以是一个通用中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)、微处理器,或者可以是一个或多个用于实现本申请方案的集成电路,例如,专用集成电路(Application-Specific Integrated Circuit,ASlC),可编程逻辑器件(Programmable Logic Device,PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(Complex Programmable Logic Device,CPLD),现场可编程逻辑门阵列(Field-Programmable Gate Array,FPGA),通用阵列逻辑(Generic Array Logic,GAL)或其任意组合。Wherein, the processor 110 may be a general-purpose central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), a microprocessor, or may be one or more integrated circuits for realizing the scheme of the present application For example, Application-Specific Integrated Circuit (Application-Specific Integrated Circuit, ASIC), Programmable Logic Device (Programmable Logic Device, PLD) or a combination thereof. The aforementioned PLD may be a complex programmable logic device (Complex Programmable Logic Device, CPLD), a field programmable logic gate array (Field-Programmable Gate Array, FPGA), a general array logic (Generic Array Logic, GAL) or any combination thereof.

可选地,处理器110可以包括一个或多个CPU。计算机设备100可以包括多个处理器110。这些处理器110中的每一个可以是一个单核处理器(single-CPU),也可以是一个多核处理器(multi-CPU)。Optionally, the processor 110 may include one or more CPUs. Computer device 100 may include multiple processors 110 . Each of these processors 110 may be a single-core processor (single-CPU), or a multi-core processor (multi-CPU).

需要说明的是,这里的处理器110可以指一个或多个设备、电路和/或用于处理数据(如计算机程序指令)的处理核。It should be noted that the processor 110 here may refer to one or more devices, circuits and/or processing cores for processing data (such as computer program instructions).

存储器120可以是只读存储器(Read-Only Memory,ROM)或可存储静态信息和指令的其它类型的静态存储设备,也可以是随机存取存储器(Random Access Memory,RA M)或者可存储信息和指令的其它类型的动态存储设备,还可以是电可擦可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(CompactDisc Read-Only Memory,CD-ROM)或其它光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其它磁存储设备,或者是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其它介质,但不限于此。The memory 120 can be a read-only memory (Read-Only Memory, ROM) or other types of static storage devices that can store static information and instructions, and can also be a random access memory (Random Access Memory, RAM) or can store information and instructions. Other types of dynamic storage devices for instructions can also be Electrically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM) or other optical disc storage , optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and any other medium that can be accessed by a computer, but is not limited to.

可选地,存储器120可以是独立存在,并通过通信总线130与处理器110相连接;存储器120也可以和处理器110集成在一起。Optionally, the memory 120 may exist independently and be connected to the processor 110 through the communication bus 130 ; the memory 120 may also be integrated with the processor 110 .

通信总线130用于在各组件之间(比如处理器和存储器之间)传送信息,通信总线120可以分为地址总线、数据总线、控制总线等。为便于表示,图1中仅用一条通信总线进行示意,但并不表示仅有一根总线或一种类型的总线。The communication bus 130 is used to transmit information between various components (such as between the processor and the memory), and the communication bus 120 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one communication bus is used for illustration in FIG. 1 , but it does not mean that there is only one bus or one type of bus.

通信接口140用于供该计算机设备100与其它设备或通信网络进行通信。通信接口140包括有线通信接口或无线通信接口。其中,有线通信接口例如可以为以太网接口。以太网接口可以是光接口,电接口或其组合。无线通信接口可以为无线局域网(Wireless LocalArea Networks,WLAN)接口、蜂窝网络通信接口或其组合等。The communication interface 140 is used for the computer device 100 to communicate with other devices or a communication network. The communication interface 140 includes a wired communication interface or a wireless communication interface. Wherein, the wired communication interface may be an Ethernet interface, for example. The Ethernet interface can be an optical interface, an electrical interface or a combination thereof. The wireless communication interface may be a wireless local area network (Wireless Local Area Networks, WLAN) interface, a cellular network communication interface, or a combination thereof.

在一些实施例中,该计算机设备100还可以包括输出设备和输入设备(图1中未示出)。输出设备和处理器110通信,可以以多种方式来显示信息。例如,输出设备可以是液晶显示器(Liquid Crystal Display,LCD)、发光二极管(Light Emitting Diode,LED)显示设备、阴极射线管(Cathode Ray Tube,CRT)显示设备或投影仪(projector)等。输入设备和处理器110通信,可以以多种方式接收用户的输入。例如,输入设备可以是鼠标、键盘、触摸屏设备或传感设备等。In some embodiments, the computer device 100 may also include an output device and an input device (not shown in FIG. 1 ). Output devices are in communication with processor 110 and can display information in a variety of ways. For example, the output device may be a liquid crystal display (Liquid Crystal Display, LCD), a light emitting diode (Light Emitting Diode, LED) display device, a cathode ray tube (Cathode Ray Tube, CRT) display device, or a projector. The input device is in communication with the processor 110 and can receive user input in a variety of ways. For example, the input device may be a mouse, a keyboard, a touch screen device, or a sensing device, among others.

在一些实施例中,存储器120用于存储执行本申请方案的计算机程序,处理器110可以执行存储器120中存储的计算机程序。例如,该计算机设备100可以通过处理器110调用并执行存储在存储器120中的计算机程序,以实现本申请实施例提供的表面缺陷检测方法的步骤。In some embodiments, the memory 120 is used to store computer programs for implementing solutions of the present application, and the processor 110 can execute the computer programs stored in the memory 120 . For example, the computer device 100 can invoke and execute a computer program stored in the memory 120 through the processor 110, so as to implement the steps of the surface defect detection method provided in the embodiment of the present application.

应该理解的是,本申请提供的表面缺陷检测方法,可以应用于表面缺陷检测装置,该表面缺陷检测装置可以通过软件、硬件或者软硬件结合的方式实现成为处理器110的部分或者全部,集成在计算机设备100中。It should be understood that the surface defect detection method provided in this application can be applied to a surface defect detection device, and the surface defect detection device can be implemented as part or all of the processor 110 through software, hardware, or a combination of software and hardware, integrated in In the computer device 100.

接下来,将通过实施例并结合附图具体地对本申请的技术方案,以及本申请的技术方案如何解决上述技术问题进行详细说明。各实施例之间可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。显然,所描述的实施例是本申请实施例一部分实施例,而不是全部的实施例。Next, the technical solution of the present application and how the technical solution of the present application solves the above technical problems will be described in detail through embodiments and in conjunction with the accompanying drawings. Various embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Apparently, the described embodiments are some of the embodiments of the present application, but not all of them.

在一个示例性实施例中,如图2所示,本申请提供了一种表面缺陷检测方法,以该方法应用于上述图1所示的计算机设备100进行举例说明,该方法可以包括以下步骤:In an exemplary embodiment, as shown in FIG. 2 , the present application provides a surface defect detection method, which is illustrated by applying the method to the computer device 100 shown in FIG. 1 above. The method may include the following steps:

步骤210:获取待检产品的待检表面图像和标准表面图像。Step 210: Obtain the surface image to be inspected and the standard surface image of the product to be inspected.

其中,待检产品为工业生产线上生产的任一产品,待检表面图像是实时拍摄的待检产品的表面图像。对应地,标准表面图像为与待检产品同类型的,且无表面缺陷的表面图像。Wherein, the product to be inspected is any product produced on an industrial production line, and the surface image to be inspected is a surface image of the product to be inspected captured in real time. Correspondingly, the standard surface image is the same type as the product to be inspected and has no surface defects.

作为一个示例,若待检产品为印刷品,则表面缺陷包括浅粘花缺陷。As an example, if the product to be inspected is a printed matter, the surface defects include light sticking defects.

需要说明的是,对于同一类型的一批产品,其生产过程中可以针对生产得到的多个待检产品,依次获取其对应的待检表面图像。而针对这一批产品,可以采用同一个标准表面图像执行本申请提供的表面缺陷检测方法,也可以这批产品中预检的多个不存在表面缺陷的标准表面图像执行本申请提供的表面缺陷检测方法,本申请实施例对此不做限制。It should be noted that, for a batch of products of the same type, during the production process, the corresponding surface images to be inspected may be sequentially acquired for a plurality of products to be inspected. For this batch of products, the same standard surface image can be used to implement the surface defect detection method provided by this application, and the surface defect detection method provided by this application can also be performed on multiple standard surface images that do not have surface defects pre-checked in this batch of products. The detection method is not limited in this embodiment of the present application.

应该理解的是,待检产品的表面可能存在缺陷,也可能不存在缺陷。若待检产品的表面存在缺陷,则在待检表面图像和标准表面图像是由同一图像采集设备拍摄的情况下,待检表面图像中存在缺陷的图像区域,与标准表面图像中对应的图像区域之间会存在像素差异。基于此,本申请通过下述步骤220和步骤230分析待检表面图像与标准表面图像之间的像素差异。It should be understood that the surface of the product to be inspected may or may not have defects. If there are defects on the surface of the product to be inspected, if the image of the surface to be inspected and the standard surface image are taken by the same image acquisition device, the image area with defects in the image of the surface to be inspected is different from the corresponding image area in the standard surface image There will be pixel differences between. Based on this, the present application analyzes the pixel difference between the surface image to be inspected and the standard surface image through the following steps 220 and 230 .

作为一个示例,拍摄待检表面图像和标准表面图像的图像采集设备可以为RG B相机。As an example, the image acquisition device for capturing the image of the surface to be inspected and the image of the standard surface may be an RG B camera.

由于生产线上实时拍摄的待检产品的初始待检图像中存在冗余信息和噪声,若直接将初始待检图像作为待检产品的待检表面图像,则会增大后续模型处理过程中的信息处理量,还可能会对最终的缺陷检测结果造成影响。Due to redundant information and noise in the initial image of the product to be inspected in real time on the production line, if the initial image to be inspected is directly used as the surface image of the product to be inspected, the information in the subsequent model processing process will be increased The processing capacity may also affect the final defect detection results.

因此,可以对实际拍摄得到的待检产品的初始待检图像,以及初始标准图像进行预处理,从而得到待检产品的待检表面图像和标准表面图像。Therefore, preprocessing can be performed on the actual image of the product to be inspected and the initial standard image, so as to obtain the surface image of the product to be inspected and the standard surface image.

在一种可能的实现方式中,如图3所示,上述步骤210的实现过程可以包括以下子步骤:In a possible implementation manner, as shown in FIG. 3, the implementation process of the above step 210 may include the following sub-steps:

步骤211:获取待检产品的初始待检图像和初始标准图像。Step 211: Obtain the initial image to be inspected and the initial standard image of the product to be inspected.

可选地,在执行下述步骤213之前,可以对初始待检图像和初始标准图像进行去噪处理,以剔除图像中的噪声信息和冗余信息。Optionally, before the following step 213 is performed, denoising processing may be performed on the initial image to be inspected and the initial standard image, so as to eliminate noise information and redundant information in the image.

其中,去噪处理可以通过滤波算法来实现。滤波算法可以为均值滤波、中值滤波、高斯滤波等,本申请实施例对此不做限制。Wherein, the denoising processing may be realized by a filtering algorithm. The filtering algorithm may be mean filtering, median filtering, Gaussian filtering, etc., which is not limited in this embodiment of the present application.

可选地,为方便计算,可以对初始待检图像和初始标准图像进行灰度化处理,以将RGB相机拍摄的彩色图像转化成为灰度图像。Optionally, for the convenience of calculation, the initial image to be inspected and the initial standard image may be grayscaled to convert the color image captured by the RGB camera into a grayscale image.

应该理解的是,彩色图像中R、G、B三个分量的值决定了一个具体的像素点,一个像素点可以有上千万种颜色;而灰度图像也是一种彩色图像,但它的特点在于R、G、B三个分量具体的值是一致的,灰度图中每个像素点的像素值变化区间是0到255。It should be understood that the values of the three components of R, G, and B in a color image determine a specific pixel, and a pixel can have tens of millions of colors; and a grayscale image is also a color image, but its The feature is that the specific values of the three components of R, G, and B are consistent, and the pixel value change range of each pixel in the grayscale image is 0 to 255.

将初始待检图像和初始标准图像转变成对应的灰度图像,在保留图像轮廓和特征的基础上,该灰度图仍然能够反映整幅图像的轮廓和纹理,不影响后续的缺陷检测。The initial to-be-inspected image and the initial standard image are converted into corresponding grayscale images. On the basis of retaining the outline and features of the image, the grayscale image can still reflect the outline and texture of the entire image without affecting the subsequent defect detection.

步骤213:基于初始标准图像,对初始待检图像进行图像配准处理,得到中间待检图像。Step 213: Based on the initial standard image, perform image registration processing on the initial image to be inspected to obtain an intermediate image to be inspected.

应该理解的是,初始待检图像经过图像配准处理后得到中间待检图像,在此步骤213中,无需对初始标准图像进行处理。换言之,执行步骤213后,得到中间待检图像和初始标准图像。It should be understood that the initial image to be inspected is subjected to image registration processing to obtain an intermediate image to be inspected, and in step 213, the initial standard image does not need to be processed. In other words, after step 213 is executed, an intermediate candidate image and an initial standard image are obtained.

在实际实施过程中,由于拍摄角度、拍摄光线等原因,可能会导致初始待检图和初始标准图像无法达到像素级别的对齐,两者之间会存在像素的偏移。In the actual implementation process, due to reasons such as shooting angle and shooting light, the initial to-be-checked image and the initial standard image may not be able to achieve pixel-level alignment, and there will be a pixel offset between the two.

因此,需要对初始待检图像与初始标准图像进行图像配准处理,使得初始待检图像和初始标准图像在图像尺寸、像素位置等方面实现对齐。Therefore, it is necessary to perform image registration processing on the initial candidate image and the initial standard image, so that the initial candidate image and the initial standard image are aligned in terms of image size and pixel position.

步骤215:对中间待检图像和初始标准图像分别进行图像预处理,得到待检表面图像和标准表面图像。Step 215: Perform image preprocessing on the intermediate image to be inspected and the initial standard image, respectively, to obtain the surface image to be inspected and the standard surface image.

其中,图像预处理可以包括降采样处理、剔除冗余点、边缘检测、腐蚀处理、膨胀处理中的至少一项。Wherein, the image pre-processing may include at least one of down-sampling processing, eliminating redundant points, edge detection, erosion processing, and dilation processing.

在一种可能的实现方式中,步骤215的实现过程为:对中间待检图像和初始标准图像进行边缘检测,获取中间待检图像的第一边缘信息和初始标准图像的第二边缘信息;基于第一边缘信息,对中间待检图像进行边缘膨胀处理,得到待检表面图像;基于第二边缘信息,对初始标准图像进行边缘膨胀处理,得到标准表面图像。In a possible implementation, the implementation process of step 215 is: perform edge detection on the intermediate image to be inspected and the initial standard image, and obtain the first edge information of the intermediate image to be inspected and the second edge information of the initial standard image; The first edge information performs edge expansion processing on the intermediate image to be inspected to obtain the surface image to be inspected; based on the second edge information, the initial standard image is subjected to edge expansion processing to obtain the standard surface image.

其中,图像边缘是图像最基本的特征,边缘(Edge)是指图像局部特性的不连续性,灰度或结构等信息的突变处称之为边缘。例如,灰度级的突变、颜色的突变、纹理结构的突变等。Among them, the image edge is the most basic feature of the image, and the edge (Edge) refers to the discontinuity of the local characteristics of the image, and the sudden change of information such as grayscale or structure is called the edge. For example, the sudden change of gray level, the sudden change of color, the sudden change of texture structure, etc.

具体地,边缘检测操作采用的边缘检测算子可以为:Roberts算子、Prewitt算子、Sobel算子、拉普拉斯(Laplacian)算子、LoG算子(也称为Marr边缘检测算子,或者高斯-拉普拉斯算子)、Canny边缘检测中的任一种。Specifically, the edge detection operators used in the edge detection operation may be: Roberts operator, Prewitt operator, Sobel operator, Laplacian operator, LoG operator (also called Marr edge detection operator, or Gaussian-Laplacian), Canny edge detection.

其中,Roberts算子又称为交叉微分算法,它是基于交叉差分的梯度算法,通过局部差分计算检测边缘线条;Roberts算子的模板分为水平方向和垂直方向,能较好的增强正负45度的图像边缘。而Prewitt算子的原理是利用特定区域内像素点的灰度值产生的差分来实现边缘检测;Prewitt算子采用模板对区域内各像素点的像素值进行计算,使得其边缘检测结果在水平方向和垂直方向均比Robert算子更加明显。拉普拉斯算子是n维欧几里德空间中的一个二阶微分算子,分为四邻域和八邻域,四邻域是对邻域中心像素的四个方向求梯度,八邻域是对八个方向求梯度。LoG算子是在运用拉普拉斯算子之前一般先进行高斯低通滤波。Canny边缘检测的基本思想就是首先对图像选择一定的Gauss滤波器进行平滑滤波,然后采用非极值抑制技术进行处理得到最后的边缘图像。Among them, the Roberts operator is also called the cross-differential algorithm, which is a gradient algorithm based on cross-difference, and detects edge lines through local difference calculations; the template of the Roberts operator is divided into horizontal and vertical directions, which can better enhance the positive and negative 45 degrees of image edges. The principle of the Prewitt operator is to use the difference generated by the gray value of the pixel in a specific area to realize edge detection; the Prewitt operator uses a template to calculate the pixel value of each pixel in the area, so that the edge detection result is horizontal and vertical direction are more obvious than Robert operator. The Laplacian operator is a second-order differential operator in n-dimensional Euclidean space, which is divided into four neighborhoods and eight neighborhoods. The four neighborhoods are to calculate the gradient in the four directions of the center pixel of the neighborhood, and the eight neighborhoods It is to find the gradient for eight directions. The LoG operator generally performs Gaussian low-pass filtering before using the Laplacian operator. The basic idea of Canny edge detection is to first select a certain Gauss filter for image smoothing, and then use non-extreme value suppression technology to process to obtain the final edge image.

作为一个示例,本申请实施例采用Sobel算子对中间待检图像和初始标准图像进行边缘检测,以获取图像边缘信息。As an example, the embodiment of the present application uses a Sobel operator to perform edge detection on the intermediate image to be inspected and the initial standard image, so as to obtain image edge information.

其中,Sobel算子在Prewitt算子的基础上增加了权重的概念,认为相邻像素点的距离远近,对当前像素点的影响是不同的,距离越近的像素点对当前像素的影响越大,距离越远的像素点对当前像素的影响越小,从而实现图像锐化并突出边缘轮廓。Among them, the Sobel operator adds the concept of weight on the basis of the Prewitt operator. It believes that the distance between adjacent pixels has different effects on the current pixel. The closer the pixel, the greater the impact on the current pixel. , the farther away the pixel has less influence on the current pixel, so as to achieve image sharpening and highlight the edge contour.

如此,采用Sobel算子可以充分考虑像素点之间的互相影响,使得计算后的边缘信息更为准确,可以更好地描述中间待检图像中的真实轮廓,以及展示出清晰的轮廓边缘。In this way, the Sobel operator can fully consider the mutual influence between pixels, so that the calculated edge information is more accurate, it can better describe the real contour in the middle image to be checked, and show a clear contour edge.

进一步地,图像边缘膨胀是在图像的边缘添加像素值,使得整体的像素值扩张,进而达到图像的膨胀效果,也可以说是像素插值处理。Furthermore, image edge expansion is to add pixel values at the edge of the image, so that the overall pixel value is expanded, and then achieve the image expansion effect, which can also be called pixel interpolation processing.

其中,根据膨胀处理时所参考的相邻像素点的位置关系,图像膨胀处理包括水平膨胀、垂直膨胀和全方向膨胀。Wherein, according to the positional relationship of adjacent pixels referenced during the expansion process, the image expansion process includes horizontal expansion, vertical expansion and omnidirectional expansion.

作为一个示例,本申请实施例可以对中间待检图像和初始标准图像的边缘进行全方位膨胀处理,得到待检表面图像和标准表面图像。As an example, in the embodiment of the present application, the edge of the intermediate image to be inspected and the initial standard image may be expanded in all directions to obtain the surface image to be inspected and the standard surface image.

应该理解的是,全方位膨胀处理是遍历目标图像中的目标区域,只考虑目标像素及其相邻的上下左右四个像素的灰度值,确认其与膨胀的结构元素是否有交点,即是否存在至少一处对应的灰度值相等。如果有交点,则处理该像素点;否则将该像素点删除。It should be understood that the omni-directional expansion process traverses the target area in the target image, only considers the gray value of the target pixel and its adjacent four pixels up, down, left, and right, and confirms whether there is an intersection with the expanded structural element, that is, whether There is at least one place where corresponding grayscale values are equal. If there is an intersection, the pixel is processed; otherwise, the pixel is deleted.

如此,通过全方位膨胀处理,不仅可以对图像边界点进行扩充,还可以将与图像边缘相接触的背景点合并到边缘信息中,使得膨胀处理后可以更好地反映图像边缘与背景信息之间的真实界限,膨胀处理效果更佳。In this way, through all-round dilation processing, not only can the image boundary points be expanded, but also the background points that are in contact with the image edge can be merged into the edge information, so that after dilation processing, the relationship between the image edge and the background information can be better reflected. Real bounds of , the dilation handles better.

步骤220:对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块。Step 220: Carry out image segmentation between the surface image to be inspected and the standard surface image, and obtain at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image.

其中,待检图像块和标准图像块的数目相同,且待检图像块和标准图像块在对应的表面图像中所处的图像区域也相同。Wherein, the numbers of the image blocks to be inspected and the standard image blocks are the same, and the image areas where the image blocks to be inspected and the standard image blocks are located in the corresponding surface images are also the same.

换言之,步骤220在对待检表面图像和标准表面图像进行图像分割时,是基于相同的图像位置进行分割的,使得分割结束后,待检图像块在待检表面图像中对应的图像区域的位置坐标,与标准图像块在标准表面图像中对应的图像区域的位置坐标是相同的;同时,分割后得到的待检图像块和标准图像块的数目也相同。In other words, when segmenting the surface image to be inspected and the standard surface image in step 220, the image is segmented based on the same image position, so that after the segmentation, the position coordinates of the image area corresponding to the image block to be inspected in the surface image to be inspected , the position coordinates of the image area corresponding to the standard image block in the standard surface image are the same; at the same time, the numbers of the image blocks to be inspected and the standard image blocks obtained after segmentation are also the same.

在一种可能的实现方式中,步骤220的实现过程可以为:对待检表面图像和标准表面图像中相同位置的像素进行像素值相减操作,得到中间表面图像;对中间表面图像进行连通区域分析,获取至少一个候选缺陷特征图;按照候选缺陷特征图在中间表面图像中对应的区域位置信息,对待检表面图像和标准表面图像进行图像分割,得到待检图像块和标准图像块。In a possible implementation, the implementation process of step 220 can be: performing pixel value subtraction operation on pixels at the same position in the surface image to be checked and the standard surface image to obtain an intermediate surface image; performing connected region analysis on the intermediate surface image , to obtain at least one candidate defect feature map; according to the region position information corresponding to the candidate defect feature map in the intermediate surface image, perform image segmentation on the surface image to be inspected and the standard surface image, and obtain image blocks to be inspected and standard image blocks.

由于待检表面图像和标准表面图像是图像配准处理后的图像对,因此,两个表面图像中对应位置的像素描述的是待检产品的同一个表面特征,故像素值可以直接相减。Since the surface image to be inspected and the standard surface image are image pairs after image registration, the pixels at corresponding positions in the two surface images describe the same surface feature of the product to be inspected, so the pixel values can be directly subtracted.

应该理解的是,若待检表面图像和标准表面图像均为灰度图像,则处理后得到的一张中间表面图像也为灰度图像。该中间表面图像中各像素点的像素值,具体为待检表面图像和标准表面图像中对应位置的两个像素值之差的绝对值。It should be understood that if both the surface image to be inspected and the standard surface image are grayscale images, an intermediate surface image obtained after processing is also a grayscale image. The pixel value of each pixel in the intermediate surface image is specifically the absolute value of the difference between two pixel values at corresponding positions in the surface image to be inspected and the standard surface image.

作为一个示例,可以通过对中间表面图像进行Blob分析,来获取至少一个候选缺陷特征图。As an example, at least one candidate defect feature map may be obtained by performing Blob analysis on the intermediate surface image.

其中,在计算机视觉中,Blob是指图像中的具有相似颜色、纹理等特征所组成的一块连通区域,则在本申请实施例中,Blob分析(Blob Analysis)是对中间表面图像中相同像素的连通域(该连通域称为Blob块)进行分析,得到该连通域的特征图,即候选缺陷特征图。Wherein, in computer vision, Blob refers to a connected area formed by features such as similar colors and textures in the image. The connected domain (the connected domain is called a Blob block) is analyzed to obtain the feature map of the connected domain, that is, the candidate defect feature map.

具体地,Blob分析是对中间表面图像中各像素点的像素值进行二值化处理,分割出前景和背景;然后进行连通区域检测,得到Blob块;进而在各Blob块中提取像素特征,得到候选缺陷特征图。Specifically, Blob analysis is to binarize the pixel values of each pixel in the intermediate surface image to segment the foreground and background; then perform connected region detection to obtain Blob blocks; and then extract pixel features from each Blob block to obtain Candidate defect feature maps.

需要说明的是,中间表面图像中的连通域数目与候选缺陷特征图的数目相同。也即是,若中间表面图像中只存在一个连通域,则Blob分析后得到一个候选缺陷特征图;若中间表面图像中存在多个连通域,则Blob分析后得到各连通域对应的候选缺陷特征图。It should be noted that the number of connected domains in the intermediate surface image is the same as the number of candidate defect feature maps. That is, if there is only one connected domain in the intermediate surface image, a candidate defect feature map will be obtained after Blob analysis; if there are multiple connected domains in the intermediate surface image, then the candidate defect features corresponding to each connected domain will be obtained after Blob analysis picture.

进一步地,以一个候选缺陷特征图为例,基于候选缺陷特征图,对待检表面图像和标准表面图像进行图像分割,得到待检图像块和标准图像块的实现过程可以为:获取候选缺陷特征图在中间表面图像中对应的区域位置信息,得到区域位置信息;按照该区域位置信息对待检表面图像进行图像分割,以从待检表面图像中分割出该区域位置信息对应的局部图像,得到待检图像块;同理,按照该区域位置信息对标准表面图像进行图像分割,以从标准表面图像中分割出该区域位置信息对应的局部图像,得到标准图像块。Further, taking a candidate defect feature map as an example, based on the candidate defect feature map, image segmentation is performed on the surface image to be inspected and the standard surface image, and the implementation process of obtaining the image block to be inspected and the standard image block can be as follows: Obtain the feature map of the candidate defect According to the corresponding area position information in the intermediate surface image, the area position information is obtained; image segmentation is performed on the surface image to be inspected according to the area position information, so as to segment the partial image corresponding to the area position information from the surface image to be inspected, and obtain the area to be inspected. image block; similarly, image segmentation is performed on the standard surface image according to the location information of the region, so as to segment the local image corresponding to the location information of the region from the standard surface image to obtain a standard image block.

如此,本申请实施例并非直接将待检表面图像和标准表面图像输入至训练好的缺陷分割模型,而是结合图像预处理和图像分割,减少图像块中的处理信息量,降低缺陷分割对缺陷分割模型的运算资源量要求,可以实现基于表面图像的缺陷分割方法在低端运算设备上的高速实时运算。In this way, the embodiment of the present application does not directly input the surface image to be inspected and the standard surface image into the trained defect segmentation model, but combines image preprocessing and image segmentation to reduce the amount of processing information in the image block and reduce the impact of defect segmentation on defects. The computing resource requirements of the segmentation model can realize high-speed real-time computing of the defect segmentation method based on surface images on low-end computing equipment.

步骤230:将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,获取至少一个缺陷分割图像块。Step 230: Input the image block to be inspected and the standard image block into the pre-trained defect segmentation model to obtain at least one defect segmented image block.

其中,每个缺陷分割图像块用于表示一个待检图像块和一个标准图像块之间的像素差异信息。Wherein, each defective segmented image block is used to represent pixel difference information between an image block to be inspected and a standard image block.

需要说明的是,本申请提供的缺陷分割模型是一种双输入神经网络模型,该缺陷分割模型在进行缺陷分割时,要求模型的输入为两个对应的图像,且对两个图像的输入顺序没有要求。It should be noted that the defect segmentation model provided by this application is a dual-input neural network model. When performing defect segmentation, the defect segmentation model requires the input of the model to be two corresponding images, and the input sequence of the two images no requirement.

可选地,候选缺陷特征图中存在大量的非缺陷特征,根据每个候选缺陷特征图的区域位置信息,在待检表面图像和标准表面图像上对应位置采集小尺寸的图像块之后,可以根据候选缺陷特征图的面积大小,对分割得到的待检图像块和标准图像块进行排序,保证大面积的候选缺陷特征图所对应的待检图像块和标准图像块,可以优先被缺陷分割模型处理。Optionally, there are a large number of non-defect features in the candidate defect feature map. According to the area position information of each candidate defect feature map, after collecting small-sized image blocks at the corresponding positions on the surface image to be inspected and the standard surface image, it can be based on The area size of the candidate defect feature map, sort the image blocks to be inspected and the standard image blocks obtained by segmentation, to ensure that the image blocks to be inspected and standard image blocks corresponding to the large-area candidate defect feature map can be preferentially processed by the defect segmentation model .

作为一个示例,以印刷品中存在的浅粘花缺陷为例,为了提升浅粘花缺陷检出的效果,达到更好的缺陷检测准确率,本申请实施例使用基于Transformer模型(是一种采用自注意力机制的深度学习模型,自注意力机制可以按输入数据各部分重要性的不同而分配不同的权重)的Seg Former(是一个将transformer与轻量级多层感知器解码器统一起来的语义分割框架)的编码器,作为缺陷分割模型的骨干网络(backbone)。其中,SegFormer使用分层次的编码器结构,可以输出多尺度特征图,并在解码器中将多尺度特征图融合在一起。As an example, take the shallow sticky defect existing in printed matter as an example, in order to improve the effect of shallow sticky defect detection and achieve better defect detection accuracy, the embodiment of the present application uses the Transformer model (which is a self- The deep learning model of the attention mechanism, the self-attention mechanism can assign different weights according to the importance of each part of the input data) Seg Former (a semantics that unifies the transformer and the lightweight multi-layer perceptron decoder Segmentation Framework), which serves as the backbone of the defect segmentation model. Among them, SegFormer uses a hierarchical encoder structure that can output multi-scale feature maps and fuse multi-scale feature maps together in the decoder.

其中,SegFormer避免了复杂的解码器,提出的MLP解码器可以从不同的层聚合信息。换言之,SegFormer类似于卷积神经网络模型中将浅层特征图与深层特征图融合的做法,目的是使得高分辨率粗粒度的特征和低分辨率细粒度的特征能一起被捕捉到,从而优化分割结果。Among them, SegFormer avoids complex decoders, and the proposed MLP decoder can aggregate information from different layers. In other words, SegFormer is similar to the fusion of shallow feature maps and deep feature maps in the convolutional neural network model. The purpose is to enable high-resolution coarse-grained features and low-resolution fine-grained features to be captured together, thereby optimizing Split results.

而且,本申请实施例抛弃了Transformer模型,以及基于自注意力的编码器(segmentation transformer,简称为SETR)里面的位置编码,在输入的图片的大小和训练时所使用的图片大小不一样时,不需要再对位置编码向量做插值(当测试分辨率与训练分辨率不同时,会导致性能下降)。Moreover, the embodiment of the present application discards the Transformer model and the positional encoding in the self-attention-based encoder (segmentation transformer, SETR for short). When the size of the input picture is different from the size of the picture used for training, Interpolation of position encoding vectors is no longer required (leading to performance degradation when the test resolution differs from the training resolution).

如此,基于本申请设计的简洁、有效的解码器,可以对浅粘花缺陷做到大于90%的缺陷检测准确率。In this way, based on the simple and effective decoder designed in this application, the defect detection accuracy rate of more than 90% can be achieved for shallow sticking defects.

基于此,本申请提供的缺陷分割模型包括编码器和解码器,步骤230的实现过程可以为:将待检图像块和标准图像块输入至编码器中,通过编码器获取待检图像块在预设的多种分辨率下的第一多尺度特征图和标准图像块在多种分辨率下的第二多尺度特征图;将第一多尺度特征图和第二多尺度特征图输入至解码器中,通过解码器对第一多尺度特征图和第二多尺度特征图进行特征融合处理,输出缺陷分割图像块。Based on this, the defect segmentation model provided by this application includes an encoder and a decoder. The implementation process of step 230 can be: input the image block to be inspected and the standard image block into the encoder, and obtain the image block to be inspected by the encoder in the The first multi-scale feature map at multiple resolutions and the second multi-scale feature map of the standard image block at multiple resolutions; input the first multi-scale feature map and the second multi-scale feature map to the decoder In the method, feature fusion processing is performed on the first multi-scale feature map and the second multi-scale feature map through the decoder, and the defect segmented image block is output.

需要说明的是,每种分辨率下对应一个第一特征图和第二特征图,多种分辨率下对应多个第一特征图(即第一多尺度特征图)和多个第二特征图(第二多尺度特征图)。It should be noted that each resolution corresponds to a first feature map and a second feature map, and multiple resolutions correspond to multiple first feature maps (ie, the first multi-scale feature map) and multiple second feature maps (second multi-scale feature map).

作为一个示例,参见图4所示的缺陷检测模型的结构图,该图仅以一个待检图像块和一个标准图像块的处理流程进行举例,多个待检图像块和多个标准图像块输入至缺陷分割模型后的具体处理流程与此类似,在此不再赘述。As an example, refer to the structural diagram of the defect detection model shown in Figure 4, which only uses the processing flow of one image block to be inspected and one standard image block as an example, and multiple image blocks to be inspected and multiple standard image blocks are input The specific processing flow after the defect segmentation model is similar to this, and will not be repeated here.

其中,编码器由4个Transformer块(Transformer块1、Transformer块2、Transformer块3和Transformer块4)构成,在经过每个Transformer块之后特征图分别被下采样至1/4、1/8、1/16、1/32。这四个不同分辨率的特征图之后在解码器中进行融合。解码器可以通过卷积神经网络实现,将编码器中所有特征图分别进行双线性差值和3x3的卷积操作,以达到转置卷积的效果,同时避免了棋盘格效应对网络模型造成的影响。Among them, the encoder is composed of 4 Transformer blocks (Transformer block 1, Transformer block 2, Transformer block 3, and Transformer block 4). After each Transformer block, the feature map is down-sampled to 1/4, 1/8, 1/16, 1/32. These four feature maps of different resolutions are then fused in the decoder. The decoder can be implemented through a convolutional neural network, which performs bilinear difference and 3x3 convolution operations on all feature maps in the encoder to achieve the effect of transposed convolution, while avoiding the checkerboard effect on the network model. Impact.

具体地,在解码器中,不同大小的特征图先被上采样至图像原始尺寸,然后进行拼接操作,得到一个包含高分辨率粗粒度的特征和低分辨率细粒度的拼接特征图。进一步地,将该拼接特征图输入到后续的卷积网络中,使用三个卷积操作,分别将特征图降维到64维、32维、16维。最后将16维的卷积特征图输入到最终卷积层,降维到2维。Specifically, in the decoder, feature maps of different sizes are first upsampled to the original size of the image, and then concatenated to obtain a concatenated feature map containing high-resolution coarse-grained features and low-resolution fine-grained features. Further, the spliced feature map is input into the subsequent convolutional network, and three convolution operations are used to reduce the dimensionality of the feature map to 64 dimensions, 32 dimensions, and 16 dimensions, respectively. Finally, the 16-dimensional convolution feature map is input to the final convolution layer, and the dimensionality is reduced to 2 dimensions.

其中,2维在这里表示当前像素有无表面缺陷。比如,是否存在浅粘花缺陷。Wherein, the 2D here indicates whether the current pixel has surface defects. For example, whether there is a shallow sticky flower defect.

基于上述解释说明,如图5所示,本申请预先训练缺陷分割模型的过程可以包括以下步骤:Based on the above explanations, as shown in Figure 5, the process of pre-training the defect segmentation model in this application may include the following steps:

步骤510:获取已检产品的训练样本图像。Step 510: Obtain training sample images of inspected products.

其中,已检产品为已经标注出表面缺陷的产品,已检产品和上文的待检产品可以为同一类型的产品,也可以为不同类型的产品。Wherein, the inspected product is a product marked with surface defects, and the inspected product and the above-mentioned product to be inspected may be the same type of product, or may be a different type of product.

在该步骤中,训练样本图像包括一个标准样本图像和多个缺陷样本图像,每个样本图像携带一个样本标签,样本标签用于表示样本图像是否存在表面缺陷;In this step, the training sample image includes a standard sample image and a plurality of defect sample images, each sample image carries a sample label, and the sample label is used to indicate whether there is a surface defect in the sample image;

需要说明的是,对于同一类型产品的多个缺陷样本图像,也可以分别结合多个标准样本图像,组成训练样本对,本申请实施例对标准样本图像的数量不做限制。It should be noted that multiple defect sample images of the same type of product may also be combined with multiple standard sample images to form a training sample pair, and the embodiment of the present application does not limit the number of standard sample images.

作为一个示例,对于已检产品A,可以获取该已检产品预先检测出来的多个缺陷样本图像,同时获取该已检产品A的两个标准样本图像。其中,两个标准样本图像的拍摄角度、采光信息等略有不同。As an example, for the inspected product A, multiple defect sample images detected in advance of the inspected product may be obtained, and two standard sample images of the inspected product A may be obtained at the same time. Among them, the shooting angle and lighting information of the two standard sample images are slightly different.

步骤520:根据训练样本图像,生成多个训练样本对。Step 520: Generate a plurality of training sample pairs according to the training sample images.

其中,每个训练样本对包括两个样本图像。Wherein, each training sample pair includes two sample images.

在一种可能的实现方式中,如图6所示,步骤520的实现过程可以为:In a possible implementation, as shown in FIG. 6, the implementation process of step 520 may be:

步骤521:将标准样本图像依次与多个缺陷样本图像进行组合,得到多个初始样本对;Step 521: combining the standard sample image with multiple defective sample images in sequence to obtain multiple initial sample pairs;

也即是,每个初始样本对均包括一个缺陷样本图像和一个标准样本图像。That is, each initial sample pair includes a defect sample image and a standard sample image.

步骤523:对多个初始样本对随机进行数据增强处理,得到多个训练样本对。Step 523: Randomly perform data enhancement processing on multiple initial sample pairs to obtain multiple training sample pairs.

在一种可能的实现方式中,数据增强处理包括以下至少一种:In a possible implementation manner, the data enhancement processing includes at least one of the following:

(1)将初始样本对中的两张样本图像进行随机交换,得到多个第一样本对;(1) Randomly exchange two sample images in the initial sample pair to obtain multiple first sample pairs;

需要说明的是,每个初始样本对可以表示为(样本图像1,样本图像2),也即是,对于缺陷分割模型而言,初始样本对中的两个样本图像之间存在先后顺序。It should be noted that each initial sample pair can be expressed as (sample image 1, sample image 2), that is, for the defect segmentation model, there is a sequence between the two sample images in the initial sample pair.

作为一个示例,为了从训练策略上完成双输入图像差异的建模,在输入缺陷样本图像D和标准样本图像R时,对初始样本对(D,R)进行随机交换,对缺陷标签不做变化,使得f(D,R)=f(R,D)成立,从而符合双输入差异建模。As an example, in order to complete the modeling of the difference between the two input images from the training strategy, when inputting the defect sample image D and the standard sample image R, the initial sample pair (D, R) is randomly exchanged, and the defect label is not changed , so that f(D, R) = f(R, D) holds, thus conforming to the dual-input difference modeling.

(2)按照预设的像素偏移范围,对初始样本对中的任一个样本图像进行像素偏移处理,得到多个第二样本对。(2) Perform pixel offset processing on any sample image in the initial sample pair according to a preset pixel offset range to obtain multiple second sample pairs.

在样本图像对配准预处理中,由于所使用算法稳定性,硬件限制及速度要求等原因,会导致缺陷样本图像与标准样本图像不能达到像素级别的对齐,会出现大于5个像素的偏移。In the sample image pair registration preprocessing, due to the stability of the algorithm used, hardware limitations and speed requirements, etc., the defect sample image and the standard sample image cannot be aligned at the pixel level, and there will be an offset greater than 5 pixels. .

基于此,为了使深度学习网络模型可以适应这种情况,在训练初始缺陷检测模型时,对初始样本对中的缺陷样本图像或者标准样本图像做随机偏移操作,使得两个样本图像之间存在位置偏移。Based on this, in order to adapt the deep learning network model to this situation, when training the initial defect detection model, a random offset operation is performed on the defect sample image or the standard sample image in the initial sample pair, so that there is a gap between the two sample images. position offset.

如此,通过模拟实际场景下的常见的图像偏移现象,可以使最终训练得到的缺陷分割模型鲁棒性更强。In this way, by simulating the common image shift phenomenon in the actual scene, the defect segmentation model finally trained can be more robust.

(3)将初始样本对中的标准样本图像随机复制为缺陷样本图像,得到多个第三样本对。(3) Randomly copy the standard sample images in the initial sample pair as defect sample images to obtain multiple third sample pairs.

也即是,第三样本对中包括两个一模一样的缺陷样本图像,此时,无论图像如何偏移、旋转,其第三样本对对应的缺陷标签应该是一个全为零的矩阵,表示两个样本图像之间不存在差异,也就不存在缺陷。That is to say, the third sample pair includes two identical defect sample images. At this time, no matter how the image is shifted or rotated, the defect label corresponding to the third sample pair should be a matrix of all zeros, indicating that the two There are no differences between sample images, and therefore no defects.

(4)将预先提取的图像缺陷粘贴至初始样本对的标准样本图像中,得到多个第四样本对。(4) Paste the pre-extracted image defects into the standard sample images of the initial sample pairs to obtain multiple fourth sample pairs.

具体地,将历史检测数据集中已经标注的表面缺陷提取出来,随机粘贴到初始样本对的标准样本图像上,就得到了随机生成的缺陷样本图像。进而通过初始样本对中的原标准样本图像和随机生成的缺陷样本图像,形成第四样本对,以缓解深度学习模型对数据量的需求。Specifically, the marked surface defects in the historical inspection data set are extracted and pasted randomly on the standard sample image of the initial sample pair to obtain a randomly generated defect sample image. Furthermore, the fourth sample pair is formed by using the original standard sample image and the randomly generated defect sample image in the initial sample pair to alleviate the data volume demand of the deep learning model.

基于此,本申请实施例中用来训练初始缺陷分割模型的多个训练样本对包括:上述初始样本对、上述第一样本对、上述第二样本对、上述第三样本对和上述第四样本对中的至少一种样本对。Based on this, the multiple training sample pairs used to train the initial defect segmentation model in the embodiment of the present application include: the above-mentioned initial sample pair, the above-mentioned first sample pair, the above-mentioned second sample pair, the above-mentioned third sample pair and the above-mentioned fourth sample pair. At least one of the sample pairs.

步骤530:将多个训练样本对输入至待训练的初始缺陷分割模型中,根据初始缺陷分割模型的输出,计算初始缺陷分割模型的目标损失函数的训练损失值;Step 530: Input multiple training sample pairs into the initial defect segmentation model to be trained, and calculate the training loss value of the target loss function of the initial defect segmentation model according to the output of the initial defect segmentation model;

在一种可能的实现方式中,步骤530的实现过程可以为:将多个训练样本对分为训练集和验证集,采用训练集中的训练样本对,分批输入到初始缺陷分割模型中,使得初始缺陷分割模型可以充分学习标准样本图像和缺陷样本图像的特征信息。在采用训练集按照预设的迭代训练轮次预设轮次后,采用验证集中的训练样本对检验初始缺陷分割模型的学习效果,计算初始缺陷分割模型的目标损失函数的训练损失值。In a possible implementation, the implementation process of step 530 may be: divide multiple training sample pairs into a training set and a verification set, and use the training sample pairs in the training set to input them into the initial defect segmentation model in batches, so that The initial defect segmentation model can fully learn the feature information of standard sample images and defect sample images. After the training set is used to preset rounds according to the preset iterative training rounds, the training sample pairs in the verification set are used to test the learning effect of the initial defect segmentation model, and the training loss value of the target loss function of the initial defect segmentation model is calculated.

其中,训练集和验证集中均包括多个训练样本对,两个集合中训练样本对的数量可以相同,也可以不同,本申请实施例对此不做限制。Wherein, both the training set and the verification set include a plurality of training sample pairs, and the number of training sample pairs in the two sets may be the same or different, which is not limited in this embodiment of the present application.

应该理解的是,训练损失是根据初始缺陷分割模型预测的缺陷分割图像块中的像素信息,与输入的训练样本对预先标注的缺陷标签之间的差值确定的,差值减小,则说明训练结果趋近于标注信息,即可结束训练。It should be understood that the training loss is determined based on the difference between the pixel information in the defect segmentation image block predicted by the initial defect segmentation model and the input training sample to the pre-marked defect label. If the difference decreases, it means that When the training result is close to the label information, the training can be ended.

作为一个示例,预设的迭代训练轮次可以为任意数值,比如,10轮、20轮等。As an example, the preset iterative training rounds may be any number, for example, 10 rounds, 20 rounds, and so on.

进一步地,对于浅粘花缺陷而言,其在整个单张彩盒图像上只占很小的一部分,因此,在进行像素级别的分类时,可能存在类别不平衡问题。虽然前文的数据增强处理可以缓解一部分问题,但本申请实施例依然需要通过目标损失函数来约束类别上的不平衡,从而避免漏检情况的发生。Furthermore, for shallow sticky flower defects, it only accounts for a small part of the entire single color box image, so there may be a class imbalance problem when performing pixel-level classification. Although the aforementioned data enhancement processing can alleviate some of the problems, the embodiment of the present application still needs to use the target loss function to constrain the imbalance in categories, so as to avoid the occurrence of missed detection.

在一种可能的实现方式中,初始缺陷分割模型的目标损失函数包括Dice损失函数和交叉熵损失函数,且Dice损失函数和交叉熵损失函数在目标损失函数中的计算系数不同。In a possible implementation manner, the target loss function of the initial defect segmentation model includes a Dice loss function and a cross-entropy loss function, and the calculation coefficients of the Dice loss function and the cross-entropy loss function in the target loss function are different.

应该理解的是,Dice是一种区域相关的损失函数,用于计算两个样本的相似度,对正负样本严重不平衡的场景有着不错的性能,训练过程中更侧重对前景区域的挖掘;交叉熵能够衡量同一个随机变量中的两个不同概率分布的差异程度,在机器学习中就表示为真实概率分布与模型预测概率分布之间的差异,交叉熵的值越小,模型预测效果就越好。It should be understood that Dice is a region-related loss function, which is used to calculate the similarity between two samples. It has good performance in the scene where the positive and negative samples are seriously unbalanced. During the training process, more emphasis is placed on mining the foreground area; Cross-entropy can measure the degree of difference between two different probability distributions in the same random variable. In machine learning, it is expressed as the difference between the real probability distribution and the model-predicted probability distribution. The smaller the cross-entropy value, the better the model prediction effect. the better.

作为一个示例,采用Dice损失函数与交叉熵(CrossEntropy)损失函数,设置初始缺陷分割模型的目标损失函数,如下述公式(1)所示:As an example, the Dice loss function and the cross-entropy (CrossEntropy) loss function are used to set the target loss function of the initial defect segmentation model, as shown in the following formula (1):

Loss=1.0*Dice(A,A′)+0.1*CrossEntropy(A,A′) (1)Loss=1.0*Dice(A,A')+0.1*CrossEntropy(A,A') (1)

其中,Dice损失函数与交叉熵损失函数计算像素位置偏差,参见下述公式(2)和公式(3)Among them, the Dice loss function and the cross-entropy loss function calculate the pixel position deviation, see the following formula (2) and formula (3)

Dice(A,A′)=1-2|A&A′|/(|A|+|A′|) (2)Dice(A, A')=1-2|A&A'|/(|A|+|A'|) (2)

CrossEntropy(A,A′)=-\sum A′log(A) (3)CrossEntropy(A, A')=-\sum A'log(A) (3)

式中,A′表示初始缺陷分割模型输出的缺陷分割结果,即浅粘花缺陷在缺陷样本图像上的像素位置信息;A表示缺陷样本图像中人工预先标注的浅粘花缺陷位置信息;Dice损失函数计算系数为1,交叉熵损失函数的计算系数为0.1。In the formula, A' represents the defect segmentation result output by the initial defect segmentation model, that is, the pixel position information of the shallow sticky defect on the defect sample image; A represents the manually pre-labeled shallow sticky defect position information in the defect sample image; Dice loss The function calculation coefficient is 1, and the calculation coefficient of the cross-entropy loss function is 0.1.

如此,通过Dice损失函数和交叉熵损失函数分别计算对应的像素位置偏差,并叠加损失权重(即计算系数)来设置本申请的目标损失函数,可以解决正负样本严重不平衡的问题。In this way, by calculating the corresponding pixel position deviation through the Dice loss function and the cross-entropy loss function, and superimposing the loss weight (that is, the calculation coefficient) to set the target loss function of this application, the problem of serious imbalance between positive and negative samples can be solved.

步骤540:若训练损失值不满足预设的收敛条件,则调整初始缺陷分割模型的参数,并再次将多个训练样本对输入至调整参数后的初始缺陷分割模型,直到训练损失值满足预设的收敛条件,则结束训练,得到训练好的缺陷分割模型。Step 540: If the training loss value does not meet the preset convergence condition, adjust the parameters of the initial defect segmentation model, and input multiple training sample pairs into the adjusted initial defect segmentation model again until the training loss value meets the preset If the convergence condition is met, the training ends and the trained defect segmentation model is obtained.

其中,调整初始缺陷分割模型的参数包括调整初始缺陷分割模型中各Transformer块的处理参数,以及卷积神经网络的网络参数。Wherein, adjusting the parameters of the initial defect segmentation model includes adjusting the processing parameters of each Transformer block in the initial defect segmentation model and the network parameters of the convolutional neural network.

作为一个示例,预设的收敛条件包括:训练损失值达到预设的损失阈值;训练损失值在预设的迭代训练轮次中不再发生变化;训练总轮次达到预设的训练总次数。As an example, the preset convergence condition includes: the training loss value reaches a preset loss threshold; the training loss value does not change in preset iterative training rounds; and the total number of training rounds reaches a preset total number of training times.

比如,损失阈值可以为0.1,迭代训练轮次可以为10轮,训练总次数可以为100轮。For example, the loss threshold can be 0.1, the iterative training rounds can be 10 rounds, and the total number of training rounds can be 100 rounds.

可选地,对于训练好的缺陷分割模型,在上线使用之前,还可以获取一些产品表面图像,作为测试集,对缺陷分割模型预测的缺陷分割图像块的精确度进行测试,在测试结果满足要求的情况下,训练好的缺陷分割模型可以在实际场景中辅助进行表面缺陷检测。Optionally, before the trained defect segmentation model is put into use, some product surface images can also be obtained as a test set to test the accuracy of the defect segmentation image blocks predicted by the defect segmentation model, and the test results meet the requirements In the case of , the trained defect segmentation model can assist in surface defect detection in actual scenes.

在上述训练缺陷分割模型过程中,本申请实施例通过对初始样本对随机进行数据增强处理来获取多个训练样本对,提高了训练样本对的多样性,增加了训练样本对的数量,使最终训练得到的缺陷分割模型具有更好的鲁棒性。同时,本申请实施例采用Dice损失函数和交叉熵损失函数,来设置初始缺陷分割模型的目标损失函数,提高了缺陷分割模型的分割准确度,避免漏检情况的发生。In the above process of training the defect segmentation model, the embodiment of the present application obtains multiple training sample pairs by randomly performing data enhancement processing on the initial sample pairs, which improves the diversity of training sample pairs and increases the number of training sample pairs, so that the final The trained defect segmentation model has better robustness. At the same time, the embodiment of the present application uses the Dice loss function and the cross-entropy loss function to set the target loss function of the initial defect segmentation model, which improves the segmentation accuracy of the defect segmentation model and avoids the occurrence of missed detection.

步骤240:基于缺陷分割图像块,确定待检产品是否存在表面缺陷。Step 240: Segment image blocks based on defects, and determine whether the product to be inspected has surface defects.

其中,缺陷分割图像块用于表示一个待检图像块和一个标准图像块之间的像素差异信息。换言之,缺陷分割图中的像素点可以反映出较标准表面图像而言,待检表面图像中是否存在表面缺陷信息,表面缺陷信息包括缺陷位置、大小、轮廓等信息。Wherein, the defect segmented image block is used to represent the pixel difference information between an image block to be inspected and a standard image block. In other words, the pixels in the defect segmentation map can reflect whether there is surface defect information in the surface image to be inspected compared with the standard surface image, and the surface defect information includes defect position, size, contour and other information.

应该理解的是,缺陷分割图像块的个数与输入至缺陷分割模型中的待检图像块或标准图像块的数目相同,对于一个缺陷分割图像块,其中所包括的像素点个数可能为0,也可能不为0。It should be understood that the number of defect segmented image blocks is the same as the number of to-be-inspected image blocks or standard image blocks input into the defect segmentation model, and for a defect segmented image block, the number of pixels included may be 0 , and may not be 0.

其中,若缺陷分割图像块中的像素点个数为0,则表示缺陷分割模型判定对应的待检图像块和标准图像块之间不存在像素差异;若缺陷分割图像块中的像素点个数不为0,则表示缺陷分割模型判定对应的待检图像块和标准图像块之间,在这些不为0的像素点处存在差异。Among them, if the number of pixels in the defect segmentation image block is 0, it means that there is no pixel difference between the image block to be inspected and the standard image block corresponding to the defect segmentation model judgment; if the number of pixels in the defect segmentation image block If it is not 0, it means that there are differences between the image block to be inspected corresponding to the judgment of the defect segmentation model and the standard image block at these non-zero pixel points.

在一种可能的实现方式中,步骤240的实现过程可以为:根据缺陷分割图像块,判断各缺陷分割图像块中是否存在描述缺陷信息的像素点;若缺陷分割图像块中不存在描述缺陷信息的像素点,即缺陷分割图像块为空,则确定该缺陷分割图像块在待检表面图像中对应的图像区域中不存在表面缺陷;若缺陷分割图像块中存在描述缺陷信息的像素点,即缺陷分割图像块不为空,则确定该缺陷分割图像块在待检表面图像中对应的图像区域中存在表面缺陷。In a possible implementation, the implementation process of step 240 can be: segment image blocks according to defects, and determine whether there are pixels describing defect information in each defect segmented image block; , that is, the defect segmented image block is empty, it is determined that there is no surface defect in the corresponding image area of the defect segmented image block in the surface image to be inspected; if there are pixels describing defect information in the defect segmented image block, that is If the defect segmented image block is not empty, it is determined that the defect segmented image block has a surface defect in a corresponding image region in the surface image to be inspected.

具体地,在待检表面图像的所有待检图像块对应的缺陷分割图像块中,均不存在描述缺陷信息的像素点时,判定该待检表面图像中不存在表面缺陷,对应的待检产品也不存在表面缺陷,该待检产品为良品。Specifically, when there is no pixel point describing defect information in the defect segmentation image blocks corresponding to all the image blocks to be inspected in the surface image to be inspected, it is determined that there is no surface defect in the surface image to be inspected, and the corresponding product to be inspected There is also no surface defect, and the product to be inspected is a good product.

进一步地,若缺陷分割图像块中存在描述缺陷信息的像素点,可以确定这些像素点在缺陷分割图像块中的位置信息,并将该位置信息映射到待检表面图像中,即可确定表面缺陷的具体位置、大小、轮廓等缺陷信息。Further, if there are pixels describing defect information in the defect segmented image block, the position information of these pixels in the defect segmented image block can be determined, and the position information can be mapped to the surface image to be inspected to determine the surface defect Defect information such as the specific location, size, and contour of the object.

在另一种可能的实现方式中,步骤240的实现过程可以为:获取缺陷分割图像块和候选缺陷特征图之间的像素交集信息;若像素交集信息为空,则确定待检产品表面不存在表面缺陷;若像素交集信息不为空,则确定待检产品表面存在表面缺陷。In another possible implementation, the implementation process of step 240 can be: obtain the pixel intersection information between the defect segmentation image block and the candidate defect feature map; if the pixel intersection information is empty, then determine that there is no Surface defect; if the pixel intersection information is not empty, it is determined that there is a surface defect on the surface of the product to be inspected.

应该理解的是,两个像素点的像素值不同时,其像素值的差值本身就可以反映两者之间的区别。因此,在基于缺陷分割图像块判断待检产品是否存在表面缺陷时,也可以结合待检表面图像和标准表面图像中相同位置的像素进行像素值相减操作和连通区域分析后得到的候选缺陷特征图,从而提高表面缺陷检测结果的准确度。It should be understood that when the pixel values of two pixel points are different, the difference between the pixel values itself can reflect the difference between the two. Therefore, when judging whether there is a surface defect in the product to be inspected based on the defect segmentation image block, it is also possible to combine the pixels at the same position in the surface image to be inspected and the standard surface image to perform pixel value subtraction and connect region analysis to obtain candidate defect features Figure, thereby improving the accuracy of surface defect detection results.

因此,若缺陷分割图像块和候选缺陷特征图之间的均存在描述缺陷信息的像素点,则取交集后,像素交集信息中就包括这些描述缺陷信息的像素点。Therefore, if there are pixels describing defect information between the defect segmentation image block and the candidate defect feature map, after taking the intersection, the pixel intersection information includes these pixels describing defect information.

进一步地,若像素交集信息不为空,还可以确定交集中的各像素点在缺陷分割图像块或候选缺陷特征图的位置信息,并将该位置信息映射到待检表面图像中,即可确定表面缺陷的具体位置、大小、轮廓等缺陷信息。Further, if the pixel intersection information is not empty, it is also possible to determine the position information of each pixel in the intersection in the defect segmentation image block or the candidate defect feature map, and map the position information to the surface image to be inspected to determine Defect information such as the specific position, size, and contour of surface defects.

在本申请实施例中,计算机设备获取待检产品的待检表面图像和标准表面图像后,先对待检表面图像和标准表面图像进行图像分割,得到待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块。其中,待检图像块和标准图像块的数目相同,且待检图像块和标准图像块在对应的表面图像中所处的图像区域也相同。然后,将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,通过缺陷分割模型获取一个待检图像块和一个标准图像块对应的缺陷分割图像块,该缺陷分割图像块可以反映该待检图像块和标准图像块之间的像素差异信息。最后,基于缺陷分割图像块,确定待检产品是否存在表面缺陷。由此可见,本申请利用训练好的缺陷分割模型进行缺陷分割,较人工检测而言,检测效率更高。而且,缺陷分割模型为双输入的神经网络模型,其输入包括一个标准表面图像对应的标准图像块和待检表面图像对应的标准图像块,解决深度学习模型泛化能力弱的问题,无需针对不同的场景、不同的产品进行模型训练,减少了模型训练成本。双输入的缺陷分割模型即使遇到不存在于训练数据集中的产品,也可以保持较好的缺陷检测结果。此外,本申请预先对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块,之后再通过缺陷分割模型对各图像块进行处理,减少了图像处理过程中的资源消耗量,降低了缺陷分割模型对图像块进行缺陷分割时对计算机设备的计算性能要求,使得该表面缺陷检测方法可以在低端运算设备上实现高速实时运算,提高了表面缺陷检测效率。In the embodiment of the present application, after the computer equipment acquires the surface image to be inspected and the standard surface image of the product to be inspected, it first performs image segmentation on the surface image to be inspected and the standard surface image to obtain at least one image block to be inspected corresponding to the surface image to be inspected At least one standard image patch corresponding to the standard surface image. Wherein, the numbers of the image blocks to be inspected and the standard image blocks are the same, and the image areas where the image blocks to be inspected and the standard image blocks are located in the corresponding surface images are also the same. Then, the image block to be inspected and the standard image block are input into the pre-trained defect segmentation model, and a defect segmented image block corresponding to an image block to be inspected and a standard image block is obtained through the defect segmentation model, and the defect segmented image block can be It reflects the pixel difference information between the image block to be checked and the standard image block. Finally, image blocks are segmented based on defects to determine whether there are surface defects in the product to be inspected. It can be seen that the present application utilizes a trained defect segmentation model for defect segmentation, which is more efficient than manual detection. Moreover, the defect segmentation model is a double-input neural network model, and its input includes a standard image block corresponding to a standard surface image and a standard image block corresponding to a surface image to be inspected, which solves the problem of weak generalization ability of the deep learning model and does not need to target different Model training for different scenarios and different products reduces the cost of model training. The defect segmentation model with two inputs can maintain good defect detection results even when encountering products that do not exist in the training dataset. In addition, the application performs image segmentation on the surface image to be inspected and the standard surface image in advance, obtains at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image, and then uses the defect segmentation model to classify each Image blocks are processed, which reduces the resource consumption in the image processing process and reduces the computing performance requirements for computer equipment when the defect segmentation model performs defect segmentation on image blocks, so that the surface defect detection method can be realized on low-end computing devices High-speed real-time calculation improves the efficiency of surface defect detection.

基于上述实施例,在一个示例性实施例中,如图7所示,本申请还提供了另一种表面缺陷检测方法,以该方法应用于上述图1所示的计算机设备100进行举例说明,该表面缺陷检测方法的实施过程为:Based on the above embodiments, in an exemplary embodiment, as shown in FIG. 7 , the present application also provides another surface defect detection method, which is illustrated by applying the method to the computer device 100 shown in FIG. 1 above, The implementation process of the surface defect detection method is as follows:

获取待检产品的初始待检图像和初始标准图像,先基于初始标准图像,对初始待检图像进行图像配准处理,得到中间待检图像。再采用Sobel算子对中间待检图像和初始标准图像进行边缘检测和边缘膨胀处理,得到待检表面图像和标准表面图像。然后,对待检表面图像和标准表面图像进行特征比对和Blob分析,得到N个候选缺陷特征图;其中,N≥1。The initial image to be inspected and the initial standard image of the product to be inspected are obtained, and based on the initial standard image, image registration processing is performed on the initial image to be inspected to obtain an intermediate image to be inspected. Then the Sobel operator is used to perform edge detection and edge expansion processing on the intermediate image to be inspected and the initial standard image to obtain the surface image to be inspected and the standard surface image. Then, feature comparison and Blob analysis are performed on the surface image to be inspected and the standard surface image to obtain N feature maps of candidate defects; where N≥1.

进一步地,基于各候选缺陷特征图的区域位置信息,对各候选缺陷特征图按照图像面积大小进行排序,并基于各候选缺陷特征图对待检表面图像和标准表面图像进行图像分割,得到N个待检图像块和N个标准图像块。Further, based on the area position information of each candidate defect feature map, sort each candidate defect feature map according to the size of the image area, and perform image segmentation on the surface image to be inspected and the standard surface image based on each candidate defect feature map, and obtain N waiting Check image blocks and N standard image blocks.

其中,N个待检图像块和N个标准图像块一一对应,对应的待检图像块和标准图像块描述的是待检产品上相同的表面区域。Wherein, the N image blocks to be inspected correspond to the N standard image blocks one by one, and the corresponding image blocks to be inspected and the standard image blocks describe the same surface area on the product to be inspected.

进一步地,将N个待检图像块和N个标准图像块按照图像块对的顺序输入至本申请提供的双输入的缺陷分割模型中,得到每对输入的待检图像块和标准图像块对应的缺陷分割图像块。Further, N image blocks to be inspected and N standard image blocks are input into the double-input defect segmentation model provided by this application in the order of image block pairs, and the correspondence between each pair of input image blocks to be inspected and standard image blocks is obtained. The defect segmented image blocks.

其中,缺陷分割图像块用于描述一个待检图像块和一个标准图像块之间的像素差异信息,其中包括的像素可能为空,即待检图像块和标准图像块之间不存在像素差异;其中所包括的像素也可能不为空,即待检图像块和标准图像块之间存在像素差异。Wherein, the defect segmented image block is used to describe the pixel difference information between an image block to be inspected and a standard image block, and the pixels included therein may be empty, that is, there is no pixel difference between the image block to be inspected and the standard image block; The pixels included therein may not be empty, that is, there is a pixel difference between the image block to be checked and the standard image block.

应该理解的是,N个待检图像块和N个标准图像块经过缺陷分割模型处理后,得到N个缺陷分割图像块。It should be understood that, after the N image blocks to be inspected and the N standard image blocks are processed by the defect segmentation model, N defect segment image blocks are obtained.

进一步地,将N个缺陷分割图像块和对应的N个候选缺陷特征图取交集,判断各缺陷分割图像块是否存在表面缺陷。Further, the N defect segmented image blocks and the corresponding N candidate defect feature maps are intersected to determine whether each defect segmented image block has a surface defect.

最后,对各缺陷分割图像块的表面缺陷判断结果进行筛选处理,以确定待检产品是否存在表面缺陷。Finally, the surface defect judgment results of each defect segmentation image block are screened to determine whether the product to be inspected has surface defects.

需要说明的是,本申请实施例在实现以上面缺陷检测方法时,其实现原理和技术效果可以参见上一实施例中步骤210-步骤240的相关内容,在此不再赘述。It should be noted that when the embodiment of the present application implements the above defect detection method, its implementation principle and technical effect can refer to the relevant content of step 210-step 240 in the previous embodiment, which will not be repeated here.

应该理解的是,虽然上述实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,上述实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flow charts involved in the above embodiments are displayed sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flow charts involved in the above embodiments may include multiple steps or stages, and these steps or stages are not necessarily executed at the same time, but may be executed at different times. These steps Or the execution order of the stages is not necessarily performed sequentially, but may be executed in turn or alternately with other steps or at least a part of steps or stages in other steps.

基于上述表面缺陷检测方法,采用相同的技术构思,本申请实施例还提供了一种用于实现上述表面缺陷检测方法所对应的表面缺陷检测装置。该装置所提供的解决问题的实现方案与上述方法实施例中所记载的实现方案相似,故下面所提供的一个或多个表面缺陷检测装置实施例中的具体限定可以参见上文中对于表面缺陷检测方法的限定,在此不再赘述。Based on the above-mentioned surface defect detection method and using the same technical idea, the embodiment of the present application also provides a surface defect detection device for implementing the above-mentioned surface defect detection method. The solution to the problem provided by the device is similar to the implementation described in the above-mentioned method embodiments, so the specific limitations in one or more embodiments of the surface defect detection device provided below can be referred to above for surface defect detection The limitation of the method will not be repeated here.

在一个示例性实施例中,如图8所示,该表面缺陷检测装置800包括:In an exemplary embodiment, as shown in FIG. 8, the surface defect detection device 800 includes:

图像获取模块810,用于获取待检产品的待检表面图像和标准表面图像;An image acquisition module 810, configured to acquire a surface image to be inspected and a standard surface image of the product to be inspected;

图像分割模块820,用于对待检表面图像和标准表面图像进行图像分割,获取待检表面图像对应的至少一个待检图像块和标准表面图像对应的至少一个标准图像块;待检图像块和标准图像块的数目相同,且待检图像块和标准图像块在对应的表面图像中所处的图像区域也相同;The image segmentation module 820 is used to perform image segmentation on the surface image to be inspected and the standard surface image, and obtain at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image; the image block to be inspected and the standard image block The number of image blocks is the same, and the image areas where the image blocks to be checked and the standard image blocks are located in the corresponding surface images are also the same;

缺陷分割模块830,用于将待检图像块和标准图像块输入至预先训练好的缺陷分割模型中,获取至少一个缺陷分割图像块;每个缺陷分割图像块用于表示一个待检图像块和一个标准图像块之间的像素差异信息。The defect segmentation module 830 is configured to input the image block to be inspected and the standard image block into the pre-trained defect segmentation model to obtain at least one defect segmented image block; each defect segmented image block is used to represent an image block to be inspected and Pixel difference information between a standard image block.

缺陷检测模块840,用于基于缺陷分割图像块,确定待检产品是否存在表面缺陷。The defect detection module 840 is configured to segment the image block based on the defect, and determine whether there is a surface defect in the product to be inspected.

在一种可能的实现方式中,图像分割模块820,包括:In a possible implementation, the image segmentation module 820 includes:

像素处理单元,用于对待检表面图像和标准表面图像中相同位置的像素进行像素值相减操作,得到中间表面图像;The pixel processing unit is used to subtract the pixel values of pixels at the same position in the surface image to be checked and the standard surface image to obtain an intermediate surface image;

区域分析单元,用于对中间表面图像进行连通区域分析,获取至少一个候选缺陷特征图;A region analysis unit, configured to perform connected region analysis on the intermediate surface image to obtain at least one candidate defect feature map;

图像分割单元,用于按照候选缺陷特征图在中间表面图像中对应的区域位置信息,对待检表面图像和标准表面图像进行图像分割,得到待检图像块和标准图像块。The image segmentation unit is configured to perform image segmentation on the surface image to be inspected and the standard surface image according to the region position information corresponding to the feature map of the candidate defect in the intermediate surface image, to obtain image blocks to be inspected and standard image blocks.

在一种可能的实现方式中,缺陷检测模块840,包括:In a possible implementation manner, the defect detection module 840 includes:

信息获取单元,用于获取缺陷分割图像块和候选缺陷特征图之间的像素交集信息;an information acquisition unit, configured to acquire pixel intersection information between defect segmentation image blocks and candidate defect feature maps;

第一确定单元,用于若像素交集信息为空,则确定待检产品表面不存在表面缺陷;The first determination unit is configured to determine that there is no surface defect on the surface of the product to be inspected if the pixel intersection information is empty;

第二确定单元,用于若像素交集信息不为空,则确定待检产品表面存在表面缺陷。The second determining unit is configured to determine that surface defects exist on the surface of the product to be inspected if the pixel intersection information is not empty.

在一种可能的实现方式中,缺陷分割模型包括编码器和解码器;则缺陷分割模块830,包括:In a possible implementation, the defect segmentation model includes an encoder and a decoder; the defect segmentation module 830 includes:

特征提取单元,用于将待检图像块和标准图像块输入至编码器中,通过编码器获取待检图像块在预设的多种分辨率下的第一多尺度特征图和标准图像块在多种分辨率下的第二多尺度特征图;The feature extraction unit is used to input the image block to be inspected and the standard image block into the encoder, and obtain the first multi-scale feature map of the image block to be inspected at various preset resolutions and the standard image block through the encoder. The second multi-scale feature map at multiple resolutions;

特征融合单元,用于将第一多尺度特征图和第二多尺度特征图输入至解码器中,通过解码器对第一多尺度特征图和第二多尺度特征图进行特征融合处理,输出缺陷分割图像块。A feature fusion unit, configured to input the first multi-scale feature map and the second multi-scale feature map into the decoder, perform feature fusion processing on the first multi-scale feature map and the second multi-scale feature map through the decoder, and output the defect Segment image blocks.

在一种可能的实现方式中,图像获取模块810,包括:In a possible implementation manner, the image acquisition module 810 includes:

图像获取单元,用于获取待检产品的初始待检图像和初始标准图像;An image acquisition unit, configured to acquire an initial image to be inspected and an initial standard image of the product to be inspected;

图像配准单元,用于基于初始标准图像,对初始待检图像进行图像配准处理,得到中间待检图像;An image registration unit, configured to perform image registration processing on the initial image to be inspected based on the initial standard image to obtain an intermediate image to be inspected;

图像处理单元,用于对中间待检图像和初始标准图像分别进行图像预处理,得到待检表面图像和标准表面图像。The image processing unit is used to perform image preprocessing on the intermediate image to be inspected and the initial standard image to obtain the surface image to be inspected and the standard surface image.

在一种可能的实现方式中,图像处理单元,具体用于:In a possible implementation manner, the image processing unit is specifically used for:

对中间待检图像和初始标准图像进行边缘检测,获取中间待检图像的第一边缘信息和初始标准图像的第二边缘信息;Edge detection is performed on the intermediate image to be inspected and the initial standard image, and the first edge information of the intermediate image to be inspected and the second edge information of the initial standard image are obtained;

基于第一边缘信息,对中间待检图像进行边缘膨胀处理,得到待检表面图像;Based on the first edge information, edge expansion processing is performed on the intermediate image to be inspected to obtain a surface image to be inspected;

基于第二边缘信息,对初始标准图像进行边缘膨胀处理,得到标准表面图像。Based on the second edge information, edge expansion processing is performed on the initial standard image to obtain a standard surface image.

在一种可能的实现方式中,如图9所示,该表面缺陷检测装置800还包括:In a possible implementation, as shown in FIG. 9, the surface defect detection device 800 further includes:

样本获取模块850,用于获取已检产品的训练样本图像;训练样本图像包括一个标准样本图像和多个缺陷样本图像,每个样本图像携带一个样本标签,样本标签用于表示样本图像是否存在表面缺陷;The sample acquisition module 850 is used to obtain the training sample image of the inspected product; the training sample image includes a standard sample image and a plurality of defect sample images, each sample image carries a sample label, and the sample label is used to indicate whether the sample image has a surface defect;

样本对制备模块860,用于根据训练样本图像,生成多个训练样本对;每个训练样本对包括两个样本图像;The sample pair preparation module 860 is used to generate a plurality of training sample pairs according to the training sample images; each training sample pair includes two sample images;

损失计算模块870,用于将多个训练样本对输入至待训练的初始缺陷分割模型中,根据初始缺陷分割模型的输出,计算初始缺陷分割模型的目标损失函数的训练损失值;The loss calculation module 870 is configured to input a plurality of training sample pairs into the initial defect segmentation model to be trained, and calculate the training loss value of the target loss function of the initial defect segmentation model according to the output of the initial defect segmentation model;

模型训练模块880,用于若训练损失值不满足预设的收敛条件,则调整初始缺陷分割模型的参数,并再次将多个训练样本对输入至调整参数后的初始缺陷分割模型,直到训练损失值满足预设的收敛条件,则结束训练,得到训练好的缺陷分割模型。The model training module 880 is used to adjust the parameters of the initial defect segmentation model if the training loss value does not meet the preset convergence condition, and input multiple training sample pairs into the initial defect segmentation model after adjusting the parameters again until the training loss If the value satisfies the preset convergence condition, the training ends and a trained defect segmentation model is obtained.

在一种可能的实现方式中,样本对制备模块,包括:In a possible implementation, the sample pair preparation module includes:

样本组合单元,用于将标准样本图像依次与多个缺陷样本图像进行组合,得到多个初始样本对;A sample combining unit is used to sequentially combine the standard sample image with a plurality of defective sample images to obtain a plurality of initial sample pairs;

样本对处理单元,用于对多个初始样本对随机进行数据增强处理,得到多个训练样本对;The sample pair processing unit is used to randomly perform data enhancement processing on multiple initial sample pairs to obtain multiple training sample pairs;

其中,数据增强处理包括以下至少一种:Among them, data enhancement processing includes at least one of the following:

将初始样本对中的两张样本图像进行随机交换,得到多个第一样本对;Randomly exchanging the two sample images in the initial sample pair to obtain multiple first sample pairs;

按照预设的像素偏移范围,对初始样本对中的任一个样本图像进行像素偏移处理,得到多个第二样本对;Perform pixel offset processing on any sample image in the initial sample pair according to a preset pixel offset range to obtain a plurality of second sample pairs;

将初始样本对中的标准样本图像随机复制为缺陷样本图像,得到多个第三样本对;Randomly copying the standard sample image in the initial sample pair as a defective sample image to obtain a plurality of third sample pairs;

将预先提取的图像缺陷粘贴至初始样本对的标准样本图像中,得到多个第四样本对;Paste the pre-extracted image defects into the standard sample image of the initial sample pair to obtain a plurality of fourth sample pairs;

多个训练样本对包括初始样本对、第一样本对、第二样本对、第三样本对和第四样本对中的至少一种样本对。The plurality of training sample pairs includes at least one sample pair among an initial sample pair, a first sample pair, a second sample pair, a third sample pair, and a fourth sample pair.

在一种可能的实现方式中,初始缺陷分割模型的目标损失函数包括Dice损失函数和交叉熵损失函数,且Dice损失函数和交叉熵损失函数在目标损失函数中的计算系数不同。In a possible implementation manner, the target loss function of the initial defect segmentation model includes a Dice loss function and a cross-entropy loss function, and the calculation coefficients of the Dice loss function and the cross-entropy loss function in the target loss function are different.

在一种可能的实现方式中,若待检产品为印刷品,则表面缺陷包括浅粘花缺陷。In a possible implementation manner, if the product to be inspected is a printed matter, the surface defects include shallow sticking defects.

需要说明的是,图8和图9所示的表面缺陷检测装置800中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。It should be noted that each module in the surface defect detection device 800 shown in FIG. 8 and FIG. 9 can be fully or partially realized by software, hardware or a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.

此外,应该理解的是,本申请实施例可以全部或部分地通过软件、硬件、固件或者其任意结合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。该计算机程序产品包括计算机程序。在计算机设备上加载和运行该计算机程序时,全部或部分地产生按照本申请实施例所示的流程或功能。In addition, it should be understood that the embodiments of the present application may be fully or partially implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product comprises a computer program. When the computer program is loaded and run on the computer device, the processes or functions according to the embodiments of the present application will be generated in whole or in part.

其中,计算机程序可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,该计算机程序可以从一个网站站点、终端、服务器或数据中心通过有线或无线方式向另一个网站站点、终端、服务器或数据中心进行传输。Among them, the computer program may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program may be transmitted from a website site, a terminal, a server or a data center through Wired or wireless transmission to another website site, terminal, server or data center.

该计算机可读存储介质可以是计算机设备能够存取的任何可用介质,或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。The computer-readable storage medium may be any available medium that can be accessed by a computer device, or a data storage device including a server, a data center, and the like integrated with one or more available media.

应该理解的是,以上仅为本申请实施例的具体实施方式而已,并不用于限定本申请实施例的保护范围。凡在本申请实施例的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本申请实施例的保护范围之内。It should be understood that, the above are only specific implementation manners of the embodiments of the present application, and are not intended to limit the protection scope of the embodiments of the present application. All modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of the embodiments of the present application shall be included in the protection scope of the embodiments of the present application.

Claims (13)

1. A method of surface defect detection, comprising:
acquiring a surface image to be detected and a standard surface image of a product to be detected;
performing image segmentation on the surface image to be detected and the standard surface image to obtain at least one image block to be detected corresponding to the surface image to be detected and at least one standard image block corresponding to the standard surface image; the number of the to-be-detected image blocks is the same as that of the standard image blocks, and the image areas of the to-be-detected image blocks and the standard image blocks in the corresponding surface images are also the same;
inputting the to-be-detected image block and the standard image block into a defect segmentation model trained in advance to obtain at least one defect segmentation image block; each defect division image block is used for representing pixel difference information between one to-be-detected image block and one standard image block;
and determining whether the product to be detected has surface defects or not based on the defect segmentation image blocks.
2. The method according to claim 1, wherein the image segmentation of the surface image to be inspected and the standard surface image to obtain at least one image block to be inspected corresponding to the surface image to be inspected and at least one standard image block corresponding to the standard surface image comprises:
carrying out pixel value subtraction operation on pixels at the same positions in the surface image to be detected and the standard surface image to obtain an intermediate surface image;
analyzing a connected region of the intermediate surface image to obtain at least one candidate defect feature map;
and according to the corresponding region position information of the candidate defect characteristic diagram in the intermediate surface image, carrying out image segmentation on the surface image to be detected and the standard surface image to obtain the image block to be detected and the standard image block.
3. The method as claimed in claim 2, wherein said dividing image blocks based on said defects to determine whether said product to be inspected has surface defects comprises:
acquiring pixel intersection information between the defect segmentation image block and the candidate defect feature map;
if the pixel intersection information is empty, determining that no surface defect exists on the surface of the product to be detected;
and if the pixel intersection information is not null, determining that the surface of the product to be detected has surface defects.
4. The method of claim 1, wherein the defect segmentation model comprises an encoder and a decoder;
inputting the to-be-detected image block and the standard image block into a defect segmentation model trained in advance to obtain at least one defect segmentation image block, wherein the defect segmentation image block comprises:
inputting the image block to be detected and the standard image block into the encoder, and acquiring a first multi-scale feature map of the image block to be detected under multiple preset resolutions and a second multi-scale feature map of the standard image block under the multiple resolutions through the encoder;
inputting the first multi-scale feature map and the second multi-scale feature map into the decoder, performing feature fusion processing on the first multi-scale feature map and the second multi-scale feature map through the decoder, and outputting the defect segmentation image block.
5. The method according to any one of claims 1 to 4, characterized in that said acquiring of the surface image to be inspected and the standard surface image of the product to be inspected comprises:
acquiring an initial to-be-detected image and an initial standard image of the product to be detected;
based on the initial standard image, carrying out image registration processing on the initial image to be detected to obtain an intermediate image to be detected;
and respectively carrying out image preprocessing on the intermediate image to be detected and the initial standard image to obtain the surface image to be detected and the standard surface image.
6. The method of claim 5, wherein said image preprocessing said intermediate inspection image and said initial standard image to obtain said inspection surface image and said standard surface image comprises:
performing edge detection on the intermediate image to be detected and the initial standard image to obtain first edge information of the intermediate image to be detected and second edge information of the initial standard image;
performing edge expansion processing on the intermediate image to be detected based on the first edge information to obtain the surface image to be detected;
and performing edge expansion processing on the initial standard image based on the second edge information to obtain the standard surface image.
7. The method according to any one of claims 1 to 4, wherein the training process of the defect segmentation model comprises:
acquiring a training sample image of a detected product; the training sample image comprises a standard sample image and a plurality of defect sample images, each sample image carries a sample label, and the sample label is used for indicating whether the sample image has surface defects or not;
generating a plurality of training sample pairs according to the training sample images; each training sample pair comprises two sample images;
inputting the training sample pairs into an initial defect segmentation model to be trained, and calculating a training loss value of a target loss function of the initial defect segmentation model according to the output of the initial defect segmentation model;
and if the training loss value does not meet the preset convergence condition, adjusting parameters of the initial defect segmentation model, inputting the training sample pairs into the initial defect segmentation model after the parameters are adjusted again, and ending the training until the training loss value meets the preset convergence condition to obtain the trained defect segmentation model.
8. The method of claim 7, wherein generating a plurality of training samples from the training sample images comprises:
combining the standard sample image with the plurality of defect sample images in sequence to obtain a plurality of initial sample pairs;
performing data enhancement processing on the plurality of initial sample pairs randomly to obtain a plurality of training sample pairs;
wherein the data enhancement processing comprises at least one of:
randomly exchanging two sample images in the initial sample pair to obtain a plurality of first sample pairs;
performing pixel offset processing on any sample image in the initial sample pair according to a preset pixel offset range to obtain a plurality of second sample pairs;
randomly copying the standard sample images in the initial sample pairs into defect sample images to obtain a plurality of third sample pairs;
pasting pre-extracted image defects to the standard sample images of the initial sample pairs to obtain a plurality of fourth sample pairs;
the plurality of training sample pairs includes at least one of the initial sample pair, the first sample pair, the second sample pair, the third sample pair, and the fourth sample pair.
9. The method according to claim 7, wherein the objective loss function of the initial defect segmentation model comprises a Dice loss function and a cross entropy loss function, and the Dice loss function and the cross entropy loss function have different calculation coefficients in the objective loss function.
10. The method according to any one of claims 1 to 4, characterized in that the surface defects comprise low-tack defects if the product to be examined is a print.
11. A surface defect detecting apparatus, comprising:
the image acquisition module is used for acquiring a surface image to be detected and a standard surface image of a product to be detected;
the image segmentation module is used for carrying out image segmentation on the surface image to be detected and the standard surface image to obtain at least one image block to be detected corresponding to the surface image to be detected and at least one standard image block corresponding to the standard surface image; the number of the to-be-detected image blocks is the same as that of the standard image blocks, and the image areas of the to-be-detected image blocks and the standard image blocks in the corresponding surface images are also the same;
the defect segmentation module is used for inputting the to-be-detected image block and the standard image block into a defect segmentation model trained in advance to obtain at least one defect segmentation image block; each defect division image block is used for representing pixel difference information between one to-be-detected image block and one standard image block;
and the defect detection module is used for dividing the image blocks based on the defects and determining whether the product to be detected has surface defects.
12. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when retrieving from the memory and executing the computer program implements the steps of the method of any of the preceding claims 1 to 10.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of one of the preceding claims 1 to 10.
CN202211689323.7A 2022-12-27 2022-12-27 Surface defect detection method, device, computer equipment and storage medium Pending CN115830004A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211689323.7A CN115830004A (en) 2022-12-27 2022-12-27 Surface defect detection method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211689323.7A CN115830004A (en) 2022-12-27 2022-12-27 Surface defect detection method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115830004A true CN115830004A (en) 2023-03-21

Family

ID=85518700

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211689323.7A Pending CN115830004A (en) 2022-12-27 2022-12-27 Surface defect detection method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115830004A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116313102A (en) * 2023-05-10 2023-06-23 上海交通大学 Brain age prediction method, system, medium and electronic device
CN116485779A (en) * 2023-05-11 2023-07-25 哈尔滨工业大学重庆研究院 Adaptive wafer defect detection method, device, electronic equipment and storage medium
CN116664846A (en) * 2023-07-31 2023-08-29 华东交通大学 Method and system for monitoring construction quality of 3D printed bridge deck based on semantic segmentation
CN116664505A (en) * 2023-05-24 2023-08-29 国能铁路装备有限责任公司 Method and device for integrity analysis of vehicle bottom components
CN116721352A (en) * 2023-07-07 2023-09-08 重庆交通大学 An apparent disease detection method for lightweight concrete bridges based on improved Segformer
CN117067112A (en) * 2023-10-17 2023-11-17 杭州泓芯微半导体有限公司 Water cutting machine and control method thereof
CN117115148A (en) * 2023-10-19 2023-11-24 苏州弘皓光电科技有限公司 Intelligent identification method of chip surface defects based on 5G technology
CN118351111A (en) * 2024-06-14 2024-07-16 深圳超盈智能科技有限公司 Chip surface defect detection method, device, equipment and storage medium
CN119313944A (en) * 2024-09-18 2025-01-14 科大讯飞华南人工智能研究院(广州)有限公司 A method for judging product appearance quality based on industrial vision
CN119722678A (en) * 2025-02-28 2025-03-28 南昌洪都汽车配件制造有限公司 Automobile parts defect detection method and system
CN120411974A (en) * 2025-07-03 2025-08-01 北京茄豆网络科技有限公司 Method for generating composite label paper based on graphic and text information and composite label paper

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10000364A1 (en) * 1999-01-08 2000-07-13 Schlumberger Technologies Inc Defect detection method for patterned substrates, intended for detection of defects in voltage contrast of semiconductor wafers obtained using electron microscopes
CN111179251A (en) * 2019-12-30 2020-05-19 上海交通大学 Defect detection system and method based on twin neural network and by utilizing template comparison
CN112037166A (en) * 2020-07-10 2020-12-04 武汉迈格驷友科技有限公司 Surface defect detection method and detection device
CN114240939A (en) * 2022-02-24 2022-03-25 苏州浪潮智能科技有限公司 Method, system, equipment and medium for detecting appearance defects of mainboard components
CN114972258A (en) * 2022-05-27 2022-08-30 深圳先进技术研究院 Battery surface defect detection method and system based on machine vision and related equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10000364A1 (en) * 1999-01-08 2000-07-13 Schlumberger Technologies Inc Defect detection method for patterned substrates, intended for detection of defects in voltage contrast of semiconductor wafers obtained using electron microscopes
CN111179251A (en) * 2019-12-30 2020-05-19 上海交通大学 Defect detection system and method based on twin neural network and by utilizing template comparison
CN112037166A (en) * 2020-07-10 2020-12-04 武汉迈格驷友科技有限公司 Surface defect detection method and detection device
CN114240939A (en) * 2022-02-24 2022-03-25 苏州浪潮智能科技有限公司 Method, system, equipment and medium for detecting appearance defects of mainboard components
CN114972258A (en) * 2022-05-27 2022-08-30 深圳先进技术研究院 Battery surface defect detection method and system based on machine vision and related equipment

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116313102A (en) * 2023-05-10 2023-06-23 上海交通大学 Brain age prediction method, system, medium and electronic device
CN116485779A (en) * 2023-05-11 2023-07-25 哈尔滨工业大学重庆研究院 Adaptive wafer defect detection method, device, electronic equipment and storage medium
CN116485779B (en) * 2023-05-11 2024-01-30 哈尔滨工业大学重庆研究院 Adaptive wafer defect detection method, device, electronic equipment and storage medium
CN116664505A (en) * 2023-05-24 2023-08-29 国能铁路装备有限责任公司 Method and device for integrity analysis of vehicle bottom components
CN116721352A (en) * 2023-07-07 2023-09-08 重庆交通大学 An apparent disease detection method for lightweight concrete bridges based on improved Segformer
CN116664846A (en) * 2023-07-31 2023-08-29 华东交通大学 Method and system for monitoring construction quality of 3D printed bridge deck based on semantic segmentation
CN116664846B (en) * 2023-07-31 2023-10-13 华东交通大学 Method and system for realizing 3D printing bridge deck construction quality monitoring based on semantic segmentation
CN117067112B (en) * 2023-10-17 2024-01-16 杭州泓芯微半导体有限公司 Water cutting machine and control method thereof
CN117067112A (en) * 2023-10-17 2023-11-17 杭州泓芯微半导体有限公司 Water cutting machine and control method thereof
CN117115148A (en) * 2023-10-19 2023-11-24 苏州弘皓光电科技有限公司 Intelligent identification method of chip surface defects based on 5G technology
CN117115148B (en) * 2023-10-19 2024-05-14 苏州弘皓光电科技有限公司 Intelligent identification method of chip surface defects based on 5G technology
CN118351111A (en) * 2024-06-14 2024-07-16 深圳超盈智能科技有限公司 Chip surface defect detection method, device, equipment and storage medium
CN119313944A (en) * 2024-09-18 2025-01-14 科大讯飞华南人工智能研究院(广州)有限公司 A method for judging product appearance quality based on industrial vision
CN119722678A (en) * 2025-02-28 2025-03-28 南昌洪都汽车配件制造有限公司 Automobile parts defect detection method and system
CN120411974A (en) * 2025-07-03 2025-08-01 北京茄豆网络科技有限公司 Method for generating composite label paper based on graphic and text information and composite label paper
CN120411974B (en) * 2025-07-03 2025-11-11 北京茄豆网络科技有限公司 Method for generating composite label paper based on graphic and text information and composite label paper

Similar Documents

Publication Publication Date Title
CN115830004A (en) Surface defect detection method, device, computer equipment and storage medium
CN111833306B (en) Defect detection method and model training method for defect detection
CN109615611B (en) A detection method for self-explosion defects of insulators based on inspection images
CN114550021B (en) Surface defect detection method and device based on feature fusion
CN111768388B (en) Product surface defect detection method and system based on positive sample reference
CN106875381B (en) Mobile phone shell defect detection method based on deep learning
CN109580630B (en) Visual inspection method for defects of mechanical parts
KR20230124713A (en) Fault detection methods, devices and systems
CN109872303B (en) Surface defect visual inspection method, device and electronic equipment
CN110570396A (en) A method of industrial product defect detection based on deep learning
CN111402226A (en) A Surface Defect Detection Method Based on Cascaded Convolutional Neural Networks
CN109829893A (en) A kind of defect object detection method based on attention mechanism
CN117132540A (en) A PCB circuit board defect post-processing method based on segmentation model
CN113807378A (en) Training data increment method, electronic device and computer-readable recording medium
CN119599956B (en) A bond wire defect detection method based on deep learning
CN110135248A (en) A kind of natural scene Method for text detection based on deep learning
CN118706336A (en) Soft package sealing detection equipment and method based on vibration and infrared image fusion
CN109241867B (en) Method and device for recognizing digital rock core image by adopting artificial intelligence algorithm
CN119131006A (en) A ceramic defect intelligent detection method, system, device and storage medium based on deep learning
CN115358981B (en) Method, device, equipment and storage medium for determining glue defects
CN117455836A (en) SF-Yolone metal gear end face defect detection method and system
CN120726000A (en) Industrial image anomaly detection method, device, equipment and storage medium
CN118761955A (en) A railway track surface defect detection method based on multi-scale context information feature fusion
CN117831060A (en) A method for identifying electrical wiring topology and related equipment
CN116309307A (en) Weld seam defect detection method, device, readable storage medium and electronic equipment

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