Industrial part defect detection method based on multi-scale feature fusion
By dividing the surface optical image of industrial parts into image blocks in a local coordinate system, extracting and fusing deep and intermediate feature maps, and performing rotational alignment, the problem of low accuracy in defect detection of complex parts is solved, and high-precision defect detection is achieved.
Patent Information
- Application Number
- CN202610140186.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-02
- Publication Date
- 2026-03-06
- Estimated Expiration
- 2046-02-02
AI Technical Summary
Existing methods for detecting defects in industrial parts suffer from problems such as decreased model generalization ability, high false negative rate, incomplete defect identification, and inaccurate positioning when dealing with precision parts with complex three-dimensional structures and posture deviations, making it difficult to meet the requirements of high-precision quality inspection.
The surface optical image of the part to be inspected is divided into image blocks in multiple local coordinate systems. Deep and medium-level feature maps are extracted, and a fused feature map is generated through semantic enhancement and multi-scale fusion. After rotation and alignment, defect detection is performed by combining the defect prior feature vector.
It achieves high-precision defect detection of complex parts, eliminates the sensitivity of detection direction introduced by posture changes and local deformation, and generates complete and continuous pixel-level defect classification and location maps.
Smart Images

Figure CN121616587A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image detection technology, and in particular to a method for detecting defects in industrial parts based on multi-scale feature fusion. Background Technology
[0002] In existing automated visual inspection technologies for industrial parts, semantic segmentation and object detection methods based on deep learning have become mainstream. However, these methods face inherent limitations when dealing with precision parts with complex three-dimensional structures and potential pose deviations during imaging.
[0003] Traditional methods typically perform global processing on the entire part image. When the part is rotated as a whole or warped locally during assembly or imaging, the visual representation of defects (especially linear cracks and directional scratches) will change directionally, leading to a decrease in the generalization ability and an increase in the false negative rate of models trained based on fixed-directional features. Secondly, although existing network architectures based on multi-scale feature fusion (such as FPN and U-Net variants) can integrate global semantics and local details, their fusion process lacks explicit modeling of the part's own geometric topology and physical characteristics. This results in incomplete identification and inaccurate localization of large defects spanning image blocks or small defects at block edges. The final output defect map has problems such as breakage, ghosting, or inconsistent boundaries, making it difficult to meet the needs of high-precision industrial quality inspection. Summary of the Invention
[0004] This invention provides a method for detecting defects in industrial parts based on multi-scale feature fusion, the main purpose of which is to solve the problem of low accuracy in detecting defects in industrial parts.
[0005] To achieve the above objectives, this invention provides a method for detecting defects in industrial parts based on multi-scale feature fusion, comprising:
[0006] Acquire a surface optical image of the industrial part to be inspected, use the geometric center of the industrial part to be inspected as a reference, divide the surface optical image into multiple non-overlapping image blocks, and construct a local coordinate system corresponding to each image block;
[0007] Deep feature maps and mid-level feature maps are extracted from each image patch. Feature upsampling is performed on the deep feature maps to obtain semantic enhancement feature maps. Channel recalibration is performed on the semantic enhancement feature maps based on the channel attention weights of the mid-level feature maps to generate semantic guidance feature maps.
[0008] The deep feature map, the semantic guidance feature map, and the mid-layer feature map are fused at multiple scales to generate a fused feature map.
[0009] The rotation direction between the fused feature map of each image block and the pre-acquired defect prior feature vector is analyzed. In the local coordinate system, a multi-angle rotation alignment operation with the center of the industrial part to be inspected as the center is performed on each image block according to the rotation direction to obtain the defect detection result of each image block.
[0010] The defect detection results of all image blocks are fused to obtain a pixel-level defect classification and location map of the industrial part to be inspected.
[0011] This invention divides the image into multiple image blocks in local coordinate systems based on the part's center, ensuring that the analysis of each local region is strictly correlated with the overall geometric topology of the part. By analyzing the rotation direction between the fused feature map and the prior feature vector of the defect, and performing a rotation alignment operation centered on the part's center on each image block, the sensitivity of the detection direction caused by changes in part posture or local deformation is effectively eliminated, making the identification of directional defects more stable and reliable. The fused feature map generated after semantically guided calibration and fusion of multi-scale features possesses both rich semantic discriminative power and detail resolution. Finally, the detection results of all image blocks are fused based on confidence and geometric consistency in a unified global coordinate system, effectively correcting the problems of defect breakage and edge misalignment caused by block division, and generating a complete, continuous, and high-precision pixel-level defect classification and location map. Therefore, the multi-scale feature fusion-based industrial part defect detection method proposed in this invention can solve the problem of low accuracy in industrial part defect detection. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating a method for detecting defects in industrial parts based on multi-scale feature fusion, as provided in an embodiment of the present invention.
[0013] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0014] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0015] This application provides a method for detecting defects in industrial parts based on multi-scale feature fusion. The execution entity of this method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the method for detecting defects in industrial parts based on multi-scale feature fusion can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0016] Reference Figure 1 The diagram shown is a flowchart illustrating a method for detecting defects in industrial parts based on multi-scale feature fusion, according to an embodiment of the present invention. In this embodiment, the method for detecting defects in industrial parts based on multi-scale feature fusion includes:
[0017] S1. Obtain the surface optical image of the industrial part to be inspected, take the geometric center of the industrial part to be inspected as the reference, divide the surface optical image into multiple non-overlapping image blocks, and construct a local coordinate system corresponding to each image block.
[0018] In this embodiment of the invention, the industrial parts to be inspected refer to various structural parts that require surface defect detection in industrial production, including but not limited to machined gears, automobile engine blocks, aerospace connectors, etc.; the surface optical image refers to the grayscale or color digital image of the part acquired by an industrial linear or area array CCD camera under uniform illumination conditions.
[0019] In detail, the surface gloss image of the industrial part to be inspected can be obtained from a pre-stored storage area using computer statements with data capture capabilities (such as Java statements, Python statements, etc.), where the storage area includes, but is not limited to, databases and blockchains.
[0020] In this embodiment of the invention, an image block refers to a rectangular sub-region segmented from the entire image; the local coordinate system is a two-dimensional Cartesian coordinate system, which is independently defined for each image block and is used to describe the positional relationship of pixels within the block.
[0021] In this embodiment of the invention, the step of using the geometric center of the industrial part to be inspected as a reference, dividing the surface optical image into multiple non-overlapping image blocks, and constructing a local coordinate system corresponding to each image block includes:
[0022] Based on the three-dimensional model topology of the industrial part to be inspected, the surface optical image is mapped to a two-dimensional unfolded image;
[0023] Based on the distribution of functional area boundaries and stress concentration areas on the surface of the industrial part to be inspected, the two-dimensional unfolded image is divided into a non-uniform grid to obtain multiple non-overlapping image blocks.
[0024] A local coordinate system with its own centroid as the origin is established for each divided image block, and the axis of the local coordinate system is aligned and calibrated with the principal stress direction or typical texture direction of the industrial part to be inspected in the corresponding area to obtain the local coordinate system corresponding to each image block.
[0025] In detail, the geometric center refers to the coordinates of the center point calculated based on the design parameters of the 3D model of the part. The geometric center can be solved by the average coordinates of the vertices of the 3D model. The topology of the 3D model is obtained by parsing the 3D design file of the part in STEP format. The topology refers to the connection relationships and geometric composition of the vertices, edges, and faces in the 3D model. The computer-aided design 3D model of the part to be inspected is loaded. Using the parametric surface information of this 3D model, the 3D surface of the part is mapped to a 2D parametric plane using the UV unfolding algorithm, generating a 2D unfolded image. That is, through a texture mapping algorithm, the acquired surface optical image is precisely mapped to the corresponding position in the 2D unfolded image according to the correspondence between the surface elements of the 3D model and the 2D unfolded image, thus establishing a one-to-one correspondence between the points on the 3D part surface and the pixels of the 2D image. For example, the axial unfolding method is used for cylindrical surfaces, the sector unfolding method for conical surfaces, and the triangular piecewise approximate unfolding method for complex free-form surfaces. For a cylindrical bearing ring, its outer cylindrical surface can be unfolded into a rectangular 2D image, thus converting the surrounding curved surface image into a planar image for processing, eliminating the influence of surface deformation on subsequent analysis.
[0026] Specifically, instead of uniform meshing, the obtained two-dimensional unfolded diagram is analyzed by identifying different functional area boundaries, such as sealing surfaces, areas around mounting holes, and raceway surfaces, based on the part's design knowledge. Simultaneously, by combining finite element analysis simulation results or empirical data, stress concentration areas of the part under typical operating conditions are identified, such as fillet transitions and groove bottoms. During mesh generation, denser meshing is used in critical functional areas and stress concentration areas to generate smaller image blocks, thereby achieving higher spatial resolution analysis in these defect-prone areas; sparser meshing is used in non-critical or flat areas. For example, in the bearing raceway area, which is prone to fatigue spalling, it is divided into dense small image blocks; while in the non-fitting area of the bearing end face, it is divided into larger image blocks, thus optimizing the allocation of computational resources and focusing on critical areas.
[0027] Furthermore, for each image block obtained from the subdivision, the average value of all its pixel coordinates is calculated to obtain the centroid of the image block, which is then used as the origin of its local coordinate system. The principal stress direction of the corresponding 3D region under the main stress state is obtained, or the typical texture direction of the region in a defect-free sample image (such as the forging streamline direction) is analyzed. The X-axis or Y-axis of the local coordinate system is adjusted to be parallel to the principal stress direction or texture direction. For example, for an image block located on a stressed rib of a part, the X-axis of its local coordinate system is set to be consistent with the principal stress direction of the rib (usually the length direction of the rib), providing a clear physical reference for subsequent feature extraction and rotation analysis, and enhancing the sensitivity to defects with directional characteristics (such as cracks along the principal stress direction).
[0028] Furthermore, a set of image blocks closely integrated with the physical structure of the parts was obtained. Each image block has a local coordinate system with a specific physical orientation, thus laying the foundation for subsequent refined feature analysis and defect matching in each independent and physically meaningful sub-region.
[0029] S2. Extract the deep feature map and the mid-level feature map of each image block, perform feature upsampling on the deep feature map to obtain the semantic enhancement feature map, and perform channel recalibration on the semantic enhancement feature map based on the channel attention weight of the mid-level feature map to generate the semantic guidance feature map.
[0030] In this embodiment of the invention, a deep feature map refers to a feature tensor extracted through deep convolutional layers of a neural network. It possesses rich semantic information but has low spatial resolution, enabling the understanding of the global structure of image patches and high-level defect categories. A mid-level feature map refers to a feature tensor extracted through mid-level convolutional layers of a neural network. It retains more spatial detail information but has a lower degree of semantic abstraction, and is sensitive to details such as local textures and edges.
[0031] In this embodiment of the invention, the extraction of deep feature maps and mid-level feature maps for each image patch includes:
[0032] A feature extraction network representing a parallel dual-branch is constructed, and a lateral connection is established between the dual branches. This indicates that the second branch in the feature extraction network can selectively receive semantic gating signals from the first branch or related to the current spatial location during the extraction process.
[0033] The number and weight of convolutional channels of the dual-branch feature extraction network are dynamically adjusted according to the region type of each image patch on the industrial part to be detected and the semantic gating signal.
[0034] The first convolutional kernel in the first branch of the adjusted feature extraction network is used to capture the global structural context of each image patch with deep stacking, and a deep feature map of each image patch is generated based on the global structural context.
[0035] By using the second convolutional kernel and dense connections in the second branch of the adjusted feature extraction network to focus on the local micro-texture and edge details of each image patch, a mid-level feature map is obtained.
[0036] In detail, a parallel dual-branch feature extraction network refers to a neural network containing two structurally independent and parallel feature extraction branches. It employs an improved parallel dual-branch encoder architecture. The first branch (deep branch) focuses on global structural feature extraction, consisting of several stacked convolutional and pooling layers using larger convolutional kernels (e.g., 5x5, 7x7), aiming to rapidly expand the receptive field and capture the global structure of image patches. The second branch (mid-level branch) focuses on local detail feature extraction, composed of multiple densely connected blocks using second convolutional kernels (e.g., 3x3), aiming to preserve fine spatial details from the first branch. The two branches are not completely independent; lateral connections are established at specific network layers. This connection includes a semantic gating mechanism: First, global average pooling and a lightweight fully connected layer are applied to the feature map output by the first branch at this layer to generate a semantic context vector; then, this vector is passed through a sigmoid activation function to generate a gating signal; finally, this gating signal is multiplied channel-by-channel with the feature map of the corresponding layer of the second branch, so that when the second branch extracts details, it can adaptively enhance or suppress the detail response of certain channels according to the global semantic context provided by the first branch. For example, it can suppress texture detail noise in areas that are suspected to be smooth backgrounds and enhance the detail response in areas that are suspected to be defect edges.
[0037] Specifically, based on the region type identified when dividing the image patch (such as the raceway surface or mounting hole edge), a region type encoding vector is provided to the network. Simultaneously, combining the complexity of the current image patch content reflected by the generated semantic gating signal, a small adjustment network dynamically generates two sets of weight coefficients, which are applied to the convolutional channel counts of the first and second branches, respectively. For example, for regions like the raceway surface that are sensitive to minor peeling defects, the channel weights of the second branch (detail branch) are increased, and the channel weights of the first branch may be fine-tuned based on the semantic gating signal (if the signal indicates complex content), such as final weight = base weight × (semantic gating signal value + 0.5). This allows the feature extraction network to adaptively allocate feature representation capacity according to task requirements. The semantic gating signal refers to the signal used to control information transmission, selectively allowing semantic information from the first branch to be passed to the second branch according to the current feature extraction needs; it is essentially a weight coefficient vector between 0 and 1.
[0038] Furthermore, the first convolutional kernel refers to a large-sized convolutional kernel used to expand the receptive field and capture global feature information; deep stacking refers to superimposing multiple convolutional layers with pooling layers, achieving deep abstraction of features through progressive computation of multiple network layers. Global structural context refers to the feature information in an image patch that reflects the overall structural relationship, such as the distribution of holes and contour morphology on the surface of a part. The preprocessed image patch is input into a dynamically adjusted feature extraction network. The first branch, through its first convolutional kernel and deep structure, gradually abstracts the image content, ultimately outputting a tensor with a small spatial size but a large number of channels, containing rich global semantic information—the deep feature map. This feature map can effectively characterize whether the image patch contains defects and the approximate category of the defects. For example, in the adjusted first branch network, the image patch is first convolved with a 7×7 first convolutional kernel with a stride of 2, covering 1 / 4 of the image patch's receptive field to initially capture a large range of structural features. Then, two 3×3 convolutional layers refine the features, followed by max pooling layers (2×2 kernels) to reduce spatial resolution and retain key features. Next, three deeply stacked convolutional layers (each with a 3×3 kernel and 64, 128, and 256 channels respectively) perform deep abstraction of the features, gradually extracting global structural context information. Finally, a 1×1 convolutional layer compresses the feature channels to 64 dimensions, generating a deep feature map of size 32×32×64. Simultaneously, the second branch works in parallel, utilizing its second convolutional kernel and dense connections. The second convolutional kernel is a smaller kernel used to accurately capture detailed features in local areas, while dense connections establish fully connected relationships between network layers, with each layer's input containing the outputs of all previous layers to fully utilize shallow detailed features. Detailed features are extracted and fused across multiple scales, ultimately outputting a tensor with higher spatial resolution and richer details than the deep feature map—the mid-level feature map. Due to the modulation from the semantic gating signal from the first branch, the details retained in this mid-level feature map are more discriminative and correlated with global semantics. Local micro-texture refers to the subtle lines on the surface of the part, such as machining marks and scratches; edge details refer to the boundary contours of different areas on the surface of the part, such as the edges of holes and grooves.
[0039] Furthermore, after extracting deep and mid-level feature maps, their different spatial resolutions prevent direct and effective feature interaction and fusion. Deep feature maps possess strong semantics but coarse spatial information, while mid-level feature maps are rich in detail but lack high-level semantic guidance. Therefore, it is necessary to upsample the deep feature maps to match the resolution and utilize information from the mid-level feature maps for guidance and enhancement.
[0040] In this embodiment of the invention, the semantically enhanced feature map refers to the feature map after resolution restoration and incorporation of detailed information from the deep feature map.
[0041] In this embodiment of the invention, the step of upsampling the deep feature map to obtain a semantically enhanced feature map includes:
[0042] The deep feature map is convolved pointwise to generate spatially adaptive upsampling kernel parameters;
[0043] Using the spatially adaptive upsampling kernel parameters, irregular interpolation is performed on each local region of the deep feature map to obtain an initial upsampling feature map;
[0044] Extract the high-frequency detail guiding signal from the middle layer feature map, and fuse the initial upsampled feature map with the high-frequency detail guiding signal element by element to generate a detail-enhanced feature map;
[0045] The detail-enhanced feature map is subjected to feature pyramid pooling to obtain multiple contextual features at different scales. The multiple contextual features at different scales are then fused to generate a semantic-enhanced feature map.
[0046] In detail, pointwise convolution refers to performing a convolution operation on a deep feature map using a 1×1 kernel. This is used to fuse feature channels and adjust dimensions without changing the spatial size of the feature map. Unlike traditional fixed interpolation kernels (such as bilinear) upsampling, it employs a learnable and spatially adaptive upsampling method. A pointwise convolutional layer (1x1 convolution) is applied to the deep feature map. The number of output channels of this convolutional layer depends on the desired upsampling factor and kernel size. For example, to perform a 2x upsampling and use a 3x3 interpolation kernel, the number of output channels is 2x2x3x3=36. These 36 parameters are rearranged to generate an independent 3x3 upsampling kernel parameter for each spatial location on the deep feature map. That is, regions with different semantic content will use different kernels for upsampling; for example, a smooth kernel is used in smooth regions, and a kernel that sharpens edges is used in edge regions.
[0047] Specifically, the local region refers to a 3×3 neighborhood region centered on each pixel in the deep feature map. Based on a dedicated upsampling kernel generated at each location, a convolution operation is performed on the corresponding local region of the deep feature map. For example, the sum of the products of the 9 pixel feature values and the corresponding upsampling kernel weights is calculated to obtain the upsampled coordinates. The pixel feature values are used to perform irregular interpolation on all pixels in the deep feature map, thereby enlarging the deep feature map to the same spatial size as the middle feature map, resulting in an initial upsampled feature map. This allows for better preservation and recovery of semantically relevant structural information during the upsampling process. From the middle feature map, high-frequency components are extracted as detail guiding signals using a high-pass filter (such as Laplacian operator convolution) or a shallow convolutional network. These high-frequency detail guiding signals are feature signals extracted from the middle feature map that reflect high-frequency information such as edges and textures. The initial upsampled feature map is then element-wise added to or concatenated with these detail guiding signals, followed by convolution to achieve fusion. This results in the upsampled feature map not only recovering the structure but also embedding real detail textures from the middle features, generating a detail-enhanced feature map. Feature pyramid pooling is then performed on the detail-enhanced feature map, using multiple pooling windows of different sizes (e.g., 1x1, 2x2, 4x4) to obtain feature vectors of different scales. The feature vector is restored to its original size by upsampling or interpolation, then concatenated with the original detail-enhanced feature map, and finally fused through a convolutional layer. This aggregates multi-scale contextual information, enabling the generated semantically enhanced feature map to simultaneously possess rich details, clear structure, and multi-scale contextual awareness.
[0048] Furthermore, after obtaining the semantically enhanced feature map, although it incorporates details, the importance of each channel feature is equal. To further optimize its feature representation, it is necessary to recalibrate it using the channel importance information contained in the mid-level feature map, thereby generating a more accurate semantically guided feature map.
[0049] In this embodiment of the invention, the channel attention weight is a vector, where each element corresponds to a feature. Figure 1 The importance score for each channel. The semantically guided feature map refers to the feature map after channel attention recalibration, in which semantic and detailed information are optimized and fused.
[0050] In this embodiment of the invention, the step of performing channel recalibration on the semantic enhancement feature map based on the channel attention weights of the mid-layer feature map to generate a semantic guidance feature map includes:
[0051] The mid-layer feature map is aggregated by both global average pooling and global max pooling to obtain an aggregated feature vector. The aggregated feature vector is then converted into initial channel attention weights using a multilayer perceptron with a preset bottleneck structure.
[0052] Extract the global semantic importance vector from the semantically enhanced feature map, and perform a gated multiplication of the initial channel attention weights with the global semantic importance vector to generate enhanced channel attention weights;
[0053] The enhanced channel attention weights are used as modulation coefficients to reweight each channel of the semantically enhanced feature map;
[0054] The reweighted feature map is added to the edge structure features in the middle layer feature map by means of a preset residual connection, and the added features are activated by means of a preset activation function to generate a semantically guided feature map.
[0055] In detail, global average pooling and global max pooling are performed on the mid-layer feature maps in the spatial dimension, respectively, to obtain two vectors summarizing global information. These two vectors are added or concatenated and then input into a multilayer perceptron with a bottleneck structure. This perceptron compresses the number of channels to 1 / r (where r is the compression ratio, e.g., 16) through a fully connected layer, performs ReLU activation, and then restores the original number of channels through another fully connected layer. Finally, a sigmoid activation function is used to generate a vector with values between 0 and 1, which is the initial channel attention weight. This weight reflects the importance of each feature channel to the content of the current image patch from the perspective of mid-layer details. Simultaneously, global average pooling is performed on the semantic enhancement feature map, and a separate lightweight fully connected layer is used to generate a vector reflecting its own global semantic distribution, i.e., the global semantic importance vector. The initial channel attention weights are multiplied element-wise with the global semantic importance vector (gating operation), thereby utilizing the global semantic distribution of the semantic enhancement feature map itself to verify and modulate the channel importance evaluation from the mid-level features. This avoids the local noise of the mid-level features affecting the accuracy of weight allocation, thus generating more robust and accurate enhanced channel attention weights.
[0056] Specifically, modulation coefficients refer to the coefficients used to adjust the intensity of feature channels, i.e., enhanced channel attention weights. These enhanced channel attention weights are treated as a modulation coefficient vector and multiplied channel-wise with the semantically enhanced feature map. High-importance channel features are enhanced, while low-importance channel features are suppressed. This refines the semantically enhanced feature map along the channel dimension, making its feature representation more focused on information most relevant to the current image patch content. To further enhance spatial details, significant edge structure features are extracted from the mid-layer feature map using an edge detection convolution kernel. The channel-reweighted feature map is then element-wise added to the extracted edge structure features through a residual connection (i.e., a skip connection). The sum is passed through a non-linear activation function (such as ReLU) to output the final semantically guided feature map. This feature map integrates optimized and calibrated deep semantic information with strong edge structure information from the mid-layer. The edge structure features refer to structural features such as the edges and contours of the part surface extracted from the mid-layer feature map, providing a highly discriminative feature representation for subsequent defect matching.
[0057] Furthermore, three feature maps with different focuses were generated for each image patch: deep feature map (global semantics), mid-level feature map (local details), and semantically guided feature map (optimization fusion). In order to make comprehensive use of this multi-scale and multi-semantic level information, the different feature maps were deeply fused.
[0058] S3. The deep feature map, the semantic guidance feature map, and the mid-level feature map are fused at multiple scales to generate a fused feature map.
[0059] In this embodiment of the invention, the fused feature map refers to the feature map obtained after multi-scale feature fusion that can comprehensively reflect the surface defect information of the part, and has global semantics, local details and edge structure characteristics.
[0060] In this embodiment of the invention, the step of multi-scale fusion of the deep feature map, the semantic guidance feature map, and the mid-level feature map to generate a fused feature map includes:
[0061] The deep feature map, the semantic guidance feature map, and the mid-layer feature map are respectively input into the spatial attention module to generate their respective spatial importance masks;
[0062] Based on the spatial importance mask, the deep feature map, the semantic guidance feature map, and the mid-layer feature map are weighted and summed to obtain preliminary fused features;
[0063] The preliminary fusion features are fused using a pre-constructed fusion decision network to obtain a pixel-level fusion weight map for the three channels;
[0064] The deep feature map, the semantic guidance feature map, and the mid-layer feature map are subjected to pixel-level soft selection and mixing based on the pixel-level fusion weight map to generate a fusion feature map.
[0065] In detail, the spatial importance mask is a matrix with the same spatial dimensions as the feature map, where the value at each position represents the importance of that spatial location in the corresponding feature map. An identical spatial attention module is configured for each input feature map (deep, semantically guided, and mid-level). This module typically consists of a single-channel dimensionality-reduced convolution, a convolution for calculating spatial attention (or using a self-attention mechanism), and a sigmoid activation function. The spatial attention module takes a given feature map as input and outputs a single-channel mask where each pixel value is between 0 and 1, indicating the strength or importance of the feature response at that location. For example, for a semantically guided feature map, it will produce a high response in the edge region of a potential defect, and the corresponding spatial importance mask value in that region will be close to 1. For instance, in the spatial importance mask corresponding to a deep feature map, the value is higher in the central region of the part structure (e.g., 0.9) and lower in the edge region (e.g., 0.3); in the mask of a semantically guided feature map, the value is higher in areas where defects may exist; and in the mask of a mid-level feature map, the value is higher in areas with rich edge details.
[0066] Specifically, the preliminary fusion features are intermediate features obtained after weighted summation. The three generated spatial importance masks are element-wise multiplied with their corresponding original feature maps, reweighting the spatial dimensions of each feature map. Then, the three spatially weighted feature maps are element-wise summed to obtain the preliminary fusion features, thus achieving primary fusion based on the spatial activation levels of each feature map. The fusion decision network is a small neural network used to learn and generate pixel-level fusion weights. The pixel-level fusion weight map is a three-channel weight tensor, with each channel corresponding to a fusion weight of an input feature map at each pixel. The fusion decision network can consist of several consecutive convolutional layers and a final sigmoid activation layer. The obtained preliminary fusion features are input into the fusion decision network. The goal of the fusion decision network is to determine, based on the content of the preliminary fusion features at each pixel, whether the final feature representation of that pixel should rely more on deep features, semantically guided features, or mid-level features. The fusion decision network outputs a three-channel feature map, namely a pixel-level fusion weight map, where each pixel position has three weight values, corresponding to the three input feature maps, and the sum of the three weights is 1 (guaranteed by Sigmoid and normalization). For example, in flat background areas of image patches, the network may assign higher weights to deep feature maps; at fine edges of suspected defects, high weights may be assigned to semantically guided feature maps; and in complex texture areas, certain weights may be assigned to mid-level feature maps.
[0067] For example, the initial fusion features (64×64×64) are input into the fusion decision network: high-level semantic information of the fusion features is extracted through depthwise separable convolutional layers, with the number of channels adjusted to 128, 64, and 32 respectively; the feature map is converted into a 32-dimensional vector through global average pooling and input into a fully connected layer. The first fully connected layer (32→64) performs feature expansion, and the second fully connected layer (64→3×64×64) outputs a pixel-level fusion weight map; the three channels of the weight map correspond to the weights of the three types of original feature maps, and the pixel value range in each channel is [0,1], and the sum of the weights of the three channels at each pixel position is 1; for example, the weight map value at a certain pixel position is (0.1, 0.7, 0.2), which means that the contribution of the semantic guidance feature at that position is 70%, the deep feature is 10%, and the mid-level feature is 20%.
[0068] Furthermore, soft selection and fusion refer to the weighted combination of multiple features based on weights. The deep feature map, semantically guided feature map, and mid-level feature map are each element-wise multiplied with the corresponding weight channel in the pixel-level fusion weight map to obtain three weighted feature maps. These three weighted feature maps are then element-wise summed to generate a fusion feature map. This achieves adaptive feature selection and fusion at the pixel level, ensuring that each location is dominated by the most relevant feature source. This generates a fusion feature map that maximizes discriminative power and minimizes information redundancy, serving as a direct basis for subsequent defect matching.
[0069] Furthermore, the fused feature map is a highly abstract and robust representation of the current image patch content. To detect defects, it needs to be compared with known defect patterns. However, direct comparison may fail due to the potential for part rotation. Therefore, this rotation is analyzed and compensated for before precise matching.
[0070] S4. Analyze the rotation direction between the fused feature map of each image block and the pre-acquired defect prior feature vector. In the local coordinate system, perform a multi-angle rotation alignment operation on each image block with the center of the industrial part to be inspected as the center, according to the rotation direction, to obtain the defect detection result of each image block.
[0071] In this embodiment of the invention, the rotation direction refers to the angle direction required to align the current image patch features with the prior defect features in the direction.
[0072] In this embodiment of the invention, the analysis of the rotation direction between the fused feature map of each image patch and the pre-acquired defect prior feature vector includes:
[0073] From the pre-constructed defect knowledge graph, retrieve multiple candidate defect prior feature vectors that are associated with the part region and material properties to which the current image block belongs;
[0074] The fused feature map is compressed into a query feature vector through global pooling;
[0075] Calculate the cosine similarity and angle between the query feature vector and each candidate defect prior feature vector in the multidimensional spherical space;
[0076] Select the candidate defect prior feature vector with the smallest included angle and the cosine similarity exceeding a preset threshold as the target vector, and take the spatial angle direction between the target vector and the query feature vector as the rotation direction;
[0077] When there are no candidate defect prior feature vectors that meet the conditions, the default direction of each image block is calculated based on the local texture principal direction of the image block, and the default direction is set as the rotation direction.
[0078] In detail, the defect knowledge graph is a knowledge base organized with a graph structure. Nodes represent defect feature vectors or types, and edges represent the relationships between them. The prior feature vectors of defects are fixed-dimensional vectors learned from historical defect samples, representing the essential characteristics of a certain type of defect. The defect knowledge graph is constructed offline, storing feature vectors of various defect types (such as cracks, porosity, scratches) under different part regions (such as raceways, end faces) and different materials (such as bearing steel, aluminum alloys). Each feature vector is associated with metadata. When processing an image patch, based on the known part region to which the image patch belongs and the overall material properties of the part, the knowledge graph is queried for nodes with the same or similar metadata, and their associated defect feature vectors are obtained as a candidate set, thus ensuring that the comparison is performed within the most relevant prior knowledge range.
[0079] Specifically, for the fused feature map of the current image patch, a global average pooling operation is performed in the spatial dimension, compressing it into a one-dimensional vector, namely the query feature vector. The query feature vector is a generalized representation of the fused feature map, summarizing the fused feature information of the entire image patch. The multidimensional spherical space is an abstract space where feature vectors are viewed as points on a sphere, and the angle between vectors is used to measure directional differences. The query feature vector and each candidate defect prior feature vector are respectively normalized using the L2 norm to a magnitude of 1, thus projecting them onto the multidimensional spherical space. The cosine similarity (i.e., the dot product) between the query feature vector and each candidate vector is calculated, with a value between -1 and 1; the closer to 1, the more similar the directions. Simultaneously, the spatial angle (inverse cosine value) between them is calculated. For example, the query feature vector... With candidate vectors The cosine similarity is included angle Iterate through all candidate vectors and find the angle between them and the query feature vector. The smallest one. Simultaneously, check if the cosine similarity between this candidate vector and the query feature vector exceeds a preset confidence threshold (e.g., 0.8). If the condition is met, the candidate vector is determined as the target vector. At this point, the direction from the query feature vector to the target vector, i.e., in spherical space, needs to be... Rotate to The same direction of rotation, i.e. the direction information, can be converted into a rotation angle on the image plane, transforming the feature matching problem into an alignment problem in spherical space, and explicitly decoupling the feature content from the feature direction.
[0080] Furthermore, if the cosine similarity of all candidate vectors is below a threshold, it indicates that the features of the current image patch may differ significantly from known defect patterns, or it may be defect-free. In this case, its principal orientation is calculated by analyzing the local texture of the image patch itself (e.g., using a gray-level co-occurrence matrix or gradient histogram), and this orientation is used as the default rotation direction, ensuring that subsequent operations can still be performed even in the absence of explicit prior matching.
[0081] Furthermore, after determining the rotation direction (i.e. the rotation angle that needs to be compensated), a rotation operation with the global center of the part as the physical constraint needs to be performed in the local coordinate system of the image block itself, so that the features of the image block and the target defect features are optimally aligned, thereby achieving accurate matching.
[0082] In this embodiment of the invention, the defect detection result is information such as the location and confidence level of the defect within the image block.
[0083] In this embodiment of the invention, the step of performing a multi-angle rotation alignment operation on each image block in the local coordinate system according to the rotation direction, with the center of the industrial part to be inspected as the center, to obtain the defect detection result of each image block includes:
[0084] Using the global geometric center of the industrial part to be inspected as the rotation center, calculate the polar coordinates of the origin of the local coordinate system of the current image block relative to the rotation center;
[0085] In the local coordinate system, multiple discrete rotation angles are generated according to the rotation direction;
[0086] Based on the fused feature map of the image block, perform a rotation operation on the affine transformation matrix of each discrete rotation angle to generate a rotation feature map sequence;
[0087] The rotated feature map sequence is spatially convolved and cross-correlated with the target vector to obtain multiple response maps;
[0088] The rotation angle with the highest peak in the response spectrum is selected as the optimal alignment angle, and the position and intensity of the response peak at the optimal alignment angle are used as the preliminary result of defect detection for the image block.
[0089] Non-maximum suppression is applied to the preliminary defect detection results to obtain the defect detection results of the image block.
[0090] In detail, obtain the coordinates of the known global geometric center of the part in the original image. Simultaneously, the coordinates of the local coordinate system origin (i.e., its centroid) of the current image patch in the original image are obtained. Calculate vectors Convert the vector to polar coordinates. ,in It's distance. It is the initial polar angle relative to the global coordinate system, thus establishing the relationship between the local coordinate system of the image patch and the global rotation center.
[0091] Specifically, the rotation direction (assuming it has been quantized into a reference angle) ) as the center, within a smaller range to its left and right (e.g. arrive A series of discrete rotation angles are generated, for example, with a step size of 1 degree. These angles are defined in the local coordinate system of the image patch itself, and the angle range covers the possibility of alignment error.
[0092] In this embodiment of the invention, the rotation feature map sequence refers to a three-dimensional array containing standardized feature maps at multiple rotation angles.
[0093] In this embodiment of the invention, the step of performing a rotation operation on the affine transformation matrix of each discrete rotation angle based on the fused feature map of the image patch to generate a rotation feature map sequence includes:
[0094] Calculate the rotation matrix based on the discrete rotation angle, and calculate the affine transformation matrix based on the rotation matrix and the offset between the local coordinate system origin and the global geometric center.
[0095] The fused feature map is geometrically transformed according to each affine transformation matrix to obtain a rotated feature map.
[0096] Each rotated feature map is filled with edge pixels generated by symmetrical copying, and each channel of each rotated feature map is normalized to obtain a normalized feature map.
[0097] All standardized feature maps generated from the same image block at different rotation angles are stacked according to a preset angle order to obtain a rotation feature map sequence.
[0098] In detail, for each discrete rotation angle The transformation matrix for its rotation around the origin of the local coordinate system is: However, to ensure the rotation operation is physically centered at the global part center O, a composite affine transformation matrix needs to be constructed. This matrix is equivalent to: first, setting the local coordinate system origin... Translate to the global center O (translation matrix T1), then rotate around O. Angle (rotation matrix) Finally, translate the center O back. The position (translation matrix T2). Therefore, the complete affine transformation matrix. This ensures that when the image block rotates, each point on it moves along an arc centered at O, conforming to the physical rotation model of the part. For the fused feature map (considered as a special type of image), the calculated affine transformation matrix is used. Geometric transformations are performed using methods such as bilinear interpolation to generate rotated feature maps. .
[0099] Specifically, since blank areas appear at the corners of the feature map after rotation, a symmetrical copying method is used to fill these areas with pixel values from the feature map edges to maintain the continuity of the feature map's size and boundary information. Next, the rotated feature map... Each channel is independently standardized (e.g., subtracting the mean and dividing by the standard deviation) to eliminate subtle changes in brightness distribution that may be caused by geometric transformations, ensuring the consistency of the numerical distribution of the feature maps at different rotation angles. The standardized rotation feature maps generated for all discrete rotation angles are stacked in batch order according to the angle, forming a feature map sequence (or tensor) with the shape [number of angles, number of channels, height, width]. This yields a sequence of image patch fusion feature maps at a series of rotation angles, i.e., the rotation feature map sequence.
[0100] Furthermore, the rotated feature map sequence is matched spatially with the prior feature vector of the target defect. The target vector (with dimensions of...) The kernel is treated as a 1x1xC convolution kernel through a reshaping operation. This kernel is then combined with a rotated feature map sequence (with dimensions of C). Perform angle-wise spatial convolution (actually a cross-correlation operation). For the feature map at each rotation angle in the sequence, the convolution calculation yields a two-dimensional response map (dimension 1). Finally, N response maps are obtained, forming a response map sequence. High-value regions on the response maps indicate a high degree of spatial matching between the feature map and the target defect pattern at that rotation angle. All response maps are traversed to find the global maximum value (peak) and its location. The rotation angle corresponding to this peak value is recorded. (i.e., the optimal alignment angle), and the spatial coordinates of the peak value on the corresponding response spectrum. and peak intensity .Will This indicates the initial location of the defect in the local coordinate system of the current image patch. As a confidence level indicating the existence of defects, These three factors, together as estimated local rotation compensation, constitute the preliminary defect detection result. Since feature matching may generate multiple local response peaks near the true defect location, a non-maximum suppression algorithm is required. A neighborhood window is set around the preliminary result location, retaining only the peak point with the highest built-in confidence within that neighborhood and suppressing other lower peak points. This yields refined, non-redundant defect location and confidence information, which is the final defect detection result for the image patch.
[0101] Furthermore, each image patch independently performed defect detection under rotation compensation. However, these results are scattered across various local coordinate systems and image patches. To obtain a seamless defect distribution map of the entire part, it is necessary to fuse all local results into a unified global view.
[0102] S5. Fuse the defect detection results of all image blocks to obtain a pixel-level defect classification and location map of the industrial part to be inspected.
[0103] In this embodiment of the invention, the pixel-level defect classification and location map is the final visualization result that includes defect category, location, and contour.
[0104] In this embodiment of the invention, fusing the defect detection results of all image blocks to obtain a pixel-level defect classification and location map of the industrial part to be inspected includes:
[0105] A global image coordinate system is established with the geometric center of the industrial part to be inspected as the origin and the design reference direction of the industrial part to be inspected as the axis.
[0106] The original position of each image block in the surface optical image is identified, and the defect detection result of each image block is mapped back to the global image coordinate system based on the original position to obtain the global defect distribution field;
[0107] For the boundary region in the global defect distribution field that is covered by multiple adjacent image blocks, calculate the spatial distribution confidence of the peak intensity of the fusion feature map response of each image block in the boundary region;
[0108] Based on the spatial distribution confidence, adaptive weight allocation and probability fusion are performed on the defect detection results for different image blocks within the boundary region to generate a global defect probability map that eliminates the boundary effect.
[0109] The boundary region is geometrically constrained and filtered according to the theoretical structural boundary of the industrial part to be inspected to obtain the defect region contour, and the category label of the defect region contour is determined according to the global defect probability map.
[0110] The defect region outline and the category label are superimposed onto the surface optical image to generate a visualized pixel-level defect classification and location map.
[0111] In detail, the global image coordinate system is a unified coordinate system established on the original part image, defined by the part's geometric center and design reference direction. On the original surface optical image, a right-handed coordinate system is established with the part's geometric center as the origin O and the part's design reference direction (e.g., the principal axis direction, the normal direction of a key positioning surface) as the X-axis direction of the global image coordinate system. This coordinate system provides an absolute spatial reference frame for the entire part. For the defect detection result (local coordinate position) of each image block, the local coordinates are transformed back to the actual pixel coordinates of the image block in the original image using the correspondence between the local coordinate system and the original image position. The transformed defect coordinates of all image blocks (and their accompanying confidence and category information) are summarized and projected onto the global image coordinate system, forming a discrete set of defect information covering the entire part image, i.e., the global defect distribution field. The global defect distribution field is a discrete set of defect points or probability distribution formed by mapping all local detection results back to the global coordinates. At this point, in the area where image blocks meet, the same physical defect may be detected by two or more adjacent image blocks, resulting in multiple duplicate or slightly offset detection points that are close in position in the global field.
[0112] Specifically, the analysis focuses on overlapping boundary regions. For each boundary pixel, it traces which image blocks cover it. For each image block covering the pixel, the peak response intensity at the corresponding position (or neighborhood) of the pixel during spatial convolution cross-correlation calculation is obtained. The smoothness and consistency of the spatial distribution of the peak response intensity in the boundary region are analyzed, for example, by calculating its local variance. The smaller the variance, the more stable and reliable the detection result of the image block at this boundary, thus obtaining its spatial distribution confidence, which is an indicator of the reliability of the detection result in the boundary region of the image block. For each pixel within the boundary region, appropriate fusion weights are assigned to them based on the spatial distribution confidence of each image block covering it at that pixel. Image blocks with higher confidence have higher weights. The defect probability estimate given by the image block at that pixel (which can be obtained by normalizing the peak response intensity) is weighted and averaged to obtain the final fused probability that the pixel belongs to a defect. The global defect probability map is obtained by fusion, showing the probability map of each pixel belonging to a defect. For non-boundary regions (i.e., internal regions covered by only one image patch), the detection probability of that image patch is directly used to generate a global defect probability map covering the entire image with a smooth and natural transition at the boundary, effectively eliminating the boundary discontinuity or seam phenomenon caused by independent processing of blocks.
[0113] Furthermore, geometric constraint filtering refers to the process of eliminating unreasonable defect areas using the theoretical structure of a part. The CAD design drawing or theoretical contour mask of the part is loaded, and the generated global defect probability map is compared with the theoretical contour. The probability of suspected defects falling outside the theoretical part area is set to zero. Simultaneously, for connected high-probability regions in the probability map, their boundary contours are obtained using contour extraction algorithms (such as Marching Squares). Based on the category associated with the most matching target defect vector in the defect knowledge graph, a category label (such as crack, porosity) is assigned. The extracted defect region contours and their category labels are rendered and superimposed onto the original optical image of the industrial part surface to be inspected using graphic overlays (such as contour lines of different colors, transparent fill blocks, and text labels). This ultimately generates an intuitive, pixel-level defect classification and location map that quality inspectors can directly interpret, completing the entire automated inspection process. This method is particularly suitable for precision parts with features of rotation or complex three-dimensional structures, exhibiting superior detection consistency, high recall, and low false alarm rate under industrial imaging conditions with strong noise, uneven illumination, and attitude deviations.
[0114] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0115] Therefore, the embodiments should be regarded as exemplary and non-limiting in all respects. The scope of the invention is not limited to the foregoing description, and all variations within the meaning and scope of equivalents falling within the protection scope are intended to be included in the invention.
[0116] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0117] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or systems stated in a system claim may also be implemented by a single unit or system through software or hardware. The terms "first," "second," etc., are used to indicate names and do not indicate any specific order.
[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for detecting defects of industrial parts based on multi-scale feature fusion, characterized in that, The method comprises: acquiring a surface optical image of an industrial part to be detected, taking the geometric center of the industrial part to be detected as a reference, dividing the surface optical image into a plurality of non-overlapping image blocks, and constructing a local coordinate system corresponding to each image block; extracting a deep feature map and a middle feature map of each image block, performing feature upsampling on the deep feature map to obtain a semantic enhanced feature map, and performing channel recalibration on the semantic enhanced feature map based on channel attention weights of the middle feature map to generate a semantic guided feature map; performing multi-scale fusion on the deep feature map, the semantic guided feature map and the middle feature map to generate a fused feature map; analyzing the rotation direction between the fused feature map of each image block and a pre-acquired defect prior feature vector, performing a multi-angle rotation alignment operation with the center of the industrial part to be detected as the center in the local coordinate system according to the rotation direction of each image block to obtain a defect detection result of each image block; fusing the defect detection results of all image blocks to obtain a pixel-level defect classification and positioning map of the industrial part to be detected.
2. The industrial part defect detection method based on multi-scale feature fusion of claim 1, wherein, The method comprises: mapping the surface optical image to a two-dimensional unfolded graph based on the three-dimensional model topology of the industrial part to be detected; performing non-uniform grid division on the two-dimensional unfolded graph according to the distribution of the functional region boundary and the stress concentration region of the surface of the industrial part to be detected to obtain a plurality of non-overlapping image blocks; establishing a local coordinate system with the centroid of each divided image block as the origin, and aligning and calibrating the axis direction of the local coordinate system with the principal stress direction or the typical texture direction of the corresponding region of the industrial part to be detected to obtain a local coordinate system corresponding to each image block.
3. The method of claim 1, wherein the method comprises: The method comprises: constructing a feature extraction network representing parallel double branches, establishing a horizontal connection between the double branches, representing that the second branch in the feature extraction network can selectively receive a semantic gating signal from the first branch or related to the current spatial position during extraction; dynamically adjusting the convolution channel number weight of the feature extraction network of the double branches according to the region type of each image block on the industrial part to be detected and the semantic gating signal; capturing the global structure context of each image block using the first convolution kernel in the first branch of the adjusted feature extraction network, and generating a deep feature map of each image block according to the global structure context; focusing on the local micro-texture and edge details of each image block using the second convolution kernel in the second branch of the adjusted feature extraction network, and obtaining a middle feature map.
4. The method of claim 1, wherein the method comprises: The method comprises: performing point-by-point convolution on the deep feature map to generate spatially adaptive up-sampling kernel parameters; The initial up-sampling feature map is obtained by performing irregular interpolation operation on each local region of the deep feature map using the spatial adaptive up-sampling kernel parameter; The high-frequency detail guide signal in the middle layer feature map is extracted, and the initial up-sampling feature map is element-wise fused with the high-frequency detail guide signal to generate a detail-enhanced feature map; The detail-enhanced feature map is subjected to feature pyramid pooling to obtain a plurality of context features of different scales, and the plurality of context features of different scales are fused to generate a semantic-enhanced feature map.
5. The method of claim 1, wherein the method further comprises: The channel recalibration of the semantic-enhanced feature map is performed based on the channel attention weight of the middle layer feature map to generate a semantic guide feature map, including: The global average pooling and global maximum pooling of the middle layer feature map are aggregated to obtain an aggregated feature vector, and the aggregated feature vector is converted into an initial channel attention weight using a pre-set multi-layer perceptron with a bottleneck structure; The global semantic importance vector of the semantic-enhanced feature map is extracted, and the initial channel attention weight is multiplied with the global semantic importance vector through gating to generate an enhanced channel attention weight; The enhanced channel attention weight is used as a modulation coefficient to re-weight each channel of the semantic-enhanced feature map; The re-weighted feature map is added to the edge structure feature in the middle layer feature map through a pre-set residual connection, and the added features are activated through a pre-set activation function to generate a semantic guide feature map.
6. The method of claim 1, wherein the method further comprises: The multi-scale fusion of the deep feature map, the semantic guide feature map and the middle layer feature map is performed to generate a fusion feature map, including: The deep feature map, the semantic guide feature map and the middle layer feature map are respectively input into a spatial attention module to generate respective spatial importance masks; The deep feature map, the semantic guide feature map and the middle layer feature map are weighted and summed based on the spatial importance masks to obtain a preliminary fusion feature; A pre-constructed fusion decision network is used to perform channel fusion on the preliminary fusion feature to obtain a three-channel pixel-level fusion weight map; The deep feature map, the semantic guide feature map and the middle layer feature map are subjected to pixel-level soft selection and mixing according to the pixel-level fusion weight map to generate a fusion feature map.
7. The method of claim 1, wherein the method further comprises: The rotation direction between the fusion feature map of each image block and the pre-acquired defect prior feature vector is analyzed, including: A plurality of candidate defect prior feature vectors associated with the part area and material attribute to which the current image block belongs are retrieved from a pre-constructed defect knowledge graph; The fusion feature map is compressed into a query feature vector through global pooling; The cosine similarity and included angle of the query feature vector and each candidate defect prior feature vector in a multi-dimensional spherical space are calculated; The candidate defect prior feature vector with the smallest included angle and the cosine similarity exceeding a pre-set threshold is selected as a target vector, and the spatial included angle direction of the target vector and the query feature vector is taken as the rotation direction; The rotation direction between the fusion feature map of each image block and the pre-acquired defect prior feature vector is analyzed, including: A plurality of candidate defect prior feature vectors associated with the part area and material attribute to which the current image block belongs are retrieved from a pre-constructed defect knowledge graph; The fusion feature map is compressed into a query feature vector through global pooling; The cosine similarity and included angle of the query feature vector and each candidate defect prior feature vector in a multi-dimensional spherical space are calculated; The candidate defect prior feature vector with the smallest included angle and the cosine similarity exceeding a pre-set threshold is selected as a target vector, and the spatial included angle direction of the target vector and the query feature vector is taken as the rotation direction; When there is no qualified candidate defect prior feature vector, a default direction of each image block is calculated based on a local texture principal direction of the image block, and the default direction is set as the rotation direction.
8. The method of claim 7, wherein the method further comprises: The method further comprises: performing a multi-angle rotation alignment operation on each image block in the local coordinate system according to the rotation direction, to obtain a defect detection result of each image block. The method further comprises: calculating polar coordinates of the origin of the local coordinate system of the current image block relative to the global geometric center of the industrial part to be detected; The method further comprises: generating a plurality of discrete rotation angles in the local coordinate system according to the rotation direction; The method further comprises: performing a rotation operation on an affine transformation matrix of each discrete rotation angle according to the fusion feature map of the image block, to generate a rotation feature map sequence; The method further comprises: selecting a rotation angle with the highest peak value in the response graph as an optimal alignment angle, and taking a response peak position and intensity at the optimal alignment angle as a defect detection preliminary result of the image block; The method further comprises: performing non-maximum suppression on the defect detection preliminary result, to obtain a defect detection result of the image block. The method further comprises: calculating a rotation matrix according to the discrete rotation angle, and calculating an affine transformation matrix according to the rotation matrix and an offset amount of the origin of the local coordinate system and the global geometric center; 9. The method of claim 8, wherein the method further comprises: The method further comprises: performing geometric transformation on the fusion feature map according to each affine transformation matrix, to obtain a rotated feature map; The method further comprises: padding edge pixels generated by symmetric replication for each rotated feature map, and performing standardization processing on each channel of each rotated feature map, to obtain a standardized feature map; The method further comprises: stacking all standardized feature maps generated at different rotation angles of the same image block in a preset angle sequence, to obtain a rotation feature map sequence. The method further comprises: establishing a global image coordinate system with a geometric center of the industrial part to be detected as an origin and with a design reference direction of the industrial part to be detected as an axis direction; The method further comprises: identifying an original position of each image block in the surface optical image, and mapping the defect detection result of each image block back to the global image coordinate system according to the original position, to obtain a global defect distribution field; 10. The method of claim 1, wherein the method further comprises: The method further comprises: calculating a spatial distribution confidence of a fusion feature map response peak intensity of each image block in a boundary region commonly covered by a plurality of adjacent image blocks in the global defect distribution field; The method further comprises: based on the spatial distribution confidence, performing adaptive weight allocation and probability fusion on the defect detection results of different image blocks in the boundary region, to generate a global defect probability map eliminating a boundary effect. According to a theoretical structure boundary of the industrial part to be detected, the boundary region is geometrically constrained and filtered to obtain a defect region contour, and a category label of the defect region contour is determined according to the global defect probability map; The defect region contour and the category label are superimposed on the surface optical image to generate a visual pixel-level defect classification and positioning map.
Citation Information
Patent Citations
Multi-field part size and appearance defect intelligent detection system
CN120525832A
PCB defect intelligent detection system and method based on image recognition
CN120689582A
Industrial part surface defect detection method and system with robustness
CN121258875A
Neural network-based defect detection method for gluing quality on aircraft skin
US12423796B1
Cited By
Tunnel lining defect look-around detection method
CN121904049A
A bearing deformation measurement method and device based on image recognition
CN122305959A