Stamping part surface roughness detection method and system based on image recognition
By establishing a standard model of metal square lattice and the surface profile of the actual stamping part, micro deformation characteristics are extracted and multi-scale analysis and edge enhancement are carried out. Combined with regional and hierarchical surface fitting strategies, the micro deformation interference problem in the surface roughness detection of stamping part is solved, and high-precision surface quality control is achieved.
Patent Information
- Application Number
- CN202510349134.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-07-11
AI Technical Summary
In the detection of surface roughness of stamping parts, high-frequency noise interference signals caused by microscopic deformation affect the accuracy of image recognition algorithms, resulting in deviations in detection results, and especially in high-precision application scenarios.
By establishing a standard model of metal square lattice and the surface profile of the actual stamping parts, microscopic deformation characteristics were extracted, multi-scale analysis and edge enhancement technology were used for precise segmentation, and the ideal surface was reconstructed in combination with regional and hierarchical surface fitting strategies, multi-dimensional feature vectors were constructed and surface quality evaluation was evaluated using support vector machine classifiers.
It realizes accurate identification of microscopic deformation of the stamped parts surface and accurate evaluation of roughness, improves detection accuracy, and provides effective surface quality control means.
Smart Images

Figure CN120298330A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of detection technology, and particularly relates to a method and system for detecting the surface roughness of stamped parts based on image recognition. Background Art
[0002] In the field of detecting the surface roughness of stamped parts, there is a thorny technical problem when using a grained die to stamp a metal square grid. Due to the slight fluctuations of the pressure and speed parameters during the stamping process, unpredictable microscopic deformations will occur in the metal square grid area. Although these deformations are difficult to detect by the naked eye, they will form fine undulations and wrinkles on the metal surface.
[0003] When using a high-precision instrument to collect the surface profile, these microscopic changes will be clearly presented in the deformation curve. The key problem is that these irregular surface microscopic changes will interfere with the judgment of the image recognition algorithm. The algorithm is originally used to identify and measure the standard surface roughness features, but these additional microscopic deformations will introduce high-frequency noise and interference signals. This makes it difficult for the algorithm to accurately distinguish the true surface roughness features from the microscopic deformations introduced by the stamping process.
[0004] More specifically, when the algorithm processes these surface images containing additional microscopic deformations, it will misjudge some deformations as roughness features, or mistake the true roughness features for deformations. This misjudgment will cause systematic deviations in the roughness measurement results, affecting the accuracy and reliability of the detection. Especially in the application scenarios that require high-precision surface quality control, this measurement deviation may cause serious quality problems and economic losses. Summary of the Invention
[0005] In view of this, the present invention aims to propose a method for detecting the surface roughness of stamped parts based on image recognition to improve the detection accuracy of the surface roughness of stamped parts.
[0006] To achieve the above object, the technical solution of the present invention is realized as follows:
[0007] A method for detecting the surface roughness of stamped parts based on image recognition includes:
[0008] Step S1: Establish a surface profile database according to the standard model of the metal square grid stamped by the grained die, obtain the actual profile data of the surface of the stamped part, compare the difference between the actual profile and the standard model of the metal square grid, and obtain a microscopic deformation feature distribution image;
[0009] Step S2: Separate the high-frequency feature components of the microscopic deformation feature distribution image, filter out the high-frequency noise, and optimize the microscopic deformation feature distribution image;
[0010] Step S3: Perform probability modeling on the optimized microscopic deformation feature distribution image, and calculate the probability distribution of each pixel belonging to the true surface roughness or microscopic deformation according to the deformation feature correlation of different local regions;
[0011] Step S4: Based on the probability distribution result, segment the microscopic deformation region, and remove isolated small regions by setting connectivity thresholds and regional area thresholds to obtain a continuous microscopic deformation region mask;
[0012] Step S5: According to the microscopic deformation region mask, perform partitioning on the original surface contour data, including reconstructing the ideal surface in the deformation region, and calculating the deviation between the actual contour and the ideal surface as the corrected roughness value;
[0013] Step S6: For the corrected roughness value, divide the surface into multiple feature regions according to the characteristics of the stamping part, and calculate statistical features for each feature region respectively. The calculated statistical features include root mean square roughness, skewness, and kurtosis parameters to construct a multi-dimensional feature vector;
[0014] Step S7: Train and classify the multi-dimensional feature vector to establish a surface quality evaluation model. When inputting the surface data of the to-be-tested stamping part, judge the surface roughness grade through the surface quality evaluation model.
[0015] Further, the step S1 includes:
[0016] Obtain the point cloud data of the surface of the metal square grid standard model and construct a three-dimensional model of the standard model surface;
[0017] Obtain the actual contour data of the surface of the stamping part, calculate the point-to-point Euclidean distance deviation between the contour data of the three-dimensional model and the actual contour data to obtain a contour difference matrix;
[0018] Extract the main deformation feature vectors of the contour difference matrix to construct a microscopic deformation feature space. If there are feature vectors in the microscopic deformation feature space that have a significant impact on deformation, perform interpolation calculation on the surface of the stamping part, and draw a deformation degree contour map according to the interpolation calculation result to obtain the surface microscopic deformation feature distribution image.
[0019] Further, the step S2 includes:
[0020] Convert the microscopic deformation feature distribution image from the spatial domain to the frequency domain to obtain a complex matrix represented in the frequency domain;
[0021] Determine the high-frequency threshold according to the size and resolution of the microscopic deformation feature distribution image;
[0022] Judge the frequency value of the amplitude spectrum in the complex matrix represented in the frequency domain. If the frequency value is higher than the high-frequency threshold, extract it as a high-frequency feature; if the frequency value is lower than the high-frequency threshold, retain it as a low-frequency feature;
[0023] For the high-frequency feature, calculate the mean and standard deviation of its amplitude value to obtain a noise threshold;
[0024] Judge the amplitude value of the high-frequency feature. If the amplitude value is lower than the noise threshold, set the high-frequency component to zero; if the amplitude value is higher than the noise threshold, retain the high-frequency component;
[0025] Convert the frequency-domain complex matrix obtained by combining the retained high-frequency components and the low-frequency features back to the spatial domain to obtain the optimized microscopic deformation feature distribution image.
[0026] Further, the step S3 includes:
[0027] Receive the microscopic deformation feature distribution image and segment it into multiple overlapping sub-regions; wherein, the size of the overlapping sub-regions is a preset pixel value, and the overlapping rate of adjacent overlapping sub-regions is a preset percentage;
[0028] Extract the local statistical features of the overlapping sub-regions to obtain a six-dimensional feature vector, where the local statistical features include mean, variance, skewness, kurtosis, maximum value, and minimum value;
[0029] Use the K-means clustering algorithm to cluster the six-dimensional feature vector to obtain the surface roughness category and the microscopic deformation category, where the number of clustering centers is a preset value;
[0030] According to the clustering result, establish a Gaussian mixture model, where the Gaussian mixture model is used to perform probability modeling on each pixel point to obtain the probability distributions of the pixel point belonging to the surface roughness category and the microscopic deformation category.
[0031] Further, the step S4 includes:
[0032] According to the probability distribution result, mark the pixel points with a microscopic deformation probability greater than a preset threshold to obtain the seed points of the region growing algorithm and establish a seed point queue;
[0033] Take out a seed point from the seed point queue and check the neighboring pixels of the seed point;
[0034] If the neighboring pixel is within the image boundary, and the microscopic deformation probability is greater than the preset threshold, the connectivity is greater than the preset connectivity threshold, and it has not been marked, then add the neighboring pixel to the current region and add it to the seed point queue;
[0035] Repeat the seed point expansion until the seed point queue is empty to obtain a preliminarily segmented microscopic deformation region;
[0036] Perform post-processing on the preliminarily segmented microscopic deformation region;
[0037] If the area of the microscopic deformation region is less than a preset area threshold, remove the microscopic deformation region from the microscopic deformation regions, and relabel the pixels of the microscopic deformation region as the background;
[0038] Perform label merging on all the remaining microscopic deformation regions to generate a final continuous microscopic deformation region mask.
[0039] Further, sample the original image to obtain multiple images of different scales, and perform region segmentation on the multiple images of different scales to obtain segmentation results of different scales;
[0040] Map the segmentation result of the small scale to the image of the large scale, and determine whether to merge regions by calculating the region overlap degree; if the region overlap degree exceeds a preset threshold, merge the regions;
[0041] Perform boundary processing on the fused segmentation result, and extract the edge gradient to determine whether the edge gradient is lower than the adaptive threshold;
[0042] If the edge gradient is lower than the adaptive threshold, label it as a boundary region;
[0043] According to the gray value distribution of the pixels inside the region, correct the marked boundary region to determine the category of the boundary pixels.
[0044] Further, the step S4 includes:
[0045] According to the obtained microscopic deformation region mask, perform partition processing on the original surface contour data to obtain three parts of contour data: the deformed region, the non-deformed region, and the transition region;
[0046] For the contour data of the non-deformed region, calculate the surface roughness Ra value;
[0047] If there is discontinuous data in the non-deformed region, use linear interpolation to fill it;
[0048] For the contour data of the deformed region, fit the ideal surface by the least squares method, and minimize the sum of squared residuals through iterative optimization;
[0049] Calculate the deviation between the actual contour of the deformed region and the fitted ideal surface, and obtain the root mean square deviation as the corrected Rq value;
[0050] For the transition region, the weighted average method is used to calculate the roughness, where the weight is proportional to the distance from the region boundary;
[0051] The Ra value, Rq value and the weighted roughness value of the transition region are combined by linear interpolation to obtain the complete surface roughness evaluation result.
[0052] Furthermore, it also includes:
[0053] The deformation region is divided into different deformation sub-regions including material missing region, material accumulation region and transition region. For different types of the deformation sub-regions, a surface fitting strategy of dividing regions and levels is adopted. Inside the material missing region, the thin plate spline interpolation method is used to obtain the ideal surface topography. Inside the material accumulation region, the Gaussian process regression is used to fit an ideal surface that smoothly transitions with the surrounding region. Inside the transition region, the radial basis function interpolation is used to obtain the ideal surface topography;
[0054] According to the local height difference and gradient change, the deformation region is divided into a material missing region, a material accumulation region and a transition region to obtain a sub-region marking map;
[0055] For the material missing region, the pixel points adjacent to the non-missing region are extracted as control points, and the thin plate spline interpolation algorithm is used to construct an interpolation function;
[0056] If it is a material accumulation region, the points inside the region and the points within the surrounding range are selected as sampling points, and the Gaussian process regression is used for fitting;
[0057] Inside the transition region, uniformly distributed control points are selected, and the radial basis function is applied for interpolation;
[0058] The weight coefficient ω is obtained by solving the equation system Aω = y, where A is the basis function matrix and y is the control point height value;
[0059] According to the weight coefficient ω, the ideal surface topographies of the material missing region, the material accumulation region and the transition region are obtained.
[0060] Furthermore, the step S6 includes:
[0061] The corrected roughness data is obtained, and the roughness data is preprocessed. The preprocessing includes normalizing the material hardness and yield strength to the range of 0 to 1, performing logarithmic conversion on the processing pressure and speed, and performing standardization processing on the application environment temperature and humidity;
[0062] According to the preprocessed data, the principal component analysis method is used for dimensionality reduction. If the explained variance of the obtained principal components reaches the preset range, the principal components are retained;
[0063] The dimensionality-reduced features and roughness data are clustered, and the surface is divided into multiple feature regions;
[0064] Statistical analysis is performed on the roughness data within each of the said feature regions, including calculating six parameters: root mean square roughness Rq, arithmetic mean roughness Ra, maximum profile height Ry, ten-point height Rz, skewness Rsk, and kurtosis Rku;
[0065] Obtain the average values of six relevant factors corresponding to each of the said feature regions, and combine the six statistical feature parameters and the six relevant factor values to obtain the said multi-dimensional feature vector; and / or,
[0066] The said step S7 includes:
[0067] Obtain samples of stamped parts with known surface quality grades, extract multi-dimensional feature vectors, and construct a training data set;
[0068] Perform Z-score normalization on the multi-dimensional feature vectors to obtain normalized feature vectors;
[0069] Use a support vector machine classifier with a radial basis kernel function to train a surface quality evaluation model, with the training data set as the input and the surface quality grade as the output;
[0070] If the surface image of the stamped part is a new input, extract the multi-dimensional feature vector and perform Z-score normalization;
[0071] Input the normalized feature vector into the trained surface quality evaluation model, and according to the output decision function value, obtain the confidence score for each roughness grade, and the grade with the highest confidence score is the final prediction result.
[0072] Compared with the prior art, the present invention has the following advantages:
[0073] The method for detecting the surface roughness of stamped parts based on image recognition according to the present invention, through the comparative analysis of establishing a standard model of a metal square grid and the surface profile of an actual stamped part, extracts microscopic deformation features, and uses multi-scale analysis and edge enhancement techniques to accurately segment the deformed region. For different types of deformed sub-regions, the detection method also adopts a surface fitting strategy of dividing regions and levels to reconstruct an ideal surface, calculates the corrected roughness value. Finally, a multi-dimensional feature vector is constructed in combination with factors such as materials and processes, and a surface quality evaluation model is established through a support vector machine classifier, which is conducive to realizing the accurate recognition of the microscopic deformation of the stamped part surface and the accurate evaluation of the roughness, providing an effective technical means for the surface quality control of stamped parts.
[0074] In addition, another object of the present invention is to propose a system for detecting the surface roughness of stamped parts based on image recognition, including:
[0075] Surface profile database construction module, micro-deformation feature extraction module, probability modeling and region segmentation module, region processing and roughness correction module, feature vector construction and classification module, and surface quality evaluation model application module;
[0076] The surface profile database construction module is used to establish a standard model and actual profile data;
[0077] The micro-deformation feature extraction module is used to obtain and optimize the deformation feature map of the stamping part;
[0078] The probability modeling and region segmentation module is used for probability calculation and micro-deformation region segmentation;
[0079] The region processing and roughness correction module is used to reconstruct the ideal surface and correct the roughness;
[0080] The feature vector construction and classification module is used to calculate statistical features and construct a multi-dimensional feature vector;
[0081] The surface quality evaluation model application module is used to judge the surface roughness grade to achieve detection.
[0082] For the stamping part surface roughness detection system based on image recognition of the present invention, the surface profile database construction module is used to establish a standard model and actual profile data, the micro-deformation feature extraction module is used to obtain and optimize the deformation feature map of the stamping part, the probability modeling and region segmentation module is used for probability calculation and micro-deformation region segmentation, the region processing and roughness correction module is used to reconstruct the ideal surface and correct the roughness, the feature vector construction and classification module is used to calculate statistical features and construct a multi-dimensional feature vector, and the surface quality evaluation model application module is used to judge the surface roughness grade to achieve detection, which is beneficial to improving the detection accuracy of the stamping part surface roughness. Brief Description of the Drawings
[0083] The drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:
[0084] Figure 1 It is a flowchart of the stamping part surface roughness detection method based on image recognition according to the embodiment of the present invention. Detailed Embodiments
[0085] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other.
[0086] In the description of the present invention, it should be noted that if terms indicating orientation or positional relationship such as "upper", "lower", "inner", "back", etc. appear, they are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present invention. In addition, if terms such as "first", "second", etc. appear, they are also only for descriptive purposes and cannot be construed as indicating or implying relative importance.
[0087] The present invention will be described in detail below with reference to the drawings and in conjunction with embodiments.
[0088] This embodiment relates to a method for detecting the surface roughness of a stamped part based on image recognition, as Figure 1 described in, the method for detecting the surface roughness of the stamped part includes:
[0089] Step S1: Establish a surface profile database according to the standard model of the metal square grid pattern stamped by the texturing die, obtain the actual profile data of the surface of the stamped part, compare the difference between the actual profile and the standard model of the metal square grid pattern, and obtain the microscopic deformation feature distribution image;
[0090] Step S2: Separate the high-frequency feature components of the microscopic deformation feature distribution image, filter out the high-frequency noise, and optimize the microscopic deformation feature distribution image;
[0091] Step S3: Perform probability modeling on the optimized microscopic deformation feature distribution image, and calculate the probability distribution of each pixel point belonging to the true surface roughness or microscopic deformation according to the correlation of deformation features in different local regions;
[0092] Step S4: Based on the probability distribution result, segment the microscopic deformation region, and by setting the connectivity threshold and the region area threshold, eliminate isolated small regions to obtain a continuous microscopic deformation region mask;
[0093] Step S5: According to the microscopic deformation region mask, perform zoning processing on the original surface profile data, including reconstructing an ideal surface in the deformation region, and calculating the deviation between the actual profile and the ideal surface as the corrected roughness value;
[0094] Step S6: For the corrected roughness value, according to the characteristics of the stamped part, divide the surface into multiple feature regions, calculate the statistical features for each feature region respectively, and the calculated statistical features include root mean square roughness, skewness, and kurtosis parameters to construct a multi-dimensional feature vector;
[0095] Step S7: Train and classify the multi-dimensional feature vector to establish a surface quality evaluation model. When the surface data of the stamped part to be measured is input, judge the surface roughness grade through the surface quality evaluation model.
[0096] The method for detecting the surface roughness of stamping parts based on image recognition described in this embodiment extracts microscopic deformation features by establishing a comparative analysis between the standard model of the metal square grid and the actual surface contour of the stamping part, and uses multi-scale analysis and edge enhancement techniques to accurately segment the deformed area. For different types of deformed sub-areas, this detection method also adopts a surface fitting strategy of dividing regions and levels to reconstruct the ideal surface, calculates the corrected roughness value. Finally, combined with factors such as materials and processes, a multi-dimensional feature vector is constructed, and a surface quality evaluation model is established through a support vector machine classifier, which is conducive to achieving accurate recognition of the microscopic deformation of the stamping part surface and accurate assessment of the roughness, providing an effective technical means for the surface quality control of stamping parts.
[0097] Among them, step S1 includes: obtaining the point cloud data of the surface of the metal square grid standard model and constructing a three-dimensional model of the surface of the standard model; obtaining the actual contour data of the surface of the stamping part, calculating the point-to-point Euclidean distance deviation between the contour data of the three-dimensional model and the actual contour data to obtain a contour difference matrix; extracting the main deformation feature vectors of the contour difference matrix and constructing a microscopic deformation feature space. If there are feature vectors in the microscopic deformation feature space that have a significant impact on the deformation, interpolation calculation is performed on the surface of the stamping part, and a contour map of the deformation degree is drawn according to the interpolation calculation result to obtain an image of the distribution of microscopic deformation features on the surface.
[0098] Specifically, the point cloud data is obtained by a three-dimensional scanner scanning the surface of the standard sample in all directions, and a three-dimensional model of the surface of the standard sample is constructed according to the point cloud data. The three-dimensional model is obtained by splicing and fusing the point cloud data from multiple perspectives through the iterative closest point algorithm. The point-to-point Euclidean distance deviation between the above-mentioned standard contour and the actual contour is calculated by the following formula: d ij represents the point-to-point Euclidean distance deviation between the standard contour and the actual contour, x i , y i , z i represent the coordinates of the standard contour points, x j , y j , z j represent the coordinates of the actual contour points.
[0099] In this embodiment, the principal component analysis method is applied to the contour difference matrix to extract the main deformation feature vectors and construct the microscopic deformation feature space of the stamping part. If there are feature vectors in the microscopic deformation feature space that have a significant impact on the deformation, interpolation calculation is performed on the surface of the stamping part. A contour map of the deformation degree is drawn according to the interpolation calculation result to obtain an image of the distribution of microscopic deformation features on the surface of the stamping part.
[0100] In some embodiments, according to the standard specifications of the embossing mold for stamping metal square grid patterns, a high-precision 3D scanner is used to comprehensively scan the surfaces of multiple standard samples to obtain point cloud data. The ICP (Iterative Closest Point) algorithm is used to splice and fuse the point cloud data from multiple perspectives to construct an accurate 3D model of the surface of the standard sample. The surface contour data is extracted from it, and a standard model database of the embossing mold for stamping metal square grid patterns is established.
[0101] For the stamping part to be detected, the same 3D scanning and point cloud processing methods are used to obtain the actual contour data of the surface of the stamping part. The corresponding standard contour data is called from the standard model database, and the ICP algorithm is used to accurately register the standard contour and the actual contour, calculate the point-to-point Euclidean distance deviation between the two, and generate a contour difference matrix. The principal component analysis algorithm is applied to the contour difference matrix to extract the main deformation feature vectors, calculate the contribution rate of each feature vector, screen out the set of feature vectors that have the most significant impact on the deformation, and construct the microscopic deformation feature space of the stamping part.
[0102] In the microscopic deformation feature space, the radial basis function interpolation method is used to perform interpolation calculations on the surface of the stamping part, draw the contour map of the deformation degree, generate the microscopic deformation feature distribution image of the surface of the stamping part, and mark the key areas with a larger deformation degree. When establishing the standard model database of the embossing mold for stamping metal square grid patterns, 10 standard samples that meet the specifications are selected and scanned with a 3D laser scanner with an accuracy of 0.05 mm. The point cloud data is collected from 8 different angles for each sample. The ICP algorithm is used to register the point cloud data, the maximum number of iterations is set to 100, and the convergence threshold is set to 0.001 mm to achieve the splicing and fusion of the point cloud. When extracting the surface contour data, the uniform sampling method is used to select 10,000 feature points in the area of 100 mm × 100 mm.
[0103] The same scanning and processing process is performed on the stamping part to be detected to obtain the actual contour data. The standard contour data corresponding to the specifications is called from the standard model database, and the ICP algorithm is applied again for registration, the Euclidean distance deviation is calculated, and a 100×100 contour difference matrix is generated. The principal component analysis algorithm is applied to this matrix, the cumulative contribution rate threshold is set to 95%, and the main deformation feature vectors are extracted. If the cumulative contribution rate of the first 3 feature vectors reaches 95%, then these 3 feature vectors are selected to construct the microscopic deformation feature space. In this feature space, the radial basis function interpolation method is used for interpolation calculations, the Gaussian kernel function is selected, and the kernel parameter is set to 0.1. When drawing the contour map of the deformation degree, the deformation amount is divided into 10 levels and represented by different colors. Finally, in the generated microscopic deformation feature distribution image of the surface of the stamping part, the area where the deformation amount exceeds 0.5 mm is marked as the key area.
[0104] Step S2 of this embodiment includes converting the microscopic deformation feature distribution image from the spatial domain to the frequency domain to obtain a complex matrix representing the frequency domain; determining a high-frequency threshold according to the size and resolution of the microscopic deformation feature distribution image; judging the frequency values of the amplitude spectrum in the complex matrix representing the frequency domain, if the frequency value is higher than the high-frequency threshold, it is extracted as a high-frequency feature, if the frequency value is lower than the high-frequency threshold, it is retained as a low-frequency feature; for the high-frequency features, calculating the mean and standard deviation of their amplitude values to obtain a noise threshold; judging the amplitude values of the high-frequency features, if the amplitude value is lower than the noise threshold, setting the high-frequency component to zero, if the amplitude value is higher than the noise threshold, retaining the high-frequency component; converting the complex matrix in the frequency domain after merging the retained high-frequency components and the low-frequency features back to the spatial domain to obtain an optimized microscopic deformation feature distribution image.
[0105] In some embodiments, the fast Fourier transform (FFT) algorithm is applied to the microscopic deformation feature distribution image of the stamping part to convert the image from the spatial domain to the frequency domain, obtaining a complex matrix representing the frequency domain, and calculating the amplitude spectrum and phase spectrum. According to the size and resolution of the image, a high-frequency threshold is set, and usually the top 20% of the frequency values sorted in the amplitude spectrum are selected as high-frequency components. The frequency components in the amplitude spectrum higher than the threshold are extracted as high-frequency features, and the frequency components lower than the threshold are retained as low-frequency features to achieve the separation of high-frequency and low-frequency components.
[0106] For the separated high-frequency feature components, calculate the mean and standard deviation of their amplitude values, and set the mean plus twice the standard deviation as the noise threshold. Set the high-frequency components with amplitude values lower than this threshold to zero, and retain the high-frequency components with amplitude values higher than the threshold to achieve the filtering of high-frequency noise. Merge the high-frequency components after noise filtering with the original low-frequency components to reconstruct the complex matrix in the frequency domain. During the merging process, keep the original phase spectrum unchanged and only modify the amplitude spectrum. Perform the inverse fast Fourier transform (IFFT) on the reconstructed complex matrix in the frequency domain to convert the frequency domain information back to the spatial domain to obtain an optimized microscopic deformation feature distribution image of the stamping part. The optimized image retains the main features of the original image, while removing high-frequency noise and making the microscopic deformation features clearer.
[0107] When processing the microscopic deformation feature distribution image of a stamping part, first input a grayscale image of 512×512 pixels into the fast Fourier transform (FFT) algorithm to obtain a 512×512 complex matrix. Calculate the amplitude spectrum and phase spectrum of this matrix. The amplitude spectrum reflects the intensity of frequency components, and the phase spectrum represents the relative positions of each frequency component. Set the high-frequency threshold as the top 20% of the sorted frequency values in the amplitude spectrum, that is, the 409th frequency value. Extract 51,200 frequency components higher than this threshold in the amplitude spectrum as high-frequency features, and retain 204,800 frequency components lower than the threshold as low-frequency features. Calculate the mean and standard deviation of the amplitude values of the high-frequency feature components. Suppose the mean is 10 and the standard deviation is 2, then set 14=(10 + 2×2) as the noise threshold. Set to zero the high-frequency components with amplitude values lower than 14, and retain the high-frequency components with amplitude values higher than 14. Merge the processed high-frequency components with the original low-frequency components to reconstruct the frequency-domain complex matrix. During the merging process, keep the original phase spectrum unchanged and only modify the amplitude spectrum. Finally, perform the inverse fast Fourier transform (IFFT) on the reconstructed 512×512 frequency-domain complex matrix to obtain the optimized microscopic deformation feature distribution image of the 512×512 pixels stamping part. In the optimized image, the microscopic deformation features are clearer, and the high-frequency noise is effectively suppressed, which is beneficial for subsequent deformation analysis and process optimization.
[0108] In this embodiment, step S3 includes receiving the microscopic deformation feature distribution image and splitting it into multiple overlapping sub-regions; wherein, the size of the overlapping sub-region is a preset pixel value, and the overlapping rate of adjacent overlapping sub-regions is a preset percentage. Extract the local statistical features of the overlapping sub-regions to obtain a six-dimensional feature vector, where the local statistical features include the mean, variance, skewness, kurtosis, maximum value, and minimum value; use the K-means clustering algorithm to cluster the six-dimensional feature vector to obtain the surface roughness category and the microscopic deformation category, where the number of cluster centers is a preset value; according to the clustering results, establish a Gaussian mixture model, where the Gaussian mixture model is used to perform probability modeling on each pixel point to obtain the probability distributions of the pixel point belonging to the surface roughness category and the microscopic deformation category.
[0109] In some embodiments, perform local region division on the optimized microscopic deformation feature map, and use the sliding window method to split the image into multiple overlapping sub-regions. The size of each sub-region is 32×32 pixels, and the overlapping rate of adjacent sub-regions is 50%. For the image edge, use the mirror filling method to process the incomplete sub-regions to ensure that the edge regions can also be completely analyzed. For each sub-region, extract the local statistical features, including the mean, variance, skewness, kurtosis, maximum value, minimum value, and construct a six-dimensional feature vector.
[0110] The mean and variance reflect the overall change trend of the region, skewness and kurtosis describe the data distribution pattern, and the maximum and minimum values characterize the local extreme value features. The K-means clustering algorithm is used to divide all sub-regions into two categories: surface roughness and micro-deformation. The number of clustering centers is set to 2, the maximum number of iterations is 100, and the convergence threshold is 0.001. Based on the clustering results, a Gaussian mixture model is used to perform probability modeling on each pixel point, and the probability distributions of the pixel point belonging to the two categories of surface roughness and micro-deformation are calculated.
[0111] Initialize the mean vectors and covariance matrices of the two Gaussian distributions, and use the expectation-maximization algorithm to iteratively optimize the model parameters until convergence or the maximum number of iterations is reached. Combining spatial correlation, a Markov random field is used to optimize the probability distribution, considering the class influence of adjacent pixel points. Construct a 4-neighborhood Markov random field, define the energy function to include a data term and a smoothing term, and use the iterative conditional mode algorithm for inference to obtain the final pixel-level probability distribution map.
[0112] When processing the optimized micro-deformation feature map of 512×512 pixels, first use a 32×32 pixel sliding window with a step size of 16 pixels to divide the image into local regions, obtaining 961 overlapping sub-regions. For the image edges, the mirror padding method is used to process the incomplete sub-regions to ensure that all sub-regions are 32×32 pixels. For each sub-region, calculate 6 statistical features: mean, variance, skewness, kurtosis, maximum value, and minimum value, and construct a 6-dimensional feature vector. For example, the feature vector of a certain sub-region is [128.5, 15.3, 0.2, 3.1, 180, 75].
[0113] Use the K-means clustering algorithm to divide 961 feature vectors into two categories: surface roughness and micro-deformation. The number of clustering centers is set to 2, the maximum number of iterations is 100, and the convergence threshold is 0.001. After clustering, the center vectors of the two categories are obtained. Based on the clustering results, a Gaussian mixture model is used to perform probability modeling on each pixel point. Initialize the mean vectors of the two Gaussian distributions as the clustering centers, and the covariance matrix as the identity matrix multiplied by 0.1. Use the expectation-maximization algorithm to iteratively optimize the model parameters, set the maximum number of iterations to 50, and the convergence threshold to 0.0001. For each pixel, calculate the probabilities of it belonging to the two categories.
[0114] Finally, construct a 4-neighborhood Markov random field, define the energy function to include a data term and a smoothing term, with the data term weight of 0.7 and the smoothing term weight of 0.3. Use the iterative conditional mode algorithm to perform 5 iterations to obtain the final 512×512 pixel-level probability distribution map, where each pixel has a probability value indicating belonging to surface roughness and a probability value indicating belonging to micro-deformation.
[0115] Step S4 in this embodiment includes marking the pixel points with a microscopic deformation probability greater than a preset threshold according to the probability distribution result, obtaining the seed points of the region growing algorithm, and establishing a seed point queue. Take out a seed point from the seed point queue and check the neighboring pixels of the seed point; if the neighboring pixels are within the image boundary, and the microscopic deformation probability is greater than the preset threshold, the connectivity is greater than the preset connectivity threshold, and they have not been marked, then add the neighboring pixels to the current region and add them to the seed point queue. Repeat the seed point expansion until the seed point queue is empty to obtain a preliminarily segmented microscopic deformation region; perform post-processing on the preliminarily segmented microscopic deformation region.
[0116] Calculate the area of each microscopic deformation region. If the area of the microscopic deformation region is less than the preset area threshold, then remove the microscopic deformation region from the microscopic deformation regions, and relabel the pixels of the microscopic deformation region as the background. Perform label merging on all the remaining microscopic deformation regions to generate the final continuous microscopic deformation region mask.
[0117] In some embodiments, according to the probability distribution result, mark the pixel points with a microscopic deformation probability greater than 0.7 as the seed points of the region growing algorithm, and establish a seed point queue. If there are no qualified seed points, gradually lower the threshold to 0.5 until at least one seed point is found. Take out a seed point from the seed point queue and check its 8-neighboring pixels. If the neighboring pixels are within the image boundary, and the microscopic deformation probability is greater than 0.6, the connectivity is greater than the preset threshold 0.8, and they have not been marked, then add them to the current region and add them to the seed point queue.
[0118] Use a boolean array to record the pixels that have been checked to avoid repeated checking. Repeat the seed point expansion until the seed point queue is empty to obtain a preliminarily segmented microscopic deformation region, and assign a unique identifier to this region. For multiple non-connected microscopic deformation regions, use different identifiers to distinguish them. Perform post-processing on all the preliminarily segmented microscopic deformation regions, calculate the area of each region by pixel counting. If the area of the region is less than the preset area threshold of 100 square pixels, then remove the region from the microscopic deformation regions, and relabel its pixels as the background.
[0119] Finally, mark and merge all the remaining microscopic deformation regions to generate the final continuous microscopic deformation region mask. When processing a microscopic deformation probability map of 512×512 pixels, first set an initial threshold of 0.7, scan the entire image, and add the pixel coordinates with probability values greater than the threshold to the seed point queue. If the queue is empty, reduce the threshold by 0.05 and repeat the scan until seed points are found or the threshold drops to 0.5. Suppose 100 seed points are found at a threshold of 0.65. Take the first seed point (250, 250) from the queue and check its 8-neighborhood pixels. For each neighborhood pixel, such as (251, 251), determine whether it is within the image boundary, whether the microscopic deformation probability is greater than 0.6, such as 0.68, and whether the connectivity is greater than 0.8, where 0.8 is calculated by the difference between the probability value of the pixel and that of the seed point, such as |0.68 - 0.65| < 0.03.
[0120] If the conditions are met and the pixel is not marked, which is recorded using a 512×512 boolean array, add it to the current region and the seed point queue. Repeat this process until the queue is empty to obtain the first microscopic deformation region and assign it the identifier 1. Continue to process the remaining seed points to obtain multiple microscopic deformation regions with different identifiers. Count the pixels in each region. For example, region 1 has 150 pixels and region 2 has 80 pixels. Exclude the regions with an area less than 100 square pixels, such as region 2, and relabel them as the background with the identifier 0. Finally, perform label merging on the remaining regions to generate the final microscopic deformation region mask, where 1 represents the microscopic deformation region and 0 represents the background.
[0121] In this embodiment, sample the original image to obtain multiple images of different scales, and perform region segmentation on the multiple images of different scales to obtain multiple segmentation results of different scales. Map the segmentation results of the small scale to the large scale image, and determine whether to merge regions by calculating the region overlap degree. If the region overlap degree exceeds the preset threshold, merge the regions. Perform boundary processing on the fused segmentation results and extract the edge gradient, and determine whether the edge gradient is lower than the adaptive threshold. If the edge gradient is lower than the adaptive threshold, mark it as a boundary region. According to the gray value distribution of the pixels inside the region, correct the marked boundary region to determine the category of the boundary pixels. Among them, extract the edge gradient through the Sobel operator and determine whether the edge gradient is lower than the adaptive threshold.
[0122] In some embodiments, multi-scale decomposition is performed on the microscopic deformation region image. The original image is downsampled using a Gaussian pyramid to generate three images of different scales, namely the original size, 1 / 2 size, and 1 / 4 size. When constructing the Gaussian pyramid, a 5×5 Gaussian kernel is used with a standard deviation set to 1.0 to smooth and downsample the image. For each scale of the image, the watershed algorithm is used for region segmentation to obtain three segmentation results of different scales, and a unique identifier is assigned to each segmented region.
[0123] In the watershed algorithm, the gradient image is used as the input, morphological operations are used to extract marker points, and the connectivity is set to 8. A bottom-up scale fusion strategy is adopted. Starting from the smallest scale, the segmentation results of the smaller scale are mapped to the larger scale. The overlap degree is obtained by calculating the number of overlapping pixels in the region divided by the total number of pixels in the region, and regions with an overlap degree exceeding 70% are merged.
[0124] For regions with an overlap degree between 30% and 70%, whether to merge is determined according to the gradient intensity of the region boundary. Boundary processing is performed on the fused segmentation results. The local edge intensity and direction information are calculated, and a 3×3 Sobel operator is used to extract the edge gradient. The edge gradient threshold is adaptively determined by the Otsu algorithm, and boundary regions with gradient values lower than the threshold are marked. According to the gray value distribution of the pixels inside the region, a Gaussian mixture model is used to correct the fuzzy boundary and reassign the categories of boundary pixels.
[0125] When processing a microscopic deformation region image of 1024×1024 pixels, first construct a Gaussian pyramid using a 5×5 Gaussian kernel with a standard deviation of 1.0 to generate three scale images of 1024×1024, 512×512, and 256×256. Apply the watershed algorithm to each scale image. Taking the 512×512 scale as an example, calculate the image gradient, perform morphological erosion and dilation using a 3×3 structuring element, extract local minima as marker points, and obtain approximately 200 segmented regions. During scale fusion, starting from 256×256, map it to 512×512, calculate the overlap degree. For example, if region A occupies 100 pixels at the small scale and overlaps 80 pixels with region B after mapping to the large scale, and the overlap degree is 80%, then these two regions are merged.
[0126] For the region with an overlap of 50%, calculate the average gradient value of the 8-neighborhood of the boundary. If it is lower than the threshold obtained by the Otsu algorithm, such as 50, then merge the regions. The fused result is then mapped to the 1024×1024 scale for the same processing. Finally, perform boundary processing on the fused result of 1024×1024. Calculate the gradient using a 3×3 Sobel operator. The threshold obtained by the Otsu algorithm is 40, and mark the boundary pixels with gradient values lower than 40. For these pixels, extract the gray values within the 5×5 neighborhood, fit their distribution using a two-component Gaussian mixture model, with means of 100 and 150 and standard deviations of 20 and 25 respectively. Reassign the pixels to the corresponding regions according to which Gaussian distribution the pixel gray value belongs to, and obtain the final segmentation result of the microscopic deformation region.
[0127] Step S5 in this embodiment includes partitioning the original surface contour data according to the obtained microscopic deformation region mask to obtain three parts of contour data: the deformed region, the undeformed region, and the transition region; for the contour data of the undeformed region, calculate the surface roughness Ra value. If there is discontinuous data in the undeformed region, use linear interpolation to fill it; for the contour data of the deformed region, fit the ideal surface using the least squares method, and minimize the sum of squared residuals through iterative optimization.
[0128] Calculate the deviation between the actual contour of the deformed region and the fitted ideal surface, and obtain the root mean square deviation as the corrected Rq value; for the transition region, calculate the roughness using the weighted average method, where the weight is proportional to the distance from the region boundary; combine the Ra value, the Rq value, and the weighted roughness value of the transition region through linear interpolation to obtain the complete surface roughness evaluation result.
[0129] It also includes: dividing the deformed region into different deformation sub-regions such as the material missing region, the material accumulation region, and the transition region. For different types of deformation sub-regions, adopt a sub-region and hierarchical surface fitting strategy. Among them, within the material missing region, obtain the ideal surface topography through thin plate spline interpolation; within the material accumulation region, fit an ideal surface that smoothly transitions with the surrounding region through Gaussian process regression; within the transition region, obtain the ideal surface topography using radial basis function interpolation.
[0130] According to the local height difference and gradient change, the deformed area is divided into a material missing area, a material accumulation area and a transition area, and a sub-region marking map is obtained. For the material missing area, the pixel points adjacent to the non-missing area are extracted as control points, and the thin plate spline interpolation algorithm is used to construct an interpolation function. If it is a material accumulation area, the internal points of the area and the points within the surrounding range are selected as sampling points, and Gaussian process regression is used for fitting. Inside the transition area, uniformly distributed control points are selected, and the radial basis function is applied for interpolation. The weight coefficient ω is obtained by solving the system of equations Aω = y, where A is the basis function matrix and y is the height value of the control points. According to the weight coefficient ω, the ideal surface topography of the material missing area, the material accumulation area and the transition area is obtained.
[0131] Exemplarily, according to the obtained microscopic deformation area mask, the original surface contour data is partitioned. Morphological operations are used to dilate and erode the mask to create a transition area, and the contour data is divided into three parts: the deformed area, the non-deformed area and the transition area. The area identifier of each data point is recorded. For the contour data of the non-deformed area, the arithmetic mean deviation method is applied to calculate the surface roughness. The sampling length is 0.8 mm and the evaluation length is 4 mm, and the Ra value is calculated.
[0132] For the discontinuous data existing in the non-deformed area, linear interpolation is used for filling. For the contour data of the deformed area, the least squares method is used to fit the ideal surface, and the order of the fitting curve is dynamically adjusted according to the size of the deformed area, ranging from the 2nd order to the 5th order. Specifically, the number of pixels in the deformed area is calculated. When the number of pixels is less than 1000, a 2nd order curve is used; when it is between 1000 and 5000, a 3rd order curve is used; when it is between 5000 and 10000, a 4th order curve is used; and when it is greater than 10000, a 5th order curve is used.
[0133] During the fitting process, the sum of the squared residuals is minimized through iterative optimization. The deviation between the actual contour of the deformed area and the fitted ideal surface is calculated, and the root mean square deviation is used as the corrected roughness value to obtain the Rq value. For the transition area, the weighted average method is used to calculate the roughness, and the weight is proportional to the distance from the area boundary. Finally, the Ra value, the Rq value and the weighted roughness value of the transition area are combined, and the complete surface roughness evaluation result is obtained through linear interpolation.
[0134] When processing a microscopic deformation region mask of 1024×1024 pixels and the corresponding surface profile data, first perform dilation and erosion operations on the mask with a 3×3 pixel size to create a transition region with a width of 6 pixels. Divide the profile data into a deformation region with a pixel value of 255, a non-deformation region with a pixel value of 0, and a transition region with a pixel value between 0 - 255. For the non-deformation region, sample once every 0.8 mm within a 4 mm evaluation length, calculate a total of 5 Ra values and take the average. If data discontinuity is found, such as the height difference between adjacent points exceeding 10 μm, linear interpolation is used to fill it. The deformation region contains 7500 pixels, and a 4th-order curve fitting is selected.
[0135] Using the least squares method, initialize the coefficients as [1, 1, 1, 1, 1], iterate 100 times through gradient descent with a learning rate of 0.01 to obtain the optimal fitting coefficients. Calculate the root mean square deviation Rq between the actual profile and the fitted surface. For the 6-pixel-wide transition region, linearly interpolate Ra and Rq. For example, the weight of the 1st pixel is 5 / 6Ra + 1 / 6Rq, the 2nd pixel is 4 / 6Ra + 2 / 6Rq, and so on. Finally, obtain a roughness matrix of 1024×1024, where the value of the non-deformation region is approximately 2 μm, the value of the deformation region is approximately 15 μm, and the value of the transition region varies smoothly between 2 - 15 μm, forming a complete surface roughness evaluation result.
[0136] Divide the deformation region into different sub-regions such as material missing area, material accumulation area, and transition area. For different types of deformed sub-regions, adopt a sub-region and hierarchical surface fitting strategy. Inside the material missing area, obtain the ideal surface topography through thin plate spline interpolation method; inside the material accumulation area, fit an ideal surface that smoothly transitions with the surrounding area through Gaussian process regression; inside the transition area, use radial basis function interpolation to obtain the ideal surface topography and the transition area, and obtain a sub-region marker map.
[0137] For the material missing area, extract the pixel points adjacent to the non-missing area as control points and construct an interpolation function using the thin plate spline interpolation algorithm. If it is the material accumulation area, select the internal points of the area and the points within the surrounding range as sampling points and use Gaussian process regression for fitting. Inside the transition area, select uniformly distributed control points and apply radial basis function for interpolation; obtain the weight coefficient ω by solving the system of equations Aω = y, where A is the basis function matrix and y is the height value of the control points. According to the weight coefficient ω, obtain the ideal surface topography of the material missing area, material accumulation area, and transition area.
[0138] In some embodiments, the deformed region is divided into sub-regions. By calculating the local height difference and gradient change within a 5×5 neighborhood, a threshold is set such that when the height difference is greater than 10 μm and the gradient change is less than 0.1, it is defined as a material missing region; when the height difference is greater than 10 μm and the gradient change is greater than 0.5, it is defined as a material accumulation region; and the rest is the transition region, thus obtaining a sub-region marking map. For the material missing region, the boundary points of the region are extracted as control points, and the selection criterion for the boundary points is the pixel points adjacent to the 8-neighborhood of the non-missing region. The thin plate spline interpolation algorithm is used, and the smoothing parameter lambda is set to 0.5 to construct the interpolation function f(x, y) = a + bx + cy + Σ(wiφ(r)), where φ(r) = r2 log(r) is the thin plate spline basis function, a, b, c are the coefficients of the constant terms, wi is the weight associated with each observation point, and ri is the Euclidean distance from the observation point (xi, yi) to (x, y).
[0139] The coefficients a, b, c, and wi are obtained by solving a system of linear equations. According to the range of the interpolation region, a grid division method is used to obtain the grid point coordinates (x, y) inside the region. By substituting the grid point coordinates into the interpolation function f(x, y), the interpolation result at the grid points is obtained, and the height value of the surface at the grid points is determined. Based on the height values at the grid points, the position coordinates (x, y, z) of the grid points in three-dimensional space are obtained. By connecting adjacent grid points to form triangular patches, the three-dimensional geometry of the surface is obtained, and the ideal surface topography inside the missing region is determined. According to the characteristics of the surface topography, the normal vectors at each position on the surface are obtained. By calculating the light and dark changes of the surface under lighting conditions, the realistic rendering effect of the surface is obtained, and the degree of coincidence between the interpolated surface topography and the actual surface is judged.
[0140] According to the evaluation result of the degree of coincidence, the optimal smoothing parameter lambda value is obtained. By reconstructing the interpolation function and calculating the interpolation result, the ideal surface model closest to the actual surface topography is obtained, and the final result of repairing the missing region is obtained, and the ideal surface topography inside the missing region is obtained. For the material accumulation region, 20% of the points inside the region and the points within a range of 10 pixels around are selected as sampling points, and Gaussian process regression is used for fitting. The kernel function is selected as the radial basis function k(x, x') = σ2exp(-||x - x′||2 / (2l2)), where x and x' represent two different points in the input space, σ2 is the signal variance, exp(-||x - x′||2 / (2l2) is the Gaussian kernel function part, which measures the similarity between the input x and x', and the length scale parameter 1 is set to 5, and the signal-to-noise ratio SNR is set to 10.
[0141] The model parameters are trained by maximizing the marginal likelihood estimation, and the predicted mean value is used as the ideal surface. Inside the transition zone, uniformly distributed control points with a grid interval of 5 pixels are selected. Radial basis function interpolation is applied, and the multiquadric function φ(r) = (r2 + c2)^(1 / 2) is selected as the basis function, where r is the distance between the control point and the target point, and the shape parameter c is set to 1.5. By solving the system of equations Aω = y, where A is an n×n basis function matrix, n is the number of control points, the elements in the matrix represent the basis function values between the i-th control point and the j-th control point, and y is the height value of the control points, the weight coefficient ω is obtained, and the ideal surface topography of the transition zone is calculated.
[0142] When processing the deformed area image of 1024×1024 pixels, first analyze the 5×5 neighborhood of each pixel. The average value of the local height difference is calculated to be 15μm, and the average value of the gradient change is 0.3. After setting the threshold, it is identified that the material missing area accounts for 20%, the material accumulation area accounts for 30%, and the transition area accounts for 50%. For the 100×100 pixel material missing area, 378 boundary points are extracted as control points. Using thin plate spline interpolation, a 10000×10000 linear equation system is solved, which takes about 2 seconds to obtain the interpolation function. In the 200×150 pixel material accumulation area, 600 internal sampling points and 450 surrounding sampling points are selected. In Gaussian process regression, Cholesky decomposition is used to optimize the calculation speed, and the training takes about 5 seconds. For the remaining 512×512 pixel transition area, 10404 control points are selected, a radial basis function matrix is constructed, and a 10404×10404 linear equation system is solved, which takes about 10 seconds.
[0143] Finally, an ideal surface height matrix of 1024×1024 is obtained, where the height change in the material missing area is smooth, and the maximum height difference is reduced to 5μm; the material accumulation area and the surrounding area transition naturally, and the height gradient is reduced to less than 0.2; the surface undulation in the transition area is continuous without obvious jumps, realizing the sub-region and hierarchical surface fitting of the deformed area.
[0144] Step S6 of this embodiment includes obtaining the corrected roughness data and preprocessing the roughness data. The preprocessing includes normalizing the material hardness and yield strength to the range of 0 to 1, performing logarithmic conversion on the processing pressure and speed, and standardizing the application environment temperature and humidity. According to the preprocessed data, the principal component analysis method is used for dimensionality reduction. If the variance explained by the obtained principal components reaches the preset range, the principal components are retained. The dimensionality-reduced features and roughness data are clustered to divide the surface into multiple feature regions.
[0145] Statistical analysis is performed on the roughness data within each characteristic region, including calculating six parameters: root mean square roughness Rq, arithmetic mean roughness Ra, maximum profile height Ry, ten-point height Rz, skewness Rsk, and kurtosis Rku. The average values of six relevant factors corresponding to each characteristic region are obtained, and the six statistical characteristic parameters and the numerical values of the six relevant factors are combined to obtain a multi-dimensional feature vector.
[0146] Exemplarily, the corrected roughness data is preprocessed according to the stamping part material properties, processing process parameters, and application scenario information. The material hardness and yield strength are normalized to the range of 0 - 1, the processing pressure and speed are processed by logarithmic transformation, and the application environment temperature and humidity are standardized. Principal component analysis is used for dimensionality reduction, and the principal components that explain 95% of the variance are retained.
[0147] K-means clustering is performed using the dimensionality-reduced features and roughness data. The number of cluster centers is set to 5, the maximum number of iterations is 100, and the Euclidean distance is used as the similarity metric. Statistical analysis is performed on the roughness data within each characteristic region, and six parameters are calculated: root mean square roughness Rq, arithmetic mean roughness Ra, maximum profile height Ry, ten-point height Rz, skewness Rsk, and kurtosis Rku. For characteristic regions of different sizes, an adaptive sampling strategy is adopted, increasing the sampling points in large regions and reducing the sampling points in small regions to ensure that each region has at least 100 valid sampling points.
[0148] The average values of six relevant factors corresponding to each characteristic region, namely material hardness, yield strength, processing pressure, speed, application environment temperature, and humidity, are extracted from the production database. If the numerical values of some factors are missing in the database, they are estimated by interpolation or regression methods. The six statistical characteristic parameters and the numerical values of the six relevant factors of each characteristic region are combined into a 12-dimensional feature vector. The 12-dimensional feature vector is standardized, and each dimension is transformed into a standard normal distribution with a mean of 0 and a variance of 1 using the Z-score method to construct a multi-dimensional feature space representing the surface characteristics of the stamping part.
[0149] When processing the surface of a 1000×1000mm stamping part, the materials and process parameters are first preprocessed. The material hardness is normalized from 200HV to 0.5, the yield strength is normalized from 300MPa to 0.6, the processing pressure of 100MPa is converted to lg100≈2, the speed of 5m / s is converted to lg5≈0.7, the environmental temperature of 25°C is standardized to 0, and the humidity of 60% is standardized to 0.5. Through principal component analysis, the 6 features are reduced to 3 principal components, explaining 95.5% of the variance. K-means clustering is performed in combination with the roughness data, and it converges after 5 iterations, obtaining 5 characteristic regions with areas of 300000, 250000, 200000, 150000, and 100000 square millimeters respectively.
[0150] Statistical analysis is performed on each region. Taking the largest region as an example, 1000 points are sampled, and it is calculated that Rq = 2.5 μm, Ra = 2.0 μm, Ry = 15 μm, Rz = 12 μm, Rsk = 0.1, and Rku = 3.2. For the smallest region, 100 points are sampled to ensure data reliability. The average values of relevant factors are extracted from the database, and it is found that the application environment humidity is missing, which is estimated to be 58% through linear regression. Twelve parameters are combined into a feature vector [2.5, 2.0, 15, 12, 0.1, 3.2, 0.5, 0.6, 2, 0.7, 0, 0.48]. After Z-score standardization, the final feature vector [-0.5, 0.2, 1.2, 0.8, -0.3, 0.1, 0.3, 0.5, 0.7, -0.1, -0.8, 0.2] is obtained, completing the construction of the multi-dimensional feature space of the stamping part surface characteristics, which takes about 30 seconds in total.
[0151] In step S7 of this embodiment, a stamping part sample with a known surface quality grade is obtained, a multi-dimensional feature vector is extracted, and a training data set is constructed; the multi-dimensional feature vector is subjected to Z-score standardization processing to obtain a standardized feature vector; a support vector machine classifier with a radial basis kernel function is used to train a surface quality evaluation model, with the training data set as the input and the surface quality grade as the output; if the stamping part surface image is newly input, a multi-dimensional feature vector is extracted and subjected to Z-score standardization processing. The standardized feature vector is input into the trained surface quality evaluation model, and according to the output decision function value, the confidence score of each roughness grade is obtained, and the grade with the highest confidence score is the final prediction result.
[0152] In some embodiments, stamping part samples with known surface quality grades are collected, the surface roughness grades are divided according to the international standard ISO4287, multi-dimensional feature vectors are extracted, and a training data set including samples of different surface roughness grades is constructed. The features are subjected to Z-score standardization processing so that the mean of each feature is 0 and the standard deviation is 1. The data set is divided into a training set and a validation set in a ratio of 8:2. A support vector machine classifier with a radial basis kernel function is selected, and the optimal parameters C and gamma are determined through grid search. The search range of C is [0.1, 1, 10, 100], and the search range of gamma is [0.001, 0.01, 0.1, 1], and 5-fold cross-validation is adopted.
[0153] Train the surface quality evaluation model on the training set and use the validation set to evaluate the model performance. Preprocess the newly input stamping part surface images, including image enhancement, denoising, and normalization, and extract the same multi-dimensional feature vectors as the training data. Standardize the feature vectors using Z-score to ensure consistency with the training data distribution. Input the standardized feature vectors into the trained support vector machine model to obtain the prediction results of the surface roughness grades. Calculate the decision function values output by the support vector machine model and use the Platt scaling method to convert the decision function values into a probability distribution to obtain the confidence scores for each roughness grade.
[0154] Select the grade with the highest confidence as the final prediction result and output the corresponding confidence score to achieve automatic detection of the surface roughness of stamping parts based on image recognition. In practical applications, collect 1000 stamping part samples with known surface quality grades and divide them into 5 grades N1 - N5 according to the ISO4287 standard. Extract 12-dimensional feature vectors, including parameters such as Ra, Rq, and Rz. Standardize the features using Z-score. For example, convert Ra from the original value of 2.5 μm to the standardized value of 0.7.
[0155] Use 800 samples as the training set and 200 samples as the validation set. Select an SVM classifier with an RBF kernel and determine the optimal parameters through grid search, C = 10, gamma = 0.01, and the accuracy of 5-fold cross-validation reaches 92%. For the newly input stamping part surface image of 1024×1024 pixels, first use Gaussian filtering for denoising with σ = 1.5, and then perform contrast stretching to stretch the gray range from [50, 200] to [0, 255]. Extract the feature vectors and standardize them. For example, standardize Ra = 3.2 μm to 1.2. Input into the SVM model to obtain the predicted grade N3. Calculate the decision function value. For example, the value for the N3 category is 2.5. Use the Platt scaling method to convert the decision function value into a probability, and obtain the confidence for the N3 grade as 0.85. Finally, output the prediction result as the surface roughness grade N3 with a confidence of 85%. It takes about 2 seconds to process a single sample, achieving fast and accurate detection of the surface roughness of stamping parts based on image recognition.
[0156] Compared with the traditional methods for detecting the surface roughness of stamping parts, applying the stamping part surface roughness detection of this embodiment can greatly improve the detection accuracy.
[0157] In addition, this embodiment relates to a stamping part surface roughness detection system based on image recognition, including a surface profile database construction module, a microscopic deformation feature extraction module, a probability modeling and region segmentation module, a region processing and roughness correction module, a feature vector construction and classification module, and a surface quality evaluation model application module.
[0158] Among them, the surface profile database construction module is used to establish the standard model and the actual profile data; the microscopic deformation feature extraction module is used to obtain and optimize the deformation feature map of the stamping part; the probability modeling and region segmentation module is used for probability calculation and microscopic deformation region segmentation; the region processing and roughness correction module is used to reconstruct the ideal surface and correct the roughness; the feature vector construction and classification module is used to calculate the statistical features and construct a multi-dimensional feature vector; the surface quality evaluation model application module is used to judge the surface roughness grade to achieve detection.
[0159] The stamping part surface roughness detection system in this embodiment can run the above-mentioned stamping part surface roughness detection method to achieve the detection of the surface roughness of the stamping part, and has a high detection accuracy.
[0160] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for detecting the surface roughness of a stamping part based on image recognition, characterized in that, Including: Step S1: Establish a surface profile database based on the standard model of the metal square grid pattern stamped by the texturing die, obtain the actual profile data of the surface of the stamped part, compare the difference between the actual profile and the standard model of the metal square grid pattern, and obtain the microscopic deformation feature distribution image; Step S2: Separate the high-frequency feature components of the microscopic deformation feature distribution image, filter out the high-frequency noise, and optimize the microscopic deformation feature distribution image; Step S3: Perform probability modeling on the optimized microscopic deformation feature distribution image, and calculate the probability distribution of each pixel point belonging to the true surface roughness or microscopic deformation according to the deformation feature correlation of different local regions; Step S4: Based on the probability distribution result, segment the microscopic deformation region, and by setting the connectivity threshold and the region area threshold, eliminate isolated small regions to obtain a continuous microscopic deformation region mask; Step S5: According to the microscopic deformation region mask, perform zoning processing on the original surface profile data, including reconstructing the ideal surface in the deformation region, and calculating the deviation between the actual profile and the ideal surface as the corrected roughness value; Step S6: For the corrected roughness value, divide the surface into multiple feature regions according to the characteristics of the stamped part, and calculate the statistical features for each feature region respectively. The calculated statistical features include the root mean square roughness, skewness, and kurtosis parameters to construct a multi-dimensional feature vector; Step S7: Train and classify the multi-dimensional feature vector, establish a surface quality evaluation model, and when the surface data of the to-be-tested stamped part is input, judge the surface roughness grade through the surface quality evaluation model.
2. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 1, characterized in that, The step S1 includes: Obtain the point cloud data of the surface of the metal square grid pattern standard model, and construct a three-dimensional model of the standard model surface; Obtain the actual profile data of the surface of the stamped part, calculate the point-to-point Euclidean distance deviation between the profile data of the three-dimensional model and the actual profile data to obtain a profile difference matrix; Extract the main deformation feature vectors of the profile difference matrix, construct a microscopic deformation feature space. If there are feature vectors in the microscopic deformation feature space that have a significant impact on the deformation, perform interpolation calculation on the surface of the stamped part, and draw a deformation degree contour map according to the interpolation calculation result to obtain the surface microscopic deformation feature distribution image.
3. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 1, wherein, The step S2 includes: Convert the microscopic deformation feature distribution image from the spatial domain to the frequency domain to obtain a complex matrix represented in the frequency domain; Determine the high-frequency threshold according to the size and resolution of the microscopic deformation feature distribution image; Judge the frequency value of the amplitude spectrum in the complex matrix represented in the frequency domain. If the frequency value is higher than the high-frequency threshold, extract it as a high-frequency feature. If the frequency value is lower than the high-frequency threshold, retain it as a low-frequency feature; For the high-frequency feature, calculate the mean and standard deviation of its amplitude value to obtain a noise threshold; Judge the amplitude value of the high-frequency feature. If the amplitude value is lower than the noise threshold, set this high-frequency component to zero. If the amplitude value is higher than the noise threshold, retain this high-frequency component; Convert the frequency-domain complex matrix obtained by merging the reserved high-frequency components and the low-frequency features back to the spatial domain to obtain the optimized microscopic deformation feature distribution image.
4. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 1, characterized in that, The step S3 includes: Receiving the microscopic deformation feature distribution image and dividing it into a plurality of overlapping sub-regions; wherein, the size of the overlapping sub-regions is a preset pixel value, and the overlapping rate of adjacent overlapping sub-regions is a preset percentage; Extracting the local statistical features of the overlapping sub-regions to obtain a six-dimensional feature vector, wherein the local statistical features include mean, variance, skewness, kurtosis, maximum value, and minimum value; Using the K-means clustering algorithm to cluster the six-dimensional feature vector to obtain the surface roughness category and the microscopic deformation category, wherein the number of clustering centers is a preset value; According to the clustering result, establish a Gaussian mixture model, wherein the Gaussian mixture model is used to perform probability modeling on each pixel point to obtain the probability distribution of the pixel point belonging to the surface roughness category and the microscopic deformation category.
5. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 1, characterized in that, The step S4 includes: According to the probability distribution result, mark the pixel points with a microscopic deformation probability greater than a preset threshold, obtain the seed points of the region growing algorithm, and establish a seed point queue; Take out a seed point from the seed point queue and check the neighboring pixels of the seed point; If the neighboring pixel is within the image boundary, and the microscopic deformation probability is greater than the preset threshold, the connectivity is greater than the preset connectivity threshold, and it has not been marked, then add the neighboring pixel to the current region and add it to the seed point queue; Repeat the seed point expansion until the seed point queue is empty to obtain the preliminarily segmented microscopic deformation region; Perform post-processing on the preliminarily segmented microscopic deformation region; If the area of the microscopic deformation region is less than a preset area threshold, then remove the microscopic deformation region from the microscopic deformation region, and re-mark the pixels of the microscopic deformation region as the background; Perform label merging on all the remaining microscopic deformation regions to generate the final continuous microscopic deformation region mask.
6. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 5, characterized in that: Sample the original image to obtain a plurality of images with different scales, and perform region segmentation on the plurality of images with different scales to obtain a plurality of segmentation results with different scales; Map the segmentation result of the small scale to the image of the large scale, and judge whether to merge regions by calculating the region overlap degree; If the region overlap degree exceeds a preset threshold, then merge the regions; Perform boundary processing on the fused segmentation result, extract the edge gradient, and judge whether the edge gradient is lower than the adaptive threshold; If the edge gradient is lower than the adaptive threshold, then mark it as a boundary region; According to the gray value distribution of the pixels inside the region, correct the marked boundary region to determine the category of the boundary pixels.
7. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 1, characterized in that, The step S4 includes: According to the obtained microscopic deformation region mask, perform partition processing on the original surface contour data to obtain three parts of contour data: the deformed region, the non-deformed region, and the transition region; For the non-deformed region contour data, calculate the surface roughness Ra value; If there is discontinuous data in the non-deformed area, linear interpolation method is used for filling; For the contour data of the deformed area, the least squares method is used to fit the ideal surface, and the sum of squared residuals is minimized through iterative optimization; Calculate the deviation between the actual contour of the deformed area and the fitted ideal surface, and obtain the root mean square deviation as the corrected Rq value; For the transition area, the weighted average method is used to calculate the roughness, where the weight is proportional to the distance from the area boundary; By linearly interpolating the Ra value, Rq value and the weighted roughness value of the transition area, a complete surface roughness evaluation result is obtained.
8. The method for detecting the surface roughness of a stamping part based on image recognition according to claim 7, wherein, It further includes: The deformed area is divided into different deformed sub-areas such as material missing area, material accumulation area and transition area. For different types of the deformed sub-areas, a surface fitting strategy of sub-regions and hierarchical levels is adopted. Inside the material missing area, the thin plate spline interpolation method is used to obtain the ideal surface topography. Inside the material accumulation area, the Gaussian process regression is used to fit an ideal surface that smoothly transitions with the surrounding area. Inside the transition area, the radial basis function interpolation is used to obtain the ideal surface topography; According to the local height difference and gradient change, the deformed area is divided into a material missing area, a material accumulation area and a transition area, and a sub-region marker map is obtained; For the material missing area, the pixel points adjacent to the non-missing area are extracted as control points, and the thin plate spline interpolation algorithm is used to construct the interpolation function; If it is a material accumulation area, the points inside the area and the points within the surrounding range are selected as sampling points, and the Gaussian process regression is used for fitting; Inside the transition area, uniformly distributed control points are selected, and the radial basis function is applied for interpolation; The weight coefficient ω is obtained by solving the equation system Aω = y, where A is the basis function matrix and y is the control point height value; According to the weight coefficient ω, the ideal surface topographies of the material missing area, the material accumulation area and the transition area are obtained.
9. The method for detecting the surface roughness of a stamping part based on image recognition according to any one of claims 1 to 8, characterized in that, The step S6 includes: Obtain the corrected roughness data, and preprocess the roughness data. The preprocessing includes normalizing the material hardness and yield strength to the range of 0 to 1, performing logarithmic conversion on the processing pressure and speed, and performing standardization processing on the applied environmental temperature and humidity; According to the preprocessed data, the principal component analysis method is used for dimensionality reduction. If the explained variance of the obtained principal components reaches the preset range, the principal components are retained; Cluster the dimensionality-reduced features and roughness data, and divide the surface into multiple feature regions; Statistical analysis is performed on the roughness data within each of the feature regions, including calculating six parameters: root mean square roughness Rq, arithmetic mean roughness Ra, maximum profile height Ry, ten-point height Rz, skewness Rsk and kurtosis Rku; Obtain the average values of six relevant factors corresponding to each of the feature regions, and combine the six statistical feature parameters and the six relevant factor values to obtain the multi-dimensional feature vector; and / or, The step S7 includes: Obtain the stamping part samples with known surface quality grades, extract the multi-dimensional feature vectors, and construct a training data set; Perform Z-score standardization processing on the multi-dimensional feature vectors to obtain the standardized feature vectors; A support vector machine classifier using a radial basis kernel function is employed to train a surface quality evaluation model, with the training data set as the input and the surface quality grade as the output; If the surface image of the stamping part is a new input, a multi-dimensional feature vector is extracted and subjected to Z-score standardization processing; The standardized feature vector is input into the trained surface quality evaluation model, and according to the output decision function value, the confidence score for each roughness grade is obtained, and the grade with the highest confidence score is the final prediction result.
10. A stamping part surface roughness detection system based on image recognition, characterized in that, It includes: a surface profile database construction module, a microscopic deformation feature extraction module, a probability modeling and region segmentation module, a region processing and roughness correction module, a feature vector construction and classification module, and a surface quality evaluation model application module; The surface profile database construction module is used to establish a standard model and actual profile data; The microscopic deformation feature extraction module is used to obtain and optimize the deformation feature map of the stamping part; The probability modeling and region segmentation module is used for probability calculation and microscopic deformation region segmentation; The region processing and roughness correction module is used to reconstruct the ideal surface and correct the roughness; The feature vector construction and classification module is used to calculate statistical features and construct a multi-dimensional feature vector; The surface quality evaluation model application module is used to judge the surface roughness grade to achieve detection.
Citation Information
Cited By
Automobile workpiece edge covering quality detection method based on weighted contour matching
CN120672751A
Zinc spraying layer thickness detection method and system
CN120760616A
Method for evaluating three-dimensional roughness of rock mass structural surface
CN120997819A
Surface roughness and heat dissipation performance collaborative optimization method of power supply heat dissipation shell
CN121031193A
Gear production line optimization control method and system based on intelligent algorithm
CN121254790A