Stamping forming quality detection method for stamping part

By generating a spatial prior weight map and an improved feature extraction operator, combined with multi-kernel learning and cost-sensitive learning, the problems of low accuracy and class imbalance in stamping quality inspection are solved, and efficient and accurate defect detection is achieved.

CN120747056AActive Publication Date: 2025-10-03BAOJI YUNJIE METAL PROD CO LTD

Patent Information

Application Number
CN202511187648.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-25
Publication Date
2025-10-03
Estimated Expiration
2045-08-25

AI Technical Summary

Technical Problem

The existing stamping quality inspection methods have low detection accuracy, especially in the case of category imbalance and insufficient defect feature extraction, resulting in high missed detection and false detection rates.

Method used

By generating a spatial prior weight map and using a three-dimensional geometric model to analyze the difficulty of regional forming, feature extraction is improved by combining elliptical neighborhood sampling and three-value pattern encoding. A weighted combination of radial basis kernel function and chi-square kernel function is adopted in the support vector machine classification model, and a cost-sensitive learning strategy is used to optimize the classifier.

Benefits of technology

It improves the sensitivity and accuracy of defects, reduces the missed detection rate, enhances the detection ability of hidden or weak defects, solves the problem of category imbalance, and enhances the consistency and robustness of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120747056A_ABST
    Figure CN120747056A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, and discloses a stamping part stamping forming quality detection method, which comprises the following steps: acquiring a surface digital image of a stamping part, analyzing the surface curvature and the material thickness change gradient of the stamping part, and generating a space prior weight map; calculating the structure tensor of a pixel point, and determining the orientation and axial length ratio of an elliptical sampling neighborhood; pixel point sampling is carried out along the elliptical sampling neighborhood to obtain an initial three-valued mode code; a global feature histogram is constructed, the contribution degree is accumulated to the statistical unit, and the contribution degree is the corresponding weight value of the pixel point in the spatial prior weight map; all the global feature histograms are cascaded to generate cascaded feature vectors; and inputting the cascade feature vector into a support vector machine classification model, and judging whether the stamping part to be detected is qualified or not. According to the method, the space prior weight map is introduced, the prior knowledge of the punch forming process is fused into the feature extraction process, so that the detection focuses on the defect high-incidence area, the extracted features are more targeted, and the detection accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for detecting the stamping quality of stamping parts. Background Art

[0002] Stamping technology is an efficient and low-cost metal plastic processing method used in fields such as automotive manufacturing, aerospace, and home appliance production. However, during the stamping process, due to factors such as uneven material flow, improper mold design, or inappropriate process parameter settings, the surface of stamped parts is prone to forming defects such as wrinkling, cracking, strain, dents, and springback. These defects not only affect the product's aesthetics but, in severe cases, can reduce mechanical properties and service life, and even pose a safety hazard. Existing quality inspection methods include manual visual inspection and automated inspection methods based on image processing. Manual visual inspection methods are highly subjective, inefficient, and costly, and are prone to missed inspections and false detections due to operator fatigue, making them difficult to meet the needs of modern mass production. Automated inspection methods based on image processing aim to extract features from the surface image of the stamped part that can effectively distinguish between qualified and defective parts, and then use a classifier to make the distinction. Local binary patterns (LBP) are commonly used in image texture analysis and defect detection. However, the existing local binary pattern (LBP) technology has the following limitations: LBP uses a fixed circular neighborhood for sampling, which makes it difficult to effectively characterize the anisotropic texture structure commonly found in defective areas; LBP's binary encoding method is sensitive to image noise; and LBP treats all areas in the image equally, ignoring the prior knowledge that different areas have different molding difficulties, resulting in insufficient discriminability of the extracted features.

[0003] In terms of classifier selection, support vector machines (SVM) are often used for defect classification tasks. Choosing the right kernel function and support vector machine parameters is crucial to the performance of the SVM. However, a single type of kernel function, such as the commonly used radial basis kernel function, often fails to fully capture the diversity and nonlinear distribution of defect characteristics in complex industrial scenarios, resulting in limited classification capabilities. Moreover, in actual production, the number of defective samples is usually far less than that of qualified samples. This serious class imbalance problem causes the trained classification model to tend to predict samples as the majority class (qualified samples), resulting in a low recognition rate for the minority class (defective samples). Moreover, during training, the SVM applies the same penalty to all misclassified samples, and does not take into account those "difficult to distinguish" samples that are closer to the classification boundary and contain more information, which affects the optimization of the model's decision boundary. How to improve the accuracy of stamping quality inspection for stamped parts is an urgent problem to be solved in this field. Summary of the Invention

[0004] The present invention provides a method for detecting the quality of stamping parts by stamping forming to solve the problem of low accuracy in the detection of the quality of stamping parts by stamping forming in the above-mentioned prior art.

[0005] The method for detecting the quality of stamping parts by stamping forming of the present invention comprises the following steps: Obtain a surface digital image of the stamping part to be inspected, and generate a spatial priori weight map representing the forming difficulty of each area by analyzing the surface curvature and material thickness variation gradient of each area of ​​the preset three-dimensional geometric model of the stamping part to be inspected. The spatial priori weight map is then aligned with the surface digital image; the structural tensor of the pixel points in the surface digital image is calculated, and the orientation and axis length ratio of the elliptical sampling neighborhood are determined according to the eigenvector of the structural tensor; pixel points are sampled at multiple preset scales along the contour of the elliptical sampling neighborhood, and the pixel values ​​of the sampling points are ternary-compared with the pixel values ​​of the central pixel points to obtain the initial ternary pattern encoding; at each scale, a global feature histogram is constructed, in which each pixel point in the surface digital image According to the rotation-invariant three-value pattern encoding corresponding to the pixel point, the statistical unit corresponding to the pixel point in the global feature histogram is obtained, and the contribution is accumulated to the statistical unit, where the contribution is the corresponding weight value of the pixel point in the spatial prior weight map; the global feature histograms constructed at all scales are cascaded to generate a cascaded feature vector; the cascaded feature vector is input into a support vector machine classification model, the kernel function of the support vector machine classification model is a weighted combination of a radial basis kernel function and a chi-square kernel function, wherein the weight coefficient of each kernel function is determined by a multi-kernel learning algorithm during the model training stage; based on the output result of the support vector machine classification model, the stamping part to be inspected is determined to be a qualified part or a defective part.

[0006] Preferably, the ternary comparison is as follows: when the absolute value of the difference between the sampling point pixel value and the center pixel value is less than a threshold value t1, it is encoded as 0; when the sampling point pixel value is greater than the center pixel value and the absolute value of the difference is not less than t1, it is encoded as 1; when the sampling point pixel value is less than the center pixel value and the absolute value of the difference is not less than t1, it is encoded as 2; the initial ternary pattern code is cyclically shifted, and the code with the smallest value is taken as the rotationally invariant ternary pattern code of the pixel point.

[0007] Preferably, the method generates a spatial priori weight map representing the forming difficulty of each area by analyzing the surface curvature and material thickness variation gradient of each area of ​​the preset three-dimensional geometric model of the stamping part to be inspected, including: dividing the three-dimensional geometric model into a surface element grid; calculating the average curvature K and material thickness variation gradient G of the center point of each surface element; normalizing the K value and G value of all surface elements to the interval [0,1], and obtaining and The weight value W of any point in the spatial prior weight map is calculated by the following formula: , where α is the preset weight coefficient, and its value range is (0,1).

[0008] Preferably, the determining of the orientation and axis length ratio of the elliptical sampling neighborhood according to the eigenvector of the structure tensor comprises: for each pixel point in the surface digital image, calculating the image gradient in the x-direction and the y-direction in the neighborhood of a preset scale; and ; Smooth the product of the gradient components through the Gaussian function to construct the structure tensor ; Perform eigenvalue decomposition on the structure tensor S to obtain two eigenvalues and the eigenvectors v1 and v2 corresponding to the two eigenvalues; the orientation of the major axis of the ellipse sampling neighborhood is consistent with the direction of the eigenvector v1; the axis length ratio of the major axis to the minor axis of the ellipse sampling neighborhood is set to , set the maximum axis length ratio threshold.

[0009] Preferably, the construction of the global feature histogram includes: dividing the rotationally invariant three-value pattern encoding into a uniform pattern and a non-uniform pattern, wherein if the number of cyclic jumps in the encoded code value sequence is not greater than 2, it is a uniform pattern; and establishing statistical units for all uniform patterns and a concentrated non-uniform pattern to construct the global feature histogram.

[0010] Preferably, the pixel sampling is performed at a plurality of preset scales, including: the plurality of preset scales are ellipse major semi-axis radii R1, R2, ..., R n Pixels, where n is the total number of scales; P pixels are uniformly sampled along the outline of the elliptical sampling neighborhood of each scale; the threshold t1 is the standard deviation of the grayscale values ​​of all pixels in the elliptical sampling neighborhood where the center pixel is located.

[0011] Preferably, the kernel function of the support vector machine classification model is a weighted combination of a radial basis kernel function and a chi-square kernel function, including: Weighted combination kernel function of the support vector machine classification model The calculation formula is: ; ; ; in and are two eigenvectors, is the radial basis kernel function, is the chi-square kernel function, is the eigenvector No. Quantity is the eigenvector No. components, weight coefficients And kernel function parameters and All are determined during the training phase.

[0012] Preferably, the support vector machine classification model adopts a cost-sensitive learning strategy during the training phase, sets differentiated penalty factors for different training samples, and assigns high penalty weights to minority class samples.

[0013] Preferably, the cost-sensitive learning strategy is used to set different penalty factors for different training samples, including: for the i-th sample x in the training set i , sample x i The penalty factor C i The calculation formula is: ; in is the basic penalty factor; is the category weight, the value of defective samples is greater than 1, and the value of qualified samples is 1; is the distance weight, the value of the distance weight is related to the sample x i The function interval to the classification hyperplane is negatively correlated.

[0014] Preferably, the multi-core learning algorithm is a SimpleMKL algorithm.

[0015] The beneficial effects of the present invention are as follows: by introducing a spatial prior weight map based on a three-dimensional model, the prior knowledge of the stamping process is integrated into the feature extraction process, so that the detection focus is on areas with high defect incidence, the extracted features are more targeted and discriminative, and the sensitivity to hidden or weak defects is improved. Moreover, the improved feature extraction operator uses elliptical neighborhood sampling, which can better match the directional structure often presented by defects such as scratches and wrinkles, and can capture more accurate texture information than circular neighborhoods. In addition, the three-value encoding can enhance the robustness of the feature to image noise, and the rotation invariant property ensures the consistency of the detection results for workpieces with different postures. In addition, in the classification stage, by weighted combination of radial basis kernel function and chi-square kernel function, the constructed classifier can learn the distribution law of complex features and improve classification accuracy. Moreover, the cost-sensitive learning strategy can set a higher misclassification cost for defect samples in the minority class, solving the common sample imbalance problem in actual industrial scenarios, improving the detection rate of defective parts, and reducing the risk of missed detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A schematic flow chart of a method for detecting the stamping quality of stamping parts provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0017] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to be used to explain the present invention, but should not be understood as limiting the present invention.

[0018] like Figure 1 As shown, the stamping quality inspection method of stamping parts provided by the embodiment of the present invention specifically includes the following steps: S1, obtain the surface digital image of the stamping part to be inspected, generate a spatial priori weight map representing the forming difficulty of each area by analyzing the surface curvature and material thickness change gradient of each area of ​​the preset three-dimensional geometric model of the stamping part to be inspected, and align the spatial priori weight map with the surface digital image.

[0019] The stamping part to be inspected is placed on a fixed tooling and photographed vertically using an industrial camera mounted directly above the workpiece. A shadowless dome light source is used to provide uniform illumination for the surface of the stamping part to capture a high-contrast, non-reflective surface digital image.

[0020] Import the 3D CAD model of the stamping part to be tested into finite element analysis software such as AutoForm to perform stamping simulation, and extract the average curvature and material tensile thinning rate of each grid cell on the surface of the 3D CAD model; use a weighted summation function, for example, weight value = ,in is the weight coefficient of curvature, b is the weight coefficient of thinning rate, the forming difficulty value of each unit is calculated, and a two-dimensional spatial prior weight map is generated. By extracting geometric feature point pairs such as positioning holes and edge contours on the image and model projection, an affine transformation matrix is ​​calculated, and the two-dimensional spatial prior weight map is accurately mapped and aligned to the digital image of the surface to be detected.

[0021] S2, calculating the structure tensor of the pixel points in the surface digital image, determining the orientation and axis length ratio of the elliptical sampling neighborhood according to the eigenvector of the structure tensor; sampling the pixels at multiple preset scales along the outline of the elliptical sampling neighborhood, performing ternary comparison on the pixel values ​​of the sampling points and the pixel values ​​of the center pixel points to obtain an initial ternary pattern code.

[0022] For each pixel in the image, Calculate the gradients in the x and y directions within the neighborhood and construct The structure tensor matrix of ; by solving the two eigenvalues ​​λ1 and λ2 of the structure tensor matrix and the corresponding eigenvectors e1 and e2, the direction of the eigenvector e1 corresponding to the larger eigenvalue λ1 is used as the major axis direction of the elliptical sampling neighborhood, and the ratio of the length of the major axis to the minor axis is set to the ratio of the square roots of the two eigenvalues, that is, .

[0023] S3. At each scale, a global feature histogram is constructed, wherein each pixel point in the surface digital image is encoded according to the rotationally invariant three-value pattern corresponding to the pixel point to obtain the statistical unit corresponding to the pixel point in the global feature histogram, and a contribution is accumulated to the statistical unit, where the contribution degree is the corresponding weight value of the pixel point in the spatial prior weight map; the global feature histograms constructed at all scales are cascaded to generate a cascade feature vector.

[0024] If the number of sampling points is 8, initialize a histogram vector with a length of 3 to the power of 8, that is, 6561, and each statistical unit corresponds to a rotation-invariant three-value pattern code; traverse each pixel point in the image, calculate the code corresponding to the pixel point, query the corresponding weight value w of the pixel point in the registered spatial prior weight map, and accumulate the corresponding weight value w to the statistical unit corresponding to the rotation-invariant three-value pattern code in the histogram, instead of simply adding 1.

[0025] The above encoding and histogram construction process is repeated at three scales with a scale radius of 2, 4, and 6, respectively, to obtain three feature histograms with a length of 6561. These three histograms are connected end to end to form a single vector with a length of 19683 dimensions, which is used as the final feature vector of the stamping part image.

[0026] S4, input the cascade feature vector into a support vector machine classification model, the kernel function of the support vector machine classification model is a weighted combination of a radial basis kernel function and a chi-square kernel function, wherein the weight coefficient of each kernel function is determined by a multi-kernel learning algorithm during the model training phase; during the training phase, the support vector machine classification model adopts a cost-sensitive learning strategy, sets differentiated penalty factors for different training samples, and assigns high penalty weights to minority class samples; based on the output result of the support vector machine classification model, the stamping part to be inspected is determined to be a qualified part or a defective part.

[0027] Specifically, the SimpleMKL algorithm is used to train the support vector machine. The SimpleMKL algorithm automatically optimizes the weight coefficients β1 and β2 of the radial basis kernel function and the chi-square kernel function during the iterative training process. For defective samples belonging to the minority class in the training set, the sample penalty factor C is set to N times the number of qualified samples, where N is the ratio of the number of qualified products to defective products. For samples that were misclassified or correctly classified in the previous iteration but were close to the classification boundary (that is, within the interval), the sample penalty factor is further multiplied by a distance weight greater than 1 to increase the sample's penalty factor, thereby achieving cost-sensitive learning.

[0028] The cascade feature vector of the stamping part to be inspected is input into the trained support vector machine model, and the support vector machine model will output a decision function value; if the decision function value is greater than 0, the stamping part is judged to be a defective part; if the decision function value is less than or equal to 0, it is judged to be a qualified part.

[0029] In an optional embodiment, the ternary comparison is as follows: when the absolute value of the difference between the sampling point pixel value and the center pixel value is less than a threshold value t1, it is encoded as 0; when the sampling point pixel value is greater than the center pixel value and the absolute value of the difference is not less than t1, it is encoded as 1; when the sampling point pixel value is less than the center pixel value and the absolute value of the difference is not less than t1, it is encoded as 2; the initial ternary pattern code is cyclically shifted, and the code with the smallest value is taken as the rotationally invariant ternary pattern code of the pixel point.

[0030] Taking the scale radius R equal to 2 and the number of sampling points P equal to 8 as an example, 8 sampling points are evenly collected along the outline of the elliptical sampling neighborhood determined in the previous step; the pixel values ​​of these 8 sampling points are compared with the pixel value of the center point. If the threshold t1 is set to 5, an 8-bit initial three-value pattern code consisting of 0, 1, and 2 is obtained, for example, 12011021; this 8-bit code is cyclically left-shifted 7 times to generate a total of 8 code sequences including the initial three-value pattern code. These 8 sequences are regarded as octal numbers and converted to decimal values. The code sequence with the smallest value is selected as the rotationally invariant three-value pattern code.

[0031] In an optional embodiment, by analyzing the surface curvature and material thickness variation gradient of each area of ​​the preset three-dimensional geometric model of the stamping part to be inspected, a spatial priori weight map representing the forming difficulty of each area is generated, including: dividing the three-dimensional geometric model into a surface element grid; calculating the average curvature K and material thickness variation gradient G of the center point of each surface element; normalizing the K value and G value of all surface elements to the [0,1] interval, and obtaining and The weight value W of any point in the spatial prior weight map is calculated by the following formula: , where α is the preset weight coefficient, and its value range is (0,1).

[0032] For example, a car's side panel has a surface that includes large flat areas, sharply curved corners, and ribbed structures. After meshing the bins, a bin located at a corner might have a calculated average curvature, K, of 0.8 due to the large curvature of the bin. Due to material stretching during the stamping process, the calculated thickness gradient, G, might be 0.6. Meanwhile, a bin located in a flat area might have a K value closer to 0.05 and a G value closer to 0.02.

[0033] After normalizing the K and G values ​​of all facets, the facets at the corners is 0.9, is 0.85, the flat area element is 0.06, is 0.03. If the weight coefficient α is set to 0.7, the weight W for the corner region is 0.885. The weight W for the flat region is 0.051. After generating the weight map in this way, the corner region, which is more difficult to form, has a much higher weight value than the flat region, indicating that this region is a priori more prone to defects such as cracking or wrinkling.

[0034] In an optional embodiment, the orientation and axis length ratio of the elliptical sampling neighborhood are determined based on the eigenvector of the structure tensor, including: for each pixel point in the surface digital image, calculating the image gradient in the x direction and the y direction in the neighborhood of the preset scale and ; Smooth the product of the gradient components through the Gaussian function to construct the structure tensor ; Perform eigenvalue decomposition on the structure tensor S to obtain two eigenvalues and the eigenvectors v1 and v2 corresponding to the two eigenvalues; the orientation of the major axis of the ellipse sampling neighborhood is consistent with the direction of the eigenvector v1; the axis length ratio of the major axis to the minor axis of the ellipse sampling neighborhood is set to , set the maximum axis length ratio threshold.

[0035] Assume that there is a fine scratch in the acquired sheet metal image. For a pixel located on the fine scratch, at the pixel The gradient is calculated in the neighborhood of . Since the scratch is vertical, the image grayscale changes dramatically in the horizontal direction, that is, the x direction, and changes slowly in the vertical direction, that is, the y direction. Therefore, the calculated The value is very large, The value is small. This results in the structure tensor S item is significantly larger than the other items.

[0036] Performing eigenvalue decomposition on the structure tensor will result in a large eigenvalue λ1, such as 120, and the eigenvector v1 of the structure tensor points in the x direction, and a very small eigenvalue λ2, such as 3, and the eigenvector v2 of the structure tensor points in the y direction. According to the settings, the long axis of the elliptical sampling neighborhood will be along the x direction, that is, perpendicular to the direction of the scratch. The ratio of the long axis to the short axis of the elliptical sampling neighborhood is , the result is 6.32. This creates a long, flat sampling neighborhood that accurately fits the local scratch structure, enhancing the ability to extract linear defect features. Setting the maximum axis length ratio threshold to 10 can prevent excessive stretching caused by noise.

[0037] In an optional embodiment, a global feature histogram is constructed, including: encoding the rotationally invariant three-value pattern into a uniform pattern and a non-uniform pattern, wherein if the number of cyclic jumps in the encoded code value sequence is not greater than 2, it is a uniform pattern; and establishing statistical units for all uniform patterns and a concentrated non-uniform pattern to construct the global feature histogram.

[0038] When using 8 sampling points for ternary pattern encoding, 3 to the power of 8, or 6561 possible patterns, is generated. If a statistical unit were created for each pattern, the dimension of the feature vector would reach 6561. This would not only be computationally intensive but also prone to overfitting in subsequent classification. Introducing the concept of uniform patterns can greatly simplify the problem. For example, the encoding sequence 11100011 has two cyclic transitions from 1 to 0 and back again, making it a uniform pattern, representing a smooth edge or corner structure. In contrast, a encoding sequence like 01201201 has far more than two transitions, making it a non-uniform pattern, typically corresponding to noise or irregular, complex textures in an image. For ternary patterns with 8 sampling points, the total number of uniform patterns is only over 200. Therefore, a global feature histogram with over 200 dimensions can be constructed, where each entry corresponds to a specific uniform pattern, plus an additional entry to count the total number of occurrences of all non-uniform patterns. In this way, the dimension of the feature vector is sharply reduced from 6561 dimensions to about 200 dimensions, which significantly improves the efficiency of feature calculation and subsequent model training while retaining most of the key texture information.

[0039] In an optional embodiment, pixel sampling is performed at multiple preset scales, including: the multiple preset scales are ellipse major semi-axis radii R1, R2, ..., R n Pixels, where n is the total number of scales; P pixels are uniformly sampled along the outline of the elliptical sampling neighborhood of each scale; the threshold t1 is the standard deviation of the grayscale values ​​of all pixels in the elliptical sampling neighborhood where the center pixel is located.

[0040] To simultaneously detect defects of varying sizes, such as tiny pits and larger dents, n is set to three scales, with the ellipse's major semi-axis radius set to R1 equal to 3 pixels, R2 equal to 6 pixels, and R3 equal to 12 pixels. At each scale, eight points are uniformly sampled along the ellipse's outline. Small-scale sampling with R1 equal to 3 pixels captures high-frequency texture details and is very effective for identifying small defects such as pits. Large-scale sampling with R3 equal to 12 pixels covers a wider area, helping to identify larger dents or waviness defects with slow grayscale changes.

[0041] The setting of threshold t1 is adaptive. For a central pixel located in the smooth area of ​​the part surface, the central pixel The grayscale values ​​of pixels within a neighborhood may be very close, for example, between 180 and 182, with a calculated standard deviation of only 0.8. This low threshold makes the encoding process very sensitive to slight grayscale variations. Conversely, if the central pixel is located in an area with a slight rolling texture, the grayscale values ​​of the pixel's neighborhood may fluctuate between 170 and 190, with a calculated standard deviation of 7.5. A higher threshold allows the encoding process to tolerate these normal texture fluctuations and avoid misidentifying them as defects.

[0042] In an optional embodiment, the kernel function of the support vector machine classification model is a weighted combination of the radial basis kernel function and the chi-square kernel function, including: the weighted combination kernel function of the support vector machine classification model The calculation formula is: ; ; ; in and are two eigenvectors, is the radial basis kernel function, is the chi-square kernel function, is the eigenvector No. Quantity is the eigenvector No. components, weight coefficients And the kernel function parameters and All are determined during the training phase.

[0043] Radial basis kernel function It is good at measuring the overall distance of feature vectors in Euclidean space and can distinguish samples with significant differences in overall feature distribution, such as a defective part with a large pit and a good qualified part. The global feature histogram of a qualified part will be very different at a macro level. Can effectively capture this difference. The chi-square kernel function The chi-square kernel is very sensitive to the differences in each statistical unit (i.e., each bin) of the global feature histogram, and is particularly suitable for comparing global feature histograms composed of texture features. For example, a tiny scratch may only cause changes in the values ​​of a few specific bins in the global feature histogram. The chi-square kernel can accurately measure this local but critical change.

[0044] During support vector machine classification model training, grid search and cross-validation may determine the optimal parameters to be β = 0.6, γ = 0.2, and η = 0.8. This means that the final classification decision relies 60% on the global feature similarity represented by the RBF kernel and 40% on the local texture detail differences represented by the chi-square kernel. This enables the classifier to identify both significant macro defects and minor defects indicated by subtle texture anomalies, achieving higher overall detection performance than a single kernel function.

[0045] In an optional embodiment, a cost-sensitive learning strategy is adopted to set different penalty factors for different training samples, including: for the i-th sample x in the training set i , sample x i The penalty factor C i The calculation formula is: ; in, is the basic penalty factor; is the category weight, the value of defective samples is greater than 1, and the value of qualified samples is 1; is the distance weight, the value of the distance weight is related to the sample x i The function interval to the classification hyperplane is negatively correlated.

[0046] In the training data set for stamping parts quality inspection, there may be 2000 qualified samples and only 100 defective samples, with a sample ratio of 20 to 1. In order to solve this class imbalance, the class weights of the defective samples can be set The number of qualified samples is 20. This is equivalent to treating the error penalty of each defective part sample as 20 times that of an ordinary qualified part during model training, forcing the model to pay more attention to the correct classification of the minority class, i.e. defective parts, and preventing the model from simply predicting all samples as the majority class, i.e. qualified parts.

[0047] Furthermore, the difficulty of identifying different defective samples is also different. A defective sample that is seriously misjudged by the model, that is, far away from the classification boundary, has a function interval of a large negative number, resulting in a distance weight of the sample. The value of is very large, such as 10.0. For another sample that has just been misjudged and is very close to the boundary, the function interval of the defect sample is a negative number with a very small absolute value. It may be 1.5. If the basic penalty factor If the final penalty factor Ci of the previous sample is 1, then the final penalty factor Ci of the next sample is 200, and that of the next sample is 30. In this way, in subsequent iterations, a huge cost will be paid to correct the classification of the seriously misclassified difficult sample, optimize the classification boundary, and improve the detection rate of various difficult defects.

[0048] The implementation principle of the stamping quality inspection method for stamped parts according to the present invention is as follows: By introducing a spatial prior weight map based on a three-dimensional model, prior knowledge of the stamping process is integrated into the feature extraction process, focusing the inspection on high-defect areas. The extracted features are therefore more targeted and discriminative, improving sensitivity to hidden or subtle defects. Furthermore, the improved feature extraction operator uses elliptical neighborhood sampling, which can better match the directional structure often exhibited by defects such as scratches and wrinkles, and can capture more accurate texture information than circular neighborhoods. Ternary encoding enhances the robustness of features to image noise, while the rotational invariance property ensures consistent inspection results for workpieces in different postures. Furthermore, during the classification stage, a classifier constructed by weightedly combining the radial basis kernel function and the chi-square kernel function can learn the distribution patterns of complex features, thereby improving classification accuracy. Furthermore, a cost-sensitive learning strategy is adopted, which sets a higher misclassification cost for defect samples in the minority class. This addresses the sample imbalance problem commonly seen in actual industrial scenarios, improves the detection rate of defective parts, and reduces the risk of missed detection.

[0049] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A method for detecting the quality of stamping parts, characterized in that: The method comprises the following steps: obtaining a digital image of the surface of a stamping part to be inspected, generating a spatial priori weight map indicating the forming difficulty of each area by analyzing the surface curvature and material thickness variation gradient of each area of ​​a preset three-dimensional geometric model of the stamping part to be inspected, and registering the spatial priori weight map with the digital image of the surface; Calculate the structure tensor of the pixels in the surface digital image, and determine the orientation and axis length ratio of the elliptical sampling neighborhood based on the eigenvector of the structure tensor; sample pixels at multiple preset scales along the contour of the elliptical sampling neighborhood, perform ternary comparison of the pixel values ​​of the sampling points with the pixel value of the center pixel, and obtain an initial ternary pattern code; At each scale, a global feature histogram is constructed, wherein each pixel point in the surface digital image is encoded according to the rotationally invariant three-value pattern corresponding to the pixel point to obtain the statistical unit corresponding to the pixel point in the global feature histogram, and the contribution is accumulated to the statistical unit, wherein the contribution degree is the corresponding weight value of the pixel point in the spatial prior weight map; the global feature histograms constructed at all scales are cascaded to generate a cascade feature vector; the cascade feature vector is input into a support vector machine classification model, wherein the kernel function of the support vector machine classification model is a weighted combination of a radial basis kernel function and a chi-square kernel function, wherein the weight coefficient of each kernel function is determined by a multi-kernel learning algorithm during the model training stage; based on the output result of the support vector machine classification model, the stamping part to be inspected is determined to be a qualified part or a defective part.

2. The method for detecting the quality of stamping parts according to claim 1, wherein: The ternary comparison is: When the absolute value of the difference between the sampling point pixel value and the center pixel value is less than the threshold t1, it is encoded as 0; when the sampling point pixel value is greater than the center pixel value and the absolute value of the difference is not less than t1, it is encoded as 1; when the sampling point pixel value is less than the center pixel value and the absolute value of the difference is not less than t1, it is encoded as 2; The initial three-value pattern code is cyclically shifted, and the code with the smallest value is taken as the rotation-invariant three-value pattern code of the pixel point.

3. The method for detecting the stamping quality of stamping parts according to claim 1, characterized in that: The method generates a spatial priori weight map representing the forming difficulty of each region by analyzing the surface curvature and material thickness variation gradient of each region of the preset three-dimensional geometric model of the stamping part to be inspected, including: Dividing the three-dimensional geometric model into a surface element grid; Calculate the average curvature K and material thickness gradient G of each surface element center point; Normalize the K and G values ​​of all facets to the interval [0,1] and get and ; The weight value W of any point in the spatial prior weight map is calculated by the following formula: , where α is the preset weight coefficient, and its value range is (0,1).

4. The method for detecting the stamping quality of stamping parts according to claim 1, wherein: The determining the orientation and axis length ratio of the elliptical sampling neighborhood according to the eigenvector of the structure tensor includes: For each pixel in the surface digital image, the image gradient in the x and y directions is calculated within a neighborhood of a preset scale. and ; The product of the gradient components is smoothed by the Gaussian function to construct the structure tensor ; Perform eigenvalue decomposition on the structure tensor S to obtain two eigenvalues and the eigenvectors v1 and v2 corresponding to the two eigenvalues; The orientation of the major axis of the elliptical sampling neighborhood is consistent with the direction of the eigenvector v1; The ratio of the major axis to the minor axis of the elliptical sampling neighborhood is set to , set the maximum axis length ratio threshold.

5. The method for detecting the stamping quality of stamping parts according to claim 1, wherein: The constructing of the global feature histogram includes: The rotationally invariant three-value pattern encoding is divided into a uniform mode and a non-uniform mode, wherein if the number of cyclic jumps in the encoded code value sequence is not greater than 2, it is a uniform mode; Statistical units are respectively established for all uniform patterns and one concentrated non-uniform pattern to construct the global feature histogram.

6. The method for detecting the stamping quality of stamping parts according to claim 2, wherein: The pixel sampling at the preset multiple scales includes: The preset multiple scales are the ellipse major semi-axis radii R1, R2, ..., R n pixels, where n is the total number of scales; Uniformly sample P pixels along the outline of the elliptical sampling neighborhood at each scale; The threshold t1 is the standard deviation of the grayscale values ​​of all pixels in the elliptical sampling neighborhood where the central pixel is located.

7. The method for detecting the stamping quality of stamping parts according to claim 1, wherein: The kernel function of the support vector machine classification model is a weighted combination of the radial basis kernel function and the chi-square kernel function, including: Weighted combination kernel function of the support vector machine classification model The calculation formula is: ; ; ; in and are two eigenvectors, is the radial basis kernel function, is the chi-square kernel function, is the eigenvector No. Quantity is the eigenvector No. components, weight coefficients And the kernel function parameters and All are determined during the training phase.

8. The method for detecting the stamping quality of stamping parts according to claim 1, wherein: During the training phase, the support vector machine classification model adopts a cost-sensitive learning strategy, sets differentiated penalty factors for different training samples, and assigns high penalty weights to minority class samples.

9. The method for detecting the stamping quality of stamping parts according to claim 8, characterized in that: The cost-sensitive learning strategy is used to set different penalty factors for different training samples, including: For the i-th sample x in the training set i , sample x i The penalty factor C i The calculation formula is: ; in is the basic penalty factor; is the category weight, the value of defective samples is greater than 1, and the value of qualified samples is 1; is the distance weight, the value of the distance weight is related to the sample x i The function interval to the classification hyperplane is negatively correlated.

10. The method for detecting the stamping quality of stamping parts according to claim 1, wherein: The multi-core learning algorithm is the SimpleMKL algorithm.

Citation Information

Patent Citations

  • Copper stamping part surface crack detection method based on quantum pigeon flock peak valley interval segmentation

    CN113916894A

  • SAR image change detection method based on global dynamic convolutional neural network

    CN115018773A

  • Stamping part surface quality detection method and system for assembly line detection

    CN119313664A

  • Multi-source fusion point cloud data driven three-dimensional streetscape generation and optimization method

    CN120219652A

  • Method and system for improved processing of image data

    US20070183682A1

Cited By

  • Printing quality detection method and system based on image processing

    CN121329921A

  • A Printing Quality Inspection Method and System Based on Image Processing

    CN121329921B