Industrial element defect detection method and system

By preprocessing, feature extraction, maximum pooling and global average pooling processing on industrial component images, global feature vectors are generated, and the problem of high computational complexity in the prior art is solved and efficient defect detection is achieved.

CN120339697APending Publication Date: 2025-07-18NANCHANG UNIV +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510415583.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

The prior art model creation in industrial component defect detection generates a large number of parameters and has high computational complexity, making it difficult to operate efficiently on edge devices, resulting in insufficiency in detection.

Method used

By collecting industrial component images in real time, performing preprocessing, using preset rules to perform feature extraction, maximum pooling and global average pooling processing, generating global feature vectors to judge defects, avoiding complex calculations and data volumes.

Benefits of technology

It improves the efficiency and accuracy of defect detection, reduces the computational complexity and data volume, and is suitable for efficient operation on edge devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120339697A_ABST
    Figure CN120339697A_ABST
Patent Text Reader

Abstract

The invention provides an industrial component defect detection method and system, and the method comprises the steps: collecting an original industrial component image in real time, and carrying out the preprocessing of the original industrial component image, so as to generate a corresponding target industrial component image in real time; performing feature extraction processing on the target industrial component image based on a preset rule to generate a corresponding initial feature map in real time, and performing maximum pooling processing on the initial feature map to generate a corresponding target feature map in real time; performing global average pooling processing on the target feature map to output a corresponding target feature vector in real time, and performing linear transformation processing on the target feature vector to generate a corresponding global feature vector in real time; and extracting global structure information corresponding to the original industrial element image from the global feature vector in real time, and judging whether defects exist in the original industrial element image or not according to the global structure information in real time. According to the method, complex data and complex calculation can be avoided, and the working efficiency is correspondingly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of industrial inspection, and particularly relates to a method and system for detecting defects of industrial components. Background Art

[0002] With the progress of technology and the rapid development of productivity, the production technologies of various industrial products have become increasingly mature. Among them, existing industrial components need to be subjected to corresponding defect detection before leaving the factory to ensure the product yield of industrial components.

[0003] Among them, with the continuous development of computer technology, people have developed corresponding defect detection algorithms and, based on these algorithms, have constructed corresponding defect detection models in real time. During daily production, the surface of industrial components is detected in real time through these defect detection models.

[0004] Furthermore, in the actual application of existing technologies, most of them are based on complex deep learning architectures to create the required defect detection models in real time. However, this way of creating models will generate a large number of parameters, and at the same time, the computational complexity is high, making it difficult to operate efficiently on edge devices, correspondingly reducing the defect detection efficiency of industrial components. Summary of the Invention

[0005] Based on this, the purpose of the present invention is to provide a method and system for detecting defects of industrial components to solve the problems in the prior art that a large number of parameters are generated during model creation, the computational complexity is high, it is difficult to operate efficiently on edge devices, resulting in a reduction in the defect detection efficiency of industrial components.

[0006] The first aspect of the embodiment of the present invention proposes:[[]] A method for detecting defects of industrial components, wherein the method includes:[[]] Collecting raw industrial component images in real time and preprocessing the raw industrial component images to generate corresponding target industrial component images in real time;[[]] Performing feature extraction processing on the target industrial component images based on preset rules to generate corresponding initial feature maps in real time, and performing max-pooling processing on the initial feature maps to generate corresponding target feature maps in real time;[[]] Performing global average pooling processing on the target feature maps to output corresponding target feature vectors in real time, and performing linear transformation processing on the target feature vectors to generate corresponding global feature vectors in real time;[[]] Extracting global structure information corresponding to the raw industrial component images from the global feature vectors in real time, and determining whether there are defects in the raw industrial component images in real time according to the global structure information.

[0007] The beneficial effects of the present invention are as follows: By collecting the images of original industrial components in real time, the corresponding processing objects can be determined. Based on this, in order to improve the detection accuracy, the current images of original industrial components are preprocessed to generate corresponding target industrial component images in real time. Based on this, corresponding feature extraction, max pooling, and average pooling processes are performed in sequence, and then the target feature vectors for subsequent judgment can be output correspondingly. Based on this, finally, it can be determined whether there are defects according to the accurately obtained global structure information, thereby avoiding complex operations and generating a large amount of data. Through image processing, the defect detection can be completed, and the defect detection efficiency is correspondingly improved.

[0008] Further, the step of performing feature extraction processing on the target industrial component image based on a preset rule to generate a corresponding initial feature map in real time includes: When the target industrial component image is obtained in real time, the target industrial component image is correspondingly input into a preset convolutional layer, and the original number of channels corresponding to the target industrial component image is detected in real time; In the preset convolutional layer, the original number of channels is mapped to the target number of channels, and based on the target number of channels, the target industrial component image is convolved through the preset convolutional layer to generate the initial feature map in real time. The target industrial component image is unique.

[0009] Further, the step of convolving the target industrial component image through the preset convolutional layer based on the target number of channels to generate the initial feature map in real time includes: In the preset convolutional layer, the original spatial size corresponding to the target industrial component image is detected in real time, and a convolutional operation with a stride of 2 is performed on the original spatial size through the preset convolutional layer to generate a corresponding target spatial size in real time; The target industrial component image is adaptively adjusted based on the target number of channels and the target spatial size to generate the initial feature map in real time. Both the target number of channels and the target spatial size contain specific values.

[0010] Further, the expression of the algorithm for performing a convolutional operation with a stride of 2 on the original spatial size through the preset convolutional layer is:

[0011] where F conv represents the target spatial size, W represents the convolutional kernel weight, I represents the original spatial size, b represents the bias term, σ represents the activation function, and * represents the convolutional operation.

[0012] Further, the expression of the algorithm for performing max pooling on the initial feature map is as follows:

[0013] where max represents taking the maximum value within the local window, and F conv (i, j) represents the initial feature map, and F pool represents the target feature map.

[0014] Further, the steps of performing global average pooling on the target feature map to output the corresponding target feature vector in real time include: When the target feature map is obtained in real time, a target three-dimensional space adapted to the target feature map is created in real time through a preset program; In the target three-dimensional space, the spatial dimension corresponding to the target feature map is detected in real time, and global average calculation is performed on the target feature map according to the spatial dimension and a preset algorithm to output the target feature vector correspondingly.

[0015] Further, the expression of the preset algorithm is as follows:

[0016] where F GAP represents the target feature vector, F(i, j) represents the feature value of the target feature map at position (i, j), and H and W are the height and width of the target feature map respectively.

[0017] The second aspect of the embodiments of the present invention proposes: An industrial component defect detection system, where the system includes: An acquisition module, configured to acquire an original industrial component image in real time and preprocess the original industrial component image to generate a corresponding target industrial component image in real time; An extraction module, configured to perform feature extraction processing on the target industrial component image based on a preset rule to generate a corresponding initial feature map in real time, and perform max pooling on the initial feature map to generate a corresponding target feature map in real time; A processing module, configured to perform global average pooling on the target feature map to output a corresponding target feature vector in real time, and perform linear transformation processing on the target feature vector to generate a corresponding global feature vector in real time; A judgment module, configured to extract the global structure information corresponding to the original industrial component image from the global feature vector in real time, and judge in real time whether there are defects in the original industrial component image according to the global structure information.

[0018] Further, the extraction module is specifically configured to: When the target industrial component image is obtained in real time, input the target industrial component image into a preset convolutional layer, and detect in real time the original number of channels corresponding to the target industrial component image; In the preset convolutional layer, map the original number of channels to the target number of channels, and perform convolutional processing on the target industrial component image through the preset convolutional layer based on the target number of channels to generate the initial feature map in real time, and the target industrial component image is unique.

[0019] Further, the extraction module is specifically configured to: In the preset convolutional layer, detect in real time the original spatial dimension corresponding to the target industrial component image, and perform a convolutional operation with a stride of 2 on the original spatial dimension through the preset convolutional layer to generate the corresponding target spatial dimension in real time; Perform adaptive adjustment processing on the target industrial component image through the target number of channels and the target spatial dimension to generate the initial feature map in real time, and both the target number of channels and the target spatial dimension contain specific numerical values.

[0020] Further, the expression of the algorithm for performing a convolutional operation with a stride of 2 on the original spatial dimension through the preset convolutional layer is:

[0021] where F conv represents the target spatial dimension, W represents the convolutional kernel weight, I represents the original spatial dimension, b represents the bias term, σ represents the activation function, and * represents the convolutional operation.

[0022] Further, the expression of the algorithm for performing max-pooling processing on the initial feature map is:

[0023] where max represents taking the maximum value within the local window, F conv (i, j) represents the initial feature map, and F pool represents the target feature map.

[0024] Further, the processing module is specifically configured to; When the target feature map is obtained in real time, create in real time a target three-dimensional space adapted to the target feature map through a preset program; In the target three-dimensional space, detect in real time the spatial dimension corresponding to the target feature map, and perform global average calculation on the target feature map according to the spatial dimension and a preset algorithm to correspondingly output the target feature vector.

[0025] Further, the expression of the preset algorithm is as follows:

[0026] where F GAP represents the target feature vector, F(i, j) represents the feature value of the target feature map at position (i, j), and H and W are the height and width of the target feature map, respectively.

[0027] In the third aspect of the embodiments of the present invention, there is provided: A computer, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the industrial component defect detection method as described above is implemented.

[0028] In the fourth aspect of the embodiments of the present invention, there is provided: A readable storage medium, on which a computer program is stored, wherein when the program is executed by a processor, the industrial component defect detection method as described above is implemented.

[0029] The additional aspects and advantages of the present invention will be partly given in the following description, partly will become obvious from the following description, or will be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 is a flowchart of the industrial component defect detection method provided by the first embodiment of the present invention; Figure 2 is a structural block diagram of the industrial component defect detection system provided by the third embodiment of the present invention.

[0031] The following specific embodiments will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0032] For the convenience of understanding the present invention, the present invention will be described more comprehensively below with reference to the relevant drawings. Several embodiments of the present invention are shown in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, these embodiments are provided to make the disclosure of the present invention more thorough and comprehensive.

[0033] It should be noted that when an element is referred to as being "fixedly provided on" another element, it can be directly on the other element or there may also be an intermediate element. When an element is considered to be "connected" to another element, it can be directly connected to the other element or there may be an intermediate element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this invention belongs. The terms used in the description of this invention herein are for the purpose of describing specific embodiments only and are not intended to limit the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0035] Please refer to Figure 1 , which shows the industrial component defect detection method provided by the first embodiment of the present invention. The industrial component defect detection method provided by this embodiment can effectively avoid complex calculations and data, thereby being able to quickly and effectively complete defect detection, correspondingly improving work efficiency.

[0036] Specifically, this embodiment provides: An industrial component defect detection method, specifically including the following steps: Step S10, real-time collect the original industrial component image, and preprocess the original industrial component image to generate a corresponding target industrial component image in real time; Step S20, perform feature extraction processing on the target industrial component image based on a preset rule to generate a corresponding initial feature map in real time, and perform max pooling processing on the initial feature map to generate a corresponding target feature map in real time; Step S30, perform global average pooling processing on the target feature map to output a corresponding target feature vector in real time, and perform linear transformation processing on the target feature vector to generate a corresponding global feature vector in real time; Step S40, real-time extract the global structure information corresponding to the original industrial component image from the global feature vector, and real-time determine whether there are defects in the original industrial component image according to the global structure information.

[0037] Specifically, in this embodiment, first of all, it should be noted that in order to quickly and effectively complete the defect detection of industrial components, it is necessary to obtain the component information corresponding to the industrial components in real time at this time. Specifically, in the actual detection process of the present invention, the component image corresponding to each industrial component will be obtained in real time. Based on this, the current component image will be further analyzed to finally determine whether the industrial component has defects. Preferably, in order to improve the accuracy of subsequent judgment, the present invention will first preprocess the original industrial component image obtained in real time. Specifically, the present invention will perform the following operations: The first step: Data cleaning First, load the data set and remove noise interference. We apply the following data cleaning steps: Outlier removal: Use the IQR (Interquartile Range) method to detect and remove outliers.

[0038] Missing value imputation: Use KNN or mean interpolation method to fill in the missing data points.

[0039] Data balancing: For imbalanced categorical data, use undersampling or oversampling techniques to enhance sample balance.

[0040] Second step: Feature extraction First, construct the input data format, unify the image size to 512×512 pixels. Then normalize it to [0,1] to improve the model convergence speed. Next, generate feature vectors. We designed three different features: Statistical features: Calculate a 10-dimensional feature vector such as mean, standard deviation, maximum value, minimum value, etc.

[0041] Texture features: Extract second-order statistical information based on GLCM (Gray-Level Co-Occurrence Matrix) to improve the discrimination ability for surface defects.

[0042] Frequency domain features: Use FFT (Fast Fourier Transform) to extract the defect spectrum information to enhance the detection ability for tiny defects.

[0043] The input module of the present invention aims to standardize and enhance the input industrial component images to ensure the consistency and stability of the input to the subsequent feature extraction module. The input module first receives RGB color images with variable sizes. To unify the input format, the input module standardizes all input images to a size of 512x512x3 through an image resizing operation (Resize). Subsequently, the normalized image is normalized (Normalize) with parameters of mean (0.485, 0.456, 0.406) and standard deviation (0.229, 0.224, 0.225) to normalize the pixel values to the range of [0,1]. The normalization formula is as follows:

[0044] where I is the original pixel value, μ is the mean, σ is the standard deviation, and I norm is the normalized pixel value.

[0045] To enhance the robustness of the model against different lighting conditions, perspective changes, and local deformations, the input module also integrates data augmentation operations (Data Augmentation), including random rotation of ±15°, left-right flipping, etc., to expand the diversity of the dataset and improve the generalization ability of the model. Based on this, the present invention will sequentially perform feature extraction, max pooling, global average pooling, and linear transformation processing on the target industrial component image obtained by real-time processing, so as to finally obtain a global feature vector for real-time judgment. Based on this, the present invention can finally extract the global feature information contained in the current global feature vector. On this basis, the present invention can objectively and accurately determine whether there are defects in the current industrial component according to the global feature information, thereby avoiding complex calculations and data, and correspondingly improving work efficiency.

[0046] Second Embodiment Further, the step of performing feature extraction processing on the target industrial component image based on a preset rule to generate a corresponding initial feature map in real time includes: When the target industrial component image is obtained in real time, input the target industrial component image into a preset convolutional layer, and detect the original number of channels corresponding to the target industrial component image in real time; In the preset convolutional layer, map the original number of channels to the target number of channels, and perform convolutional processing on the target industrial component image through the preset convolutional layer based on the target number of channels to generate the initial feature map in real time. The target industrial component image is unique.

[0047] Further, the step of performing convolutional processing on the target industrial component image through the preset convolutional layer based on the target number of channels to generate the initial feature map in real time includes: In the preset convolutional layer, detect the original spatial size corresponding to the target industrial component image in real time, and perform a convolutional operation with a stride of 2 on the original spatial size through the preset convolutional layer to generate a corresponding target spatial size in real time; Perform adaptive adjustment processing on the target industrial component image through the target number of channels and the target spatial size to generate the initial feature map in real time. Both the target number of channels and the target spatial size contain specific values.

[0048] Further, the expression of the algorithm for performing a convolutional operation with a stride of 2 on the original spatial size through the preset convolutional layer is:

[0049] where, F convLet \(D\) represent the target spatial dimension, \(W\) represent the convolutional kernel weight, \(I\) represent the original spatial dimension, \(b\) represent the bias term, \(\sigma\) represent the activation function, and \(*\) represent the convolution operation.

[0050] Furthermore, the expression of the algorithm for performing max pooling on the initial feature map is:

[0051] where \(max\) represents taking the maximum value within the local window, \(F\) conv (i, j) represents the initial feature map, and \(F\) pool represents the target feature map.

[0052] Furthermore, the steps of performing global average pooling on the target feature map to output the corresponding target feature vector in real time include: When the target feature map is obtained in real time, a target three-dimensional space adapted to the target feature map is created in real time through a preset program; In the target three-dimensional space, the spatial dimension corresponding to the target feature map is detected in real time, and global average calculation is performed on the target feature map according to the spatial dimension and a preset algorithm to output the target feature vector correspondingly.

[0053] Furthermore, the expression of the preset algorithm is:

[0054] where \(F\) GAP represents the target feature vector, \(F(i, j)\) represents the feature value of the target feature map at position \((i, j)\), and \(H\) and \(W\) are the height and width of the target feature map respectively.

[0055] In addition, in this embodiment, it should also be noted that the input image first passes through a 7x7 convolutional layer (Conv1), which maps an image with 3 input channels to 64 output channels. At the same time, through a convolutional operation with a stride of 2, the spatial dimension of the image is halved to obtain a feature map with a size of 256x256x64. The specific convolution operation formula is as follows:

[0056] where \(F\) conv represents the target spatial dimension, \(W\) represents the convolutional kernel weight, \(I\) represents the original spatial dimension, \(b\) represents the bias term, \(\sigma\) represents the activation function, and \(*\) represents the convolution operation.

[0057] Then, through a 3x3 max pooling layer (MaxPool), the spatial dimension of the feature map is further halved to 128x128x64, while retaining the key feature information. The max pooling operation formula is as follows:

[0058] Among them, max represents taking the maximum value within the local window, and F conv (i, j) represents the initial feature map, and F pool represents the target feature map.

[0059] Subsequently, the feature map sequentially passes through three residual blocks (ResBlock1, ResBlock2, ResBlock3). Each residual block contains two 3x3 convolutional layers, and feature fusion and enhancement are achieved through skip connections. The specific operation formula of the residual block is as follows:

[0060] Among them, F conv2 is the output of the second convolutional layer, and F input is the input of the residual block.

[0061] In ResBlock1, the feature map with 64 input channels is mapped to 128 output channels. Since the stride of the convolutional operation is 1, the spatial size of the feature map remains unchanged, still being 128x128x128. After entering ResBlock2, the number of channels of the feature map increases to 256, and at the same time, the convolutional operation with a stride of 2 causes the spatial size to be halved again, obtaining a feature map with a size of 64x64x64. Finally, in ResBlock3, the number of channels of the feature map is further increased to 512, and the spatial size is further halved to 32x32x512.

[0062] After the hierarchical feature extraction and abstraction of the above residual blocks, the local texture information in the image is fully encoded into the high-dimensional feature space. In order to further integrate these local features into a global feature representation, the present invention adopts global average pooling (GAP) operation to perform global average calculation on the spatial dimension of the 32x32x512 feature map, and finally obtains a fixed-size 1x1x512 feature vector. This vector centrally reflects the local texture features of the input image and provides a rich local information basis for subsequent feature fusion and defect detection. The operation formula of global average pooling is as follows:

[0063] Among them, F GAP represents the target feature vector, F(i, j) represents the feature value of the target feature map at position (i, j), and H and W are the height and width of the target feature map respectively.

[0064] The Transformer branch adopts the Swin Transformer architecture. Through Patch Embedding and multiple levels of Swin Blocks, it extracts the global features of the image. The input image undergoes a Patch Embedding operation, which divides the image into 4x4 patches and maps each patch to a 96-dimensional feature vector, resulting in a feature map of size 128x128x96. The specific formula for the Patch Embedding operation is as follows:

[0065] where, I patch is the image patch of each patch, and Linear represents the linear transformation.

[0066] The feature map sequentially passes through four Swin Blocks. Each Swin Block contains the Shifted Window Attention mechanism and multi-head attention calculation, which can effectively capture the long-range dependencies in the image. The specific formula for the multi-head attention mechanism is as follows:

[0067] where, Q, K, and V are the query, key, and value respectively, and d k is the dimension of the key vector.

[0068] Swin Block 1 uses a window size of 7x7 and 3 attention heads, mapping the feature map with 96 input channels to 96 output channels, and the spatial size of the feature map remains 128x128x96. Swin Block 2 uses the same window size, but the number of attention heads increases to 6, doubling the number of channels of the feature map to 192, while the spatial size is halved to 64x64x192. Swin Block 3 and Swin Block 4 use 12 and 24 attention heads respectively, further increasing the number of channels of the feature map to 384 and 768, and the spatial sizes are halved to 32x32x384 and 16x16x768 respectively.

[0069] Finally, through a linear transformation (MLP Head), the 16x16x768 feature map is mapped to a 1x1x512 global feature vector, which centrally embodies the global structural information of the input image and provides feature support from a global perspective for subsequent feature fusion and defect detection. The linear transformation formula is as follows:

[0070] where, Finput is the input feature map, and Linear represents the linear transformation.

[0071] To make full use of the local features extracted by the CNN branch and the global features extracted by the Transformer branch, the present invention designs a feature fusion module, which uses a channel attention mechanism (SE-Module) to weight and fuse the two types of features to improve the accuracy of defect detection. The feature fusion module first calculates the global average pooling (GAP) of the input features to obtain the average value of each channel. Then, through two fully connected layers (FC1 and FC2), the channel average value is mapped to a low-dimensional space and undergoes a non-linear transformation. Finally, the weight of each channel is generated through the Sigmoid activation function. The specific formula is as follows:

[0072]

[0073] where S c is the global average pooling value of channel c, FC1 and FC2 are fully connected layers, σ is the Sigmoid activation function, ReLU is the ReLU activation function, and W c is the weight of channel c.

[0074] These weights reflect the importance of different channels in feature representation. By multiplying the weights with the original features, the weighted adjustment of the features is achieved, enhancing the expression ability of key features and suppressing the influence of redundant features at the same time. The specific weighting formula is as follows:

[0075] where X is the original feature map, W is the channel weight, represents element-wise multiplication.

[0076] After being processed by the channel attention mechanism, the CNN features and Transformer features are both of size 1x1x512. To further integrate these two types of features, the present invention uses the method of channel concatenation to fuse them into a 1x1x1024 feature vector.

[0077] The goal of the decoder module is to map the fused feature vector back to the pixel space and generate the detection result of the target. Specifically, the decoder module first maps the 1x1x1024 feature vector to a 1x1x512 feature map through a linear mapping (FC1). The specific formula is as follows:

[0078] where F inoutis the input feature vector, and Linear represents a linear transformation.

[0079] Subsequently, through a series of deconvolution operations (Upsample 1, Upsample 2, Upsample 3), the spatial size of the feature map is gradually enlarged to 64x64x64. The specific deconvolution operation formula is as follows:

[0080] Among them, represents the deconvolution operation.

[0081] Finally, through an output layer (Output Layer) with a Sigmoid activation function, the feature map is mapped to a detection heat map of 64x64x1, where each pixel value represents the probability of a defect at that position. The specific formula is as follows:

[0082] Among them, σ is the Sigmoid activation function, and P defect is the defect probability map.

[0083] To improve the inference speed and deployment efficiency of the model, the present invention adopts two optimization strategies: pruning and quantization. Specifically, the pruning strategy screens low-weight channels through L1 regularization, reduces the number of model parameters and computational complexity, thereby significantly improving the inference speed. The specific pruning formula is as follows:

[0084] Among them, W is the weight, λ is the threshold, and W pruned is the pruned weight.

[0085] The quantization strategy adopts INT8 quantization, quantizes the weights and activation functions of the model from floating-point numbers (FP32) to 8-bit integers (INT8), reduces the storage requirements and computational complexity of the model, and makes it more suitable for deployment on embedded devices. The specific quantization formula is as follows:

[0086] Among them, Quantize represents the quantization operation, round represents the rounding operation, and W quantized is the quantized weight.

[0087] Furthermore, through the above method, the required global feature vector can be finally obtained. At the same time, the required global feature information can be extracted in real time from the inside of the current global feature vector. Based on this, it is possible to finally objectively and accurately judge whether there are defects, corresponding to an improvement in work efficiency.

[0088] Please refer to Figure 2 , the third embodiment of the present invention provides: An industrial component defect detection system, wherein the system includes: An acquisition module for real-time acquisition of original industrial component images and preprocessing the original industrial component images to generate corresponding target industrial component images in real time; An extraction module for performing feature extraction processing on the target industrial component images based on preset rules to generate corresponding initial feature maps in real time, and performing max pooling processing on the initial feature maps to generate corresponding target feature maps in real time; A processing module for performing global average pooling processing on the target feature maps to output corresponding target feature vectors in real time, and performing linear transformation processing on the target feature vectors to generate corresponding global feature vectors in real time; A judgment module for extracting global structure information corresponding to the original industrial component image from the global feature vectors in real time, and judging in real time whether there are defects in the original industrial component image according to the global structure information.

[0089] Further, the extraction module is specifically used for: When the target industrial component image is acquired in real time, input the target industrial component image into a preset convolutional layer correspondingly, and detect the original number of channels corresponding to the target industrial component image in real time; In the preset convolutional layer, map the original number of channels to the target number of channels correspondingly, and perform convolutional processing on the target industrial component image through the preset convolutional layer based on the target number of channels to generate the initial feature map, and the target industrial component image is unique.

[0090] Further, the extraction module is specifically used for: In the preset convolutional layer, detect the original spatial dimension corresponding to the target industrial component image in real time, and perform a convolutional operation with a stride of 2 on the original spatial dimension through the preset convolutional layer to generate a corresponding target spatial dimension in real time; Perform adaptive adjustment processing on the target industrial component image through the target number of channels and the target spatial dimension to generate the initial feature map in real time, and both the target number of channels and the target spatial dimension contain specific numerical values.

[0091] Further, the expression of the algorithm for performing a convolutional operation with a stride of 2 on the original spatial dimension through the preset convolutional layer is:

[0092] Where Fconv D represents the target spatial dimension, W represents the convolution kernel weight, I represents the original spatial dimension, b represents the bias term, σ represents the activation function, and * represents the convolution operation.

[0093] Furthermore, the expression of the algorithm for performing max pooling on the initial feature map is:

[0094] where max represents taking the maximum value within the local window, F conv (i, j) represents the initial feature map, and F pool represents the target feature map.

[0095] Furthermore, the processing module is specifically configured to; When the target feature map is obtained in real time, a target three-dimensional space adapted to the target feature map is created in real time through a preset program; In the target three-dimensional space, the spatial dimension corresponding to the target feature map is detected in real time, and global average calculation is performed on the target feature map according to the spatial dimension and a preset algorithm to correspondingly output the target feature vector.

[0096] Furthermore, the expression of the preset algorithm is:

[0097] where F GAP represents the target feature vector, F(i, j) represents the feature value of the target feature map at position (i, j), and H and W are the height and width of the target feature map respectively.

[0098] The fourth embodiment of the present invention provides a computer, including a memory, a processor, and a computer program stored on the memory and executable on the processor. Among them, when the processor executes the computer program, the industrial component defect detection method described above is implemented.

[0099] The fifth embodiment of the present invention provides a readable storage medium, on which a computer program is stored. Among them, when the program is executed by a processor, the industrial component defect detection method described above is implemented.

[0100] In summary, the industrial component defect detection method and system provided in the above embodiments of the present invention can effectively avoid complex calculations and data, thereby being able to quickly and effectively complete defect detection and correspondingly improving work efficiency.

[0101] It should be noted that the above-mentioned modules can be functional modules or program modules, and can be implemented either by software or by hardware. For the modules implemented by hardware, the above-mentioned modules can be located in the same processor; or the above-mentioned modules can also be located in different processors respectively in any combined form.

[0102] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in conjunction with these instruction execution systems, apparatuses, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0103] More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or otherwise processing it as appropriate, and then storing it in a computer memory.

[0104] It should be understood that each part of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well-known in the art can be used: discrete logic circuits with logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits with suitable combinational logic gate circuits, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0105] In the description of this specification, the descriptions referring to terms such as "one embodiment", "some embodiments", "examples", "specific examples", or "some examples", etc., mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic expressions of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0106] The above-described embodiments only express several implementation manners of the present invention, and their descriptions are relatively specific and detailed, but should not be construed as limiting the scope of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.

Claims

1. An industrial component defect detection method, characterized in that, The method includes: Collecting original industrial component images in real time, and preprocessing the original industrial component images to generate corresponding target industrial component images in real time; Performing feature extraction processing on the target industrial component images based on preset rules to generate corresponding initial feature maps in real time, and performing max pooling processing on the initial feature maps to generate corresponding target feature maps in real time; Performing global average pooling processing on the target feature maps to output corresponding target feature vectors in real time, and performing linear transformation processing on the target feature vectors to generate corresponding global feature vectors in real time; Extracting global structure information corresponding to the original industrial component images from the global feature vectors in real time, and judging in real time whether there are defects in the original industrial component images according to the global structure information.

2. The industrial component defect detection method according to claim 1, wherein: The step of performing feature extraction processing on the target industrial component images based on preset rules to generate corresponding initial feature maps in real time includes: When the target industrial component images are obtained in real time, inputting the target industrial component images into a preset convolutional layer correspondingly, and detecting the original number of channels corresponding to the target industrial component images in real time; In the preset convolutional layer, mapping the original number of channels to the target number of channels correspondingly, and performing convolutional processing on the target industrial component images through the preset convolutional layer based on the target number of channels to generate the initial feature maps in real time, and the target industrial component images are unique.

3. The industrial component defect detection method according to claim 2, characterized in that: The step of performing convolutional processing on the target industrial component images through the preset convolutional layer based on the target number of channels to generate the initial feature maps in real time includes: In the preset convolutional layer, detecting the original spatial size corresponding to the target industrial component images in real time, and performing a convolutional operation with a stride of 2 on the original spatial size through the preset convolutional layer to generate a corresponding target spatial size in real time; Performing adaptive adjustment processing on the target industrial component images through the target number of channels and the target spatial size to generate the initial feature maps in real time, and both the target number of channels and the target spatial size include specific numerical values.

4. The industrial component defect detection method according to claim 3, characterized in that: The expression of the algorithm for performing a convolutional operation with a stride of 2 on the original spatial size through the preset convolutional layer is: Among them, F conv represents the target spatial dimension, W represents the convolutional kernel weight, I represents the original spatial dimension, b represents the bias term, σ represents the activation function, and * represents the convolution operation.

5. The industrial component defect detection method according to claim 1, characterized in that: The expression of the algorithm for performing max pooling processing on the initial feature maps is: Among them, max represents taking the maximum value within the local window, and F conv (i, j) represents the initial feature map, and F pool represents the target feature map.

6. The industrial component defect detection method according to claim 1, characterized in that: The step of performing global average pooling processing on the target feature maps to output corresponding target feature vectors in real time includes; When the target feature maps are obtained in real time, creating a target three-dimensional space adapted to the target feature maps in real time through a preset program; In the target three-dimensional space, detecting the spatial dimension corresponding to the target feature maps in real time, and performing global average calculation on the target feature maps according to the spatial dimension and a preset algorithm to output the target feature vectors correspondingly.

7. The industrial component defect detection method according to claim 6, characterized in that: The expression of the preset algorithm is: Among them, F GAP represents the target feature vector, F(i, j) represents the feature value of the target feature map at the position (i, j), and H and W are the height and width of the target feature map respectively.

8. An industrial component defect detection system, characterized in that, The system includes: A collection module, configured to collect original industrial component images in real time, and preprocess the original industrial component images to generate corresponding target industrial component images in real time; An extraction module, configured to perform feature extraction processing on the target industrial component image based on a preset rule to generate a corresponding initial feature map in real time, and perform max pooling processing on the initial feature map to generate a corresponding target feature map in real time; A processing module, configured to perform global average pooling processing on the target feature map to output a corresponding target feature vector in real time, and perform linear transformation processing on the target feature vector to generate a corresponding global feature vector in real time; A judgment module, configured to extract global structure information corresponding to the original industrial component image from the global feature vector in real time, and judge in real time whether there are defects in the original industrial component image according to the global structure information.

9. A computer, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the industrial component defect detection method according to any one of claims 1 to 7.

10. A readable storage medium, on which a computer program is stored, characterized in that, When the program is executed by the processor, it implements the industrial component defect detection method according to any one of claims 1 to 7.