Quality inspection classification method and system for stamping production line, product and storage medium
By combining image segmentation, contrast enhancement, and defect detection on the stamping production line with intelligent optimization models, we can resolve quality issues caused by ungraded materials, achieve product consistency and high quality, and meet diverse needs.
Patent Information
- Application Number
- CN202510843524.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-10-10
AI Technical Summary
The material collection method in the existing stamping production line is not graded, resulting in the mixing of materials of different qualities, making it difficult to meet the diverse needs of different customers and affecting the consistency and high quality of the products.
By acquiring the image data of the stamping workpiece, dividing it into multiple sub-image data, performing contrast evaluation and enhancement processing, identifying and correcting the reflective area, using shape and surface defect detection algorithms to identify the workpiece contour and defects, collecting the workpieces in grades, and inputting them into the stamping process intelligent optimization model for parameter adjustment.
The consistency and high quality of products are achieved to meet the needs of different customers. Through graded collection and process optimization, the detection accuracy and product quality are improved.
Smart Images

Figure CN120765997A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the stamping production technical field, in particular to a quality inspection classification method and system of a stamping production line, a product and a storage medium. BACKGROUND
[0002] The stamping production line plays a vital role in modern manufacturing industry, which deforms metal plates by high pressure to produce various automobile parts and metal shells of electronic products.
[0003] In the related art, the collection of materials is mostly in a unified manner, and the materials are not classified. Although this method is simple to operate, it has some potential problems. Unified collection may cause different quality materials to be mixed together, which is difficult to meet the diversified needs of different customers, especially for customers who have high requirements for product quality, which may not guarantee the consistency and high quality of the products. SUMMARY
[0004] The application provides a quality inspection classification method and system of a stamping production line, a product and a storage medium, which are used to guarantee the consistency and high quality of the products and meet the diversified needs of different customers.
[0005] In a first aspect, the application provides a quality inspection classification method of a stamping production line, comprising: acquiring image data of a stamping workpiece; dividing the image data into a plurality of sub-image data; performing contrast evaluation on each sub-image data, and determining sub-image data that needs to be enhanced according to a preset contrast threshold; performing contrast enhancement processing on the sub-image data that needs to be enhanced to obtain enhanced sub-image data; wherein the difference between the brightest and darkest pixels in the enhanced sub-image data is increased, and the contrast of the local area of the enhanced sub-image data is improved; identifying enhanced sub-image data with brightness greater than a corresponding brightness threshold in the enhanced sub-image data, and judging whether the enhanced sub-image data is caused by reflection; if the enhanced sub-image data is caused by reflection, correcting the enhanced sub-image data to obtain a corrected sub-image; merging the corrected sub-image into corrected image data; identifying contour data of the stamping workpiece in the corrected image data by using a shape recognition algorithm; identifying surface defects of the contour data by using a surface defect detection algorithm to obtain evaluation data; classifying the stamping workpiece into different grades according to the evaluation data; and performing corresponding collection strategies on stamping workpieces of different grades.
[0006] By adopting the technical scheme, the image data is divided into multiple sub-image data, which helps to process different areas in a targeted manner, contrast evaluation is performed on each sub-image data to determine the sub-image data that needs to be enhanced, and the image area that needs to be improved is identified. The sub-image data that needs to be enhanced is subjected to contrast enhancement processing, which increases the difference between the brightest and darkest pixels and improves the contrast of the local area, which can effectively improve the clarity and detail visibility of the image and lay a foundation for subsequent defect detection. By identifying the high-brightness area caused by reflection and correcting it, the detection interference problem caused by the high reflectivity of the metal workpiece is solved. The shape recognition algorithm is used to identify the contour data of the stamping workpiece, and the surface defect detection algorithm is used to identify the surface defects of the contour data to obtain evaluation data. The overall shape and local details of the workpiece are comprehensively detected. According to the evaluation data, the stamping workpiece is divided into different grades, and corresponding collection strategies are executed for stamping workpieces of different grades. This grading collection method can ensure the consistency and high quality of the product and meet the diversified needs of different customers.
[0007] In combination with some embodiments of the first aspect, in some embodiments, after the step of executing corresponding collection strategies for stamping workpieces of different grades, the method further comprises: collecting evaluation data of the stamping workpiece; inputting the evaluation data into a preset stamping process intelligent optimization model to obtain an optimization scheme, wherein the optimization scheme comprises: a pressure parameter of the stamping machine; a speed parameter of the stamping machine; a temperature control parameter of the stamping die; outputting the optimization scheme; obtaining new evaluation data of a new stamping workpiece produced using the optimization scheme; determining whether the grade of the new evaluation data is greater than the grade of the evaluation data; if not, regarding the new evaluation data as the evaluation data, and executing the step of collecting the evaluation data of the stamping workpiece.
[0008] By adopting the technical scheme, the evaluation data is input into a preset stamping process intelligent optimization model to obtain an optimization scheme including a pressure parameter, a speed parameter, and a temperature control parameter, which can quickly generate targeted optimization suggestions based on historical data. After outputting and applying the optimization scheme, the evaluation data of a new stamping workpiece is obtained and compared with the original data. If the grade of the new evaluation data is not higher than the grade of the original evaluation data, the new data is regarded as a new input, and the optimization process is re-executed. This iterative optimization method can continuously improve the effect of the stamping process. In summary, the continuous optimization of the stamping process is realized, which can improve the product quality.
[0009] In combination with some embodiments of the first aspect, in some embodiments, the step of determining whether the enhanced sub-image data is caused by reflection specifically includes: extracting the contour of an area in the enhanced sub-image data that is greater than a corresponding brightness threshold; calculating the circularity of the contour; when the circularity is greater than a preset circularity threshold; using a region growing algorithm to expand outward from the center of the contour; analyzing the shape changes of the contour during the expansion process; if the contour maintains its geometric shape and presents a symmetrical brightness decreasing distribution based on the center, then determining that the enhanced sub-image data is caused by reflection.
[0010] By adopting the above technical solution, the outline of the high-brightness area is extracted and its circularity is calculated. This step can preliminarily screen out possible reflective areas. Normal reflections are usually regular circles or ellipses and therefore have a high circularity. A region growing algorithm is used to expand outward from the center of the outline and analyze the shape changes of the outline during the expansion process. This step can capture the shape stability of the reflective area; normal reflections usually maintain their geometric shape. The brightness distribution of the outline is analyzed to determine whether it presents a symmetrical brightness decreasing distribution based on the center. Normal reflections usually present a gradual brightness distribution from the center outward. By comprehensively considering the circularity, shape stability and brightness distribution characteristics of the outline, normal reflections can be accurately distinguished from other situations.
[0011] In combination with some embodiments of the first aspect, in some embodiments, the step of correcting the enhanced sub-image data to obtain a corrected sub-image specifically includes: creating a reflection intensity map of the contour; determining the reflection component based on the reflection intensity map; and subtracting the reflection component from the enhanced sub-image data to obtain the corrected sub-image.
[0012] By employing this technical solution, a reflection intensity map of the contour is created and the reflection component is determined based on the reflection intensity map. This accurately simulates the effect of reflections on the image. The reflection component is then subtracted from the enhanced sub-image data to produce a corrected sub-image. This subtraction effectively removes the effects of reflections while preserving other information in the original image to the greatest extent possible.
[0013] In some embodiments of the first aspect, the step of performing contrast evaluation on each sub-image data specifically comprises: converting the sub-image data into a grayscale image, and performing normalization processing on the grayscale image; calculating gradients of the grayscale image in horizontal and vertical directions respectively; calculating gradient amplitudes of each pixel position according to the horizontal and vertical gradients, and taking the gradient amplitudes as a measure of edge intensity; calculating an average value and a standard deviation of the edge intensity; counting the number of edge pixels exceeding an edge intensity threshold; taking the average value of the edge intensity as a first contrast feature; taking the standard deviation of the edge intensity as a second contrast feature; calculating a proportion of edge pixels exceeding the edge intensity threshold to total pixels as a third contrast feature; and performing weighted summation on the first, second and third contrast features to obtain a contrast score.
[0014] By adopting the above technical solution, gradients in horizontal and vertical directions are calculated, and gradient amplitudes of each pixel position are calculated according to the gradients as a measure of edge intensity. This step can capture details and edge information in the image. An average value and a standard deviation of the edge intensity are calculated, and the number of edge pixels exceeding a threshold is counted. These indicators respectively reflect the overall contrast level, the degree of contrast variation and the proportion of significant edges of the image. These indicators are taken as contrast features, and a final contrast score is obtained by weighted summation. This comprehensive evaluation method can comprehensively reflect the contrast of the image.
[0015] In some embodiments of the first aspect, the step of increasing the difference between the brightest and darkest pixels in the enhanced sub-image data specifically comprises: determining an original pixel value range of the enhanced sub-image data; establishing a linear mapping relationship from the original pixel value range to a preset target pixel value range; and converting each pixel value in the enhanced sub-image data according to the linear mapping relationship.
[0016] By adopting the above technical solution, a linear mapping relationship from the original pixel value range to the preset target pixel value range is established. This linear mapping can maintain the relative brightness relationship of the original image while expanding the distribution range of the pixel values. Each pixel value in the enhanced sub-image data is converted according to the established linear mapping relationship. The contrast of the sub-image is effectively enhanced, and the clarity and detail visibility of the image are improved.
[0017] In some embodiments of the first aspect, the step of increasing the contrast of local regions of the enhanced sub-image data specifically comprises: dividing the enhanced sub-image data into a plurality of local regions, the local regions having partially overlapping regions; performing histogram equalization processing on the local regions; remapping pixel values of the local regions according to the equalization results; fusing pixel values of the overlapping regions; and merging the processed local region data.
[0018] By adopting the above technical solution, the enhanced sub-image data is divided into multiple local regions, and adjacent regions are ensured to partially overlap, which is used to subsequently mitigate the abrupt boundaries that may appear between different local regions. Histogram equalization is then performed on each local region. Histogram equalization is applied to small areas of the image, rather than performing global equalization on the entire image. This local processing can better preserve and enhance local details and edge information, while significantly improving local contrast. The pixel values of the local region are remapped based on the equalization results. This optimizes local contrast, making subtle features that might otherwise be overlooked more prominent and clear. The pixel values of the overlapping regions are then fused. This resolves the boundary discontinuity problem that may be caused by local processing, ensuring the overall coherence and natural transition of the processed image.
[0019] In the second aspect, the present application provides a quality inspection and classification system for a stamping production line, the quality inspection and classification system for the stamping production line comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and one or more processors call the computer instructions to enable the quality inspection and classification system for the stamping production line to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0020] In a third aspect, the present application provides a computer program product comprising instructions, which, when run on a quality inspection and classification system of a stamping production line, enables the quality inspection and classification system of the stamping production line to execute the method described in the first aspect and any possible implementation of the first aspect.
[0021] In a fourth aspect, the present application provides a computer-readable storage medium comprising instructions, which, when executed on a quality inspection and classification system of a stamping production line, enables the quality inspection and classification system of the stamping production line to execute the method described in the first aspect and any possible implementation of the first aspect.
[0022] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. Divide the image data into multiple sub-image data to help target different areas. Perform contrast evaluation on each sub-image data to determine which sub-image data needs to be enhanced and identify the image areas that need improvement. Perform contrast enhancement on the sub-image data that needs to be enhanced to increase the difference between the brightest and darkest pixels and improve the contrast of local areas. This can effectively improve image clarity and detail visibility, laying the foundation for subsequent defect detection. By identifying and correcting high-brightness areas caused by reflections, the detection interference problem caused by the high reflectivity of metal workpieces is solved. Use the shape recognition algorithm to identify the contour data of the stamped workpiece, and use the surface defect detection algorithm to identify surface defects in the contour data to obtain evaluation data. Comprehensive inspection of the overall shape and local details of the workpiece. According to the evaluation data, the stamped workpieces are divided into different grades, and corresponding collection strategies are implemented for stamped workpieces of different grades. This hierarchical collection method can ensure product consistency and high quality and meet the diverse needs of different customers.
[0023] 2. Input the evaluation data into the preset intelligent optimization model of the stamping process to obtain an optimization plan including pressure parameters, speed parameters, and temperature control parameters, which can quickly generate targeted optimization suggestions based on historical data. After outputting and applying the optimization plan, obtain the evaluation data of the new stamping workpiece and compare it with the original data. If the level of the new evaluation data is not higher than that of the original evaluation data, the new data is used as the new input and the optimization process is re-executed. This iterative optimization method can continuously improve the effect of the stamping process. In short, the continuous optimization of the stamping process is achieved, which can improve product quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 This is a flow chart of a quality inspection and classification method for a stamping production line according to an embodiment of the present application; Figure 2 This is another flow chart of the quality inspection and classification method for a stamping production line according to an embodiment of the present application; Figure 3 This is another flow chart of the quality inspection and classification method for a stamping production line according to an embodiment of the present application; Figure 4 It is an exemplary hardware structure diagram of the quality inspection and classification system of the stamping production line in the embodiment of the present application. DETAILED DESCRIPTION
[0025] The terms used in the following examples of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular expressions "a," "an," "said," "above," "the," and "this" are intended to include plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and encompasses any or all possible combinations of one or more of the listed items.
[0026] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0027] The following describes the derivation process of the technical problem in detail: In related technologies, materials are often collected in a centralized manner without any grading. While this approach is simple to operate, it also presents potential problems. Centralized collection can result in the mixing of materials of varying qualities, making it difficult to meet the diverse needs of different customers. This can be especially challenging for those with high-quality requirements, as product consistency and high quality cannot be guaranteed.
[0028] To address this issue, automatic quality inspection systems have been introduced into stamping production lines. These systems can quickly capture and analyze images of produced products, compare them with set quality standards, and automatically determine whether the products meet quality requirements, thereby achieving product quality classification.
[0029] However, in actual use, the products in stamping lines are often made of metal, which is highly reflective. Furthermore, the stamping lines themselves are bulky, have dense metal structures, and are relatively close to the products, making the reflections more pronounced and seriously affecting the accuracy and stability of detection.
[0030] The following describes the quality inspection classification method for a stamping production line in an embodiment of the present application in combination with the above exemplary derivation process: See also Figure 1 , which is a flow chart of the quality inspection and classification method of the stamping production line in an embodiment of the present application.
[0031] S101, acquiring image data of a stamping workpiece; Image data refers to the digital image information of the stamping workpiece obtained by a camera or other image capturing device, including pixel values, color information, etc.
[0032] S102, dividing the image data into a plurality of sub-image data; In some embodiments, the segmentation may divide the image data of the entire stamping workpiece into multiple smaller regions based on a fixed-size grid, and then assign a unique identifier to each divided region to form a sub-image dataset.
[0033] In other embodiments, the stamped workpiece may be divided into several different regions based on the characteristics of the stamped workpiece, and then each region may be further segmented into multiple sub-image data. This method is more flexible and can adapt to complex workpiece shapes and surface features.
[0034] In an exemplary embodiment, a car door panel is divided into an edge area, a central plane area, a concave-convex molding area, etc.
[0035] For flat areas, a larger fixed-size grid can be used.
[0036] For curved surfaces or areas with high detail, smaller meshes or adaptive irregular shape segmentation can be used.
[0037] For edge or contour areas, strip segmentation along the edge can be used.
[0038] It should be noted that during the division process, the transition and connection between regions are considered to ensure that important features are not cut by the segmentation line.
[0039] S103, performing contrast evaluation on each sub-image data, and determining sub-image data that needs to be enhanced according to a preset contrast threshold; In some embodiments, a histogram method is used to calculate the contrast of each sub-image; the calculated result is compared with a threshold, and sub-images below the threshold are marked as needing to be enhanced.
[0040] In other embodiments, the maximum pixel value and the minimum pixel value of each sub-image are calculated; the contrast is calculated using the formula (maximum value - minimum value) / (maximum value + minimum value); the calculated result is compared with a preset threshold to determine the sub-image that needs to be enhanced.
[0041] It is understandable that contrast evaluation and determination may also be achieved in other ways, which are not limited here.
[0042] In a preferred embodiment, step S103 specifically includes: S1031, converting the sub-image data into a grayscale image, and performing normalization processing on the grayscale image; In some embodiments, the color sub-image is converted to a grayscale image by calculating the weighted average of the RGB channels. The commonly used weights are R: 0.299, G: 0.587, B: 0.114, which reflects the sensitivity of the human eye to different colors. After conversion, the grayscale image is normalized, mapping the pixel values from the original range of 0-255 to the range of 0-1. The purpose of this step is to simplify the subsequent calculation process and eliminate the influence that may be brought about by the overall brightness difference of the image, making the contrast evaluation results between different images more comparable.
[0043] S1032, respectively calculating the gradient of the grayscale image in the horizontal direction and the vertical direction; The gradient represents the rate of brightness change of the image in a certain direction. The horizontal direction gradient refers to the brightness change of the image in the horizontal direction. The vertical direction gradient refers to the brightness change of the image in the vertical direction.
[0044] In some embodiments, for each pixel in the image, the brightness difference between it and its adjacent pixels in the horizontal and vertical directions is calculated respectively. The horizontal direction gradient is usually obtained by calculating the difference between the current pixel and its right pixel, and the vertical direction gradient is obtained by calculating the difference between the current pixel and its lower pixel.
[0045] S1033, according to the horizontal direction gradient and the vertical direction gradient, calculating the gradient magnitude of each pixel position, taking the gradient magnitude as the measure of edge strength; The gradient magnitude represents the length of the gradient vector, reflecting the overall change intensity of the image at that point. The edge strength refers to the degree of saliency of the edge feature at a certain position in the image. The measure refers to the numerical standard used to quantify the edge strength.
[0046] In some implementations, for each pixel in the image, the horizontal direction gradient and the vertical direction gradient are regarded as two components of a two-dimensional vector, and then the length of this vector is calculated as the gradient magnitude. The Euclidean distance formula is usually used to calculate the gradient magnitude, that is, the square root of the sum of the squares of the horizontal and vertical direction gradients. The calculated gradient magnitude is directly used as the edge strength of the pixel position. The purpose of this step is to integrate the two-dimensional gradient information into a scalar value, so as to more intuitively represent the edge and texture strength in the image.
[0047] In other embodiments, for each pixel, take its horizontal direction gradient Gx and vertical direction gradient Gy; Calculate the gradient magnitude: magnitude = sqrt(Gx 2 + Gy 2 ) In the formula, magnitude is the gradient magnitude, Gx is the horizontal direction gradient, Gy is the vertical direction gradient, and sqrt(Gx 2+ Gy 2 ) is the Euclidean norm.
[0048] S1034, calculating the mean and standard deviation of edge intensity; In some embodiments, the mean is obtained by summing all edge intensity values of the whole image and dividing by the total number of pixels. This mean reflects the overall edge and texture intensity of the image. Then, the square of the difference between each edge intensity value and the mean is calculated, and the sum of these squared values is divided by the total number of pixels to obtain the square root, which is the standard deviation. The standard deviation describes the dispersion of the edge intensity distribution, and a larger standard deviation indicates that there are significant edge contrasts in the image. The purpose of this step is to obtain statistical quantities that describe the characteristics of the edge distribution of the image, providing a basis for subsequent contrast evaluation.
[0049] S1035, counting the number of edge pixels exceeding the edge intensity threshold; The edge intensity threshold refers to the critical value for determining whether a pixel is a significant edge.
[0050] S1036, taking the mean of edge intensity as the first contrast feature; In some embodiments, the previously calculated mean of edge intensity is directly assigned to the first contrast feature. This mean reflects the overall edge and texture intensity of the image, and a higher mean generally means that the image has more details and clearer edges, so it can be used as an important indicator to measure the contrast of the image. The purpose of this step is to extract a simple and effective feature for subsequent contrast score calculation.
[0051] S1037, taking the standard deviation of edge intensity as the second contrast feature; In some embodiments, the previously calculated standard deviation of edge intensity is directly assigned to the second contrast feature. The standard deviation reflects the degree of variation of edge intensity in the image, and a larger standard deviation generally means that there are more intense contrasts and changes in the image, indicating that the image has more abundant texture and clearer structure.
[0052] S1038, calculating the proportion of edge pixels exceeding the edge intensity threshold to the total number of pixels as the third contrast feature; In some embodiments, the total number of pixels of the image is first obtained, which is usually the width of the image multiplied by the height. Then, the number of edge pixels counted previously is divided by the total number of pixels to obtain a proportion value between 0 and 1. This proportion reflects the density of significant edges in the image, and a higher proportion generally means that the image contains more details and structural information.
[0053] S1039, weighted sum of the first contrast feature, the second contrast feature, and the third contrast feature to obtain the contrast score.
[0054] In some embodiments, each feature is assigned a weight that reflects its relative importance to the final score. Each feature value is then multiplied by its corresponding weight, and these products are summed to produce a comprehensive score. This score comprehensively considers the image's edge strength, the variability of edge distribution, and the density of significant edges, providing a more comprehensive reflection of the image's contrast level. The purpose of this step is to integrate contrast features from multiple angles into a single, easily comparable and understandable score.
[0055] As can be seen, horizontal and vertical gradients are calculated, and based on these gradients, the gradient magnitude at each pixel is calculated as a measure of edge strength. This step captures detail and edge information in the image. The mean and standard deviation of the edge strength are calculated, and the number of edge pixels exceeding a threshold is counted. These metrics reflect the overall image contrast level, the degree of contrast variation, and the proportion of significant edges, respectively. These metrics are used as contrast features and a weighted summation is performed to obtain the final contrast score. This comprehensive evaluation method can comprehensively reflect the contrast of the image.
[0056] S104, performing contrast enhancement processing on the sub-image data to be enhanced to obtain enhanced sub-image data; wherein the difference between the brightest and darkest pixels in the enhanced sub-image data is increased, and the contrast of a local area of the enhanced sub-image data is improved; In some embodiments, the dynamic range of an image is expanded, i.e., the difference between the brightest and darkest pixels is increased, making the image appear clearer overall. Secondly, while maintaining overall brightness, the contrast of local areas of the image is enhanced to make details stand out. This can be achieved through techniques such as histogram equalization and adaptive contrast enhancement.
[0057] In some preferred embodiments, increasing the difference between the brightest and darkest pixels in the enhanced sub-image data specifically includes: S1041, determining the original pixel value range of the enhanced sub-image data; S1042: Establishing a linear mapping relationship from the original pixel value range to the preset target pixel value range; The preset target pixel value range refers to a new pixel value interval to which the original image is expected to be mapped, and is used to enhance the contrast of the image. It is generally input by a user or set by a user.
[0058] S1043. Convert each pixel value in the enhanced sub-image data according to the linear mapping relationship.
[0059] In some embodiments, for each pixel in the enhancement sub-image data, the original pixel value is substituted into the linear mapping function established in step S1042 to calculate a new pixel value, and then the original pixel value is replaced with the new pixel value. This process increases the difference between the brightest and darkest pixels in the image, thereby enhancing the contrast of the image.
[0060] It can be seen that a linear mapping relationship from the original pixel value range to the preset target pixel value range is established. This linear mapping can maintain the relative brightness relationship of the original image while expanding the distribution range of the pixel values. According to the established linear mapping relationship, each pixel value in the enhancement sub-image data is converted. The contrast of the sub-image is effectively enhanced, and the clarity and detail visibility of the image are improved.
[0061] In some preferred embodiments, the contrast of the local region of the enhancement sub-image data is improved, specifically including: The step of improving the contrast of the local region of the enhancement sub-image data specifically includes: S1044, dividing the enhancement sub-image data into multiple local regions, and the local regions have partially overlapping regions; In some embodiments, the size and overlap degree of the local region are obtained, which are generally input by the user or set by the user, and then the entire image is divided into multiple overlapping rectangular regions according to certain rules (such as from left to right, from top to bottom).
[0062] For example, the number of rows and columns of the grid is determined; the size of each grid cell is calculated; the image is divided according to the grid, and each grid cell corresponds to a local region; and each local region is expanded to create an overlap.
[0063] S1045, performing histogram equalization processing on the local region; The histogram equalization is an image enhancement technique for adjusting the gray scale distribution of an image and improving the contrast of the image.
[0064] In some embodiments, the gray scale histogram of each local region is calculated, then the cumulative distribution function (CDF) of the histogram is calculated, and finally the original gray scale value is mapped according to the CDF to obtain the equalized gray scale value.
[0065] S1046, remapping the pixel value of the local region according to the equalization result; In some embodiments, the cumulative distribution function calculated in S1045 is used to process each pixel in the local region. The original pixel value is input into the function to obtain a new pixel value, and this new pixel value reflects the equalized gray scale distribution. This process achieves the enhancement of the contrast of the local region.
[0066] S1047, fusing pixel values of overlapping areas; The step of fusing the pixel values of the overlapping regions is typically performed after each local region has been independently processed. This is to eliminate boundary effects that may be introduced by the local processing and to achieve a more natural transition across the entire image. In some embodiments, a weighted average is calculated for each pixel in the overlapping region based on its position in the different local regions. This weighted average takes into account the relative position of the pixels in each local region, resulting in a smoother transition.
[0067] S1048: Merge the processed local area data.
[0068] As can be seen, the enhanced sub-image data is divided into multiple local regions, and adjacent regions are partially overlapped to subsequently mitigate any abrupt boundaries that may appear between different local regions. Histogram equalization is then performed on each local region. Histogram equalization is applied to small regions of the image, rather than globally equalizing the entire image. This local processing better preserves and enhances local details and edge information, while significantly improving local contrast. The pixel values of the local regions are remapped based on the equalization results. This optimizes local contrast, making subtle features that might otherwise be overlooked more prominent and clear. The pixel values of overlapping regions are then fused. This resolves the boundary discontinuity that may result from local processing, ensuring the overall coherence and natural transitions of the processed image.
[0069] S105, identifying enhanced sub-image data having brightness greater than a corresponding brightness threshold in the enhanced sub-image data, and determining whether the enhanced sub-image data is caused by reflection; In some embodiments, brightness analysis is performed on each enhanced sub-image data to identify areas where brightness exceeds a preset threshold. These high-brightness areas are then further analyzed to determine whether they are caused by reflections from metal surfaces. This determination can be based on various features, such as the shape, size, and location of the highlighted area, as well as the brightness comparison with surrounding areas, which will not be further detailed here.
[0070] In some embodiments, the shape and size of the highlight area are analyzed, and if the highlight area is irregular in shape and large in area, it is determined to be a reflection.
[0071] S106: If the enhanced sub-image data is caused by reflection, correct the enhanced sub-image data to obtain a corrected sub-image; In some embodiments, sub-image data identified as having reflection issues undergoes specialized processing. This processing aims to reduce the brightness of the reflective areas and restore image details obscured by the reflections. Possible processing methods include local brightness adjustment, image interpolation, and image reconstruction based on surrounding areas.
[0072] S107, merging the corrected sub-images into corrected image data; S108, using a shape recognition algorithm to identify the contour data of the punched workpiece in the corrected image data; In some embodiments, a selected shape recognition algorithm is applied to the entire image to identify contour lines representing the boundaries of the stamped workpiece. This process typically includes steps such as edge detection, contour extraction, and contour optimization. The resulting contour data should accurately reflect the actual shape of the stamped workpiece, including its external boundaries and any internal holes.
[0073] S109, using a surface defect detection algorithm to identify surface defects in the contour data to obtain evaluation data; and classifying the stamped workpieces into different grades based on the evaluation data; In some embodiments, an appropriate threshold is set based on the grayscale value distribution of the image, and the image is binarized to separate possible defect areas. This method is particularly suitable for identifying defects such as scratches and dents that cause obvious brightness changes. Use morphological operations such as dilation, erosion, opening, and closing. These operations can help remove noise, connect disconnected edges, fill small holes, etc. For stamping workpieces, this can help separate real defects from normal surface textures. Starting from a seed point, the region is gradually expanded based on pixel similarity. This method helps identify defect areas with similar characteristics, such as corrosion or discoloration areas. Predefine templates for common defects such as circular pits and linear scratches, and search for areas similar to these templates in the image. This method is particularly effective for identifying defects of specific shapes.
[0074] It should be noted that the surface defect detection algorithm is set according to actual needs and is not limited here.
[0075] Based on the detection results of the above algorithm, the following evaluation data can be generated: defect number (counting the number of defects detected), defect area (calculating the number of pixels in each defect area and converting it to the actual area), defect location (recording the center coordinates or boundary coordinates of each defect), defect type (classifying defects according to shape, size, edge features, etc., such as scratches, dents, discoloration, etc.), defect severity (which can be evaluated based on factors such as defect area and depth through edge strength estimation). Based on the generated evaluation data, a grading system can be designed to classify stamped workpieces, which is not limited here.
[0076] S110 , executing corresponding collection strategies for stamping workpieces of different grades.
[0077] In some embodiments, workpieces of different grades are stored in designated containers or areas, marked with specific information, or sent directly to the next process. High-grade workpieces may be directly packaged, while low-grade workpieces may require further inspection or rework.
[0078] As can be seen, segmenting image data into multiple sub-images facilitates targeted processing of different areas. Contrast assessment is performed on each sub-image to determine which sub-image data requires enhancement, thereby identifying image areas requiring improvement. Contrast enhancement is performed on the sub-image data requiring enhancement, increasing the difference between the brightest and darkest pixels and improving the contrast of local areas. This effectively improves image clarity and detail visibility, laying the foundation for subsequent defect detection. By identifying and correcting high-brightness areas caused by reflections, the problem of detection interference caused by the high reflectivity of metal workpieces is resolved. A shape recognition algorithm is used to identify the contour data of the stamped workpiece, and a surface defect detection algorithm is used to identify surface defects within the contour data to generate evaluation data. Comprehensive inspection of the overall shape and local details of the workpiece is performed. Based on the evaluation data, the stamped workpieces are classified into different grades, and corresponding collection strategies are implemented for each grade. This hierarchical collection method ensures product consistency and high quality, meeting the diverse needs of different customers.
[0079] In actual use, surface defects of stamped products are known and the stamping process needs to be optimized. Therefore, in the following embodiment, based on the surface defect detection results, the stamping process parameters are automatically analyzed and adjusted to achieve continuous improvement of product quality.
[0080] See also Figure 2 , Figure 2 This is another flow chart of the quality inspection and classification method for a stamping production line according to an embodiment of the present application; S201, collecting assessment data of stamping workpieces; S202: Input the evaluation data into a preset stamping process intelligent optimization model to obtain an optimization solution, wherein the optimization solution includes: pressure parameters of the stamping machine; speed parameters of the stamping machine; and temperature control parameters of the stamping die; Collect a large amount of historical production data, including stamping process parameters (input) and corresponding product quality evaluation results (output). Each sample contains: Input data: pressure parameters, speed parameters, temperature parameters, material properties, mold status, etc.
[0081] Output data: surface defect type, defect quantity, defect area, etc.
[0082] These training samples are then used to train the stamping process intelligent optimization model, so that the stamping process intelligent optimization model can combine the evaluation data and the optimization plan.
[0083] Therefore, the pre-set intelligent optimization model combines a large amount of historical production data. It can understand how pressure, speed and temperature parameters affect product quality and production efficiency.
[0084] Based on the input evaluation data, the model analyzes the gap between the current parameters and the ideal state, considers the mutual influence between the parameters, and calculates the optimal parameter combination.
[0085] The model generates an optimization plan with specific values, covering: Pressure parameters of the stamping machine (such as main pressure value, holding pressure value) Speed parameters of the punching machine (such as punching speed, rising speed, and falling speed) Temperature control parameters of stamping dies (such as die preheating temperature, cooling rate) S203, outputting an optimization plan; In some embodiments, the system presents the solution generated by the optimization model in an appropriate form for execution by an operator or an automated system.
[0086] S204, obtaining new evaluation data for producing a new stamping workpiece using the optimization solution; New evaluation data refers to the data set obtained after quality inspection and efficiency evaluation of these new artifacts.
[0087] S205, determining whether the level of the new evaluation data is greater than the level of the evaluation data; If it is greater than, the optimization scheme is judged to be effective, and this round of optimization ends.
[0088] S206: If not, the new evaluation data is regarded as evaluation data, and the step of collecting the evaluation data of the stamping workpiece is executed.
[0089] Wherein, "not greater than" indicates that the level of the new evaluation data does not exceed the level of the original evaluation data. Treating the new evaluation data as evaluation data means replacing the original data with the new data as the basis for the next round of optimization. Execute step S201.
[0090] It can be seen that by inputting the evaluation data into the preset stamping process intelligent optimization model, an optimization scheme including pressure parameters, speed parameters and temperature control parameters is obtained, which can quickly generate targeted optimization suggestions based on historical data. After outputting and applying the optimization scheme, the evaluation data of the new stamping workpiece is obtained and compared with the original data. If the level of the new evaluation data is not higher than that of the original evaluation data, the new data is used as a new input and the optimization process is re-executed. This iterative optimization method can continuously improve the effect of the stamping process. In short, the continuous optimization of the stamping process is achieved, which can improve product quality.
[0091] See alsoFigure 3 , Figure 3 This is another flow chart of the quality inspection classification method for a stamping production line in an embodiment of the present application; in some preferred embodiments, step S105 specifically includes: S301, extracting the contour of the area greater than the corresponding brightness threshold in the enhanced sub-image data; It should be noted that the principle and details of this step are similar to those of step S108. For relevant details, please refer to step S108 and are not limited here.
[0092] S302, calculating the circularity of the contour; In some embodiments, for each extracted contour, its area and perimeter are first calculated. A circularity formula is then applied, typically 4π multiplied by the area divided by the square of the perimeter, to obtain a value between 0 and 1. Values closer to 1 indicate a contour that is closer to a perfect circle. This step aims to quantify the contour's shape characteristics, as reflections often produce highlights that are nearly circular or elliptical.
[0093] S303: When the circularity is greater than a preset circularity threshold, a region growing algorithm is used to expand the contour from the center outward. The region growing algorithm is an image segmentation method that starts from a seed point and gradually adds similar neighboring pixels into the region. The center of the contour represents the geometric center point of the region enclosed by the contour.
[0094] In some embodiments, the average brightness of the pixels inside the contour is calculated as an initial threshold; starting from the center of the contour, the brightness values of the adjacent pixels are checked. If the brightness values of the adjacent pixels are within the threshold range, they are added to the area; the threshold is dynamically adjusted, such as using the brightness of the newly added pixels to update the average value; and the above steps are repeated until no new pixels can be added.
[0095] S304, analyzing the shape change of the contour during the expansion process; In some embodiments, it is necessary to record the shape characteristics of the current outline, such as circularity, eccentricity, and principal axis orientation, at each iterative step of region growing. Particular attention is paid to whether the outline maintains a stable geometric shape or exhibits significant deformation. This step aims to determine whether the expanded region still maintains the regular geometric shape characteristic of reflections, which is an important basis for distinguishing reflections from other high-brightness areas.
[0096] S305: If the outline maintains a geometric shape and presents a symmetrical brightness decreasing distribution based on the center, it is determined that the enhanced sub-image data is caused by reflection.
[0097] Geometry refers to the overall shape characteristics of the contour. Symmetrically decreasing distribution means that the brightness value presents a regular decreasing pattern from the center to the outside. Judgment refers to making a final conclusion based on the observed characteristics.
[0098] In some embodiments, it is confirmed whether the contour maintains the basic geometric shape during the expansion, especially whether the characteristics of approaching a circle or an ellipse are maintained. Then, the brightness distribution in the region is analyzed to check whether there is a symmetrically decreasing pattern from the center to the outside. This pattern is usually manifested as the highest brightness in the center, gradually decreasing outward, and the decreasing trend is basically consistent in each direction. If both conditions are met, it can be highly confident that the enhanced image data is caused by reflection. This judgment is based on the physical principle that reflection usually produces image characteristics with regular geometric shape and specific brightness distribution.
[0099] As can be seen, the contour of the high-brightness region is extracted and the circularity thereof is calculated, which can preliminarily screen out possible reflection regions. Normal reflection usually presents a regular circle or ellipse, and thus has a higher circularity. The region growing algorithm is used to expand from the center of the contour to the outside, and the shape change of the contour during the expansion is analyzed. This step can capture the shape stability of the reflection region, and normal reflection usually can maintain its geometric shape. The brightness distribution of the contour is analyzed to determine whether it presents a symmetrically decreasing distribution with the center as the reference. Normal reflection usually presents a gradual brightness distribution from the center to the outside. By comprehensively considering the circularity, shape stability and brightness distribution characteristics of the contour, normal reflection and other situations can be accurately distinguished.
[0100] In some preferred embodiments, step S106 specifically comprises: S306, creating a reflection intensity map of the contour; The reflection intensity map refers to a two-dimensional image for representing the reflection intensity distribution of each point in the reflection region. Creation refers to generating such an intensity distribution map through calculation and modeling.
[0101] In some embodiments, it is assumed that the reflection intensity presents a symmetrically decreasing trend from the center to the outside. Then, the center point and the maximum intensity value of the reflection region are determined; the maximum distance from the center to the contour edge is calculated as the standard deviation of the distribution; for each pixel in the contour, the intensity value is calculated using a two-dimensional Gaussian function according to its distance to the center; the calculated intensity value is normalized to the range of 0-255; a new image with the same size as the original image is generated, and the intensity value is filled into the corresponding position.
[0102] S307, determining the reflection component based on the reflection intensity map; In some embodiments, the maximum brightness value of the specular region in the original image and the maximum value of the specular intensity map are analyzed; a linear mapping relationship is established to map the specular intensity value to the actual brightness value; for each pixel in the specular region, the linear mapping is applied; and the calculated value is taken as the specular component of each pixel. It can be understood that other ways can also be used to determine the specular component, which are not limited here.
[0103] In S308, the specular component is subtracted from the enhanced sub-image data to obtain a corrected sub-image.
[0104] In some embodiments, for each pixel in the enhanced sub-image data, the original brightness value thereof is subtracted by the specular component value at the corresponding position.
[0105] As can be seen, the specular intensity map is created, the specular component is determined based on the specular intensity map, the influence of the specular reflection on the image can be accurately simulated, the specular component is subtracted from the enhanced sub-image data to obtain a corrected sub-image, and the subtraction operation can effectively remove the influence of the specular reflection while retaining other information of the original image to the greatest extent.
[0106] Next, an exemplary quality inspection and classification system 400 of a stamping production line provided by the embodiments of the present application is introduced. Figure 4 FIG. 1 is an exemplary hardware structure schematic diagram of the quality inspection and classification system 400 of the stamping production line provided by the embodiments of the present application.
[0107] In some embodiments, the quality inspection and classification system 400 of the stamping production line is a computer device or includes a computer device in the quality inspection and classification system 400 of the stamping production line. The computer device includes a processor, a memory and a network interface connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The database of the computer device is configured to store data. The network interface of the computer device is configured to communicate with other terminals or servers outside through a network connection. In some embodiments, the network interface can be a wired network interface, and in some embodiments, the network interface can also be a wireless network interface. The computer program is executed by the processor to implement the method in the embodiments of the present application.
[0108] Those skilled in the art can understand that, Figure 4The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. A specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0109] The above-described embodiments are only used to illustrate the technical scheme of the present application, but not limit it; although the technical scheme of the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical scheme recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical scheme deviate from the scope of the technical scheme of the embodiments of the present application.
[0110] In the above-described embodiments, the term "when" can be interpreted as meaning "if" or "after" or "in response to determining" or "in response to detecting" according to the context. Similarly, the phrase "upon determining" or "if detecting (the stated condition or event)" can be interpreted as meaning "if determining" or "in response to determining" or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)" according to the context.
[0111] In the above-described embodiments, all or part of the technical scheme can be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the technical scheme can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed by a computer, the computer instructions produce all or part of the processes or functions described in the embodiments of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state disk), etc.
[0112] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
Claims
1. A quality inspection and classification method for a stamping production line, characterized in that: include: Acquire image data of the stamping workpiece; dividing the image data into a plurality of sub-image data; Performing contrast evaluation on each sub-image data, and determining the sub-image data that needs to be enhanced according to a preset contrast threshold; Performing contrast enhancement processing on the sub-image data to be enhanced to obtain enhanced sub-image data; wherein the difference between the brightest and darkest pixels in the enhanced sub-image data is increased, and the contrast of a local area of the enhanced sub-image data is improved; identifying, from the enhanced sub-image data, the enhanced sub-image data having a brightness greater than a corresponding brightness threshold, and determining whether the enhanced sub-image data is caused by reflection; If the enhanced sub-image data is caused by reflection, correcting the enhanced sub-image data to obtain a corrected sub-image; merging the corrected sub-images into corrected image data; Recognizing contour data of the stamped workpiece in the corrected image data using a shape recognition algorithm; Identifying surface defects of the contour data using a surface defect detection algorithm to obtain evaluation data; and classifying the stamped workpieces into different grades based on the evaluation data; Corresponding collection strategies are implemented for the stamping workpieces of different grades.
2. The method according to claim 1, characterized in that After the step of executing corresponding collection strategies for the stamping workpieces of different grades, the method further includes: collecting the evaluation data of the stamping workpiece; Input the evaluation data into a preset stamping process intelligent optimization model to obtain an optimization plan, wherein the optimization plan includes: pressure parameters of the stamping machine; speed parameters of the stamping machine; and temperature control parameters of the stamping die; outputting the optimization solution; Obtain new evaluation data for producing a new stamping workpiece using the optimization solution; Determining whether the level of the new evaluation data is greater than the level of the evaluation data; If not, the new evaluation data is regarded as the evaluation data, and the step of collecting the evaluation data of the stamping workpiece is performed.
3. The method according to claim 1, characterized in that The step of determining whether the enhanced sub-image data is caused by reflection specifically includes: Extracting the contour of the area greater than the corresponding brightness threshold in the enhanced sub-image data; calculating the circularity of the contour; When the circularity is greater than a preset circularity threshold, a region growing algorithm is used to expand outward from the center of the contour; analyzing a change in shape of the profile during the expansion process; If the outline maintains a geometric shape and presents a symmetrical brightness decreasing distribution based on the center, it is determined that the enhanced sub-image data is caused by reflection.
4. The method according to claim 3, characterized in that The step of correcting the enhanced sub-image data to obtain a corrected sub-image specifically includes: creating a reflection intensity map of the contour; determining a light reflection component based on the light reflection intensity map; The reflected light component is subtracted from the enhanced sub-image data to obtain a corrected sub-image.
5. The method according to claim 1, wherein The step of performing contrast evaluation on each sub-image data specifically includes: Converting the sub-image data into a grayscale image and performing normalization processing on the grayscale image; Calculating the gradients of the grayscale image in the horizontal direction and the vertical direction respectively; Calculating the gradient magnitude at each pixel position according to the horizontal gradient and the vertical gradient, and using the gradient magnitude as a measure of edge strength; Calculating the mean and standard deviation of the edge strength; Count the number of edge pixels exceeding the edge strength threshold; taking the average value of the edge intensities as a first contrast feature; Using the standard deviation of the edge intensity as a second contrast feature; Calculating the ratio of edge pixels exceeding the edge intensity threshold to total pixels as a third contrast feature; A weighted sum is performed on the first contrast feature, the second contrast feature, and the third contrast feature to obtain a contrast score.
6. The method according to claim 1, characterized in that The step of increasing the difference between the brightest and darkest pixels in the enhanced sub-image data specifically comprises: Determining the original pixel value range of the enhanced sub-image data; Establishing a linear mapping relationship from the original pixel value range to a preset target pixel value range; Each pixel value in the enhanced sub-image data is converted according to the linear mapping relationship.
7. The method according to claim 1, characterized in that The step of improving the contrast of the local area of the enhanced sub-image data specifically includes: Dividing the enhanced sub-image data into a plurality of local regions, wherein the local regions have partially overlapping areas; performing histogram equalization processing on the local area; remapping the pixel values of the local area according to the equalization result; fusing pixel values of the overlapping area; The local area data after merging processing.
8. A quality inspection and classification system for a stamping production line, characterized in that: The quality inspection and classification system of the stamping production line includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the quality inspection and classification system of the stamping production line to execute the method as described in any one of claims 1-7.
9. A computer program product comprising instructions, characterized in that When the computer program product is run on a quality inspection and classification system of a stamping production line, the quality inspection and classification system of the stamping production line is enabled to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on the quality inspection and classification system of the stamping production line, the quality inspection and classification system of the stamping production line is caused to execute the method according to any one of claims 1 to 7.