Intelligent factory quality inspection method and system based on machine vision

By constructing a multimodal feature space and generating differential feature maps, the problem of insufficient feature fusion in existing technologies is solved, thereby improving the accuracy and adaptability of quality inspection.

CN121095210BActive Publication Date: 2026-08-04HIMIT (SHENZHEN) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HIMIT (SHENZHEN) TECH CO LTD
Filing Date
2025-09-04
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

Existing technologies have failed to construct a unified feature space to fuse the features of 3D point cloud images and 2D texture images, resulting in the loss of correlation information between geometric anomalies and texture defects, which affects the accuracy and reliability of quality inspection.

Method used

Multi-angle 3D point cloud images and surface texture images of the target workpiece under different lighting conditions are collected. A multi-modal feature space that integrates geometric shape and micro-texture is constructed through cross-modal feature registration, generating a differential feature map. A comprehensive defect score is calculated through a defect-sensitive region weight model.

Benefits of technology

It achieves a unified representation of geometric morphology and microtexture features, captures the topological correlation patterns between feature vectors at different scales, and improves the accuracy and adaptability of quality inspection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121095210B_ABST
    Figure CN121095210B_ABST
Patent Text Reader

Abstract

The application provides a kind of intelligent factory quality inspection method and system based on machine vision, by collecting the multi-angle three-dimensional point cloud image and corresponding surface texture image of target workpiece under different illumination conditions, obtain multi-source quality inspection data group, carry out cross-modal feature registration, construct multi-modal feature space, carry out discretization processing to multi-modal feature space by grid division algorithm, generate standardized feature vector set, then carry out multi-scale topological structure analysis, calculate the persistent homology group between features to extract the feature correlation mode of different grid units, generate the difference feature atlas describing the difference of space structure, finally call the preset defect sensitive area weight model to carry out area weight weighting processing on the difference feature atlas, calculate to obtain the comprehensive defect score reflecting the overall defect degree of workpiece. Comprehensive defect score can reflect the influence degree of different area structure difference on overall quality, improve the adaptability of quality inspection result and actual production process demand.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of quality inspection and identification, and more specifically, to a smart factory quality inspection method and system based on machine vision. Background Technology

[0002] In the production process of smart factories, the quality inspection stage uses machine vision technology to detect the surface quality of workpieces. Its core lies in extracting the geometric shape and surface texture features of the workpiece from image data to determine the presence of defects. Existing technologies acquire data by separately acquiring 3D point cloud images and 2D texture images. Geometric morphology information is obtained using a coordinate transformation-based registration method, while micro-texture features are extracted using algorithms such as directional gradients. These two types of features are then input into a classification model for defect identification. However, existing methods fail to construct a unified feature space to fuse the inherent correlation between the two types of features, resulting in the loss of information regarding the correlation between geometric anomalies and texture defects. In the feature analysis stage, there is a heavy reliance on calculating local numerical differences, such as judging anomalies through the mean or variance of feature values. This makes it difficult to capture the topological correlation patterns between features in different regions, making it impossible to effectively extract the distribution patterns of overall structural anomalies, thus affecting the accuracy and reliability of quality inspection. Summary of the Invention

[0003] This invention provides a machine vision-based intelligent factory quality inspection method and system.

[0004] In a first aspect, embodiments of the present invention provide a machine vision-based intelligent factory quality inspection method, the method comprising: acquiring multi-angle three-dimensional point cloud images and corresponding surface texture images of a target workpiece under different lighting conditions to obtain a multi-source quality inspection data set containing geometric morphology information and micro-texture features; performing cross-modal feature registration on the multi-source quality inspection data set to construct a multi-modal feature space integrating geometric morphology and micro-texture, wherein the dimension of the multi-modal feature space is positively correlated with the sampling density of the point cloud image and the resolution of the texture image; discretizing the multi-modal feature space using a grid partitioning algorithm to generate a standardized feature vector set with a unified dimension, wherein each vector element of the standardized feature vector set corresponds to a discrete grid cell in the feature space; performing multi-scale topological structure analysis on the standardized feature vector set to calculate the continuous homology group between feature vectors to extract feature association patterns of different grid cells, generating a difference feature map describing spatial structure differences; and calling a preset defect sensitive area weight model to perform regional weight weighting processing on the difference feature map to calculate a comprehensive defect score reflecting the overall defect degree of the workpiece, wherein the numerical range of the comprehensive defect score corresponds to a preset quality inspection pass threshold range.

[0005] Secondly, embodiments of the present invention provide a computer system, including: a memory storing a computer program; and a processor for loading the computer program to implement the machine vision-based intelligent factory quality inspection method as described above.

[0006] The core effect of the machine vision-based intelligent factory quality inspection method provided by this invention lies in the following: By performing cross-modal feature registration on multi-source quality inspection data sets, a multimodal feature space integrating geometric morphology and micro-texture is constructed, achieving a unified representation of geometric morphology and micro-texture features. This allows the originally independent three-dimensional structural information and two-dimensional surface details to form complementary relationships within the same feature space. By performing multi-scale topological structure analysis on standardized feature vector sets and calculating continuous homology groups to generate differential feature maps, the limitations of traditional analysis methods based on local numerical differences are overcome. This method can capture the topological correlation patterns between feature vectors at different scales and reflects the overall distribution law of workpiece surface structural anomalies through continuous homology group calculation. By calling a preset defect-sensitive region weight model to perform regional weighting processing on the differential feature maps to calculate a comprehensive defect score, and combining process knowledge, targeted weighting of the differential feature maps is achieved. This enables the comprehensive defect score to reflect the degree of influence of structural differences in different regions on overall quality, improving the adaptability of quality inspection results to actual production process requirements. Attached Figure Description

[0007] Figure 1 This is a flowchart of a machine vision-based intelligent factory quality inspection method provided in an embodiment of the present invention.

[0008] Figure 2 This is a schematic diagram of the composition of a computer system provided in an embodiment of the present invention. Detailed Implementation

[0009] Please see Figure 1 The flowchart below illustrates a machine vision-based intelligent factory quality inspection method according to an embodiment of the present invention. This method can be executed by a computer system and may include the following steps: Step S100: Collect multi-angle three-dimensional point cloud images and corresponding surface texture images of the target workpiece under different lighting conditions to obtain a multi-source quality inspection data set containing geometric morphology information and micro-texture features.

[0010] In the quality inspection scenario of a smart factory, the target workpiece is the object to be inspected for quality. Taking an automobile engine block as an example, it has a complex geometric shape and surface texture, and its quality inspection requirements are high. Different lighting conditions refer to obtaining images with different effects by adjusting the intensity, color, and direction of the light. Multi-angle imaging involves taking pictures of the engine block from multiple different perspectives, which can comprehensively capture the features of its various parts. 3D point cloud images are images composed of a large number of points in three-dimensional space. These points represent the positional information of the engine block surface, from which geometric morphology information can be extracted, such as the shape contour of the block, the size of the bores, and the surface flatness. Surface texture images reflect the microscopic texture features of the block surface, such as surface roughness and machining marks. Multi-source quality inspection data sets are datasets that integrate 3D point cloud images and surface texture images acquired under different lighting and multi-angle conditions.

[0011] In the actual data acquisition process, a 3D laser scanner can be used to acquire 3D point cloud images. A 3D laser scanner determines the 3D coordinates of each point on the object's surface by emitting a laser beam and measuring the time of reflected light. The engine block is placed on a rotatable worktable, and the position and angle of the laser scanner are adjusted to scan the block from multiple directions. Simultaneously, the block is illuminated with light sources of different intensities and colors to highlight different features. For surface texture image acquisition, a high-resolution industrial camera is used. Industrial cameras have high pixel counts and frame rates, enabling them to clearly capture the texture details of the block's surface. Similarly, the block surface is photographed from multiple angles under different lighting conditions. The acquired 3D point cloud images and surface texture images are then processed and stored to obtain a multi-source quality inspection data set containing geometric morphological information and microscopic texture features.

[0012] Step S200: Perform cross-modal feature registration on the multi-source quality inspection data set to construct a multimodal feature space that integrates geometric shape and micro-texture. The dimension of the multimodal feature space is positively correlated with the sampling density of the point cloud image and the resolution of the texture image.

[0013] Cross-modal feature registration is the process of matching and aligning different types of data in a multi-source quality inspection dataset, namely, the geometric morphological information of 3D point cloud images and the micro-texture features of surface texture images. Since these two types of data are acquired in different ways, they may differ in location and scale, requiring registration to make them spatially correspond. The multimodal feature space is a space that integrates both geometric morphology and micro-texture features, allowing for comprehensive consideration of both features for quality inspection. Higher sampling density of the point cloud image means denser 3D point cloud data, enabling a more accurate description of the engine block's geometry; higher resolution of the texture image allows for a clearer presentation of the micro-texture features of the block surface. Therefore, the dimensionality of the multimodal feature space increases with the sampling density of the point cloud image and the resolution of the texture image.

[0014] In one implementation, step S200 can be implemented as the following steps S210~S260: Step S210: Separate the geometric morphology information of the 3D point cloud image and the micro-texture features of the surface texture image from the multi-source quality inspection data set, and establish two independent single-modal feature sequences. The length of the single-modal feature sequence is consistent with the number of acquisition frames of the original data set.

[0015] In the multi-source quality inspection data set, the 3D point cloud image contains the geometric morphology information of the engine block, such as the shape and size of various parts; the surface texture image contains the microscopic texture features of the block surface, such as roughness and machining patterns. Separating these two types of information is necessary for subsequent processing and analysis. The single-modal feature sequence is a sequence of the separated geometric morphology information and microscopic texture features arranged in the order of acquisition. Since each acquisition corresponds to a set of geometric morphology information and microscopic texture features, the length of the single-modal feature sequence is the same as the number of acquisition frames in the original data set.

[0016] In practice, specialized image processing software and algorithms are used to achieve separation. For 3D point cloud images, the data structure is analyzed to extract the parts representing geometric morphology information, such as point coordinates and normal vectors. For surface texture images, image filtering, edge detection, and other methods are used to extract micro-texture features. The extracted geometric morphology information and micro-texture features are stored in two separate lists, thus establishing two independent unimodal feature sequences.

[0017] Step S220: Extract neighborhood geometric features from the geometric morphology information. Calculate the distribution feature vector, curvature change feature vector, and normal vector feature vector based on the distribution of the neighborhood point set of each sampling point to generate a geometric feature sequence containing multi-dimensional geometric attributes.

[0018] Neighborhood geometric feature extraction involves selecting a set of neighboring points centered on each sampling point in a 3D point cloud image and extracting useful geometric features from this set. A sampling point is a single point in the 3D point cloud image, while the neighborhood point set refers to the collection of all points within a certain range centered on the sampling point. The distribution feature vector describes the spatial distribution of the neighborhood point set, reflecting the local structural features of the engine block surface. The curvature variation feature vector represents the curvature variation around the sampling point; curvature reflects the degree of surface bending, and the curvature variation feature vector can be used to detect abnormal protrusions or depressions on the cylinder block surface. The normal vector feature vector represents the direction of the normal vector of the surface where the sampling point is located; the normal vector is perpendicular to the surface and reflects the surface orientation. The geometric feature sequence is a sequence formed by combining the calculated distribution feature vector, curvature variation feature vector, and normal vector feature vector in a specific order. It contains multiple dimensions of geometric attributes and can more comprehensively describe the geometric morphology of the engine block.

[0019] As one implementation method, step S220 can be implemented as the following steps S221~S226: Step S221: Perform a neighborhood search on the 3D point cloud data in the geometric morphology information. With each sampling point as the center, select a neighborhood point set within a preset radius. The number of elements in the neighborhood point set is proportional to the sampling density of the point cloud image. The higher the density, the more elements the neighborhood point set has.

[0020] Neighborhood search is the process of finding neighboring points of each sampled point in 3D point cloud data. The preset radius is a pre-defined distance value; all points within this radius, centered on the sampled point, are selected as neighboring points. The sampling density of a point cloud image refers to the number of points per unit volume. A higher sampling density indicates a denser point cloud, resulting in a larger set of neighboring points within the same preset radius.

[0021] In practical implementation, the KD-tree (K-Dimensional Tree) algorithm is used for neighborhood search. A KD-tree is a data structure for efficiently storing and retrieving multidimensional spatial data; it organizes 3D point cloud data into a binary tree. During the search, starting from the root node of the tree, the search is recursively performed within the tree based on the coordinates of the sampled point and a preset radius range, adding points that meet the criteria to the neighborhood point set. For example, for 3D point cloud data of an engine block, a KD-tree is first constructed, and then for each sampled point, a search is performed within the KD-tree to quickly find its neighborhood points.

[0022] Step S222: Construct a local covariance matrix based on the neighborhood point set. Using the spatial coordinate deviation of the neighborhood point set as input, calculate the covariance matrix describing the neighborhood distribution through matrix elements. The row and column dimensions of the matrix are consistent with the spatial coordinate dimensions.

[0023] The local covariance matrix describes the spatial distribution of a neighborhood point set. The spatial coordinate deviation of the neighborhood point set refers to the difference between the coordinates of the neighborhood points and the coordinates of the sampling points. The covariance matrix is ​​a statistical matrix whose elements represent the covariance between different variables. In this step, the spatial coordinate deviation of the neighborhood point set is used as input, and the covariance matrix is ​​generated by calculating the covariance between these deviations. Since it is in three-dimensional space with a spatial coordinate dimension of 3, the covariance matrix is ​​a 3×3 matrix.

[0024] In the specific calculation, the coordinate deviation of each neighboring point relative to the sampling point is first calculated. Then, statistical analysis is performed on these deviations to calculate the covariance between different coordinate deviations. For example, the covariance between the x-coordinate deviation and the y-coordinate deviation is calculated, and so on, to obtain the elements of the covariance matrix.

[0025] Step S223: Perform eigenvalue decomposition on the local covariance matrix, extract the eigenvalues ​​and eigenvectors of the matrix, and arrange the eigenvectors in order to generate distribution feature vectors that describe the distribution characteristics of the neighborhood point set. The dimension of the vectors is the same as the number of eigenvalues.

[0026] Eigenvalue decomposition is the process of decomposing a matrix into eigenvalues ​​and eigenvectors. Eigenvalues ​​represent the scaling factor of the matrix in a certain direction, and eigenvectors represent the eigendirection of the matrix in that direction. In this step, eigenvalue decomposition is performed on the local covariance matrix to extract the eigenvalues ​​and eigenvectors. Then, the eigenvectors are arranged in order to generate distribution eigenvectors that describe the distribution characteristics of the neighborhood point set.

[0027] Step S224: Calculate the local curvature change features of the sampling points based on the spatial coordinates of the neighborhood point set, calculate the curvature change value by the distance deviation from the neighborhood point set to the fitting plane, and arrange the curvature change values ​​in different directions in directional order to generate a curvature change feature vector.

[0028] Local curvature variation features reflect the curvature changes of the surface surrounding the sampling point. The fitted plane is a plane fitted using a set of neighboring points, which can approximate the surface surrounding the sampling point. The distance deviation from the neighboring point set to the fitted plane refers to the perpendicular distance from each neighboring point to the fitted plane; these distance deviations can be used to calculate the curvature variation value. Curvature variation values ​​in different directions refer to the curvature changes calculated in different directions; arranging these values ​​in directional order generates the curvature variation feature vector.

[0029] In practical calculations, the least squares method is first used to fit a plane to the neighborhood point set. Then, the distance deviation from each neighborhood point to this plane is calculated. Based on these distance deviations, the curvature change values ​​in different directions are calculated. For example, calculations are performed in different directions such as the horizontal and vertical directions. Finally, these curvature change values ​​are arranged in directional order to obtain the curvature change feature vector.

[0030] Step S225: Fit a local plane based on the spatial coordinates of the neighborhood point set, extract the plane normal vector through the plane's direction parameters, and arrange the direction components of the normal vector in the order of the coordinate system axes to generate the normal vector feature vector. The dimension of the vector is consistent with the dimension of the spatial coordinate system.

[0031] Fitting a local plane involves determining a plane by using the spatial coordinates of a neighborhood set of points, making that plane as close as possible to the neighborhood set. The plane's orientation parameters describe its orientation in space, and these parameters allow us to extract the plane's normal vector. The normal vector is perpendicular to the plane, and its direction components represent the projection of the normal vector onto each coordinate axis. Arranging the direction components of the normal vector in order of the coordinate system axes generates the normal vector eigenvectors. Since this occurs in three-dimensional space with a coordinate system dimension of 3, the normal vector eigenvectors also have a dimension of 3.

[0032] In practice, the least squares method is used to fit the local plane. The equation of the plane is solved based on the coordinates of the neighborhood point set, thus obtaining the plane's direction parameters. Then, the normal vector is calculated based on the direction parameters. The x, y, and z components of the normal vector are arranged in order to obtain the eigenvectors of the normal vector.

[0033] Step S226: Concatenate the distribution feature vector, curvature change feature vector, and normal feature vector sequentially according to the channel dimension to generate a geometric feature sequence containing multi-channel geometric features in a vector stacking manner. The number of channels in the sequence is consistent with the number of types of concatenated feature vectors, and each channel corresponds to a geometric attribute.

[0034] The distribution feature vector, curvature variation feature vector, and normal feature vector describe the geometric features of the engine block surface from different perspectives. Concatenating them sequentially along the channel dimension involves combining these three vectors in a specific order. Vector stacking refers to arranging these vectors one after another to form a longer vector. The geometric feature sequence contains multiple channels, each corresponding to a geometric attribute, such as distribution features, curvature variation features, and normal vector features. The number of channels matches the number of different types of feature vectors being concatenated; in this example, there are three types of feature vectors, so the geometric feature sequence has three channels.

[0035] Step S230: Extract the directional gradient distribution of the micro-texture features. Calculate the directional distribution feature vector, intensity distribution feature vector, and periodic distribution feature vector through the pixel grayscale changes of the texture image to generate a texture feature sequence containing multi-dimensional texture attributes.

[0036] Oriented gradient distribution extraction extracts gradient information of texture in different directions from micro-texture features. The pixel grayscale variations of a texture image reflect the details and features of the texture. The directional distribution feature vector describes the distribution of texture in different directions, the intensity distribution feature vector represents the intensity variations of the texture, and the periodic distribution feature vector reflects the periodicity of the texture. A texture feature sequence is a sequence composed of directional, intensity, and periodic distribution feature vectors combined in a specific order. It contains multiple dimensions of texture attributes and can more comprehensively describe the micro-texture of the engine block surface.

[0037] In practice, image processing algorithms are used to extract directional gradient distributions. First, the texture image is converted to grayscale, transforming a color image into a grayscale image. Then, the gradient value and direction of each pixel in the image are calculated. Based on the gradient value and direction, the gradient distribution in different directions is statistically analyzed, yielding a directional distribution feature vector. The intensity of the gradient is calculated, and its distribution is statistically analyzed, yielding an intensity distribution feature vector. Spectral analysis is performed on the texture image to identify the periodicity of the texture, resulting in a periodic distribution feature vector. These three feature vectors are then combined sequentially to generate a texture feature sequence.

[0038] Step S240: Construct a cross-modal correlation metric function. Using the corresponding spatial positions of the geometric feature sequence and the texture feature sequence as input, calculate the correlation degree parameter describing the degree of modal correlation through the mutual information entropy value. The value of the correlation degree parameter is proportional to the feature correspondence.

[0039] Cross-modal correlation metrics are used to measure the degree of correlation between geometric feature sequences and texture feature sequences. The corresponding spatial locations of the geometric and texture feature sequences refer to their positions on the engine block surface. Mutual information entropy is an indicator used to measure the correlation between two random variables. By calculating the mutual information entropy between the geometric and texture feature sequences, a correlation parameter describing their modal correlation can be obtained. A larger correlation parameter value indicates a stronger correspondence between the geometric and texture features.

[0040] In one implementation, step S240 can be implemented as the following steps S241~S246: Step S241: Align the geometric feature sequence and the texture feature sequence in terms of spatial dimension, and adjust the spatial resolution of the two feature sequences so that the sampling points and pixels at corresponding positions correspond one-to-one.

[0041] Spatial dimension alignment aims to ensure that geometric feature sequences and texture feature sequences have the same spatial resolution, enabling accurate comparison of their features at corresponding locations. A sampling point is a point in the geometric feature sequence, and a pixel is a point in the texture feature sequence. Adjusting the spatial resolution of the two feature sequences involves using methods such as interpolation or downsampling to ensure a one-to-one correspondence between sampling points and pixels in the geometric and texture feature sequences.

[0042] In practice, image interpolation algorithms can be used to adjust spatial resolution. For geometric feature sequences with low resolution, bilinear interpolation or cubic spline interpolation can be used to improve resolution. For texture feature sequences with high resolution, downsampling methods can be used to reduce resolution. Through these adjustments, corresponding positions in the two feature sequences are matched one-to-one.

[0043] Step S242: In the aligned spatial dimension, the feature sequence is divided into multiple spatial units according to the preset grid division. Each spatial unit contains a subsequence of geometric feature sequence and a subsequence of texture feature sequence. The size of the spatial unit is inversely proportional to the resolution of the feature sequence.

[0044] Preset mesh generation divides the aligned feature sequence into multiple small spatial units according to certain rules. Each spatial unit contains a subsequence of geometric feature sequence and a subsequence of texture feature sequence, allowing for individual analysis of features within each small region. The size of the spatial unit is inversely proportional to the resolution of the feature sequence; higher resolution results in smaller spatial units, and lower resolution results in larger spatial units.

[0045] In practical implementation, the feature sequence is divided into multiple spatial units based on its resolution and a preset grid size. For example, a two-dimensional feature sequence can be divided according to certain row and column intervals to obtain multiple rectangular spatial units.

[0046] Step S243: Using the geometric subsequence and texture subsequence within each spatial unit as input, calculate the joint probability distribution of the two subsequences. Generate a joint probability matrix by the common occurrence frequency of the subsequence elements. The row dimension of the joint probability matrix is ​​the number of geometric subsequence element types, and the column dimension is the number of texture subsequence element types.

[0047] The joint probability distribution describes the probability of elements co-occurring in geometric and texture subsequences. Taking the geometric and texture subsequences within each spatial unit as input, the co-occurrence frequency of their elements is calculated. The joint probability matrix is ​​a two-dimensional matrix, with rows representing the number of element types in the geometric subsequence and columns representing the number of element types in the texture subsequence. Each element in the matrix represents the probability of a certain element in the geometric subsequence co-occurring with a certain element in the texture subsequence. In actual calculation, the number of element types in the geometric and texture subsequences is first counted. Then, each spatial unit is traversed, and the number of co-occurrences of elements in the geometric and texture subsequences is counted. Dividing the number of co-occurrences by the total number of occurrences yields each element of the joint probability matrix.

[0048] Step S244: Calculate the edge probability distribution of the joint probability distribution, extract the edge probability of the geometric subsequence and the edge probability of the texture subsequence respectively. The edge probability is generated by the row summation and column summation of the joint probability matrix. The row summation corresponds to the geometric edge probability, and the column summation corresponds to the texture edge probability.

[0049] Marginal probability distributions are the probability distributions of the joint probability distribution over a certain variable. For the joint probability matrix, the marginal probabilities of the geometric subsequences can be obtained by summing the rows, and the marginal probabilities of the texture subsequences can be obtained by summing the columns. The geometric marginal probability represents the probability of each element appearing in the geometric subsequence, and the texture marginal probability represents the probability of each element appearing in the texture subsequence. In actual calculations, summing each row of the joint probability matrix yields the marginal probability vector of the geometric subsequences. Summing each column of the joint probability matrix yields the marginal probability vector of the texture subsequences.

[0050] Step S245: Using the joint probability distribution and the marginal probability distribution as input, calculate the mutual information entropy value of the two subsequences using the mutual information entropy value formula. After normalizing the entropy value, generate the correlation degree parameter describing the modal correlation degree of the spatial unit. The parameter's value range is 0~1.

[0051] The mutual information entropy formula is used to calculate the mutual information entropy value between geometric and texture subsequences, reflecting their correlation. The joint probability distribution and marginal probability distribution are used as inputs and substituted into the mutual information entropy formula for calculation. Since the range of mutual information entropy values ​​can be large, normalization is required, transforming them to the range of 0 to 1 to obtain a correlation parameter describing the modal correlation degree of the spatial unit. The closer the parameter value is to 1, the higher the correlation between geometric and texture features within the spatial unit.

[0052] Step S246: Arrange the correlation parameters of all spatial units in spatial order to generate a cross-modal correlation matrix covering the entire spatial range of the feature sequence. The row and column dimensions of the matrix correspond to the spatial row and column dimensions of the feature sequence, respectively, and the matrix element values ​​are the correlation parameters of the corresponding spatial units.

[0053] The cross-modal correlation matrix is ​​used to represent the degree of correlation between geometric and texture features in the entire feature sequence space. The correlation parameters of all spatial units are arranged in spatial order to form a two-dimensional matrix. The row and column dimensions of the matrix correspond to the spatial row and column dimensions of the feature sequence, respectively, and each element in the matrix represents the correlation parameter of the corresponding spatial unit.

[0054] In practice, the correlation parameter of each spatial unit is sequentially filled into the corresponding position in the cross-modal correlation matrix according to its spatial position in the feature sequence. This results in a complete cross-modal correlation matrix for subsequent analysis and processing.

[0055] Step S250: Align the geometric feature sequence and the texture feature sequence in space according to the correlation parameter. Iterate and adjust the spatial coordinates of the feature sequence to maximize the cumulative value of the correlation parameter at the corresponding position, and generate the aligned cross-modal feature sequence.

[0056] The correlation parameter reflects the degree of correlation between geometric feature sequences and texture feature sequences at corresponding positions. Spatial alignment of the geometric and texture feature sequences based on these parameters involves adjusting their spatial coordinates to maximize the cumulative value of the correlation parameter at corresponding positions. Iterative adjustment involves repeatedly trying different spatial coordinate adjustment schemes to gradually find the position that maximizes the cumulative value of the correlation parameter. The aligned cross-modal feature sequence, obtained by accurately aligning the geometric and texture feature sequences in space, more accurately reflects the comprehensive characteristics of the engine block.

[0057] In practice, optimization algorithms are used to achieve iterative adjustments. For example, gradient descent can be used, with the cumulative correlation parameter as the objective function. By continuously adjusting the spatial coordinates of the feature sequence, the objective function is maximized. After multiple iterations, the aligned cross-modal feature sequence is obtained.

[0058] Step S260: Map the aligned cross-modal feature sequence to a preset joint feature space, and generate a multimodal feature space containing composite attributes of geometric shape and micro-texture through feature dimension expansion and fusion. The dimension of the feature space is consistent with the sum of the dimensions of the aligned feature sequence.

[0059] The predefined joint feature space is a predefined space used to map the aligned cross-modal feature sequence. Feature dimensionality expansion refers to adding dimensions to the features in the joint feature space to accommodate more information. Feature fusion integrates geometric morphology and microtexture features to generate features containing composite attributes. The multimodal feature space contains composite attributes of geometric morphology and microtexture, enabling a more comprehensive description of the engine block's features. The dimension of the feature space is consistent with the sum of the dimensions of the aligned feature sequence, ensuring information integrity.

[0060] In practice, methods such as linear transformation or nonlinear mapping are used to map the aligned cross-modal feature sequences to a joint feature space. Then, feature dimensions are expanded and fused through methods such as feature concatenation and weighted summation to generate a multimodal feature space.

[0061] Step S300: Discretize the multimodal feature space using a grid partitioning algorithm to generate a standardized feature vector set with a unified dimension. Each vector element of the standardized feature vector set corresponds to a discrete grid cell in the feature space.

[0062] Mesh partitioning algorithms are used to divide a continuous multimodal feature space into multiple discrete mesh cells. Discretization transforms the continuous feature space into a discrete representation, facilitating subsequent analysis and processing. The standardized feature vector set is a set of vectors obtained by organizing and standardizing the feature information of each mesh cell, with each vector element corresponding to a discrete mesh cell in the feature space.

[0063] As one implementation method, step S300 can be implemented as the following steps S310~S360: Step S310: Perform feature density estimation on the multimodal feature space. Using the feature points in the feature space as input, calculate the local feature density of each feature point through the kernel density function. Distribute the density values ​​according to the location of the feature points to generate a continuous feature density distribution field. The dimension of the feature density distribution field is consistent with the dimension of the feature space.

[0064] Feature density estimation estimates the distribution density of feature points in a multimodal feature space. Using feature points in the feature space as input, a kernel density function is used to calculate the local feature density of each feature point. The kernel density function is a function used to estimate probability density; it calculates the density of a point by weighted summation of surrounding feature points. The local feature density values ​​of each feature point are distributed in the feature space according to its location, generating a continuous feature density distribution field. The dimension of this distribution field is consistent with the dimension of the feature space, intuitively reflecting the distribution density of feature points in space.

[0065] As one implementation method, step S310 can be implemented as the following steps S311~S316: Step S311: Select the kernel function type in the multimodal feature space, and determine the shape parameter of the kernel function according to the dimension of the feature space and the distribution of feature points. The value of the shape parameter is proportional to the average distance between feature points, and the larger the distance, the larger the value of the shape parameter.

[0066] There are various types of kernel functions, such as Gaussian kernels and rectangular kernels. The appropriate kernel function needs to be selected based on the characteristics of the multimodal feature space. The dimensionality of the feature space and the distribution of feature points affect the shape parameter of the kernel function. The shape parameter determines the range of the kernel function, and its value is proportional to the average distance between feature points. If the average distance between feature points is large, it indicates that the feature point distribution is relatively sparse, requiring a larger shape parameter so that the kernel function can cover more feature points.

[0067] In practice, the appropriate kernel function type is selected based on the dimension of the feature space and the distribution of feature points. For example, if the feature point distribution is relatively smooth, a Gaussian kernel function can be chosen. Then, the shape parameters of the kernel function are determined based on the average distance between feature points.

[0068] Step S312: Randomly select a preset number of sampling points in the feature space as the kernel function center. The number of sampling points is proportional to the total number of feature points in the feature space. The more feature points there are, the more sampling points there are, ensuring that the sampling points uniformly cover the entire feature space.

[0069] The preset number of sampling points is a pre-determined number of points used as the center of the kernel function. The number of sampling points is proportional to the total number of feature points in the feature space; the more feature points there are, the more sampling points are needed. Randomly selecting sampling points and ensuring they uniformly cover the entire feature space is to enable the kernel function to effectively estimate the density across the entire feature space.

[0070] In practical implementation, a random number generator is used to randomly select sampling points in the feature space. The number of sampling points is determined according to a preset ratio based on the total number of feature points in the feature space. Then, the distribution of the sampling points is checked to ensure they are evenly distributed throughout the feature space.

[0071] Step S313: Using the center of each kernel function as a reference, determine the influence range according to the shape parameters of the kernel function, calculate the distance from all feature points in the feature space to the center of the kernel function, and feature points whose distance is within the influence range participate in the kernel function density contribution calculation.

[0072] The influence range of a kernel function is a region determined by its shape parameters. Feature points within this region affect the density contribution of the kernel function center. The distances from all feature points in the feature space to the kernel function center are calculated, and feature points whose distances fall within the influence range are selected. These feature points will then participate in the calculation of the kernel function density contribution.

[0073] In practice, the size of the influence range is determined based on the shape parameters of the kernel function. For each kernel function center, the distances from all feature points in the feature space to it are calculated. Feature points whose distances are less than the influence range are marked as points participating in the density contribution calculation.

[0074] Step S314: Perform kernel function density superposition calculation for each feature point, sum the density contribution values ​​of all kernel function centers to the feature point, and generate the local feature density value of the feature point. The density contribution value is inversely proportional to the distance, and the smaller the distance, the larger the contribution value.

[0075] Kernel function density superposition calculation involves summing the density contributions of all kernel function centers to a given feature point. The density contribution of each kernel function center to a feature point is inversely proportional to the distance between them; the smaller the distance, the larger the contribution. By summing the density contributions of all kernel function centers, the local feature density value of that feature point is obtained.

[0076] In practice, for each feature point, all kernel function centers are traversed, and the density contribution value of each kernel function center to that feature point is calculated. Then, these contribution values ​​are added together to obtain the local feature density value of that feature point.

[0077] Step S315: Map the local feature density values ​​to the feature space according to the spatial location of the feature points to generate a discrete density value distribution point set. The number of elements in the point set is the same as the number of feature points, and each element contains spatial coordinates and the corresponding density value.

[0078] The local feature density value of each feature point is mapped to the feature space according to its spatial location, forming a discrete set of density value distribution points. The number of elements in the point set is the same as the number of feature points, and each element contains the spatial coordinates of the feature point and the corresponding local feature density value.

[0079] In practice, the local feature density value of each feature point is associated with its spatial coordinates and stored in a data structure to form a discrete set of density value distribution points.

[0080] Step S316: Perform spatial interpolation on the discrete density value distribution point set to fill the density value gaps between point sets and generate a continuous feature density distribution field. The spatial resolution of the distribution field is proportional to the interpolation accuracy; the higher the accuracy, the higher the resolution.

[0081] Spatial interpolation is used to fill in the density value gaps between discrete density value distribution points, transforming the discrete point sets into a continuous feature density distribution field. The interpolation accuracy determines the accuracy of the interpolation result; the higher the interpolation accuracy, the higher the spatial resolution of the generated feature density distribution field.

[0082] In practical implementation, interpolation algorithms such as Kriging interpolation and bilinear interpolation are used to interpolate discrete density value distribution point sets. Interpolation parameters are set according to the required interpolation accuracy to generate a continuous feature density distribution field.

[0083] Step S320: Determine the meshing density based on the characteristic density distribution field. With the overall density mean of the distribution field as the benchmark, when the local density value is greater than the overall density mean of the characteristic density distribution field, a denser mesh is formed. When the local density value is less than or equal to the overall density mean of the characteristic density distribution field, a sparser mesh is formed. The volume of the mesh cell is inversely proportional to the local density value.

[0084] The feature density distribution field reflects the distribution density of feature points in the feature space. Using the overall density mean of the distribution field as a benchmark, the mesh density is determined based on the magnitude of the local density values. When the local density value is greater than the overall density mean, it indicates that the feature points in that region are relatively dense, requiring a denser mesh to more accurately describe the features of that region. When the local density value is less than or equal to the overall density mean, it indicates that the feature points in that region are relatively sparse, allowing for a sparser mesh. The volume of a mesh cell is inversely proportional to the local density value; the larger the local density value, the smaller the mesh cell volume.

[0085] In practice, the overall density mean of the characteristic density distribution field is calculated. Each location in the characteristic density distribution field is traversed, and the local density value is compared with the overall density mean. Based on the comparison result, the mesh density at that location is determined.

[0086] Step S330: Using the boundary range of the multimodal feature space and the mesh division density as input, an irregular mesh structure is generated by calculating the mesh node coordinates. The shape of the unit of the mesh structure is adjusted according to the morphology of the density distribution field. The density uniform region has a regular shape, and the density variation region has an irregular shape.

[0087] The boundary of the multimodal feature space determines the spatial range of the mesh. Using the boundary range and mesh density as input, an irregular mesh structure is generated by calculating the coordinates of the mesh nodes. The shape of the mesh cells is adjusted according to the morphology of the density distribution field. In regions with uniform density, the mesh cells are regular shapes, such as squares or rectangles; in regions with large density variations, the mesh cells are irregular shapes to better adapt to the distribution of feature points.

[0088] In practical implementation, the coordinates of the grid nodes are calculated using a grid generation algorithm based on the boundary range of the multimodal feature space and the grid density. The shape of the grid cells is adjusted according to the morphology of the density distribution field to generate an irregular grid structure.

[0089] Step S340: Perform statistical feature extraction on the feature data within each grid cell. Using the feature values ​​of all feature points within the cell as input, calculate the statistical values ​​of the feature values ​​in each dimension. The statistical values ​​include the mean, variance, and median. Arrange the statistical values ​​in dimensional order to generate a grid statistical feature vector.

[0090] Statistical feature extraction is used to extract useful statistical information from the feature data within each grid cell. Taking the feature values ​​of all feature points within the cell as input, statistical values ​​such as the mean, variance, and median of these feature values ​​are calculated for each dimension. The mean reflects the average level of the feature values, the variance represents the dispersion of the feature values, and the median represents the middle position of the feature values. These statistical values ​​are arranged in dimensional order to generate a grid statistical feature vector that summarizes the feature information of each grid cell.

[0091] In one implementation, step S340 can be implemented as the following steps S341~S346: Step S341: Traverse each grid cell in the grid structure, determine the feature points contained in the grid cell through the boundary coordinates of the grid cell, and generate a set of cell feature points. The elements of the set of cell feature points are the complete feature vectors of the feature points.

[0092] The algorithm iterates through each grid cell in the grid structure, selecting feature points located within that cell based on its boundary coordinates. The complete feature vectors of these feature points are then collected to form a set of cell feature points. This set contains the feature information of all feature points within the grid cell.

[0093] In practice, a loop structure is used to traverse each grid cell in the grid structure. For each grid cell, it is checked whether the coordinates of all feature points in the feature space are within the boundary range of that grid cell. The feature vectors of the feature points within the boundary range are added to the cell feature point set.

[0094] Step S342: Split the set of unit feature points by feature dimension, and split the feature vector of each feature point into a single-dimensional feature value sequence. Each dimension corresponds to a feature value sequence, and the sequence length is consistent with the number of feature points in the set.

[0095] Each feature point in a unit feature point set has a feature vector, which contains feature information in multiple dimensions. Splitting the unit feature point set by feature dimension means splitting the feature vector of each feature point into multiple sequences of feature values ​​in a single dimension. Each dimension corresponds to a sequence of feature values, and the length of the sequence is the same as the number of feature points in the unit feature point set.

[0096] Step S343: Calculate the mean of each feature value sequence. The mean is generated by dividing the sum of all feature values ​​in the sequence by the sequence length. The mean values ​​of different dimensions are arranged in dimensional order to generate a mean statistical vector.

[0097] The mean is the average level of a set of data. For each sequence of features, the mean is obtained by summing all the features and dividing by the length of the sequence. The means of different dimensions are then arranged in dimensional order to generate a mean statistical vector. This vector reflects the average level of the features within each grid cell across all dimensions.

[0098] In practice, a loop is used to iterate through each feature value sequence and calculate its mean. The calculated means are then stored in a vector in dimensional order to generate a mean statistical vector.

[0099] Step S344: Calculate the variance of each feature value sequence. The variance is generated by dividing the sum of squared deviations of each feature value from the mean by the sequence length. The variances of different dimensions are arranged in dimensional order to generate a variance statistical vector.

[0100] Variance is a measure of the dispersion of a set of data. For each sequence of eigenvalues, the squared deviation of each eigenvalue from the mean of the sequence is calculated. These squared deviations are then summed and divided by the sequence length to obtain the variance of the sequence. The variances of different dimensions are arranged in dimensional order to generate a variance statistical vector. This vector reflects the dispersion of eigenvalues ​​in each dimension within each grid cell.

[0101] In practice, a loop is used to iterate through each feature value sequence and calculate its variance. The calculated variances are then stored in a vector in dimensional order to generate a variance statistics vector.

[0102] Step S345: Calculate the median of each feature value sequence. After sorting the sequence by numerical value, take the feature value at the middle position as the median. Arrange the medians of different dimensions in dimensional order to generate a median statistical vector.

[0103] The median is the middle value in a set of data after sorting by size. For each sequence of eigenvalues, they are sorted by value, and the middle eigenvalue is taken as the median. The medians of different dimensions are then arranged in dimensional order to generate a median statistical vector. This vector reflects the median level of the eigenvalues ​​within each grid cell across all dimensions.

[0104] In practice, a sorting algorithm is used to sort each feature value sequence. Based on the sequence length, the index of the middle position is determined, and the feature value at that position is taken as the median. The medians of different dimensions are stored in a vector in dimensional order to generate a median statistical vector.

[0105] Step S346: Concatenate the mean statistical vector, variance statistical vector, and median statistical vector in sequence to generate a grid statistical feature vector containing multi-dimensional statistical features.

[0106] The mean, variance, and median statistical vectors describe the statistical information of the feature values ​​within a grid cell from different perspectives. Concatenating them sequentially forms a longer vector, the grid statistical feature vector. This vector contains statistical features across multiple dimensions, providing a more comprehensive description of the characteristics of each grid cell.

[0107] Step S350: Standardize the grid statistical feature vectors. Taking the statistical feature vectors of all grid cells in the feature space as a whole, adjust the value of each vector element by the mean and standard deviation so that the distribution of the adjusted element values ​​conforms to the preset standard interval. The interval boundary is determined by the overall feature distribution.

[0108] Standardization is performed to ensure that the element values ​​in the grid statistical eigenvectors have a uniform scale and distribution. Taking the statistical eigenvectors of all grid cells in the feature space as a whole, the mean and standard deviation of these vector elements are calculated. Each vector element value is then adjusted using the mean and standard deviation to ensure that the adjusted element value distribution conforms to a preset standard interval. The boundaries of the standard interval are determined based on the overall feature distribution, thus ensuring that the statistical eigenvectors of all grid cells are compared at the same scale.

[0109] In practice, a standardization algorithm is used to process the grid statistical feature vectors. The mean and standard deviation of the statistical feature vector elements of all grid cells are calculated. Based on the mean and standard deviation, the value of each vector element is adjusted to fall within a preset standard range.

[0110] Step S360: Arrange the standardized statistical feature vectors of all grid cells in order of grid number to generate a standardized feature vector set containing feature information of all grid cells. The number of vectors in the vector set is the same as the number of grid cells, and the dimension of each vector is the same as the sum of the dimensions of the statistical features.

[0111] The standardized statistical feature vectors of all grid cells are arranged in grid number order to form a vector set, namely the standardized feature vector set. The number of vectors in the vector set is the same as the number of grid cells, and the dimension of each vector is the same as the sum of the dimensions of the statistical features. This vector set contains the feature information of all grid cells and is the basis for subsequent analysis and processing.

[0112] In practice, a loop structure is used to traverse all grid cells and add their standardized statistical feature vectors to a list in order of grid number to generate a set of standardized feature vectors.

[0113] Step S400: Perform multi-scale topological structure analysis on the standardized feature vector set, calculate the continuous homology group between feature vectors to extract the feature association patterns of different grid units, and generate a difference feature map describing the differences in spatial structure.

[0114] Multi-scale topology analysis is used to study the topological structure of a standardized eigenvector set at different scales. Continuous homology groups are a mathematical tool for describing topological structures; by calculating the continuous homology groups between eigenvectors, feature association patterns between different grid cells can be extracted. Dissimilarity feature maps are a visual representation used to describe differences in spatial structures, which can help to intuitively identify quality problems on the surface of engine cylinder blocks.

[0115] In one implementation, step S400 can be implemented as the following steps S410~S460: Step S410: Divide the standardized feature vector set into multi-scale windows. Using the vector order of the feature vector set as the time axis, divide the continuous feature vector subsequences according to preset window lengths. Each window length corresponds to an analysis scale, and the window length is set according to the sequence length ratio.

[0116] Multi-scale window partitioning divides the standardized feature vector set into multiple consecutive feature vector subsequences according to different window lengths. The time axis is used as the vector order of the feature vector set, and the partitioning is performed according to various preset window lengths. Each window length corresponds to an analysis scale, and the window length is set proportionally to the sequence length, allowing for analysis of the feature vector set at different scales.

[0117] In practical implementation, various window lengths are determined based on a preset window length ratio. Using the vector order of the feature vector set as the time axis, a loop structure is used to divide the feature vector subsequences according to different window lengths.

[0118] Step S420: Construct a feature association graph within the feature vector subsequence of each analysis scale, using the feature vectors in the subsequence as nodes and the similarity between vectors as edge weights, and generate an association graph structure describing the connection relationship between nodes through similarity calculation.

[0119] Feature association graphs are used to represent the relationships between feature vectors in a subsequence of feature vectors. Using feature vectors in the subsequence as nodes and the similarity between vectors as edge weights, an association graph structure is constructed. By calculating the similarity between feature vectors, the connection relationships between nodes and the weights of edges are determined. The association graph structure can intuitively display the correlation between different feature vectors.

[0120] In one implementation, step S420 can be implemented as the following steps S421~S426: Step S421: Preprocess the feature vector subsequence. Take each feature vector in the feature vector subsequence as input and adjust the range of element values ​​through vector normalization so that the magnitude of the vector is uniformly set to a preset value.

[0121] Vector normalization adjusts the element values ​​of a feature vector to make the vector's magnitude uniform to a preset value. By preprocessing each feature vector in a feature vector subsequence, vector normalization can eliminate scale differences in vector element values, allowing different feature vectors to be compared at the same scale.

[0122] In practice, a vector normalization algorithm is used to process each eigenvector in the eigenvector subsequence. The magnitude of each vector is calculated, each element of the vector is divided by the magnitude, and then multiplied by a preset value to make the magnitude of the vector reach the preset value.

[0123] Step S422: Calculate the similarity of all feature vector pairs in the feature vector subsequence. Using any two feature vectors as input pairs, calculate the cosine value of the angle between the vectors and use the cosine value as the similarity parameter.

[0124] Similarity calculation measures the degree of similarity between any two feature vectors in a subsequence of feature vectors. Taking any two feature vectors as input pairs, the cosine of the angle between them is calculated; this value serves as the similarity parameter. The closer the cosine value is to 1, the more similar the two vectors are; the closer the cosine value is to 0, the less similar the two vectors are.

[0125] In practice, a loop is used to iterate through all feature vector pairs in the feature vector subsequence and calculate the cosine of the angle between them. The calculated cosine value is then used as a similarity parameter.

[0126] Step S423: Set a similarity threshold. Based on the overall similarity distribution of the subsequences, select a threshold that makes the average connectivity of the nodes in the association graph meet the preset value. Vector pairs with similarity parameters higher than the threshold are retained, while those lower than the threshold are discarded.

[0127] A similarity threshold is used to filter the connections between feature vectors. Based on the overall similarity distribution of subsequences, an appropriate threshold is selected so that the average connectivity of nodes in the association graph meets a preset value. Vector pairs with similarity parameters above the threshold are retained, while those below the threshold are discarded. This reduces noise in the association graph, making it clearer how important relationships between feature vectors are displayed.

[0128] In practice, based on the overall similarity distribution of the subsequences, different thresholds are tried to calculate the average connectivity of the nodes in the association graph. A threshold is then selected that makes the average connectivity meet a preset value.

[0129] Step S424: Assign edge weights to the retained connections by converting the similarity parameters into edge weights through a linear mapping based on the similarity parameters.

[0130] Assigning edge weights to the preserved connections is to represent the similarity between feature vectors in the association graph. Based on the similarity parameter, a linear mapping is used to convert the similarity parameter into edge weights. The linear mapping transforms the original range of the similarity parameter into a range suitable for use as edge weights.

[0131] In practical implementation, a linear mapping function is used to convert similarity parameters into edge weights. The parameters of the linear mapping are determined based on the range of similarity parameters and the preset range of edge weights.

[0132] Step S425: Construct the adjacency matrix of the association graph, using the eigenvector index in the subsequence as the node index, the rows and columns of the adjacency matrix corresponding to the node indices, the matrix elements as the edge weights of the corresponding node pairs, and the element value of the element with no connection relationship is 0.

[0133] An adjacency matrix is ​​a matrix representation of an association graph structure. It is constructed using the eigenvector indices of the subsequences as node indices. The rows and columns of the matrix correspond to node indices, and the matrix elements represent the edge weights of corresponding node pairs. If there is no connection between two nodes, the matrix element value is 0.

[0134] In practice, a two-dimensional matrix is ​​created, the size of which is determined by the length of the eigenvector subsequence. Based on the preserved connectivity and edge weights, the edge weights are filled into the corresponding positions in the adjacency matrix. Positions without connectivity are filled with 0.

[0135] Step S426: Generate an association graph structure description through the adjacency matrix, including a node list, an edge list, and an edge weight list. The node list consists of feature vector indices, the edge list consists of connected node index pairs, and the edge weight list consists of the weight values ​​of the corresponding edges. The three together constitute the association graph structure.

[0136] A detailed description of the association graph structure can be generated using the adjacency matrix. The node list contains the indices of the feature vectors, the edge list contains the index pairs of connected nodes, and the edge weight list contains the weight values ​​of the corresponding edges. These three lists together constitute the association graph structure, facilitating subsequent topological pattern extraction and analysis.

[0137] In the actual implementation, the adjacency matrix is ​​traversed, and the positions and values ​​of non-zero elements are extracted. Node indices are used as a node list, the positions of non-zero elements are used as an edge list, and the values ​​of non-zero elements are used as an edge weight list.

[0138] Step S430: Extract topological patterns from the feature association graph. Using the node connection relationship and edge weight of the association graph as input, identify the topological structures that meet the preset support threshold through the frequent subgraph mining algorithm. The preset support threshold is the lower limit of the proportion of the number of times the subgraph appears in the association graph. Sort the structures according to the support value from high to low to generate a set of topological patterns. The higher the support value, the higher the ranking of the pattern in the set.

[0139] Topological pattern extraction is used to identify representative topological structures from feature association graphs. Taking the node connections and edge weights of the association graph as input, a frequent subgraph mining algorithm is used. A preset support threshold is the lower limit of the proportion of times a subgraph appears in the association graph; only subgraphs that meet this threshold are considered frequent subgraphs. The mined topological structures are sorted from high to low support values ​​to generate a topological pattern set. Patterns with higher support values ​​are ranked higher in the set, as these patterns are more representative of the features of the association graph.

[0140] In practice, a frequent subgraph mining algorithm is used to mine feature association graphs. A preset support threshold is set, and subgraphs that meet the threshold are selected. The support value of each subgraph is calculated, and the topology is sorted from high to low according to the support value to generate a set of topology patterns.

[0141] Step S440: Calculate the difference degree of topological patterns at different analysis scales. Using the set of topological patterns at adjacent scales as input, generate a difference degree parameter describing the pattern changes by calculating the pattern edit distance. The smaller the edit distance, the smaller the difference degree parameter value.

[0142] Topological patterns may differ across different analysis scales, and calculating their dissimilarity can reveal how these patterns have changed. Using a set of topological patterns from adjacent scales as input, the dissimilarity parameter is calculated using pattern edit distance. Pattern edit distance measures the degree of difference between two topological patterns; a smaller edit distance results in a smaller dissimilarity parameter value, indicating greater similarity between the two patterns.

[0143] In one implementation, step S440 can be implemented as the following steps S441~S446: Step S441: Select the corresponding topology pattern pair from the topology pattern sets of two adjacent analysis scales. Each pattern pair contains the topology pattern of the previous scale and the topology pattern of the next scale. The pattern position is determined by the overlapping area of ​​the window on the time axis.

[0144] Selecting topological pattern pairs at corresponding locations from the topological pattern sets of two adjacent analysis scales is to compare the changes in topological patterns at the same location at different scales. Each pattern pair contains a topological pattern from the previous scale and a topological pattern from the next scale, with the pattern positions determined by the overlapping region of the window on the time axis. This ensures that the selected pattern pairs have a correspondence in both time and space.

[0145] In practice, based on the overlapping area of ​​the window on the time axis, the topology pattern pair at the corresponding position is selected from the topology pattern sets of two adjacent analysis scales.

[0146] Step S442: Perform pattern decomposition on the topology pattern pair, splitting each topology pattern into a node set, an edge set, and an attribute set. The node set is the node index contained in the pattern, the edge set is the connection relationship between nodes, and the attribute set is the statistical feature of edge weights.

[0147] Schema decomposition is used to break down a topological schema into more basic components, facilitating subsequent difference calculations. Each topological schema is decomposed into a node set, an edge set, and an attribute set. The node set contains the indices of all nodes in the schema, the edge set represents the connections between nodes, and the attribute set contains the statistical characteristics of the edge weights, such as mean and variance.

[0148] In practical implementation, each topology pattern is analyzed to extract the node set, edge set, and attribute set. These sets are then stored in an appropriate data structure.

[0149] Step S443: Calculate the differences between the pattern node sets. Determine the common and unique nodes of the two patterns by matching the node index. The more common nodes there are, the smaller the differences between the node sets. Quantify the node differences into node edit distance, which includes the number of node addition, deletion and replacement operations.

[0150] The differences in the node sets of two topological patterns reflect the differences in their node composition. Node index matching identifies common and unique nodes between the two patterns. The more common nodes, the more similar the node sets of the two patterns are, and the smaller the differences in their node sets. The node differences are quantified as the node edit distance, which includes the number of node addition, deletion, and replacement operations. In practice, the node sets of the two patterns are compared to identify common and unique nodes. The number of node addition, deletion, and replacement operations is calculated to obtain the node edit distance.

[0151] Step S444: Calculate the difference between the edge sets of the two patterns. Based on common nodes, compare the connection relationships of common node pairs in the two patterns. The number of edge pairs with different connection relationships is taken as the edge set difference and quantified as edge edit distance, which includes the number of edge addition and deletion operations.

[0152] The difference in edge sets reflects the differences in node connectivity between two topological patterns. Based on common nodes, the connectivity of common node pairs in the two patterns is compared. The number of edge pairs with differing connectivity is taken as the edge set difference, which is quantified as the edge edit distance, encompassing the number of edge addition and deletion operations.

[0153] In practice, for pairs of common nodes, the connection relationships between them are compared in the two patterns. The number of edge pairs with differing connection relationships is counted, and the edge edit distance is obtained.

[0154] Step S445: Calculate the difference of the pattern attribute set. Using the edge weights of the common edges as input, the attribute difference value is generated by summing the absolute differences of the weight values. The larger the difference value, the greater the difference of the attribute set. The attribute difference value is normalized to the attribute edit distance.

[0155] The differences in the pattern attribute sets reflect the differences in edge weight attributes between two topological patterns. Using the edge weights of common edges as input, the absolute difference between their weight values ​​is calculated, and these absolute differences are summed to obtain the attribute difference value. A larger difference value indicates a greater difference in the attribute sets. To facilitate comparison, the attribute difference value is normalized to obtain the attribute edit distance.

[0156] In practice, the edge weights of the common edges in the two patterns are compared, and the absolute difference of the weight values ​​is calculated. These absolute differences are then summed to obtain the attribute difference value. A normalization function is used to convert the attribute difference value into the attribute edit distance.

[0157] Step S446: The node edit distance, edge edit distance, and attribute edit distance are weighted and summed according to a preset ratio to generate a difference parameter describing the overall difference of the topology pattern. The parameter value is the weighted sum of the three edit distances. The larger the value, the more significant the pattern difference.

[0158] Node edit distance, edge edit distance, and attribute edit distance describe the differences between two topological patterns from different perspectives. By weighting and summing them according to a preset ratio, a dissimilarity parameter describing the overall difference between the topological patterns is obtained. A larger parameter value indicates a more significant difference between the two topological patterns.

[0159] In practice, the node edit distance, edge edit distance, and attribute edit distance are weighted and summed according to a preset ratio to obtain the difference parameter.

[0160] Step S450: Map the difference parameters to a two-dimensional plane according to their spatial location, using the spatial coordinates of the grid cells as the planar coordinates and the difference parameters as the planar pixel values, to generate a preliminary difference feature map. The size of the map corresponds to the spatial distribution range of the grid cells.

[0161] Mapping the difference parameter to a two-dimensional plane based on spatial location is to visualize the differences in topological patterns. Using the spatial coordinates of the grid cells as planar coordinates and the difference parameter as the planar pixel value, a preliminary difference feature map is generated. The size of the map corresponds to the spatial distribution range of the grid cells, allowing for a direct view of the differences in topological patterns at different spatial locations.

[0162] In practice, a two-dimensional array is created, the size of which is determined by the spatial distribution range of the grid cells. The difference parameter of each grid cell is filled into the corresponding position in the array to generate a preliminary difference feature map.

[0163] Step S460: Perform map optimization processing on the preliminary differential feature map. Using the pixel value distribution of the map as input, remove noise interference through spatial filtering to generate a differential feature map containing multi-scale structural difference information.

[0164] Map optimization is used to remove noise interference from the initial differential feature map, making the map clearer and more accurate. Taking the pixel value distribution of the map as input, a spatial filtering algorithm is used for processing. Spatial filtering can smooth pixel value variations, remove some random noise points, and generate a differential feature map containing multi-scale structural difference information.

[0165] In practical implementation, spatial filtering algorithms such as Gaussian filtering and median filtering are used to process the initial differential feature map. Based on the pixel value distribution of the map, appropriate filtering parameters are selected to remove noise interference and generate an optimized differential feature map.

[0166] Step S500: Call the preset defect sensitive area weight model to perform regional weighting processing on the difference feature map, and calculate the comprehensive defect score that reflects the overall defect degree of the workpiece. The numerical range of the comprehensive defect score corresponds to the preset quality inspection pass threshold range.

[0167] The pre-trained defect-sensitive region weight model is used to assign different weights to different regions in the differential feature map. Different regions have varying degrees of sensitivity to defects, and the weight model assigns corresponding weights to each region based on factors such as its location and characteristics. The region weighting process involves multiplying the feature value of each region in the differential feature map by its corresponding weight, and then summing the results to obtain a comprehensive defect score reflecting the overall defect severity of the workpiece. The numerical range of the comprehensive defect score corresponds to a pre-set quality inspection pass threshold range. By comparing the comprehensive defect score with the quality inspection pass threshold, it can be determined whether the workpiece is qualified.

[0168] As one implementation method, step S500 can be implemented as the following steps S510~S560: Step S510: Perform region segmentation on the difference feature map. Using the pixel value distribution of the map as input, the region growing algorithm divides adjacent pixels with similar pixel values ​​into the same region, generating multiple feature regions. Each region corresponds to a local area on the workpiece surface.

[0169] Region segmentation is the process of dividing a differential feature map into multiple feature regions. Using the pixel value distribution of the map as input, a region growing algorithm is employed. Starting with a seed pixel, the algorithm checks the pixel values ​​of its neighboring pixels. If the pixel values ​​of neighboring pixels are similar to those of the seed pixel, they are merged into the same region. This process is repeated until no neighboring pixels meet the criteria. By using the region growing algorithm to group neighboring pixels with similar pixel values ​​into the same region, multiple feature regions are generated. Each feature region corresponds to a local area on the surface of the engine block, facilitating targeted analysis of defects in different regions.

[0170] As one implementation method, step S510 can be implemented as the following steps S511~S516: Step S511: Preprocess the differential feature map. Using the pixel matrix of the map as input, remove noise interference by Gaussian filtering. The size of the filter kernel is proportional to the resolution of the map; the higher the resolution, the larger the kernel size.

[0171] Preprocessing is used to improve the accuracy of subsequent region segmentation. The pixel matrix of the differential feature map contains all pixel information of the map. Gaussian filtering is a linear smoothing filtering method that can effectively remove Gaussian noise from an image while preserving edge information. The size of the filter kernel is proportional to the resolution of the map; higher resolution indicates richer details in the image, requiring a larger filter kernel to smooth noise and avoid over-smoothing that could lead to loss of image details. In practice, image processing libraries such as OpenCV are used to implement Gaussian filtering. The size of the filter kernel is determined based on the map resolution, and then the filter kernel is applied to the pixel matrix. A weighted average is calculated for each pixel and its neighborhood to obtain the filtered pixel matrix.

[0172] Step S512: Select seed pixels in the map. Based on the pixel value, select initial seed points evenly at preset intervals. The number of seed points is proportional to the size of the map. The larger the size, the more seed points there are.

[0173] Seed pixels are the starting points for the region growing algorithm. Based on pixel values, initial seed points are selected evenly across the map at preset intervals. The larger the map size, the wider the area it encompasses, requiring more seed points to cover the entire map and ensure comprehensive region growing.

[0174] In practice, the number of seed points to be selected is calculated based on the size of the graph and the preset interval. Then, pixels are selected as seed points in the graph according to the principle of uniform distribution. For example, seed points can be selected according to a certain row and column interval.

[0175] Step S513: Perform region growth for each seed pixel. With the seed pixel as the center, check the neighboring pixels in the four-neighbor or eight-neighbor areas, calculate the pixel value difference between the neighboring pixels and the seed pixel, and add pixels with a difference less than a preset threshold to the current region.

[0176] Region growing is a process that starts with a seed pixel and gradually expands the region. Centered on the seed pixel, it examines its four-neighbor (top, bottom, left, and right) or eight-neighbor (four diagonal neighbors in addition to top, bottom, left, and right) neighboring pixels. The pixel value difference between the neighboring pixels and the seed pixel is calculated, and pixels with differences less than a preset threshold are added to the current region. The preset threshold is the standard for determining whether neighboring pixels belong to the same region; the size of the threshold affects the result of region growing.

[0177] In practice, a loop is used to iterate through each seed pixel and check its neighboring pixels. When calculating the pixel value difference, the absolute value of the difference can be obtained by directly subtracting the values. Pixels that meet the conditions are added to the pixel set of the current region.

[0178] Step S514: Update the growth threshold of the region. Use the average pixel value of all pixels in the current region as the new reference value, recalculate the difference between the adjacent pixels and the average value, and adjust the threshold to adapt the region growth to the region with gradually changing pixel values.

[0179] During region growing, pixel values ​​may exhibit gradual changes. To better adapt region growing to these gradual changes, the region growing threshold needs to be updated. Using the average pixel value of all pixels within the current region as a new reference value, the difference between adjacent pixels and this average value is recalculated. The threshold is then adjusted based on the calculation results, allowing region growing to more accurately incorporate pixels within the gradual change region into the current region.

[0180] In practice, the mean pixel value of all pixels within the current region is calculated. Then, for each adjacent pixel, the difference between its value and the mean is calculated. Based on the distribution of these differences, a preset threshold is adjusted to allow more pixels conforming to the gradient pattern to be added to the current region.

[0181] Step S515: Merge small regions with an area smaller than a preset threshold. Based on the number of pixels in the region, merge regions with fewer than the threshold into the adjacent region with the largest area. The pixel value of the merged region is a weighted average of the pixel values ​​of the two regions.

[0182] After region growing is complete, some small regions may appear. These small regions may be noisy or meaningless. To simplify subsequent analysis, these small regions with areas smaller than a preset threshold need to be merged. Based on the number of pixels in a region, regions with fewer pixels than the threshold are merged into the adjacent region with the largest area. The pixel value of the merged region is a weighted average of the pixel values ​​of the two regions, which makes the pixel values ​​of the merged region more consistent with the overall characteristics.

[0183] In practice, the number of pixels in each region is counted, and small regions with fewer pixels than a preset threshold are selected. For each small region, its adjacent region with the largest area is found, and the pixels of the small region are merged into that region. When calculating the pixel value of the merged region, a weighted average is performed based on the number of pixels in the two regions.

[0184] Step S516: Generate descriptive information for the feature regions, including region boundary coordinates, region area, average pixel value of the region, and region location marker. Store the descriptive information and the corresponding regions to generate a list of regions containing all feature regions.

[0185] Descriptive information about feature regions helps in better understanding the characteristics and location of each region. Region boundary coordinates determine the region's location range within the map, region area reflects its size, mean region pixel value reflects its average characteristics, and region location markers are used to distinguish different regions. Storing this descriptive information along with the corresponding regions generates a list of regions containing all feature regions, facilitating subsequent processing and analysis.

[0186] In practical implementation, image processing algorithms are used to calculate the boundary coordinates and area of ​​each region. The average pixel value of all pixels within the region is calculated. A unique region location marker is assigned to each region. This descriptive information is stored in a data structure, such as a list or dictionary, to generate a list of regions.

[0187] Step S520: Call the preset defect-sensitive region weight model, take the spatial location and difference feature map of the feature region as input, and generate the weight coefficient of each feature region through the region sensitivity rules inside the model. The weight coefficient is proportional to the sensitivity of the region to defects.

[0188] The pre-trained defect-sensitive region weighting model generates weight coefficients for each feature region based on its spatial location and differential feature map information, using internal region sensitivity rules. Different regions have varying degrees of sensitivity to defects; for example, critical parts of the engine block are more sensitive to defects, and these regions will have relatively higher weight coefficients. The weight coefficients are proportional to the region's sensitivity to defects, more accurately reflecting the importance of each region in the overall defect assessment.

[0189] In practice, the spatial location information of the feature regions (such as region boundary coordinates) and the differential feature map are input into the defect-sensitive region weight model. The model calculates the weight coefficient of each feature region based on internal rules, such as historical defect data at different locations and the degree of impact of that location on engine performance.

[0190] Step S530: Multiply the weight coefficient by the difference feature value of the corresponding feature region. Take the difference feature value of all pixels in the region as input, multiply each pixel value by the region weight coefficient, and sum them to generate the region weight value. The weight value reflects the degree of defect contribution of the region.

[0191] Multiplying the weighting coefficient by the difference feature value of the corresponding feature region is to account for the contribution of each region to the overall defect. Using the difference feature values ​​of all pixels within a region as input, each pixel value is multiplied by the region weighting coefficient, and the results are summed to obtain the region weighted value. The region weighted value reflects the importance of that region in the overall defect assessment; the larger the weighting coefficient, the greater the contribution of the difference feature values ​​within the region to the overall defect.

[0192] As one implementation method, step S530 can be implemented as the following steps S531~S536: Step S531: Traverse each feature region in the region list, extract the difference feature values ​​of all pixels in the region through the region boundary coordinates, and generate a set of region pixel values. The elements of the set are the difference feature values ​​of the pixels. The larger the value, the more significant the structural difference at that location.

[0193] By traversing each feature region in the region list, the differential feature values ​​of all pixels within the region can be accurately extracted based on the region boundary coordinates. These differential feature values ​​reflect the structural differences at each pixel location within the region; the larger the value, the more significant the structural difference at that location, and the greater the possibility of defects. These differential feature values ​​are collected to generate a set of region pixel values.

[0194] In practice, a loop is used to iterate through the list of regions. For each feature region, based on its boundary coordinates, the pixel difference feature values ​​at the corresponding locations are extracted from the difference feature map, and these values ​​are added to the region's pixel value set.

[0195] Step S532: Obtain the weight coefficient corresponding to the feature region. Search for it in the output of the defect sensitive region weight model according to the region location mark so that the weight coefficient corresponds one-to-one with the region. The weight coefficient value of the region with high sensitivity is larger.

[0196] From the output of the defect-sensitive region weight model, the weight coefficient corresponding to each feature region is found according to the region location marker. The region location marker is a unique marker assigned to each feature region in step S516. This marker can accurately find the corresponding weight coefficient, ensuring a one-to-one correspondence between the weight coefficient and the region. Regions with high sensitivity, such as critical parts of the engine block, have larger weight coefficient values ​​and are of greater importance in the overall defect assessment.

[0197] In practical implementation, regional location markers are used as indexes to find the corresponding weight coefficients in the output of the defect-sensitive region weight model. The found weight coefficients are then associated with the feature regions.

[0198] Step S533: Perform a weighted calculation on each pixel value in the set of region pixel values, multiply the pixel value by the region weight coefficient to generate a weighted pixel value, and each weighted pixel value reflects the weighted degree of the pixel's contribution to the region defect.

[0199] Weighting each pixel value in the region's pixel value set is performed to account for each pixel's actual contribution to the region's defect assessment. The pixel value is multiplied by a region weight coefficient to obtain a weighted pixel value. Each weighted pixel value reflects the degree to which that pixel contributes to the region's defect; the larger the weight coefficient, the greater the pixel's contribution to the region's defect.

[0200] In practice, a loop is used to iterate through the set of pixel values ​​in the region, multiplying each pixel value by the corresponding region weight coefficient to obtain a weighted pixel value. The weighted pixel values ​​are then stored in a new set.

[0201] Step S534: Summate all weighted pixel values. Add all weighted pixel values ​​in the region to generate a weighted sum for the region. The weighted sum is proportional to the number of pixels in the region and the weight coefficient. The more pixels and the greater the weight, the larger the weighted sum value.

[0202] The weighted sum of all weighted pixel values ​​is calculated to obtain the region weighted sum. The region weighted sum reflects the degree of defect contribution of the entire region after considering the weight coefficients. The weighted sum is proportional to the number of pixels in the region and the weight coefficients. More pixels indicate a larger region, which may contain more defect information; a larger weight indicates that the region is more sensitive to defects and its defect contribution is greater.

[0203] In practice, a loop structure is used to traverse the set of weighted pixel values, and all weighted pixel values ​​are summed to obtain the region weighted sum.

[0204] Step S535: Normalize the weighted sum of regions by using the region area as the normalization factor. Divide the weighted sum by the number of pixels in the region to generate the weighted mean of the regions. The mean eliminates the influence of the difference in region area on the weighted value.

[0205] The size of a region affects the value of its weighted sum. To eliminate the influence of region area differences on the weighted value, the weighted sum needs to be normalized. Using the region area as a normalization factor, the weighted sum is divided by the number of pixels in the region to obtain the weighted mean. The weighted mean can more fairly compare the defect contribution of regions of different sizes.

[0206] In practice, the weighted sum of the regions is divided by the number of pixels in each region to obtain the weighted mean of the regions. The normalized weighted mean of the regions is then stored in a list of regions for subsequent calculations.

[0207] Step S536: Multiply the weighted mean of the regions by the area ratio to generate the weighted value of the regions. The area ratio is the ratio of the area of ​​a region to the total area of ​​the map, so that regions with larger areas contribute more to the overall score, and generate the final weighted value of the regions.

[0208] The area proportion of the region reflects the proportion of each region in the entire atlas. Multiply the weighted mean of the region by the area proportion of the region to obtain the final weighted value of the region. This can make the regions with larger areas contribute more to the overall score and more reasonably reflect the impact of each region on the overall defect degree.

[0209] In actual implementation, calculate the ratio of the area of each region to the total area of the atlas to obtain the area proportion of the region. Multiply the weighted mean of the region by the area proportion of the region to obtain the final weighted value of the region. Store the final weighted value of the region in the region list.

[0210] Step S540: Perform a summation calculation on the weighted values of all feature regions. Add the weighted values of different regions after adjusting them according to the area proportion of the region to generate a preliminary score reflecting the overall defect degree of the workpiece. The regions with larger area proportions have a greater impact on the preliminary score.

[0211] Performing a summation calculation on the weighted values of all feature regions is to obtain a preliminary score reflecting the overall defect degree of the workpiece. The weighted values of different regions have already considered the defect sensitivity degree and area proportion of the region. Adding these weighted values after adjusting them according to the area proportion of the region can more accurately reflect the overall defect situation of the workpiece. The regions with larger area proportions have a greater impact on the preliminary score because these regions play a more important role in the workpiece.

[0212] In actual operation, traverse the region list and add the weighted values of each region to obtain a preliminary score. During the addition process, the weighted value of each region has been adjusted according to the area proportion of the region.

[0213] Step S550: Map the preliminary score to a preset score range, and adjust the score value range through linear transformation to make the score value correspond to the preset quality inspection qualified threshold range.

[0214] The preset score range is a pre-set range used to represent the defect degree of the workpiece. Map the preliminary score to the preset score range, and adjust the score value range through linear transformation to make the score value correspond to the preset quality inspection qualified threshold range. This can more intuitively judge whether the workpiece is qualified. For example, if the score value is within the quality inspection qualified threshold range, it indicates that the workpiece is qualified; otherwise, it indicates that the workpiece has defects.

[0215] In actual implementation, use the linear transformation formula to convert the preliminary score into the preset score range. Determine the parameters of the linear transformation according to the range of the preliminary score and the boundaries of the preset score range.

[0216] Step S560: Verify the mapped score. Based on the standard defect sample score distribution of the workpiece, adjust the score value through deviation correction so that the distribution of the score value is consistent with the standard sample distribution, and generate the final comprehensive defect score.

[0217] Verification of the mapped scores aims to improve their accuracy and reliability. Based on the score distribution of standard defect samples of the workpiece—pre-collected samples with known defects whose score distribution reflects the normal defect scores of the workpiece—deviation correction adjusts the score values ​​to align with the standard sample distribution, generating the final comprehensive defect score. This reduces scoring errors and more accurately assesses the quality of the workpiece.

[0218] In practice, the standard defect sample score distribution of the workpiece is analyzed, and its mean, standard deviation, and other statistical parameters are calculated. Based on these statistical parameters, the mapped scores are corrected for deviation, adjusting the score values ​​to ensure their distribution aligns with the standard sample distribution, thus obtaining the final comprehensive defect score. By comparing the final comprehensive defect score with the quality inspection pass threshold range, it can be determined whether the engine block meets quality requirements, completing the quality inspection task of the smart factory.

[0219] It is understood that the various algorithms involved in the above descriptions of the embodiments of the present invention can all be obtained from relevant content in the prior art. In order to save space, they will not be elaborated on in the embodiments of the present invention.

[0220] Furthermore, those skilled in the art can supplement the details when implementing the solution of this invention based on common knowledge in the field. For example, they can use normalization to eliminate dimensional conflicts before feature fusion, use interpolation to eliminate dimensional differences, combine historical data, experience or business scenario requirements to reasonably set the threshold, train the model based on a general model training method, set the number of layers in the model structure based on actual needs, select the activation function, etc. This invention will not provide redundant descriptions of overly detailed implementation processes here.

[0221] For example, in step S226, when the distribution feature vector, curvature change feature vector, and normal feature vector are sequentially concatenated according to the channel dimension to generate a geometric feature sequence containing multi-channel geometric features, specifically, the distribution feature vector, curvature change feature vector, and normal feature vector are normalized respectively to eliminate dimensional differences, thereby generating a normalized distribution feature vector, a normalized curvature change feature vector, and a normalized normal feature vector; the normalized distribution feature vector, normalized curvature change feature vector, and normalized normal feature vector are then sequentially concatenated according to the channel dimension to generate a geometric feature sequence containing multi-channel geometric features.

[0222] Alternatively, in step S340, when performing statistical feature extraction on the feature data within each grid cell, using the feature values ​​of all feature points within the cell as input, calculating the statistical values ​​of the feature values ​​in each dimension, and arranging the statistical values ​​in dimensional order to generate a grid statistical feature vector, specifically, this can involve performing statistical feature extraction on the feature data within each grid cell, using the feature values ​​of all feature points within the cell as input, calculating the mean, variance, and median of the feature values ​​in each dimension; normalizing the mean, variance, and median to generate dimensionless mean, variance, and median statistical values; arranging the normalized mean, variance, and median statistical values ​​for the same dimension in order to generate a joint statistical feature sub-vector for that dimension; and concatenating the joint statistical feature sub-vectors of all dimensions in dimensional order to generate a grid statistical feature vector.

[0223] Furthermore, for steps S343-S346, the following steps can be taken: Calculate the mean of each feature value sequence by dividing the sum of all feature values ​​in the sequence by the sequence length; calculate the variance of each feature value sequence by dividing the sum of squared deviations of each feature value from the mean by the sequence length; calculate the median of each feature value sequence by taking the median of the feature value in the middle position after sorting the sequence by numerical value; use the set of mean, variance, and median calculated on the same feature dimension by all grid cells as a reference dataset, and normalize the mean, variance, and median of that dimension respectively to generate dimensionless mean, variance, and median statistics corresponding to the feature value sequence; arrange the normalized mean, variance, and median statistics of the same dimension in order to generate a joint statistical feature vector for that dimension.

[0224] Please see Figure 2This is a schematic diagram of a computer system provided in an embodiment of the present invention. The computer system includes at least a processor 101, a communication interface 102, and a memory 103. The processor 101, communication interface 102, and memory 103 can be connected via a bus or other means. The processor 101 (or Central Processing Unit, CPU) is the computing and control core of the computer system, capable of parsing various instructions and processing various data within the computer system. The communication interface 102 may optionally include standard wired interfaces or wireless interfaces (such as Wi-Fi, mobile communication interfaces, etc.), and can be used to send and receive data under the control of the processor 101; the communication interface 102 can also be used for data transmission and interaction within the computer system. The memory 103 is a memory device in the computer system used to store programs and data. It is understood that the memory 103 here can include the computer system's built-in memory, or it can include extended memory supported by the computer system. The memory 103 provides storage space, which stores the computer system's operating system; this invention does not limit this storage space.

[0225] In one embodiment, the processor 101 executes the machine vision-based smart factory quality inspection method provided above in the embodiments of the present invention by running a computer program in the memory 103.

Claims

1. A machine vision-based intelligent factory quality inspection method, characterized in that, The method includes: Collect multi-angle three-dimensional point cloud images and corresponding surface texture images of the target workpiece under different lighting conditions to obtain a multi-source quality inspection data set containing geometric morphology information and micro-texture features. Cross-modal feature registration is performed on the multi-source quality inspection data set to construct a multimodal feature space that integrates geometric shape and micro-texture. The dimension of the multimodal feature space is positively correlated with the sampling density of the point cloud image and the resolution of the texture image. The multimodal feature space is discretized using a grid partitioning algorithm to generate a standardized feature vector set with a unified dimension. Each vector element of the standardized feature vector set corresponds to a discrete grid cell in the feature space. Multi-scale topological structure analysis is performed on the standardized feature vector set to calculate the persistent homology groups between feature vectors to extract feature association patterns of different grid units, generating a difference feature map describing spatial structure differences. Specifically, this includes: dividing the standardized feature vector set into multi-scale windows, using the vector order of the feature vector set as the time axis, dividing continuous feature vector subsequences according to preset window lengths, each window length corresponding to an analysis scale, with the window length set proportional to the sequence length; constructing a feature association graph within each feature vector subsequence of each analysis scale, using feature vectors in the subsequence as nodes and the similarity between vectors as edge weights, generating an association graph structure describing node connection relationships through similarity calculation; and extracting topological patterns from the feature association graph, using the node connection relationships and edge weights of the association graph as input, and identifying patterns that meet preset support thresholds through a frequent subgraph mining algorithm. The topology structure is defined as follows: the preset support threshold is the lower limit of the proportion of times a subgraph appears in the association graph; structures are sorted from high to low support values ​​to generate a set of topological patterns, with patterns having higher support values ​​appearing earlier in the set; the difference degree of topological patterns at different analysis scales is calculated, using the set of topological patterns at adjacent scales as input, and a difference degree parameter describing pattern changes is generated by calculating the pattern edit distance, with smaller edit distances resulting in smaller difference degree parameter values; the difference degree parameter is mapped to a two-dimensional plane according to its spatial location, using the spatial coordinates of grid cells as planar coordinates and the difference parameter as planar pixel values, to generate a preliminary difference feature map, the size of which corresponds to the spatial distribution range of the grid cells; the preliminary difference feature map is then optimized, using the pixel value distribution of the map as input, and spatial filtering is used to remove noise interference, generating a difference feature map containing multi-scale structural difference information. The differential feature map is processed by calling a preset defect sensitive area weight model to calculate a comprehensive defect score that reflects the overall defect level of the workpiece. The numerical range of the comprehensive defect score corresponds to the preset quality inspection pass threshold range.

2. The method according to claim 1, characterized in that, The step of performing cross-modal feature registration on the multi-source quality inspection data set to construct a multimodal feature space that integrates geometric morphology and micro-texture includes: Geometric morphological information of 3D point cloud images and micro-texture features of surface texture images are separated from the multi-source quality inspection data set to establish two independent single-modal feature sequences. The length of the single-modal feature sequence is consistent with the number of acquisition frames of the original data set. The geometric morphology information is subjected to neighborhood geometric feature extraction. The distribution feature vector, curvature change feature vector and normal vector are calculated based on the distribution of the neighborhood point set of each sampling point to generate a geometric feature sequence containing multi-dimensional geometric attributes. The micro-texture features are subjected to directional gradient distribution extraction. The directional distribution feature vector, intensity distribution feature vector, and periodic distribution feature vector are calculated by the pixel grayscale changes of the texture image to generate a texture feature sequence containing multi-dimensional texture attributes. A cross-modal correlation metric function is constructed, which takes the corresponding spatial positions of geometric feature sequences and texture feature sequences as inputs, and calculates a correlation degree parameter describing the degree of modal correlation through mutual information entropy value. The value of the correlation degree parameter is proportional to the feature correspondence. Based on the correlation parameter, the geometric feature sequence and the texture feature sequence are spatially aligned. The spatial coordinates of the feature sequence are iteratively adjusted to maximize the cumulative value of the correlation parameter at the corresponding position, thereby generating the aligned cross-modal feature sequence. The aligned cross-modal feature sequences are mapped to a preset joint feature space, and a multimodal feature space containing composite attributes of geometric shape and micro-texture is generated through feature dimension expansion and fusion.

3. The method according to claim 2, characterized in that, The step of extracting neighborhood geometric features from the geometric morphology information involves calculating distribution feature vectors, curvature change feature vectors, and normal vectors based on the distribution of neighborhood point sets for each sampling point, generating a geometric feature sequence containing multi-dimensional geometric attributes, including: A neighborhood search is performed on the three-dimensional point cloud data in the geometric morphology information, and a set of neighboring points is selected with each sampling point as the center and within a preset radius range. A local covariance matrix is ​​constructed based on the neighborhood point set. The spatial coordinate deviation of the neighborhood point set is used as input, and a covariance matrix describing the neighborhood distribution is generated by calculating the matrix elements. The row and column dimensions of the covariance matrix are consistent with the spatial coordinate dimensions. The local covariance matrix is ​​subjected to eigenvalue decomposition to extract the eigenvalues ​​and eigenvectors of the matrix. The eigenvectors are arranged in order to generate a distribution feature vector describing the distribution characteristics of the neighborhood point set. The dimension of the distribution feature vector is the same as the number of eigenvalues. The local curvature change characteristics of the sampling points are calculated based on the spatial coordinates of the neighborhood point set. The curvature change value is calculated by the distance deviation from the neighborhood point set to the fitting plane. The curvature change values ​​in different directions are arranged in directional order to generate a curvature change feature vector. A local plane is fitted based on the spatial coordinates of the neighborhood point set. The plane normal vector is extracted through the plane's direction parameters. The direction components of the normal vector are arranged in the order of the coordinate system axes to generate a normal vector feature vector. The dimension of the normal vector feature vector is consistent with the dimension of the spatial coordinate system. The distribution feature vector, curvature change feature vector, and normal feature vector are concatenated sequentially according to the channel dimension to generate a geometric feature sequence containing multi-channel geometric features. The number of channels in the geometric feature sequence is consistent with the number of types of concatenated feature vectors, and each channel corresponds to a geometric attribute.

4. The method according to claim 3, characterized in that, The construction of the cross-modal correlation metric function takes the corresponding spatial positions of the geometric feature sequence and the texture feature sequence as input, and calculates correlation parameters describing the degree of modal correlation through mutual information entropy values, including: The geometric feature sequence and the texture feature sequence are aligned in spatial dimension, and the spatial resolution of the two feature sequences is adjusted so that the sampling points and pixels at corresponding positions correspond one-to-one. In the aligned spatial dimension, the feature sequence is divided into multiple spatial units according to a preset grid. Each spatial unit contains a subsequence of geometric feature sequence and a subsequence of texture feature sequence. The size of the spatial unit is inversely proportional to the resolution of the feature sequence. Using the geometric subsequence and texture subsequence within each spatial unit as input, calculate the joint probability distribution of the two subsequences, and generate a joint probability matrix by the common occurrence frequency of subsequence elements. The row dimension of the joint probability matrix is ​​the number of geometric subsequence element types, and the column dimension is the number of texture subsequence element types. Calculate the marginal probability distribution of the joint probability distribution, and extract the marginal probabilities of the geometric subsequence and the texture subsequence respectively; Using the joint probability distribution and marginal probability distribution as input, the mutual information entropy values ​​of the two subsequences are calculated using the mutual information entropy value formula. After normalizing the entropy values, a correlation parameter describing the modal correlation degree of the spatial unit is generated. Arrange the correlation parameters of all spatial units in spatial order to generate a cross-modal correlation matrix covering the entire spatial range of the feature sequence. The row and column dimensions of the cross-modal correlation matrix correspond to the spatial row and column dimensions of the feature sequence, respectively, and the matrix element values ​​are the correlation parameters of the corresponding spatial units.

5. The method according to claim 1, characterized in that, The step of discretizing the multimodal feature space using a grid partitioning algorithm to generate a standardized feature vector set with a unified dimension includes: The feature density of the multimodal feature space is estimated by taking the feature points in the feature space as input and calculating the local feature density of each feature point through the kernel density function. The density values ​​are then distributed according to the location of the feature points to generate a continuous feature density distribution field. The grid division density is determined based on the characteristic density distribution field. The overall density mean of the distribution field is used as a reference. When the local density value is greater than the overall density mean of the characteristic density distribution field, a denser grid is divided. When the local density value is less than or equal to the overall density mean of the characteristic density distribution field, a sparser grid is divided. The volume of the grid cell is inversely proportional to the local density value. Using the boundary range of the multimodal feature space and the mesh density as input, an irregular mesh structure is generated by calculating the mesh node coordinates; Statistical feature extraction is performed on the feature data within each grid cell. Taking the feature values ​​of all feature points within the cell as input, the statistical values ​​of the feature values ​​are calculated in each dimension. The statistical values ​​include the mean, variance, and median. The statistical values ​​are then arranged in dimensional order to generate a grid statistical feature vector. The grid statistical feature vectors are standardized by taking the statistical feature vectors of all grid cells in the feature space as a whole and adjusting the value of each vector element by the mean and standard deviation so that the distribution of the adjusted element values ​​conforms to the preset standard interval. The interval boundary is determined by the overall feature distribution. Arrange the standardized statistical feature vectors of all grid cells in order of grid number to generate a standardized feature vector set containing feature information of all grid cells. The number of vectors in the standardized feature vector set is the same as the number of grid cells, and the dimension of each vector is the same as the sum of the dimensions of the statistical features.

6. The method according to claim 5, characterized in that, The step of estimating the feature density of the multimodal feature space, using feature points in the feature space as input, calculating the local feature density of each feature point through a kernel density function, and generating a continuous feature density distribution field by distributing the density values ​​according to the location of the feature points, includes: In the multimodal feature space, a kernel function type is selected, and the shape parameter of the kernel function is determined according to the dimension of the feature space and the distribution shape of the feature points. The value of the shape parameter is proportional to the average distance between the feature points, and the larger the distance, the larger the value of the shape parameter. A preset number of sampling points are randomly selected in the feature space as the kernel function center. The number of sampling points is proportional to the total number of feature points in the feature space. The more the total number of feature points, the more sampling points there are. Using the center of each kernel function as a reference, the influence range is determined according to the shape parameter of the kernel function. The distance from all feature points in the feature space to the center of the kernel function is calculated. Feature points whose distance is within the influence range participate in the kernel function density contribution calculation. For each feature point, perform kernel function density superposition calculation, sum the density contribution values ​​of all kernel function centers to the feature point, and generate the local feature density value of the feature point. The density contribution value is inversely proportional to the distance, and the smaller the distance, the larger the contribution value. The local feature density values ​​are mapped to the feature space according to the spatial location of the feature points to generate a discrete density value distribution point set. The number of elements in the point set is the same as the number of feature points, and each element contains spatial coordinates and a corresponding density value. Spatial interpolation is performed on the discrete density value distribution point set to fill the density value gaps between point sets and generate a continuous characteristic density distribution field.

7. The method according to claim 6, characterized in that, The step of extracting statistical features from the feature data within each grid cell, using the feature values ​​of all feature points within the cell as input, calculates the statistical values ​​of the feature values ​​in each dimension, and arranges the statistical values ​​in dimensional order to generate a grid statistical feature vector, includes: Traverse each grid cell in the grid structure, determine the feature points contained in the grid cell through the boundary coordinates of the grid cell, generate a set of cell feature points, and the elements of the set of cell feature points are the complete feature vectors of the feature points. The set of unit feature points is split according to feature dimensions. The feature vector of each feature point is split into a sequence of feature values ​​in a single dimension. Each dimension corresponds to a sequence of feature values. The length of the sequence is the same as the number of feature points in the set. Calculate the mean of each feature value sequence, and generate the mean by dividing the sum of all feature values ​​in the sequence by the sequence length. Arrange the means of different dimensions in order of dimension to generate a mean statistical vector. Calculate the variance of each feature value sequence, and generate the variance by dividing the sum of squared deviations of each feature value from the mean by the sequence length. Arrange the variances of different dimensions in dimensional order to generate a variance statistical vector. Calculate the median of each feature value sequence, sort the sequence by numerical value, and take the feature value at the middle position as the median. Arrange the medians of different dimensions in dimensional order to generate a median statistical vector. The mean statistical vector, variance statistical vector, and median statistical vector are concatenated in sequence to generate a grid statistical feature vector containing multi-dimensional statistical features.

8. The method according to claim 1, characterized in that, The construction of a feature association graph within the feature vector subsequence at each analysis scale, using feature vectors in the subsequence as nodes and the similarity between vectors as edge weights, generates an association graph structure describing the connection relationships between nodes through similarity calculation, including: The feature vector subsequence is preprocessed by taking each feature vector in the feature vector subsequence as input and adjusting the range of element values ​​through vector normalization so that the magnitude of the vector is uniformly set to a preset value. Calculate the similarity of all feature vector pairs in the feature vector subsequence. Take any two feature vectors as input pairs, calculate the cosine value of the angle between the vectors, and use the cosine value as the similarity parameter. A similarity threshold is set based on the overall similarity distribution of the subsequences. A threshold is selected that makes the average connectivity of the nodes in the association graph meet the preset value. Vector pairs corresponding to similarity parameters that are higher than the threshold are retained, while those that are lower than the threshold are discarded. Edge weights are assigned to the preserved connections, and the similarity parameters are converted into edge weights through a linear mapping based on the similarity parameters. Construct an adjacency matrix for the association graph, using the eigenvector index in the subsequence as the node index, the rows and columns of the adjacency matrix as the node indices, the matrix elements as the edge weights of the corresponding node pairs, and the values ​​of elements with no connection are 0. An adjacency matrix is ​​used to generate a description of the association graph structure, including a node list, an edge list, and an edge weight list. The node list consists of feature vector indices, the edge list consists of connected node index pairs, and the edge weight list consists of the weight values ​​of the corresponding edges. These three components constitute the association graph structure.

9. A computer system, characterized in that, include: A memory, wherein a computer program is stored; A processor for loading the computer program to implement the machine vision-based intelligent factory quality inspection method as described in any one of claims 1-8.