CN118657776A - Improved motherboard defect detection method, device and equipment based on anomaly detection model - Google Patents
Improved motherboard defect detection method, device and equipment based on anomaly detection model Download PDFInfo
- Publication number
- CN118657776A CN118657776A CN202411142028.9A CN202411142028A CN118657776A CN 118657776 A CN118657776 A CN 118657776A CN 202411142028 A CN202411142028 A CN 202411142028A CN 118657776 A CN118657776 A CN 118657776A
- Authority
- CN
- China
- Prior art keywords
- detected
- key area
- motherboard
- improved
- model
- 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.)
- Granted
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 164
- 230000007547 defect Effects 0.000 title claims abstract description 127
- 238000012549 training Methods 0.000 claims abstract description 81
- 230000005856 abnormality Effects 0.000 claims abstract description 71
- 230000002159 abnormal effect Effects 0.000 claims abstract description 38
- 238000000034 method Methods 0.000 claims abstract description 25
- 230000000007 visual effect Effects 0.000 claims description 77
- 238000000605 extraction Methods 0.000 claims description 46
- 230000009467 reduction Effects 0.000 claims description 44
- 230000006870 function Effects 0.000 claims description 33
- 238000007781 pre-processing Methods 0.000 claims description 26
- 239000011159 matrix material Substances 0.000 claims description 24
- 230000004913 activation Effects 0.000 claims description 22
- 238000004590 computer program Methods 0.000 claims description 22
- 238000012545 processing Methods 0.000 claims description 22
- 230000009466 transformation Effects 0.000 claims description 22
- 239000000284 extract Substances 0.000 claims description 12
- 238000011176 pooling Methods 0.000 claims description 9
- 238000010606 normalization Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 abstract description 12
- 230000006872 improvement Effects 0.000 abstract description 4
- 230000009286 beneficial effect Effects 0.000 description 8
- 238000004364 calculation method Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 2
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 2
- 101100012902 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) FIG2 gene Proteins 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000013507 mapping Methods 0.000 description 2
- 238000012821 model calculation Methods 0.000 description 2
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 101100233916 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) KAR5 gene Proteins 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000000844 transformation Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/8851—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/95—Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
- G01N21/956—Inspecting patterns on the surface of objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/048—Activation functions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/082—Learning methods modifying the architecture, e.g. adding, deleting or silencing nodes or connections
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/04—Inference or reasoning models
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
- G06V10/443—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components by matching or filtering
- G06V10/449—Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters
- G06V10/451—Biologically inspired filters, e.g. difference of Gaussians [DoG] or Gabor filters with interaction between the filter responses, e.g. cortical complex cells
- G06V10/454—Integrating the filters into a hierarchical structure, e.g. convolutional neural networks [CNN]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/77—Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
- G06V10/7715—Feature extraction, e.g. by transforming the feature space, e.g. multi-dimensional scaling [MDS]; Mappings, e.g. subspace methods
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/8851—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges
- G01N2021/8887—Scan or image signal processing specially adapted therefor, e.g. for scan signal adjustment, for detecting different kinds of defects, for compensating for structures, markings, edges based on image processing techniques
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
- G01N21/95—Investigating the presence of flaws or contamination characterised by the material or shape of the object to be examined
- G01N21/956—Inspecting patterns on the surface of objects
- G01N2021/95638—Inspecting patterns on the surface of objects for PCB's
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30141—Printed circuit board [PCB]
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Molecular Biology (AREA)
- Biomedical Technology (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Biophysics (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- Pathology (AREA)
- Immunology (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Medical Informatics (AREA)
- Biodiversity & Conservation Biology (AREA)
- Quality & Reliability (AREA)
- Image Analysis (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及缺陷检测技术领域,尤其涉及基于异常检测模型改进的主板缺陷检测方法、装置及设备。The present application relates to the technical field of defect detection, and in particular to a method, device and equipment for detecting motherboard defects based on an improved abnormality detection model.
背景技术Background Art
当主板图像的分辨率过大时,直接使用Anomalib模型进行缺陷检测,针对性不强,很难收敛到真正关心的区域,影响缺陷检测的准确性,并且检测花费时间较长,影响缺陷检测的效率。When the resolution of the motherboard image is too large, directly using the Anomalib model for defect detection is not very targeted and it is difficult to converge to the area of real concern, which affects the accuracy of defect detection. In addition, the detection takes a long time, which affects the efficiency of defect detection.
上述内容仅用于辅助理解本发明的技术方案,并不代表承认上述内容是现有技术。The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art.
发明内容Summary of the invention
本申请的主要目的在于提供一种基于异常检测模型改进的主板缺陷检测方法、装置及设备,旨在解决现有技术中传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。The main purpose of this application is to provide a motherboard defect detection method, device and equipment based on an improved anomaly detection model, aiming to solve the technical problems of low accuracy and efficiency when the traditional Anomalib model in the prior art performs defect detection on large-resolution motherboard images.
为实现上述目的,本申请提供了一种基于异常检测模型改进的主板缺陷检测方法,所述的方法包括:To achieve the above objectives, the present application provides a method for detecting motherboard defects based on an improved anomaly detection model, the method comprising:
获取待检测主板的原始图像,并在所述待检测主板的原始图像中提取出待检测关键区域;Acquire an original image of the motherboard to be detected, and extract a key area to be detected from the original image of the motherboard to be detected;
基于改进的Anomalib模型,对所述待检测关键区域进行检测,得到所述待检测关键区域的异常概率分布数据,所述改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,所述预处理单元用于提取所述待检测关键区域中的视觉特征,并将所述视觉特征输入所述Bottleneck单元,所述Bottleneck单元用于基于所述视觉特征生成降维特征,并将所述降维特征输入所述异常识别单元进行异常识别;Based on the improved Anomalib model, the key area to be detected is detected to obtain abnormal probability distribution data of the key area to be detected, the improved Anomalib model includes a preprocessing unit, a Bottleneck unit that replaces the original feature extraction unit, and an abnormality recognition unit, the preprocessing unit is used to extract visual features in the key area to be detected, and input the visual features into the Bottleneck unit, the Bottleneck unit is used to generate dimensionality reduction features based on the visual features, and input the dimensionality reduction features into the abnormality recognition unit for abnormality recognition;
基于所述待检测关键区域的异常概率分布数据,确定所述待检测关键区域中的缺陷位置;Determining the defect position in the key area to be detected based on the abnormal probability distribution data of the key area to be detected;
对所述待检测关键区域以及所述待检测关键区域中的缺陷位置分别进行标记,生成所述待检测主板的结果热力图。The key area to be inspected and the defect positions in the key area to be inspected are marked respectively to generate a result heat map of the motherboard to be inspected.
在一实施例中,所述改进的Anomalib模型采用新的Relu4激活函数替换原始的Relu激活函数。In one embodiment, the improved Anomalib model uses a new Relu4 activation function to replace the original Relu activation function.
在一实施例中,所述获取待检测主板的原始图像,并在所述待检测主板的原始图像中提取出待检测关键区域的步骤包括:In one embodiment, the step of acquiring an original image of the motherboard to be detected and extracting a key area to be detected from the original image of the motherboard to be detected includes:
获取待检测主板的原始图像,基于所述待检测主板上参考点在所述原始图像中的坐标以及所述参考点在基准图像中的坐标,确定转换矩阵;Acquire an original image of the motherboard to be detected, and determine a transformation matrix based on the coordinates of a reference point on the motherboard to be detected in the original image and the coordinates of the reference point in the reference image;
获取目标区域在基准图像中的坐标,基于所述转换矩阵以及所述目标区域在基准图像中的坐标,确定所述待检测关键区域的坐标;Acquire the coordinates of the target area in the reference image, and determine the coordinates of the key area to be detected based on the transformation matrix and the coordinates of the target area in the reference image;
基于所述待检测关键区域的坐标,在所述原始图像中提取出所述待检测关键区域。Based on the coordinates of the key area to be detected, the key area to be detected is extracted from the original image.
在一实施例中,所述预处理单元至少包括特征提取器,所述异常识别单元至少包括NormalizingFlow层与FastFlow层,所述基于改进的Anomalib模型,对所述待检测关键区域进行检测,得到所述待检测关键区域的异常概率分布数据的步骤包括:In one embodiment, the preprocessing unit includes at least a feature extractor, the abnormality identification unit includes at least a NormalizingFlow layer and a FastFlow layer, and the step of detecting the key area to be detected based on the improved Anomalib model to obtain abnormal probability distribution data of the key area to be detected includes:
将所述待检测关键区域对应的向量数据输入所述特征提取器进行特征提取,得到所述待检测关键区域的视觉特征;Inputting the vector data corresponding to the key area to be detected into the feature extractor for feature extraction to obtain the visual features of the key area to be detected;
将所述视觉特征输入所述Bottleneck单元进行特征提取与降维处理,得到所述降维特征;Inputting the visual features into the Bottleneck unit for feature extraction and dimensionality reduction processing to obtain the reduced dimensionality features;
将所述降维特征输入所述NormalizingFlow层进行分布归一化,得到特征正态分布数据;Input the dimension reduction features into the NormalizingFlow layer for distribution normalization to obtain feature normal distribution data;
将所述特征正态分布数据输入所述FastFlow层进行异常识别,得到所述待检测关键区域的异常概率分布数据。The characteristic normal distribution data is input into the FastFlow layer for anomaly recognition to obtain the abnormal probability distribution data of the key area to be detected.
在一实施例中,所述Bottleneck单元包括依次连接的第一卷积层、第二卷积层、第三卷积层、池化层以及第四卷积层,所述第二卷积层采用预设标准卷积核,所述第一卷积层、所述第三卷积层以及所述第四卷积层均采用预设小尺寸卷积核,所述预设小尺寸卷积核小于所述预设标准卷积核,所述将所述视觉特征输入所述Bottleneck单元进行特征提取与降维,得到所述降维特征的步骤还包括:In one embodiment, the Bottleneck unit includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a pooling layer, and a fourth convolutional layer connected in sequence, the second convolutional layer uses a preset standard convolutional kernel, the first convolutional layer, the third convolutional layer, and the fourth convolutional layer all use a preset small-size convolutional kernel, the preset small-size convolutional kernel is smaller than the preset standard convolutional kernel, and the step of inputting the visual feature into the Bottleneck unit for feature extraction and dimensionality reduction, and obtaining the reduced dimensionality feature also includes:
将所述视觉特征输入所述第一卷积层进行降维处理,得到降维视觉特征;Inputting the visual features into the first convolutional layer for dimensionality reduction processing to obtain dimensionality-reduced visual features;
将所述降维视觉特征输入所述第二卷积层进行特征提取,并将特征提取后的降维视觉特征输入所述第三卷积层进行升维处理,得到升维视觉特征;Inputting the reduced-dimensional visual features into the second convolutional layer for feature extraction, and inputting the reduced-dimensional visual features after feature extraction into the third convolutional layer for dimensionality increase processing to obtain the increased-dimensional visual features;
将所述升维视觉特征输入所述池化层进行特征提取,并将特征提取后的升维视觉特征输入所述第四卷积层进行降维处理,得到所述降维特征。The up-dimensional visual features are input into the pooling layer for feature extraction, and the up-dimensional visual features after feature extraction are input into the fourth convolutional layer for dimensionality reduction processing to obtain the reduced dimensionality features.
在一实施例中,所述将所述特征正态分布数据输入所述FastFlow层进行异常识别,得到所述待检测关键区域的异常概率分布数据的步骤包括:In one embodiment, the step of inputting the characteristic normal distribution data into the FastFlow layer for abnormality identification to obtain abnormal probability distribution data of the key area to be detected includes:
将所述特征正态分布数据输入所述FastFlow层,基于所述特征正态分布数据与基准特征正态分布数据之间的距离,确定所述待检测关键区域中不同位置的异常分数;Inputting the characteristic normal distribution data into the FastFlow layer, and determining the abnormal scores of different positions in the key area to be detected based on the distance between the characteristic normal distribution data and the reference characteristic normal distribution data;
基于所述待检测关键区域中不同位置的异常分数,确定所述待检测关键区域中不同位置的异常概率;Determining the abnormality probabilities of different positions in the key area to be detected based on the abnormality scores of different positions in the key area to be detected;
基于所述待检测关键区域中不同位置的异常概率,确定所述待检测关键区域的异常概率分布数据。Based on the abnormality probabilities at different positions in the key area to be detected, abnormality probability distribution data of the key area to be detected is determined.
在一实施例中,所述的方法还包括:In one embodiment, the method further comprises:
获取训练图像,基于训练参考点在所述训练图像中的坐标以及所述训练参考点在基准图像中的坐标,确定训练转换矩阵;Acquire a training image, and determine a training transformation matrix based on coordinates of a training reference point in the training image and coordinates of the training reference point in the reference image;
基于所述训练转换矩阵以及目标区域的坐标,确定所述训练图像中训练关键区域的坐标;Determining the coordinates of the training key area in the training image based on the training transformation matrix and the coordinates of the target area;
基于所述训练关键区域的坐标,在所述训练图像中提取出所述训练关键区域;Extracting the training key area from the training image based on the coordinates of the training key area;
基于所述训练关键区域,训练得到所述改进的Anomalib模型,并将所述改进的Anomalib模型转化后部署至移动端。Based on the training key area, the improved Anomalib model is trained and the improved Anomalib model is converted and deployed to the mobile terminal.
此外,为实现上述目的,本申请还提出一种基于异常检测模型改进的主板缺陷检测装置,所述基于异常检测模型改进的主板缺陷检测装置包括:In addition, to achieve the above purpose, the present application also proposes a motherboard defect detection device based on an improved abnormality detection model, and the motherboard defect detection device based on an improved abnormality detection model includes:
区域提取模块,用于获取待检测主板的原始图像,并在所述待检测主板的原始图像中提取出待检测关键区域;The region extraction module is used to obtain the original image of the motherboard to be detected, and extract the key region to be detected from the original image of the motherboard to be detected;
缺陷检测模块,用于基于改进的Anomalib模型,对所述待检测关键区域进行检测,得到所述待检测关键区域的异常概率分布数据,所述改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,所述预处理单元用于提取所述待检测关键区域中的视觉特征,并将所述视觉特征输入所述Bottleneck单元,所述Bottleneck单元用于基于所述视觉特征生成降维特征,并将所述降维特征输入所述异常识别单元进行异常识别;A defect detection module, configured to detect the key area to be detected based on an improved Anomalib model to obtain abnormal probability distribution data of the key area to be detected, wherein the improved Anomalib model includes a preprocessing unit, a Bottleneck unit replacing an original feature extraction unit, and an abnormality recognition unit, wherein the preprocessing unit is configured to extract visual features in the key area to be detected and input the visual features into the Bottleneck unit, and the Bottleneck unit is configured to generate a dimensionality reduction feature based on the visual features and input the dimensionality reduction feature into the abnormality recognition unit for abnormality recognition;
所述缺陷检测模块,还用于基于所述待检测关键区域的异常概率分布数据,确定所述待检测关键区域中的缺陷位置;The defect detection module is further used to determine the defect position in the key area to be detected based on the abnormal probability distribution data of the key area to be detected;
所述缺陷检测模块,还用于对所述待检测关键区域以及所述待检测关键区域中的缺陷位置分别进行标记,生成所述待检测主板的结果热力图。The defect detection module is also used to mark the key area to be detected and the defect position in the key area to be detected respectively, and generate a result heat map of the motherboard to be detected.
此外,为实现上述目的,本申请还提出一种基于异常检测模型改进的主板缺陷检测设备,所述基于异常检测模型改进的主板缺陷检测设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序配置为实现如上文所述的基于异常检测模型改进的主板缺陷检测方法的步骤。In addition, to achieve the above-mentioned purpose, the present application also proposes a motherboard defect detection device improved based on anomaly detection model, and the motherboard defect detection device improved based on anomaly detection model includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the motherboard defect detection method improved based on anomaly detection model as described above.
此外,为实现上述目的,本发明还提出一种存储介质,所述存储介质为计算机可读存储介质,所述存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上文所述的基于异常检测模型改进的主板缺陷检测方法的步骤。In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the improved motherboard defect detection method based on the abnormality detection model as described above are implemented.
此外,为实现上述目的,本申请还提供一种计算机程序产品,所述计算机程序产品包括计算机程序,所述计算机程序被处理器执行时实现如上文所述的基于异常检测模型改进的主板缺陷检测方法的步骤。In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the improved motherboard defect detection method based on the abnormality detection model as described above.
本申请提供了一种基于异常检测模型改进的主板缺陷检测方法,获取待检测主板的原始图像,并在待检测主板的原始图像中提取出待检测关键区域;基于改进的Anomalib模型,对待检测关键区域进行检测,得到待检测关键区域的异常概率分布数据,改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,预处理单元用于提取待检测关键区域中的视觉特征,并将视觉特征输入Bottleneck单元,Bottleneck单元用于基于视觉特征生成降维特征,并将降维特征输入异常识别单元进行异常识别;基于待检测关键区域的异常概率分布数据,确定待检测关键区域中的缺陷位置;对待检测关键区域以及待检测关键区域中的缺陷位置分别进行标记,生成待检测主板的结果热力图。本申请优化了模型结构,利用Bottleneck单元进行降维,并采用鲁棒性更好的新激活函数,减少推理计算量,减少推理花费时间,提高模型的推理效率,同时利用图像关键区域进行训练和推理,提高模型针对性,提高模型的准确性与推理效率,从而可以提高缺陷检测的准确性和效率,即使图像分辨率很大,也能快速、准确地得到检测结果,解决了传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。The present application provides a mainboard defect detection method improved based on an anomaly detection model, which obtains an original image of a mainboard to be detected, and extracts a key area to be detected from the original image of the mainboard to be detected; based on an improved Anomalib model, the key area to be detected is detected to obtain abnormal probability distribution data of the key area to be detected, the improved Anomalib model includes a preprocessing unit, a Bottleneck unit that replaces the original feature extraction unit, and an abnormality recognition unit, the preprocessing unit is used to extract visual features in the key area to be detected, and input the visual features into the Bottleneck unit, the Bottleneck unit is used to generate dimensionality reduction features based on the visual features, and input the dimensionality reduction features into the abnormality recognition unit for abnormality recognition; based on the abnormal probability distribution data of the key area to be detected, the defect position in the key area to be detected is determined; the key area to be detected and the defect position in the key area to be detected are marked respectively, and a result heat map of the mainboard to be detected is generated. This application optimizes the model structure, uses the Bottleneck unit for dimensionality reduction, and adopts a new activation function with better robustness to reduce the amount of inference calculations, reduce the time spent on inference, and improve the inference efficiency of the model. At the same time, it uses the key areas of the image for training and inference to improve the model's pertinence, improve the model's accuracy and inference efficiency, thereby improving the accuracy and efficiency of defect detection. Even if the image resolution is large, the detection results can be obtained quickly and accurately, solving the technical problem of low accuracy and efficiency of the traditional Anomalib model when performing defect detection on large-resolution motherboard images.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
图1为本申请基于异常检测模型改进的主板缺陷检测方法实施例一的流程示意图;FIG1 is a flow chart of a first embodiment of a method for detecting motherboard defects based on an improved abnormality detection model of the present application;
图2为本申请实施例一提供的基于异常检测模型改进的主板缺陷检测方法的改进的Anomalib模型结构示意图;FIG2 is a schematic diagram of the structure of an improved Anomalib model of a mainboard defect detection method based on an improved anomaly detection model provided in Example 1 of the present application;
图3为本申请实施例一提供的基于异常检测模型改进的主板缺陷检测方法的Bottleneck单元结构示意图;FIG3 is a schematic diagram of the Bottleneck unit structure of the improved mainboard defect detection method based on the abnormality detection model provided in Example 1 of the present application;
图4为本申请实施例一提供的基于异常检测模型改进的主板缺陷检测方法的新激活函数示意图;FIG4 is a schematic diagram of a new activation function of the improved mainboard defect detection method based on anomaly detection model provided in Example 1 of the present application;
图5为本申请实施例基于异常检测模型改进的主板缺陷检测装置的模块结构示意图;FIG5 is a schematic diagram of the module structure of a mainboard defect detection device improved based on an abnormality detection model according to an embodiment of the present application;
图6为本申请实施例中基于异常检测模型改进的主板缺陷检测方法涉及的硬件运行环境的设备结构示意图。FIG6 is a schematic diagram of the device structure of the hardware operating environment involved in the improved mainboard defect detection method based on the abnormality detection model in an embodiment of the present application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings.
具体实施方式DETAILED DESCRIPTION
应当理解,此处所描述的具体实施例仅仅用以解释本申请的技术方案,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
为了更好的理解本申请的技术方案,下面将结合说明书附图以及具体的实施方式进行详细的说明。In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
本申请实施例的主要解决方案是:获取待检测主板的原始图像,并在待检测主板的原始图像中提取出待检测关键区域;基于改进的Anomalib模型,对待检测关键区域进行检测,得到待检测关键区域的异常概率分布数据,改进的Anomalib模型包括连接的预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,预处理单元用于提取待检测关键区域中的视觉特征,并将视觉特征输入Bottleneck单元,Bottleneck单元用于基于视觉特征生成降维特征,并将降维特征输入异常识别单元进行异常识别;基于待检测关键区域的异常概率分布数据,确定待检测关键区域中的缺陷位置;对待检测关键区域以及待检测关键区域中的缺陷位置分别进行标记,生成待检测主板的结果热力图。The main solution of the embodiment of the present application is: obtaining the original image of the mainboard to be detected, and extracting the key area to be detected from the original image of the mainboard to be detected; based on the improved Anomalib model, detecting the key area to be detected, and obtaining abnormal probability distribution data of the key area to be detected, the improved Anomalib model includes a connected preprocessing unit, a Bottleneck unit that replaces the original feature extraction unit, and an abnormality recognition unit, the preprocessing unit is used to extract visual features in the key area to be detected, and input the visual features into the Bottleneck unit, the Bottleneck unit is used to generate dimensionality reduction features based on the visual features, and input the dimensionality reduction features into the abnormality recognition unit for abnormality recognition; based on the abnormal probability distribution data of the key area to be detected, determining the defect position in the key area to be detected; marking the key area to be detected and the defect position in the key area to be detected respectively, and generating a result heat map of the mainboard to be detected.
目前,当主板图像的分辨率过大时,直接使用Anomalib模型进行缺陷检测,针对性不强,很难收敛到真正关心的区域,影响缺陷检测的准确性,并且检测花费时间较长,影响缺陷检测的效率。At present, when the resolution of the motherboard image is too large, directly using the Anomalib model for defect detection is not very targeted and it is difficult to converge to the area of real concern, which affects the accuracy of defect detection. In addition, the detection takes a long time, which affects the efficiency of defect detection.
本申请提供一种解决方案,优化了模型结构,利用Bottleneck单元进行降维,并采用鲁棒性更好的新激活函数,减少推理计算量,减少推理花费时间,提高模型的推理效率,同时利用图像关键区域进行训练和推理,提高模型针对性,提高模型的准确性与推理效率,从而可以提高缺陷检测的准确性和效率,即使图像分辨率很大,也能快速、准确地得到检测结果,解决了传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。The present application provides a solution, optimizes the model structure, uses the Bottleneck unit for dimensionality reduction, and adopts a new activation function with better robustness, reduces the amount of inference calculations, reduces the time spent on inference, and improves the inference efficiency of the model. At the same time, the key areas of the image are used for training and inference to improve the model's pertinence, improve the model's accuracy and inference efficiency, thereby improving the accuracy and efficiency of defect detection. Even if the image resolution is large, the detection results can be obtained quickly and accurately, solving the technical problem of low accuracy and efficiency of the traditional Anomalib model when performing defect detection on large-resolution motherboard images.
需要说明的是,本实施例的执行主体可以是一种具有数据处理、网络通信以及程序运行功能的计算服务设备,例如平板电脑、个人电脑、手机等,或者是一种能够实现上述功能的电子设备、基于异常检测模型改进的主板缺陷检测设备等,本实施例对此并不作具体限定。以下以基于异常检测模型改进的主板缺陷检测设备为例,对本实施例及下述各实施例进行说明。It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a motherboard defect detection device improved based on anomaly detection model, etc., and this embodiment does not specifically limit this. The following takes the motherboard defect detection device improved based on anomaly detection model as an example to illustrate this embodiment and the following embodiments.
本申请实施例提供了一种基于异常检测模型改进的主板缺陷检测方法,参照图1,图1为本申请基于异常检测模型改进的主板缺陷检测方法第一实施例的流程示意图。An embodiment of the present application provides a mainboard defect detection method based on an improved anomaly detection model. Referring to FIG. 1 , FIG. 1 is a flow chart of a first embodiment of the mainboard defect detection method based on an improved anomaly detection model of the present application.
本实施例中,所述基于异常检测模型改进的主板缺陷检测方法包括步骤S10~S40:In this embodiment, the improved mainboard defect detection method based on the abnormality detection model includes steps S10 to S40:
步骤S10,获取待检测主板的原始图像,并在所述待检测主板的原始图像中提取出待检测关键区域;Step S10, obtaining an original image of the motherboard to be detected, and extracting a key area to be detected from the original image of the motherboard to be detected;
需要说明的是,待检测主板指的是需要进行缺陷检测的主板,具体数量根据实际情况确定,不作具体限定。待检测主板的原始图像即直接拍摄得到的待检测主板的图像。在获取图像时,通常需要使用专用的灯箱和摄像头。待检测关键区域指的是待检测主板的原始图像中需要重点关注的部分,通常是重要元器件所在的区域,对此不作具体限定。It should be noted that the motherboard to be tested refers to the motherboard that needs to be tested for defects. The specific number is determined according to the actual situation and is not specifically limited. The original image of the motherboard to be tested is the image of the motherboard to be tested directly taken. When acquiring the image, it is usually necessary to use a dedicated light box and camera. The key area to be tested refers to the part that needs to be focused on in the original image of the motherboard to be tested, which is usually the area where important components are located, and there is no specific limitation on this.
在一种可行的实施方式中,步骤S10可以包括步骤S101~S103:In a feasible implementation, step S10 may include steps S101 to S103:
步骤S101,获取待检测主板的原始图像,基于所述待检测主板上参考点在所述原始图像中的坐标以及所述参考点在基准图像中的坐标,确定转换矩阵;Step S101, obtaining an original image of a motherboard to be inspected, and determining a transformation matrix based on the coordinates of a reference point on the motherboard to be inspected in the original image and the coordinates of the reference point in the reference image;
需要说明的是,参考点指的是待检测主板上设置的mark点,通常设置在比较明显的位置,例如:孔洞,参考点在原始图像中的坐标即待检测主板上参考点在原始图像中的像素坐标。基准图像指的是设置的作为基准的模板图像,参考点在基准图像中的坐标即待检测主板上参考点在基准图像中的像素坐标。在具体实现时,可以将参考点设置为所有待检测主板共同拥有的特征点。It should be noted that the reference point refers to the mark point set on the motherboard to be tested, which is usually set at a more obvious position, such as a hole. The coordinates of the reference point in the original image are the pixel coordinates of the reference point on the motherboard to be tested in the original image. The benchmark image refers to the template image set as a benchmark, and the coordinates of the reference point in the benchmark image are the pixel coordinates of the reference point on the motherboard to be tested in the benchmark image. In specific implementation, the reference point can be set as a feature point common to all motherboards to be tested.
可以理解的是,转换矩阵指的是基准图像中的像素坐标转换至原始图像中的像素坐标所需要的计算矩阵。一般来说,参考点的数量需要大于等于2,从而可以根据参考点在基准图像与原始图像中的像素坐标计算出相应的转换矩阵。It is understood that the conversion matrix refers to the calculation matrix required to convert the pixel coordinates in the reference image to the pixel coordinates in the original image. Generally speaking, the number of reference points needs to be greater than or equal to 2, so that the corresponding conversion matrix can be calculated based on the pixel coordinates of the reference points in the reference image and the original image.
步骤S102,获取目标区域在基准图像中的坐标,基于所述转换矩阵以及所述目标区域在基准图像中的坐标,确定所述待检测关键区域的坐标;Step S102, obtaining the coordinates of the target area in the reference image, and determining the coordinates of the key area to be detected based on the transformation matrix and the coordinates of the target area in the reference image;
需要说明的是,目标区域指的是当前需要关注缺陷的位置,可根据实际需求灵活选取,可以选择主板上所有元器件所在的区域,也可以选择其中的一个或多个元器件所在的区域,对此不作具体限定。目标区域在原始图像中的坐标即为待检测关键区域的坐标,因此,可以利用转换矩阵对目标区域在基准图像中的坐标进行转换,从而得到原始图像中待检测关键区域的坐标。It should be noted that the target area refers to the location of the defect that needs to be paid attention to at present, which can be flexibly selected according to actual needs. The area where all components on the motherboard are located can be selected, or the area where one or more components are located can be selected, and there is no specific limitation on this. The coordinates of the target area in the original image are the coordinates of the key area to be detected. Therefore, the coordinates of the target area in the reference image can be transformed using the transformation matrix to obtain the coordinates of the key area to be detected in the original image.
可以理解的是,由于元器件的位置各不相同,因此,可以设置多个目标区域,若设置了多个目标区域,相应的,可以提取出多个待检测关键区域。It is understandable that, since the locations of components are different, multiple target areas can be set. If multiple target areas are set, multiple key areas to be detected can be extracted accordingly.
步骤S103,基于所述待检测关键区域的坐标,在所述原始图像中提取出所述待检测关键区域。Step S103: extracting the key area to be detected from the original image based on the coordinates of the key area to be detected.
可以理解的是,按照待检测关键区域的坐标,从原始图像中提取出所有的待检测关键区域。It can be understood that all the key areas to be detected are extracted from the original image according to the coordinates of the key areas to be detected.
步骤S20,基于改进的Anomalib模型,对所述待检测关键区域进行检测,得到所述待检测关键区域的异常概率分布数据,所述改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元;Step S20, based on the improved Anomalib model, the key area to be detected is detected to obtain abnormal probability distribution data of the key area to be detected, wherein the improved Anomalib model includes a preprocessing unit, a Bottleneck unit replacing the original feature extraction unit, and an abnormality recognition unit;
需要说明的是,本实施例使用改进的Anomalib模型进行缺陷检测。改进的Anomalib模型包括连接的预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元。参考图2,预处理单元、Bottleneck单元以及异常识别单元依次连接。It should be noted that this embodiment uses an improved Anomalib model for defect detection. The improved Anomalib model includes a connected preprocessing unit, a Bottleneck unit that replaces the original feature extraction unit, and an anomaly recognition unit. Referring to FIG2 , the preprocessing unit, the Bottleneck unit, and the anomaly recognition unit are connected in sequence.
可以理解的是,预处理单元用于提取待检测关键区域中的视觉特征,并将视觉特征输入Bottleneck单元,Bottleneck单元用于基于视觉特征生成降维特征,并将降维特征输入异常识别单元进行异常识别。It can be understood that the preprocessing unit is used to extract visual features in the key area to be detected and input the visual features into the Bottleneck unit, the Bottleneck unit is used to generate dimensionality reduction features based on the visual features and input the dimensionality reduction features into the anomaly recognition unit for anomaly recognition.
另外地,需要说明的是,预处理单元至少包括特征提取器,异常识别单元至少包括NormalizingFlow层与FastFlow层。In addition, it should be noted that the preprocessing unit at least includes a feature extractor, and the abnormality identification unit at least includes a NormalizingFlow layer and a FastFlow layer.
在一种可行的实施方式中,训练得到改进的Anomalib模型的步骤包括:获取训练图像,基于训练参考点在所述训练图像中的坐标以及所述训练参考点在基准图像中的坐标,确定训练转换矩阵;基于所述训练转换矩阵以及目标区域的坐标,确定所述训练图像中训练关键区域的坐标;基于所述训练关键区域的坐标,在所述训练图像中提取出所述训练关键区域;基于所述训练关键区域,训练得到所述改进的Anomalib模型,并将所述改进的Anomalib模型转化后部署至移动端。In a feasible implementation, the steps of training an improved Anomalib model include: acquiring a training image, and determining a training transformation matrix based on the coordinates of a training reference point in the training image and the coordinates of the training reference point in the reference image; determining the coordinates of a training key area in the training image based on the training transformation matrix and the coordinates of a target area; extracting the training key area from the training image based on the coordinates of the training key area; training the improved Anomalib model based on the training key area, and converting the improved Anomalib model and deploying it to a mobile terminal.
需要说明的是,训练图像即初始的训练图像,通常是无缺陷主板的完整图像,由于本实施例是对主板图像中的关键区域进行缺陷检测,因此,训练图像还需要进一步提取出相应的关键区域,用于模型训练。训练参考点指的是拍摄训练图像所使用无缺陷主板上设置的mark点,通常设置在比较明显的位置,训练参考点在训练图像中的坐标即训练参考点在训练图像中的像素坐标,训练参考点在基准图像中的坐标即训练参考点在基准图像中的像素坐标。在具体实现时,可以将训练参考点设置为这些无缺陷主板共同拥有的特征点。It should be noted that the training image, i.e. the initial training image, is usually a complete image of a defect-free motherboard. Since this embodiment performs defect detection on key areas in the motherboard image, the training image needs to further extract the corresponding key areas for model training. The training reference point refers to the mark point set on the defect-free motherboard used to shoot the training image, which is usually set in a more obvious position. The coordinates of the training reference point in the training image are the pixel coordinates of the training reference point in the training image, and the coordinates of the training reference point in the reference image are the pixel coordinates of the training reference point in the reference image. In the specific implementation, the training reference point can be set to a feature point common to these defect-free motherboards.
可以理解的是,训练转换矩阵指的是基准图像中的像素坐标转换至训练图像中的像素坐标所需要的计算矩阵。一般来说,训练参考点的数量需要大于等于2,从而可以根据训练参考点在基准图像与训练图像中的像素坐标计算出相应的训练转换矩阵。目标区域在训练图像中的坐标即为训练关键区域的坐标,因此,可以利用训练转换矩阵对目标区域在基准图像中的坐标进行转换,从而得到训练关键区域的坐标。训练关键区域即训练图像中提取出的关键区域,与基准图像中的目标区域相对应,与原始图像中的待检测关键区域相对应。It can be understood that the training transformation matrix refers to the calculation matrix required to transform the pixel coordinates in the reference image to the pixel coordinates in the training image. Generally speaking, the number of training reference points needs to be greater than or equal to 2, so that the corresponding training transformation matrix can be calculated based on the pixel coordinates of the training reference points in the reference image and the training image. The coordinates of the target area in the training image are the coordinates of the training key area. Therefore, the training transformation matrix can be used to transform the coordinates of the target area in the reference image to obtain the coordinates of the training key area. The training key area is the key area extracted from the training image, which corresponds to the target area in the reference image and the key area to be detected in the original image.
应当理解的是,本实施例中改进的Anomalib模型可以部署在移动端,例如:Android端。在具体实现时,可以先利用训练关键区域训练出Pytorch的ckpt模型,然后转化为onnx模型,以得到最终改进的Anomalib模型,最后通过onnxruntime部署至移动端。It should be understood that the improved Anomalib model in this embodiment can be deployed on a mobile terminal, such as an Android terminal. In specific implementation, the Pytorch ckpt model can be trained using the training key area, and then converted into an onnx model to obtain the final improved Anomalib model, and finally deployed to the mobile terminal through onnxruntime.
在一种可行的实施方式中,步骤S20可以包括步骤S201~S204:In a feasible implementation, step S20 may include steps S201 to S204:
步骤S201,将所述待检测关键区域对应的向量数据输入所述特征提取器进行特征提取,得到所述待检测关键区域的视觉特征;Step S201, inputting the vector data corresponding to the key area to be detected into the feature extractor for feature extraction to obtain the visual features of the key area to be detected;
需要说明的是,待检测关键区域需要转换为相应的向量数据输入特征提取器,例如:转换成1*3*512*512的向量数据。特征提取器可以对待检测关键区域进行特征提取,提取出有效的视觉特征,用于后续的异常检测和定位。It should be noted that the key area to be detected needs to be converted into corresponding vector data and input into the feature extractor, for example, converted into 1*3*512*512 vector data. The feature extractor can extract features from the key area to be detected and extract effective visual features for subsequent anomaly detection and positioning.
步骤S202,将所述视觉特征输入所述Bottleneck单元进行特征提取与降维处理,得到所述降维特征。Step S202: input the visual features into the Bottleneck unit for feature extraction and dimensionality reduction processing to obtain the reduced dimensionality features.
需要说明的是,本实施例使用Bottleneck单元替换了原始特征提取单元,原始特征提取单元即传统Anomalib模型所采用的特征提取单元,不作具体限定。Bottleneck单元可以对输入的视觉特征进行特征提取与降维,最终可以得到降维后的特征,即降维特征。It should be noted that the present embodiment uses the Bottleneck unit to replace the original feature extraction unit, which is the feature extraction unit used by the traditional Anomalib model and is not specifically limited. The Bottleneck unit can extract and reduce the dimension of the input visual features, and finally obtain the reduced dimension features, i.e., the reduced dimension features.
另外地,需要说明的是,Bottleneck单元包括依次连接的第一卷积层、第二卷积层、第三卷积层、池化层以及第四卷积层,第二卷积层采用预设标准卷积核,第一卷积层、第三卷积层以及第四卷积层的卷积核相同,均为预设小尺寸卷积核。预设标准卷积核即标准的卷积核,通常是3×3,预设小尺寸卷积核即设定的较小尺寸的卷积核,通常小于预设标准卷积核,例如:1×1。示例性地,参考图3,本实施例引入新型卷积算子ODConv(Omni-Dimensional Dynamic Convolution),使用的预设小尺寸卷积核为1×1,使用的预设标准卷积核为3×3。In addition, it should be noted that the Bottleneck unit includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a pooling layer and a fourth convolutional layer connected in sequence. The second convolutional layer adopts a preset standard convolution kernel, and the convolution kernels of the first convolutional layer, the third convolutional layer and the fourth convolutional layer are the same, which are preset small-size convolution kernels. The preset standard convolution kernel is a standard convolution kernel, usually 3×3, and the preset small-size convolution kernel is a set convolution kernel of a smaller size, usually smaller than the preset standard convolution kernel, for example: 1×1. Exemplarily, referring to Figure 3, this embodiment introduces a new convolution operator ODConv (Omni-Dimensional Dynamic Convolution), and the preset small-size convolution kernel used is 1×1, and the preset standard convolution kernel used is 3×3.
在一种可行的实施方式中,步骤S202可以包括:将所述视觉特征输入所述第一卷积层进行降维处理,得到降维视觉特征;将所述降维视觉特征输入所述第二卷积层进行特征提取,并将特征提取后的降维视觉特征输入所述第三卷积层进行升维处理,得到升维视觉特征;将所述升维视觉特征输入所述池化层进行特征提取,并将特征提取后的升维视觉特征输入所述第四卷积层进行降维处理,得到所述降维特征。In a feasible implementation, step S202 may include: inputting the visual features into the first convolution layer for dimensionality reduction processing to obtain reduced dimensionality visual features; inputting the reduced dimensionality visual features into the second convolution layer for feature extraction, and inputting the reduced dimensionality visual features after feature extraction into the third convolution layer for dimensionality increase processing to obtain increased dimensionality visual features; inputting the increased dimensionality visual features into the pooling layer for feature extraction, and inputting the increased dimensionality visual features after feature extraction into the fourth convolution layer for dimensionality reduction processing to obtain the reduced dimensionality features.
可以理解的是,先使用卷积核为1x1的第一卷积层对视觉特征进行降维,得到初步的降维的视觉特征,即降维视觉特征,接着采用卷积核为3×3的第二卷积层对降维视觉特征进行特征提取,然后输入卷积核为1×1的第三卷积层进行升维,得到进一步处理后的视觉特征,即升维视觉特征,接着利用池化层对升维视觉特征进行特征提取,最后输入卷积核为1×1的第四卷积层进行降维,得到最终需要的降维特征。It can be understood that the first convolution layer with a convolution kernel of 1x1 is first used to reduce the dimension of the visual features to obtain preliminary reduced-dimensional visual features, i.e., reduced-dimensional visual features. Then, the second convolution layer with a convolution kernel of 3×3 is used to extract the reduced-dimensional visual features. Then, the third convolution layer with a convolution kernel of 1×1 is input to increase the dimension to obtain further processed visual features, i.e., increased-dimensional visual features. Then, the pooling layer is used to extract the increased-dimensional visual features. Finally, the fourth convolution layer with a convolution kernel of 1×1 is input to reduce the dimension to obtain the final required reduced-dimensional features.
应当理解的是,利用Bottleneck单元可以对特征进行降维,有效减少模型的计算量,减少模型推理时间,同时能够提高精度。It should be understood that the Bottleneck unit can be used to reduce the dimension of features, effectively reduce the amount of model calculations, reduce model inference time, and improve accuracy.
步骤S203,将所述降维特征输入所述NormalizingFlow层进行分布归一化,得到特征正态分布数据;Step S203, inputting the dimension reduction features into the NormalizingFlow layer for distribution normalization to obtain feature normal distribution data;
需要说明的是,Normalizing Flow层的主要作用是通过二维归一化流对降维特征的分布进行建模,从而将特征映射到一个更易于处理的标准正态分布上,使模型更准确地进行异常检测和定位。特征正态分布数据指的是将降维特征映射至标准正态分布后得到的特征分布情况。It should be noted that the main function of the Normalizing Flow layer is to model the distribution of dimensionality reduction features through a two-dimensional normalizing flow, thereby mapping the features to a standard normal distribution that is easier to handle, allowing the model to detect and locate anomalies more accurately. Feature normal distribution data refers to the feature distribution obtained after mapping the dimensionality reduction features to a standard normal distribution.
步骤S204,将所述特征正态分布数据输入所述FastFlow层进行异常识别,得到所述待检测关键区域的异常概率分布数据。Step S204: input the characteristic normal distribution data into the FastFlow layer for anomaly identification to obtain the anomaly probability distribution data of the key area to be detected.
在一种可行的实施方式中,步骤S204可以包括:将所述特征正态分布数据输入所述FastFlow层,基于所述特征正态分布数据与基准特征正态分布数据之间的距离,确定所述待检测关键区域中不同位置的异常分数;基于所述待检测关键区域中不同位置的异常分数,确定所述待检测关键区域中不同位置的异常概率;基于所述待检测关键区域中不同位置的异常概率,确定所述待检测关键区域的异常概率分布数据。In a feasible implementation, step S204 may include: inputting the characteristic normal distribution data into the FastFlow layer, and determining the abnormality scores of different positions in the key area to be detected based on the distance between the characteristic normal distribution data and the benchmark characteristic normal distribution data; determining the abnormality probability of different positions in the key area to be detected based on the abnormality scores of different positions in the key area to be detected; and determining the abnormal probability distribution data of the key area to be detected based on the abnormality probability of different positions in the key area to be detected.
需要说明的是,基准特征正态分布数据即作为基准的特征分布情况,通常是训练关键区域的特征分布情况。It should be noted that the benchmark feature normal distribution data is the feature distribution used as a benchmark, which is usually the feature distribution of the key training area.
另外地,需要说明的是,异常分数可以定量地评估一个数据点与正常数据分布之间的偏离程度,通常可以作为判断数据是否异常的依据。待检测关键区域中不同位置的异常分数可以通过比较特征正态分布数据与基准特征正态分布数据之间的差异程度来进行计算,这种差异通常可以通过距离度量来量化的,例如欧氏距离、马氏距离等,距离越大,通常表明异常的程度越高,可见,异常分数越高,越可能异常。示例性地,异常分数的计算关系式如下所示:In addition, it should be noted that the anomaly score can quantitatively evaluate the degree of deviation between a data point and the normal data distribution, and can usually be used as a basis for judging whether the data is abnormal. The anomaly scores of different locations in the key area to be detected can be calculated by comparing the degree of difference between the characteristic normal distribution data and the benchmark characteristic normal distribution data. This difference can usually be quantified by a distance metric, such as Euclidean distance, Mahalanobis distance, etc. The larger the distance, the higher the degree of abnormality. It can be seen that the higher the anomaly score, the more likely it is abnormal. Exemplarily, the calculation relationship of the anomaly score is as follows:
其中,是待检测关键区域的特征正态分布数据,是基准特征正态分布数据,是特征正态分布数据与基准特征正态分布数据之间的距离,即异常分数。in, is the characteristic normal distribution data of the key area to be detected, is the benchmark characteristic normal distribution data, is the distance between the characteristic normal distribution data and the benchmark characteristic normal distribution data, that is, the anomaly score.
可以理解的是,待检测关键区域中不同位置的异常概率指的是该位置上数据点属于异常类的概率,与异常分数密切相关,异常分数较高的位置对应较高的异常概率,也就是说该位置是缺陷位置的可能性更高。异常概率通常是基于这些异常分数进一步得到的概率性的评估,需要考虑特征之间的相互作用和其他可能的影响因素,从而提供更为综合的异常评价。根据待检测关键区域中不同位置的异常概率,可以得到待检测关键区域中异常概率的分布情况,也就是异常概率分布数据。It can be understood that the anomaly probability at different locations in the key area to be detected refers to the probability that the data point at that location belongs to the anomaly class, which is closely related to the anomaly score. Positions with higher anomaly scores correspond to higher anomaly probabilities, which means that the location is more likely to be a defect location. The anomaly probability is usually a probabilistic assessment further obtained based on these anomaly scores, and it is necessary to consider the interaction between features and other possible influencing factors to provide a more comprehensive anomaly evaluation. According to the anomaly probability at different locations in the key area to be detected, the distribution of the anomaly probability in the key area to be detected can be obtained, that is, the anomaly probability distribution data.
进一步地,改进的Anomalib模型采用新的Relu4激活函数替换原始的Relu激活函数。Furthermore, the improved Anomalib model adopts the new Relu4 activation function to replace the original Relu activation function.
需要说明的是,原始的Relu激活函数为,在低精度变换过程中损失较大,因此,参考图4所示的函数图,本实施例对Relu激活函数进行改进,设计了新的Relu4激活函数,即,能够在要求效率的移动终端中实现更好的鲁棒性。本实施例将传统Anomalib模型中所有的Relu激活函数都替换为Relu4激活函数。It should be noted that the original Relu activation function is , the loss is large in the low-precision transformation process. Therefore, referring to the function diagram shown in FIG4 , this embodiment improves the Relu activation function and designs a new Relu4 activation function, namely , which can achieve better robustness in mobile terminals that require efficiency. In this embodiment, all Relu activation functions in the traditional Anomalib model are replaced by Relu4 activation functions.
可以理解的是,由于本实施例利用Bottleneck单元替换原始的特征提取单元,大大减少了模型的计算量,减少了模型推理时间,提高了模型计算效率,并采用新的Relu4激活函数替换原始的Relu激活函数,能够提高模型在移动端应用时的鲁棒性,从而能够将改进的Anomalib模型部署在移动端进行应用。It can be understood that since this embodiment uses the Bottleneck unit to replace the original feature extraction unit, the calculation amount of the model is greatly reduced, the model inference time is reduced, the model calculation efficiency is improved, and the new Relu4 activation function is used to replace the original Relu activation function, which can improve the robustness of the model when applied on the mobile terminal, so that the improved Anomalib model can be deployed on the mobile terminal for application.
应当理解的是,本实施例中的Anomalib模型指的是包含特征提取器、特征提取单元、NormalizingFlow层与FastFlow层,并且采用Relu激活函数的异常检测模型,从而可以对该Anomalib模型进行优化,利用Bottleneck单元替换原始的特征提取单元,并采用新的Relu4激活函数替换原始的Relu激活函数,得到改进的Anomalib模型,用于基于异常检测模型改进的主板缺陷检测。It should be understood that the Anomalib model in this embodiment refers to an anomaly detection model that includes a feature extractor, a feature extraction unit, a NormalizingFlow layer and a FastFlow layer, and uses a Relu activation function, so that the Anomalib model can be optimized, the original feature extraction unit is replaced by a Bottleneck unit, and the original Relu activation function is replaced by a new Relu4 activation function to obtain an improved Anomalib model for improved motherboard defect detection based on the anomaly detection model.
步骤S30,基于所述待检测关键区域的异常概率分布数据,确定所述待检测关键区域中的缺陷位置;Step S30, determining the defect position in the key area to be detected based on the abnormal probability distribution data of the key area to be detected;
需要说明的是,缺陷位置即存在缺陷的位点/区域。可以通过设置概率阈值来筛选出待检测关键区域中的缺陷位置,通常将异常概率大于概率阈值的位置认为是缺陷位置。在具体实现时,可以将概率阈值设置为0.5,也可根据实际需求灵活调整,对此不作具体限定。It should be noted that the defect position is the site/area where the defect exists. The defect position in the key area to be detected can be screened out by setting a probability threshold. Usually, the position where the abnormal probability is greater than the probability threshold is considered to be the defect position. In specific implementation, the probability threshold can be set to 0.5, or it can be flexibly adjusted according to actual needs, and there is no specific limitation on this.
步骤S40,对所述待检测关键区域以及所述待检测关键区域中的缺陷位置分别进行标记,生成所述待检测主板的结果热力图。Step S40, marking the key area to be inspected and the defect positions in the key area to be inspected respectively, and generating a result heat map of the motherboard to be inspected.
可以理解的是,本实施例最终可以输出检测结果对应的热力图,即结果热力图,结果热力图中可以标出各个待检测关键区域,并用鲜亮的颜色(例如:红色,需要与待检测关键区域的标记颜色不同)标记出各个待检测关键区域的缺陷位置。It can be understood that this embodiment can ultimately output a heat map corresponding to the detection results, that is, a result heat map. In the result heat map, each key area to be detected can be marked, and the defect position of each key area to be detected can be marked with a bright color (for example: red, which needs to be different from the marking color of the key area to be detected).
本实施例提供一种基于异常检测模型改进的主板缺陷检测方法,获取待检测主板的原始图像,并在待检测主板的原始图像中提取出待检测关键区域;基于改进的Anomalib模型,对待检测关键区域进行检测,得到待检测关键区域的异常概率分布数据,改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,预处理单元用于提取待检测关键区域中的视觉特征,并将视觉特征输入Bottleneck单元,Bottleneck单元用于基于视觉特征生成降维特征,并将降维特征输入异常识别单元进行异常识别;基于待检测关键区域的异常概率分布数据,确定待检测关键区域中的缺陷位置;对待检测关键区域以及待检测关键区域中的缺陷位置分别进行标记,生成待检测主板的结果热力图。优化了模型结构,利用Bottleneck单元进行降维,并采用鲁棒性更好的新激活函数,减少推理计算量,减少推理花费时间,提高模型的推理效率,同时利用图像关键区域进行训练和推理,提高模型针对性,提高模型的准确性与推理效率,从而可以提高缺陷检测的准确性和效率,即使图像分辨率很大,也能快速、准确地得到检测结果。The present embodiment provides a mainboard defect detection method improved based on an anomaly detection model, which obtains an original image of a mainboard to be detected, and extracts a key area to be detected from the original image of the mainboard to be detected; based on an improved Anomalib model, the key area to be detected is detected to obtain abnormal probability distribution data of the key area to be detected, and the improved Anomalib model includes a preprocessing unit, a Bottleneck unit that replaces an original feature extraction unit, and an abnormality recognition unit, the preprocessing unit is used to extract visual features in the key area to be detected, and input the visual features into the Bottleneck unit, the Bottleneck unit is used to generate a dimensionality reduction feature based on the visual features, and input the dimensionality reduction feature into the abnormality recognition unit for abnormality recognition; based on the abnormal probability distribution data of the key area to be detected, the defect position in the key area to be detected is determined; the key area to be detected and the defect position in the key area to be detected are marked respectively, and a result heat map of the mainboard to be detected is generated. The model structure is optimized, the Bottleneck unit is used for dimensionality reduction, and a new activation function with better robustness is adopted to reduce the amount of inference calculations, reduce the time spent on inference, and improve the inference efficiency of the model. At the same time, the key areas of the image are used for training and inference to improve the model's pertinence, accuracy and inference efficiency, thereby improving the accuracy and efficiency of defect detection. Even if the image resolution is large, the detection results can be obtained quickly and accurately.
需要说明的是,上述示例仅用于理解本申请,并不构成对本申请基于异常检测模型改进的主板缺陷检测方法的限定,基于此技术构思进行更多形式的简单变换,均在本申请的保护范围内。It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the improved motherboard defect detection method based on the abnormal detection model of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
本申请还提供一种基于异常检测模型改进的主板缺陷检测装置,请参照图5,所述基于异常检测模型改进的主板缺陷检测装置包括:The present application also provides a mainboard defect detection device improved based on an anomaly detection model. Please refer to FIG. 5 . The mainboard defect detection device improved based on an anomaly detection model includes:
区域提取模块10,用于获取待检测主板的原始图像,并在所述待检测主板的原始图像中提取出待检测关键区域。The region extraction module 10 is used to obtain the original image of the motherboard to be detected, and extract the key region to be detected from the original image of the motherboard to be detected.
缺陷检测模块20,用于基于改进的Anomalib模型,对所述待检测关键区域进行检测,得到所述待检测关键区域的异常概率分布数据,所述改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,所述预处理单元用于提取所述待检测关键区域中的视觉特征,并将所述视觉特征输入所述Bottleneck单元,所述Bottleneck单元用于基于所述视觉特征生成降维特征,并将所述降维特征输入所述异常识别单元进行异常识别。The defect detection module 20 is used to detect the key area to be detected based on the improved Anomalib model to obtain the abnormal probability distribution data of the key area to be detected. The improved Anomalib model includes a preprocessing unit, a Bottleneck unit that replaces the original feature extraction unit, and an abnormality recognition unit. The preprocessing unit is used to extract the visual features in the key area to be detected and input the visual features into the Bottleneck unit. The Bottleneck unit is used to generate a dimensionality reduction feature based on the visual feature, and input the dimensionality reduction feature into the abnormality recognition unit for abnormality recognition.
所述缺陷检测模块,还用于基于所述待检测关键区域的异常概率分布数据,确定所述待检测关键区域中的缺陷位置。The defect detection module is further used to determine the defect position in the key area to be detected based on the abnormal probability distribution data of the key area to be detected.
所述缺陷检测模块,还用于对所述待检测关键区域以及所述待检测关键区域中的缺陷位置分别进行标记,生成所述待检测主板的结果热力图。The defect detection module is also used to mark the key area to be detected and the defect position in the key area to be detected respectively, and generate a result heat map of the motherboard to be detected.
在一种可行的实施方式中,所述改进的Anomalib模型采用新的Relu4激活函数替换原始的Relu激活函数。In a feasible implementation, the improved Anomalib model uses a new Relu4 activation function to replace the original Relu activation function.
在一种可行的实施方式中,所述区域提取模块10,还用于获取待检测主板的原始图像,基于所述待检测主板上参考点在所述原始图像中的坐标以及所述参考点在基准图像中的坐标,确定转换矩阵;In a feasible implementation manner, the region extraction module 10 is further used to obtain an original image of the motherboard to be detected, and determine a transformation matrix based on the coordinates of a reference point on the motherboard to be detected in the original image and the coordinates of the reference point in the reference image;
获取目标区域在基准图像中的坐标,基于所述转换矩阵以及所述目标区域在基准图像中的坐标,确定所述待检测关键区域的坐标;Acquire the coordinates of the target area in the reference image, and determine the coordinates of the key area to be detected based on the transformation matrix and the coordinates of the target area in the reference image;
基于所述待检测关键区域的坐标,在所述原始图像中提取出所述待检测关键区域。Based on the coordinates of the key area to be detected, the key area to be detected is extracted from the original image.
在一种可行的实施方式中,所述预处理单元至少包括特征提取器,所述异常识别单元至少包括NormalizingFlow层与FastFlow层,所述缺陷检测模块,还用于将所述待检测关键区域对应的向量数据输入所述特征提取器进行特征提取,得到所述待检测关键区域的视觉特征;In a feasible implementation manner, the preprocessing unit includes at least a feature extractor, the abnormality identification unit includes at least a NormalizingFlow layer and a FastFlow layer, and the defect detection module is further used to input the vector data corresponding to the key area to be detected into the feature extractor for feature extraction to obtain the visual features of the key area to be detected;
将所述视觉特征输入所述Bottleneck单元进行特征提取与降维处理,得到所述降维特征;Inputting the visual features into the Bottleneck unit for feature extraction and dimensionality reduction processing to obtain the reduced dimensionality features;
将所述降维特征输入所述NormalizingFlow层进行分布归一化,得到特征正态分布数据;Input the dimension reduction features into the NormalizingFlow layer for distribution normalization to obtain feature normal distribution data;
将所述特征正态分布数据输入所述FastFlow层进行异常识别,得到所述待检测关键区域的异常概率分布数据。The characteristic normal distribution data is input into the FastFlow layer for anomaly recognition to obtain the abnormal probability distribution data of the key area to be detected.
在一种可行的实施方式中,所述Bottleneck单元包括依次连接的第一卷积层、第二卷积层、第三卷积层、池化层以及第四卷积层,所述第二卷积层采用预设标准卷积核,所述第一卷积层、所述第三卷积层以及所述第四卷积层均采用预设小尺寸卷积核,所述预设小尺寸卷积核小于所述预设标准卷积核,所述缺陷检测模块,还用于将所述视觉特征输入所述第一卷积层进行降维处理,得到降维视觉特征;In a feasible implementation manner, the Bottleneck unit includes a first convolutional layer, a second convolutional layer, a third convolutional layer, a pooling layer, and a fourth convolutional layer connected in sequence, the second convolutional layer adopts a preset standard convolutional kernel, the first convolutional layer, the third convolutional layer, and the fourth convolutional layer all adopt a preset small-size convolutional kernel, and the preset small-size convolutional kernel is smaller than the preset standard convolutional kernel, and the defect detection module is further used to input the visual feature into the first convolutional layer for dimensionality reduction processing to obtain a reduced-dimensional visual feature;
将所述降维视觉特征输入所述第二卷积层进行特征提取,并将特征提取后的降维视觉特征输入所述第三卷积层进行升维处理,得到升维视觉特征;Inputting the reduced-dimensional visual features into the second convolutional layer for feature extraction, and inputting the reduced-dimensional visual features after feature extraction into the third convolutional layer for dimensionality increase processing to obtain the increased-dimensional visual features;
将所述升维视觉特征输入所述池化层进行特征提取,并将特征提取后的升维视觉特征输入所述第四卷积层进行降维处理,得到所述降维特征。The up-dimensional visual features are input into the pooling layer for feature extraction, and the up-dimensional visual features after feature extraction are input into the fourth convolutional layer for dimensionality reduction processing to obtain the reduced dimensionality features.
在一种可行的实施方式中,所述缺陷检测模块,还用于将所述特征正态分布数据输入所述FastFlow层,基于所述特征正态分布数据与基准特征正态分布数据之间的距离,确定所述待检测关键区域中不同位置的异常分数;In a feasible implementation manner, the defect detection module is further used to input the characteristic normal distribution data into the FastFlow layer, and determine the abnormality scores of different positions in the key area to be detected based on the distance between the characteristic normal distribution data and the reference characteristic normal distribution data;
基于所述待检测关键区域中不同位置的异常分数,确定所述待检测关键区域中不同位置的异常概率;Determining the abnormality probabilities of different positions in the key area to be detected based on the abnormality scores of different positions in the key area to be detected;
基于所述待检测关键区域中不同位置的异常概率,确定所述待检测关键区域的异常概率分布数据。Based on the abnormality probabilities at different positions in the key area to be detected, abnormality probability distribution data of the key area to be detected is determined.
在一种可行的实施方式中,所述缺陷检测模块,还用于获取训练图像,基于训练参考点在所述训练图像中的坐标以及所述训练参考点在基准图像中的坐标,确定训练转换矩阵;In a feasible implementation manner, the defect detection module is further used to obtain a training image, and determine a training transformation matrix based on coordinates of a training reference point in the training image and coordinates of the training reference point in the reference image;
基于所述训练转换矩阵以及目标区域的坐标,确定所述训练图像中训练关键区域的坐标;Determining the coordinates of the training key area in the training image based on the training transformation matrix and the coordinates of the target area;
基于所述训练关键区域的坐标,在所述训练图像中提取出所述训练关键区域;Extracting the training key area from the training image based on the coordinates of the training key area;
基于所述训练关键区域,训练得到所述改进的Anomalib模型,并将所述改进的Anomalib模型转化后部署至移动端。Based on the training key area, the improved Anomalib model is trained and the improved Anomalib model is converted and deployed to the mobile terminal.
本申请提供的基于异常检测模型改进的主板缺陷检测装置,采用上述实施例中的基于异常检测模型改进的主板缺陷检测方法,能够解决传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。与现有技术相比,本申请提供的基于异常检测模型改进的主板缺陷检测装置的有益效果与上述实施例提供的基于异常检测模型改进的主板缺陷检测方法的有益效果相同,且所述基于异常检测模型改进的主板缺陷检测装置中的其他技术特征与上述实施例方法公开的特征相同,在此不做赘述。The improved motherboard defect detection device based on the anomaly detection model provided in the present application adopts the improved motherboard defect detection method based on the anomaly detection model in the above-mentioned embodiment, which can solve the technical problem of low accuracy and efficiency when the traditional Anomalib model performs defect detection on a motherboard image with a large resolution. Compared with the prior art, the beneficial effects of the improved motherboard defect detection device based on the anomaly detection model provided in the present application are the same as the beneficial effects of the improved motherboard defect detection method based on the anomaly detection model provided in the above-mentioned embodiment, and the other technical features of the improved motherboard defect detection device based on the anomaly detection model are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
本申请提供一种基于异常检测模型改进的主板缺陷检测设备,基于异常检测模型改进的主板缺陷检测设备包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述实施例一中的基于异常检测模型改进的主板缺陷检测方法。The present application provides a motherboard defect detection device improved based on an anomaly detection model, and the motherboard defect detection device improved based on an anomaly detection model includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the motherboard defect detection method improved based on the anomaly detection model in the above-mentioned embodiment one.
下面参考图6,其示出了适于用来实现本申请实施例的基于异常检测模型改进的主板缺陷检测设备的结构示意图。本申请实施例中的基于异常检测模型改进的主板缺陷检测设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(PersonalDigital Assistant:个人数字助理)、PAD(Portable Application Description:平板电脑)、PMP(Portable Media Player:便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图6示出的基于异常检测模型改进的主板缺陷检测设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Reference is made to Figure 6 below, which shows a schematic diagram of the structure of a motherboard defect detection device based on an abnormality detection model improvement suitable for implementing an embodiment of the present application. The motherboard defect detection device based on an abnormality detection model improvement in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The motherboard defect detection device based on an abnormality detection model improvement shown in Figure 6 is only an example and should not bring any limitations to the functions and scope of use of the embodiments of the present application.
如图6所示,基于异常检测模型改进的主板缺陷检测设备可以包括处理装置1001(例如中央处理器、图形处理器等),其可以根据存储在只读存储器(ROM:Read OnlyMemory)1002中的程序或者从存储装置1003加载到随机访问存储器(RAM:Random AccessMemory)1004中的程序而执行各种适当的动作和处理。在RAM1004中,还存储有基于异常检测模型改进的主板缺陷检测设备操作所需的各种程序和数据。处理装置1001、ROM1002以及RAM1004通过总线1005彼此相连。输入/输出(I/O)接口1006也连接至总线。通常,以下系统可以连接至I/O接口1006:包括例如触摸屏、触摸板、键盘、鼠标、图像传感器、麦克风、加速度计、陀螺仪等的输入装置1007;包括例如液晶显示器(LCD:Liquid Crystal Display)、扬声器、振动器等的输出装置1008;包括例如磁带、硬盘等的存储装置1003;以及通信装置1009。通信装置1009可以允许基于异常检测模型改进的主板缺陷检测设备与其他设备进行无线或有线通信以交换数据。虽然图中示出了具有各种系统的基于异常检测模型改进的主板缺陷检测设备,但是应理解的是,并不要求实施或具备所有示出的系统。可以替代地实施或具备更多或更少的系统。As shown in FIG6 , the improved motherboard defect detection device based on the abnormal detection model may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the improved motherboard defect detection device based on the abnormal detection model are also stored in RAM 1004. The processing device 1001, ROM 1002, and RAM 1004 are connected to each other via a bus 1005. An input/output (I/O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I/O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the improved motherboard defect detection device based on the abnormality detection model to communicate wirelessly or wired with other devices to exchange data. Although the improved motherboard defect detection device based on the abnormality detection model with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
特别地,根据本申请公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本申请公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置从网络上被下载和安装,或者从存储装置1003被安装,或者从ROM1002被安装。在该计算机程序被处理装置1001执行时,执行本申请公开实施例的方法中限定的上述功能。In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
本申请提供的基于异常检测模型改进的主板缺陷检测设备,采用上述实施例中的基于异常检测模型改进的主板缺陷检测方法,能解决传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。与现有技术相比,本申请提供的基于异常检测模型改进的主板缺陷检测设备的有益效果与上述实施例提供的基于异常检测模型改进的主板缺陷检测方法的有益效果相同,且该基于异常检测模型改进的主板缺陷检测设备中的其他技术特征与上一实施例方法公开的特征相同,在此不做赘述。The improved motherboard defect detection device based on the anomaly detection model provided in the present application adopts the improved motherboard defect detection method based on the anomaly detection model in the above-mentioned embodiment, which can solve the technical problem of low accuracy and efficiency when the traditional Anomalib model performs defect detection on a motherboard image with a large resolution. Compared with the prior art, the beneficial effects of the improved motherboard defect detection device based on the anomaly detection model provided in the present application are the same as the beneficial effects of the improved motherboard defect detection method based on the anomaly detection model provided in the above-mentioned embodiment, and the other technical features of the improved motherboard defect detection device based on the anomaly detection model are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
应当理解,本申请公开的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式的描述中,具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
本申请提供一种计算机可读存储介质,具有存储在其上的计算机可读程序指令(即计算机程序),计算机可读程序指令用于执行上述实施例中的基于异常检测模型改进的主板缺陷检测方法。The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the improved motherboard defect detection method based on the abnormality detection model in the above-mentioned embodiment.
本申请提供的计算机可读存储介质例如可以是U盘,但不限于电、磁、光、电磁、红外线、或半导体的系统、系统或器件,或者任意以上的组合。计算机可读存储介质的更具体地例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM:Random Access Memory)、只读存储器(ROM:Read Only Memory)、可擦式可编程只读存储器(EPROM:Erasable Programmable Read Only Memory或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM:CD-Read Only Memory)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本实施例中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、系统或者器件使用或者与其结合使用。计算机可读存储介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(Radio Frequency:射频)等等,或者上述的任意合适的组合。The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.
上述计算机可读存储介质可以是基于异常检测模型改进的主板缺陷检测设备中所包含的;也可以是单独存在,而未装配入基于异常检测模型改进的主板缺陷检测设备中。The above-mentioned computer-readable storage medium may be included in the mainboard defect detection device improved based on the abnormality detection model; or it may exist independently without being assembled into the mainboard defect detection device improved based on the abnormality detection model.
上述计算机可读存储介质承载有一个或者多个程序,当上述一个或者多个程序被基于异常检测模型改进的主板缺陷检测设备执行时,使得基于异常检测模型改进的主板缺陷检测设备:获取待检测主板的原始图像,并在待检测主板的原始图像中提取出待检测关键区域;基于改进的Anomalib模型,对待检测关键区域进行检测,得到待检测关键区域的异常概率分布数据,改进的Anomalib模型包括预处理单元、替换了原始特征提取单元的Bottleneck单元以及异常识别单元,预处理单元用于提取待检测关键区域中的视觉特征,并将视觉特征输入Bottleneck单元,Bottleneck单元用于基于视觉特征生成降维特征,并将降维特征输入异常识别单元进行异常识别;基于待检测关键区域的异常概率分布数据,确定待检测关键区域中的缺陷位置;对待检测关键区域以及待检测关键区域中的缺陷位置分别进行标记,生成待检测主板的结果热力图。The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the motherboard defect detection device improved based on the anomaly detection model, the motherboard defect detection device improved based on the anomaly detection model: obtains the original image of the motherboard to be detected, and extracts the key area to be detected in the original image of the motherboard to be detected; based on the improved Anomalib model, detects the key area to be detected to obtain the abnormal probability distribution data of the key area to be detected, the improved Anomalib model includes a preprocessing unit, a Bottleneck unit that replaces the original feature extraction unit, and an abnormality recognition unit, the preprocessing unit is used to extract the visual features in the key area to be detected, and input the visual features into the Bottleneck unit, the Bottleneck unit is used to generate a dimensionality reduction feature based on the visual features, and input the dimensionality reduction feature into the abnormality recognition unit for abnormality recognition; based on the abnormal probability distribution data of the key area to be detected, the defect position in the key area to be detected is determined; the key area to be detected and the defect position in the key area to be detected are marked respectively, and a result heat map of the motherboard to be detected is generated.
可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN:Local Area Network)或广域网(WAN:Wide Area Network)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and/or flow chart, and the combination of the boxes in the block diagram and/or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该单元本身的限定。The modules involved in the embodiments of the present application may be implemented by software or hardware, wherein the name of the module does not, in some cases, constitute a limitation on the unit itself.
本申请提供的可读存储介质为计算机可读存储介质,所述计算机可读存储介质存储有用于执行上述基于异常检测模型改进的主板缺陷检测方法的计算机可读程序指令(即计算机程序),能够解决传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。与现有技术相比,本申请提供的计算机可读存储介质的有益效果与上述实施例提供的基于异常检测模型改进的主板缺陷检测方法的有益效果相同,在此不做赘述。The readable storage medium provided in the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned improved motherboard defect detection method based on the anomaly detection model, and can solve the technical problem of low accuracy and efficiency when the traditional Anomalib model performs defect detection on large-resolution motherboard images. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in the present application are the same as the beneficial effects of the improved motherboard defect detection method based on the anomaly detection model provided in the above-mentioned embodiment, and will not be repeated here.
本申请还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述的基于异常检测模型改进的主板缺陷检测方法的步骤。The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned improved mainboard defect detection method based on anomaly detection model.
本申请提供的计算机程序产品能够解决传统Anomalib模型对大分辨率的主板图像进行缺陷检测时,准确性和效率较低的技术问题。与现有技术相比,本申请提供的计算机程序产品的有益效果与上述实施例提供的基于异常检测模型改进的主板缺陷检测方法的有益效果相同,在此不做赘述。The computer program product provided by the present application can solve the technical problem of low accuracy and efficiency when the traditional Anomalib model performs defect detection on a motherboard image with a large resolution. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the improved motherboard defect detection method based on the anomaly detection model provided by the above embodiment, and will not be described in detail here.
以上所述仅为本申请的部分实施例,并非因此限制本申请的专利范围,凡是在本申请的技术构思下,利用本申请说明书及附图内容所作的等效结构变换,或直接/间接运用在其他相关的技术领域均包括在本申请的专利保护范围内。The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct/indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411142028.9A CN118657776B (en) | 2024-08-20 | 2024-08-20 | Mainboard defect detection method, device and equipment based on abnormality detection model improvement |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411142028.9A CN118657776B (en) | 2024-08-20 | 2024-08-20 | Mainboard defect detection method, device and equipment based on abnormality detection model improvement |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118657776A true CN118657776A (en) | 2024-09-17 |
CN118657776B CN118657776B (en) | 2024-12-13 |
Family
ID=92698010
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202411142028.9A Active CN118657776B (en) | 2024-08-20 | 2024-08-20 | Mainboard defect detection method, device and equipment based on abnormality detection model improvement |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118657776B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114092467A (en) * | 2021-12-01 | 2022-02-25 | 重庆大学 | Scratch detection method and system based on lightweight convolutional neural network |
KR102448338B1 (en) * | 2022-06-15 | 2022-09-29 | (주)시큐레이어 | Method and device for training pathological anomaly detection model on tissue using improved patchcore technique, and method and device for testing using the same |
CN115908344A (en) * | 2022-11-30 | 2023-04-04 | 广东工业大学 | A Micro LED chip defect detection method based on MLCT-YOLO |
CN116500042A (en) * | 2023-05-09 | 2023-07-28 | 哈尔滨工业大学重庆研究院 | Defect detection method, device, system and storage medium |
CN118305101A (en) * | 2024-04-03 | 2024-07-09 | 江苏理工学院 | Automatic bearing defect detection system and method |
CN118351054A (en) * | 2024-03-19 | 2024-07-16 | 浙大宁波理工学院 | High-reflection cylinder workpiece surface defect detection method based on improved YOLOv model |
-
2024
- 2024-08-20 CN CN202411142028.9A patent/CN118657776B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114092467A (en) * | 2021-12-01 | 2022-02-25 | 重庆大学 | Scratch detection method and system based on lightweight convolutional neural network |
KR102448338B1 (en) * | 2022-06-15 | 2022-09-29 | (주)시큐레이어 | Method and device for training pathological anomaly detection model on tissue using improved patchcore technique, and method and device for testing using the same |
CN115908344A (en) * | 2022-11-30 | 2023-04-04 | 广东工业大学 | A Micro LED chip defect detection method based on MLCT-YOLO |
CN116500042A (en) * | 2023-05-09 | 2023-07-28 | 哈尔滨工业大学重庆研究院 | Defect detection method, device, system and storage medium |
CN118351054A (en) * | 2024-03-19 | 2024-07-16 | 浙大宁波理工学院 | High-reflection cylinder workpiece surface defect detection method based on improved YOLOv model |
CN118305101A (en) * | 2024-04-03 | 2024-07-09 | 江苏理工学院 | Automatic bearing defect detection system and method |
Also Published As
Publication number | Publication date |
---|---|
CN118657776B (en) | 2024-12-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107729560A (en) | User's portrait building method, device and computing device based on big data | |
CN111444807B (en) | Target detection method, device, electronic equipment and computer readable medium | |
CN112559341A (en) | Picture testing method, device, equipment and storage medium | |
CN115510795A (en) | Data processing method and related device | |
US11967125B2 (en) | Image processing method and system | |
CN114638411B (en) | Carbon dioxide concentration prediction method, device, equipment and medium | |
CN111898619A (en) | Image feature extraction method, apparatus, computer equipment and readable storage medium | |
CN115062571A (en) | Method, system, device and computer readable storage medium for dynamic selection of data region applied to integrated circuit device | |
CN118657776A (en) | Improved motherboard defect detection method, device and equipment based on anomaly detection model | |
CN110210279A (en) | Object detection method, device and computer readable storage medium | |
CN118918166A (en) | Target measurement method, device, client, medium and product | |
CN113850220A (en) | Text perspective transformation method and equipment | |
CN114155567A (en) | Target detection method and device, storage medium and electronic device | |
CN115062695B (en) | Cheating judgment method, device, equipment and medium | |
CN116785724A (en) | Three-dimensional model auditing method and device, electronic equipment and storage medium | |
CN113673522A (en) | Method, device and equipment for detecting inclination angle of text image and storage medium | |
CN117474827A (en) | Image definition detection method and device | |
CN112966671A (en) | Contract detection method and device, electronic equipment and storage medium | |
CN119380852B (en) | Atmospheric pollution simulation assessment method, device and electronic equipment based on image processing | |
CN115228087B (en) | Game character control optimization method, device, electronic device and medium | |
CN112416989A (en) | Management method and device of Internet performance broker platform and electronic equipment | |
CN114596336B (en) | YOLOv 3-based complex scene laser tracker target ball center positioning method and device | |
CN119645338B (en) | Display screen projection control method, display screen and storage medium | |
CN118470696B (en) | Method and device for acquiring screen display information of vehicle cabin, electronic equipment and storage medium | |
CN118762385B (en) | Fingerprint ridge characteristic splicing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |