Stainless steel product quality detection method and device
By obtaining the quality detection images of stainless steel products based on machine learning models and analyzing texture features using grayscale symbiosis matrix, the problems of inefficiency and poor accuracy of traditional detection methods are solved, and more efficient and reliable quality detection is achieved.
Patent Information
- Application Number
- CN202510165269.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-05-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional stainless steel products quality testing methods are inefficient, and the test results are easily affected by artificial subjective factors, making it difficult to ensure accuracy and consistency. Especially when there are complex patterns on the surface of stainless steel products, it is difficult to accurately identify patterns and scratches, resulting in misjudgment.
The machine learning model-based method is used to obtain the quality detection images of stainless steel products, combine the grayscale symbiosis matrix to analyze the subtle texture features in the image, determine the target quality detection characteristics, and then conduct accurate quality detection.
It improves the accuracy and reliability of stainless steel product quality inspection, reduces the possibility of misjudgment and misjudgment, and ensures the accuracy and consistency of the inspection results.
Smart Images

Figure CN120047422A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the technical field of quality inspection, and more specifically, relates to a method and device for quality inspection of stainless steel products. Background Art
[0002] As an important material widely used in many fields such as construction, machinery manufacturing, food processing, and medical equipment, the quality of stainless steel products is directly related to key aspects such as product performance, service life, and safety.
[0003] Traditional methods for quality inspection of stainless steel products mostly rely on manual visual inspection or simple image recognition. This method is not only inefficient, but also the inspection results are easily affected by the subjective factors of inspectors, making it difficult to ensure the accuracy and consistency of inspection. The surface features of stainless steel products are complex and diverse, and there may be various normal textures, patterns, etc. These features may be confused with defect features. When the surface of stainless steel products has decorations such as patterns, it is impossible to accurately identify patterns and scratches, resulting in misjudgment and affecting the accuracy of stainless steel product quality inspection.
[0004] Therefore, there is an urgent need for an accurate and reliable method for quality inspection of stainless steel products. Summary of the Invention
[0005] The purpose of the present disclosure is to provide a method and device for quality inspection of stainless steel products to improve the accuracy and reliability of quality inspection of stainless steel products.
[0006] In the first aspect of the embodiments of the present disclosure, a method for quality inspection of stainless steel products is provided, including: Obtaining a quality inspection image of a stainless steel product based on a machine learning model; In response to the presence of quality inspection influencing features in the stainless steel product, determining target quality inspection features based on the gray-level co-occurrence matrix and the quality inspection image; the quality inspection influencing features are features of the same type as those in the quality inspection image; In response to the absence of quality inspection influencing features in the stainless steel product, taking the features in the quality inspection image as target quality inspection features; Detecting the quality of the stainless steel product based on the target quality inspection features to obtain a quality inspection result.
[0007] In the second aspect of the embodiments of the present disclosure, a device for quality inspection of stainless steel products is provided, including: Obtaining a quality inspection image of a stainless steel product based on a machine learning model; In response to the presence of quality inspection influencing features in the stainless steel product, determining target quality inspection features based on the gray-level co-occurrence matrix and the quality inspection image; the quality inspection influencing features are features of the same type as those in the quality inspection image; In response to the absence of quality inspection influencing features in the stainless steel product, the features in the quality inspection image are used as target quality inspection features; Based on the target quality inspection features, the quality of the stainless steel product is inspected to obtain a quality inspection result.
[0008] In the third aspect of the embodiments of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the steps of the above-mentioned method for inspecting the quality of stainless steel products are implemented.
[0009] In the fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for inspecting the quality of stainless steel products are implemented.
[0010] The beneficial effects of the method and device for inspecting the quality of stainless steel products provided by the embodiments of the present disclosure are as follows: In the present disclosure, a method based on a machine learning model is adopted to obtain a quality inspection image, making the detected features and images more accurate and avoiding omission. The present disclosure analyzes the quality inspection image through a gray-level co-occurrence matrix to capture the fine texture features in the image. Combining with the target quality inspection features, the quality problems of stainless steel products can be more accurately identified, reducing the possibility of misjudgment and missed judgment. The present disclosure considers the possible quality inspection influencing features of stainless steel products and distinguishes them from the target quality inspection features through gray-level co-occurrence matrix recognition, which can ensure the accuracy and reliability of the quality inspection result. The present disclosure can automatically adjust the processing strategy according to different quality inspection images. When there are no quality inspection influencing features in the stainless steel product, the features in the quality inspection image are directly used as target quality inspection features; while when there are influencing features, further analysis is carried out based on the gray-level co-occurrence matrix, improving the versatility of the present disclosure and the accuracy and reliability of the quality inspection of stainless steel products. Description of the Drawings
[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present disclosure. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0012] Figure 1 It is a schematic flowchart of a method for inspecting the quality of stainless steel products provided by an embodiment of the present disclosure; Figure 2Structural block diagram of a quality inspection device for stainless steel products provided by an embodiment of the present disclosure; Figure 3 Schematic block diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0013] In the following description, specific details such as specific system architectures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present disclosure. However, those skilled in the art should clearly understand that the present disclosure can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present disclosure.
[0014] To make the purpose, technical solution, and advantages of the present disclosure clearer, the following will be described through specific embodiments with reference to the accompanying drawings.
[0015] Please refer to Figure 1 , Figure 1 Schematic flowchart of a quality inspection method for stainless steel products provided by an embodiment of the present disclosure. The method includes: S101: Obtain a quality inspection image of the stainless steel product based on a machine learning model.
[0016] In this embodiment, the machine learning model is a model that has been trained with a large number of images of stainless steel with quality problems, and can be a convolutional neural network model, a recurrent neural network model, etc. After learning a large amount of data, the images of all aspects of the stainless steel product are input into the machine learning model, and the images with quality problems in the stainless steel product image can be screened and obtained.
[0017] The quality inspection image refers to an image with quality problems in the omnidirectional image of the stainless steel product, and the quality problems can include scratches, pits, uneven surfaces, etc.
[0018] S102: In response to the stainless steel product having quality inspection influencing features, determine target quality inspection features based on the gray-level co-occurrence matrix and the quality inspection image; the quality inspection influencing features are features of the same type as the features in the quality inspection image.
[0019] In this embodiment, considering that there are a wide variety of patterns on stainless steel products, it is impossible to make accurate judgments only relying on the machine learning model. For example, when a stainless steel product has both patterns and scratches, the machine learning model will identify normal patterns and engraved patterns that belong to normal textures as abnormal, and the detected quality inspection result is inaccurate. Therefore, the present disclosure performs detection by setting different strategies to obtain accurate quality inspection features.
[0020] The quality inspection influencing feature refers to the feature in the quality inspection image of stainless steel products that can interfere with the judgment of the true quality status of the products. These features belong to the same category as other features used to judge quality in the image. For example, for the feature in the quality inspection image being a scratch, then for stainless steel products with patterns or indentations on the surface, their normal patterns and indentations are a kind of quality inspection influencing feature because it may be confused with the scratch defect feature, and they both belong to the category of engraving on the surface.
[0021] Whether there is a quality inspection influencing feature in the stainless steel product can be based on the sample of the stainless steel product or pre - setting. If the sample or pre - setting indicates that there is a quality influencing feature on the surface of the currently inspected stainless steel product, then when the same feature as the sample or pre - set quality influencing feature is detected in the quality inspection image, the target quality inspection feature should be determined based on the gray - level co - occurrence matrix and the quality inspection image.
[0022] The gray - level co - occurrence matrix is a matrix used to describe the co - occurrence situation of gray - level pairs in an image under a given spatial relationship. By calculating the gray - level co - occurrence matrix, multiple parameters reflecting the texture features of the image can be extracted, such as energy, contrast, correlation, entropy, etc. These parameters can help analyze the spatial distribution relationship between different gray values in the image, thereby judging the characteristics in the image.
[0023] The target quality inspection feature is the feature used to judge the quality of stainless steel products, which is the feature after removing the quality inspection influencing feature.
[0024] The quality inspection influencing feature can be that the stainless steel product itself has patterns or holes, etc., and the features in the quality inspection image can be scratches or pits. Patterns will affect the detection of scratches, and holes will affect the detection of pits.
[0025] S103: In response to the absence of a quality inspection influencing feature in the stainless steel product, use the feature in the quality inspection image as the target quality inspection feature.
[0026] In this embodiment, when there is no quality inspection influencing feature in the sample of the stainless steel product and no preset is made, then all the features appearing in the quality inspection image are the target quality inspection features, that is, the features for detecting the quality of the stainless steel product.
[0027] That is to say, when the stainless steel product itself has no features affecting quality inspection, the image of the stainless steel product detected by the machine learning model trained with a large amount of data is the image with abnormal features.
[0028] S104: Detect the quality of the stainless steel product based on the target quality inspection feature to obtain the quality inspection result.
[0029] In an embodiment of the present disclosure, the quality of a stainless-steel product is detected based on target quality detection features, and a quality detection result is obtained, including: The quality of the stainless-steel product is detected based on the target quality detection features to obtain a scratch detection result and a pit detection result; The scratch detection result and the pit detection result are weighted and calculated to obtain the quality detection result.
[0030] In an embodiment of the present disclosure, the quality of a stainless-steel product is detected based on target quality detection features, and a quality detection result is obtained, including: The quality of the stainless-steel product is detected based on the target quality detection features to obtain a scratch detection result and a pit detection result; The scratch detection result and the pit detection result are weighted and calculated to obtain the quality detection result.
[0031] In this embodiment, the main features to be detected are scratches and pits. After obtaining the target quality detection features, quality detection is performed. The quality detection result can be presented in the form of a numerical value. The higher the numerical value, the lower the quality. The quality detection result can also be a grading result, such as no quality problem, minor quality problem, moderate quality problem, severe quality problem, etc.
[0032] The scratch detection result refers to the quality detection result obtained by detecting the scratch feature in the target quality detection features, and the pit detection result refers to the quality detection result obtained by detecting the pit feature in the target quality detection features. The scratch detection result and the pit detection result can be weighted and calculated to obtain the final detection result, that is, the quality detection result.
[0033] Considering that when the length of a scratch is long (i.e., greater than the target length) or the width is wide (i.e., greater than the target width), even if the area of the pit is small (i.e., less than or equal to the target area), it is also a serious quality problem. At this time, if the original weight is still used, the detection result at this time is inaccurate, that is, the area of the pit is small or there is no pit. The weight of the scratch detection result should be appropriately increased, and the weight of the pit detection result should be decreased by the same amplitude. To avoid the situation where there are obvious scratches, but the quality detection result does not match the actual situation.
[0034] Similarly, when the area of the pit is large (i.e., greater than the target area), and at the same time the length of the scratch is short (i.e., less than or equal to the target length) and the width of the scratch is small (less than or equal to the target width), that is, the scratch is small or there is no scratch, the weight of the scratch detection result should be appropriately decreased, and the weight of the pit detection result should be increased by the same amplitude. To avoid the situation where there are obvious pits, but the quality detection result does not match the actual situation.
[0035] The target area, target length, and target width can be set based on experience or set according to the size of the stainless steel product, because for stainless steel products of different sizes, the same-sized scratch has different effects on them.
[0036] From the above, it can be obtained that the present disclosure obtains the quality inspection image by using a method based on a machine learning model, making the detected features and images more accurate and avoiding omission. The present disclosure analyzes the quality inspection image through a gray-level co-occurrence matrix to capture the fine texture features in the image. Combining with the target quality inspection features, the quality problems of stainless steel products can be identified more precisely, reducing the possibility of misjudgment and missed judgment. The present disclosure considers the possible quality inspection influence features of stainless steel products and distinguishes them from the target quality inspection features through gray-level co-occurrence matrix recognition, which can ensure the accuracy and reliability of the quality inspection results. The present disclosure can automatically adjust the processing strategy according to different quality inspection images. When there are no quality inspection influence features in the stainless steel product, the features in the quality inspection image are directly used as the target quality inspection features; while when there are influence features, further analysis is performed based on the gray-level co-occurrence matrix, improving the versatility of the present disclosure and the accuracy and reliability of the quality inspection of stainless steel products.
[0037] In an embodiment of the present disclosure, determining the target quality inspection features based on the gray-level co-occurrence matrix and the quality inspection image includes: Dividing the quality inspection image into multiple quality inspection sub-images; Determining the distance parameter, angle parameter, and gray-level series of the gray-level co-occurrence matrix based on the quality inspection sub-images; Calculating the gray-level co-occurrence matrix of the quality inspection features based on the distance parameter, angle parameter, and gray-level series; Obtaining multiple evaluation results of the quality inspection sub-images based on the gray-level co-occurrence matrix; Determining the target quality inspection features based on the multiple evaluation results.
[0038] In this embodiment, determining the distance parameter, angle parameter, and gray-level series of the gray-level co-occurrence matrix based on the quality inspection sub-images includes: Determining the distance parameter of the co-occurrence matrix based on the quality inspection sub-images; Determining the angle parameter of the co-occurrence matrix based on the quality inspection sub-images; Determining the gray-level series of the co-occurrence matrix based on the quality inspection sub-images.
[0039] In this embodiment, the quality inspection image can be divided into multiple quality inspection sub-images through image segmentation. The quality inspection sub-image is a part of the quality inspection image. Considering that the quality inspection image is obtained by machine learning, it contains not only the target quality inspection features but also the quality inspection influencing features. Therefore, the quality inspection image can be divided into multiple sub-images. The number of divisions can be set according to experience or according to the complexity or quantity of the patterns on the stainless steel products. When the number of patterns is larger, the number of divisions should also be increased to more accurately distinguish patterns and scratches.
[0040] After the division, the parameters of the gray-level co-occurrence matrix should be determined according to the features of each quality inspection sub-image. In an embodiment of the present disclosure, determining the distance parameter of the gray-level co-occurrence matrix based on the quality inspection sub-image includes: In response to the resolution of the quality inspection sub-image being greater than or equal to the first resolution, increasing the reference value of the distance parameter by the first resolution step to obtain the distance parameter; In response to the resolution of the quality inspection sub-image being less than or equal to the second resolution, decreasing the reference value of the distance parameter by the second resolution step to obtain the distance parameter; In response to the resolution of the quality inspection sub-image being less than the first resolution and greater than the second resolution, using the reference value of the distance parameter as the distance parameter.
[0041] In this embodiment, considering that when the resolution of the quality inspection sub-image is greater than or equal to the first resolution, it indicates that the resolution of the quality inspection sub-image is relatively high, that is, the image contains more details. The reference value of the distance parameter can be increased by the first resolution step to capture texture features at a larger scale. A larger distance parameter can help identify the relationship between pixels farther apart and reflect more macroscopic texture features or defects. The first resolution and the first resolution step can be determined according to the results during the experiment. For example, the first resolution can be 1024×1024 pixels, and the first resolution step can be 1 or 2.
[0042] When the resolution of the quality inspection sub-image is less than or equal to the first resolution, it indicates that the resolution of the quality inspection sub-image is relatively low. A low-resolution image has fewer details, and a larger distance parameter may exceed the information range of the image itself, resulting in inaccurate or incomplete information in the gray-level co-occurrence matrix. The reference value of the distance parameter can be decreased by the second resolution step. The second resolution and the first resolution step can be determined according to the results during the experiment. For example, the second resolution can be 256×256 pixels, and the second resolution step can be 1 or 2.
[0043] When the resolution of the quality inspection sub-image is less than the first resolution and greater than the second resolution, it indicates that the image quality of the quality inspection sub-image is moderate. At this time, the reference value of the distance parameter can be used without adjustment. The reference value of the distance parameter is a value with strong adaptability and can be determined according to experience or common practice. For example, for stainless steel products, the distance parameter is generally set to 3.
[0044] In this embodiment, determining the angular parameter of the co-occurrence matrix based on the quality inspection sub-image includes: In response to the texture feature in the quality inspection sub-image being in the horizontal direction, setting the angular parameter of the co-occurrence matrix to horizontal and vertical; In response to the texture feature in the quality inspection sub-image being in the inclined direction, setting the angular parameter of the co-occurrence matrix to the inclination angle; In response to the texture feature in the quality inspection sub-image being unclear or containing both horizontal and inclined directions, setting the angle of the co-occurrence matrix to horizontal, vertical, and inclined.
[0045] In this embodiment, the texture feature refers to the direction of the texture or pattern in the quality inspection sub-image. The texture direction in the quality inspection sub-image can be judged by feature extraction and setting the threshold of the horizontal direction and the threshold of the inclined direction. If the texture or pattern is in the horizontal direction, then 0° (horizontal) and 90° (vertical) can be selected as the angular parameters. For stainless steel products with inclined textures, that is, the texture or pattern is inclined, then the corresponding 45° or 135° angles can be selected as the angular parameters. The advantage of doing this is that it can focus on the features of the texture and pattern in the main direction, avoid unnecessary calculations and information redundancy, and at the same time can more prominently show the main texture and pattern features in these directions.
[0046] In this embodiment, determining the gray level number of the co-occurrence matrix based on the quality inspection sub-image includes: In response to the original gray level range of the quality inspection sub-image being greater than the first gray level range, taking the first gray level number as the gray level number; In response to the original gray level range of the quality inspection sub-image being less than or equal to the first gray level range, taking the second gray level number as the gray level number.
[0047] In this embodiment, the original gray range is the gray range of the quality inspection sub-image, which is determined by the number of bits of gray. For example, for a gray image with 8-bit gray, its original gray range is 0 - 255. The first gray range can be 0 - 127. If the original gray range of the quality inspection sub-image is relatively wide, in this case, a relatively large number of gray levels can be selected, such as 32 or 64 (i.e., the first gray level number). This can better retain the detailed information in the image, avoid over-merging different gray values into the same gray level, and thus more accurately describe the texture features of the image. Because a larger number of gray levels can distinguish subtle gray differences, which helps to capture potential subtle texture changes and quality defects in the image, the first gray level number can be 64.
[0048] When the gray range of the quality inspection sub-image is relatively narrow, and the gray values are concentrated in a relatively small range (such as 50 to 150), a smaller number of gray levels can be selected, such as 8 or 16. Using too many gray levels may result in some gray levels having no corresponding pixels, thus causing waste of computing resources and may introduce noise or unnecessary complexity. The second gray level number can be 16.
[0049] After determining the distance parameter, angle parameter, and gray level number of the gray-level co-occurrence matrix, the gray-level co-occurrence matrix of the quality inspection feature can be calculated. The quality inspection feature is a feature in the quality inspection sub-image, which contains patterns and may also contain possible scratches.
[0050] The calculation formula of the gray-level co-occurrence matrix is: , where is the probability of pixel pairs with gray values of and in the gray-level co-occurrence matrix, the size of image is , is the displacement determined according to the distance parameter and the angle parameter .
[0051] After obtaining the gray-level co-occurrence matrix, multiple evaluation results of the quality inspection sub-image can be calculated. The evaluation results include: energy evaluation result, contrast evaluation result, correlation evaluation result, and entropy evaluation result.
[0052] Energy, also called angular second moment, represents the consistency or uniformity of the texture. The calculation formula is: , where, is the gray level of image .
[0053] Contrast: Reflects the clarity and local variation of the texture in the image. The calculation formula is: , where is an exponential parameter for controlling the sensitivity of texture metrics.
[0054] Correlation: Measures the degree of linear dependence of image texture, and the calculation formula is: , where represents the row mean, represents the column mean, represents the row standard deviation, represents the column standard deviation.
[0055]
[0056]
[0057]
[0058]
[0059] Entropy: Represents the randomness or disorder of image texture, and the calculation formula is:
[0060] Energy is the sum of the squares of the elements of the gray-level co-occurrence matrix, which reflects the consistency or uniformity of image texture. Normally, uniform texture has higher energy, while quality defects (such as scratches and pits) will destroy the uniformity of the texture, resulting in a decrease in energy. Therefore, in order to make the higher the numerical value of the energy evaluation result indicates the more serious the quality defect, we can take the reciprocal of the energy and then perform normalization processing.
[0061] The energy evaluation result can be determined according to the first formula: , where represents the calculated energy, represents the energy evaluation result, represents the maximum energy value under normal conditions (defect-free area), which can be obtained from the data in the experimental process.
[0062] Contrast reflects the degree of difference in gray values in the image. The contrast of normal texture is usually relatively stable, while defects will cause a sharp change in local gray values, increasing the contrast. Therefore, the contrast evaluation result can directly use the contrast value, but in order to normalize it to interval, we divide it by an appropriate maximum value.
[0063] The contrast evaluation result can be calculated according to the second formula, and the second formula: , where Indicates the contrast evaluation result, Indicates the calculated contrast value, Is a reference maximum contrast value, which can be obtained through statistical analysis of a large number of defect-free images or set according to experience.
[0064] The correlation measures the linear correlation of pixel gray values in the image. Normal textures have a high correlation, while defects will destroy this correlation and reduce it. Therefore, the correlation evaluation result can be calculated according to the third formula. The third formula: , where Indicates the correlation evaluation result, Indicates the calculated correlation value, Is the maximum correlation value under normal conditions (defect-free area), which can be obtained through statistical analysis of a large number of defect-free images or set according to experience.
[0065] Entropy represents the randomness or disorder of the image texture. Normal textures have a certain entropy value. Scratches will make the texture more chaotic and increase the entropy value. Therefore, the entropy evaluation result can be calculated according to the fourth formula. The fourth formula: , where Indicates the entropy evaluation result, Indicates the calculated entropy value, Indicates the maximum entropy value, which can be determined through statistics of defect-free images or according to experience. The above parameters are all numerical values.
[0066] Finally, the four obtained evaluation results are weighted and calculated to obtain the final evaluation result, that is, the target evaluation result. When performing weighted calculation, the weights of the above four evaluation results should be different because the performances and influences of scratches and pits in the above four evaluation results have different emphases. Therefore, they should not be simply weighted and calculated fixedly.
[0067] It can be concluded from the above that by dividing the quality inspection image into multiple quality inspection sub-images, the present disclosure can analyze each part of the stainless steel product more carefully, which helps to reduce the loss of details caused by the too large image, thereby improving the accuracy of quality inspection. The present disclosure dynamically adjusts the distance parameter, angle parameter and gray level of the gray-level co-occurrence matrix according to the quality inspection sub-images, ensuring that the optimal analysis can be obtained for different images, improving the versatility of the present disclosure, and improving the accuracy and reliability of the quality inspection of stainless steel products.
[0068] In an embodiment of the present disclosure, determining the target quality inspection feature based on multiple evaluation results includes: In response to the feature type in the quality inspection image being a scratch type, adjust the weights of multiple evaluation results based on the first weight adjustment strategy; In response to the feature type in the quality inspection image being a pothole type, adjust the weights of multiple evaluation results based on the second weight adjustment strategy; Perform weighted calculation on multiple evaluation results to obtain the target evaluation result; In response to the target evaluation result being greater than or equal to the outlier, determine the feature in the quality inspection sub-image as the target quality inspection feature; Among them, the adjustment directions of the first weight adjustment strategy and the second weight adjustment strategy are different.
[0069] In an embodiment of the present disclosure, the multiple evaluation results include: an energy evaluation result, a contrast evaluation result, a correlation evaluation result, and an entropy evaluation result; Adjusting the weights of multiple evaluation results based on the first weight adjustment strategy includes: Increase the weight of the energy evaluation result based on the first energy step size, increase the weight of the contrast evaluation result based on the first contrast step size, decrease the weight of the correlation evaluation result based on the first correlation step size, and decrease the weight of the entropy evaluation result based on the first entropy step size.
[0070] In this embodiment, through the above analysis, it can be seen that different processing and calculation of evaluation results are performed on each quality inspection sub-image to obtain their respective gray-level co-occurrence matrices. Secondly, the energy evaluation result, contrast evaluation result, correlation evaluation result, and entropy evaluation result are calculated through the gray-level co-occurrence matrix. These results describe the texture features of the quality inspection sub-image from different aspects, but for different quality problems (such as scratch type and pothole type), their importance (weights) are different. Therefore, fixed weights cannot be used for weighted calculation, but the weights need to be adjusted according to the feature type in the quality inspection image. The feature type in the quality inspection image is identified by the machine learning model. Although the machine learning model cannot accurately obtain patterns, scratches, or potholes, etc., it can achieve the function of simply identifying the type.
[0071] For scratch-type features, they mainly affect the local gray-level consistency and contrast of the image. Scratches will destroy the uniformity of the texture, resulting in large energy changes; at the same time, the gray-level difference between the scratch area and the surrounding normal area increases, causing the contrast to rise. In terms of correlation, scratches will, to a certain extent, destroy the original linear relationship between pixels, resulting in a decrease in correlation; for entropy, scratches will make the local texture more complex, and the entropy value may increase, but compared with the changes in energy and contrast, the sensitivity of correlation and entropy to scratches is slightly lower. Therefore, when calculating the evaluation results of the scratch type, the weights of the energy evaluation result and the contrast evaluation result should be appropriately increased, while the weights of the correlation evaluation result and the entropy evaluation result should be decreased.
[0072] That is, increase the weight of the energy evaluation result based on the first energy step size, increase the weight of the contrast evaluation result based on the first contrast step size, decrease the weight of the correlation evaluation result based on the first correlation weight, and decrease the weight of the entropy evaluation result based on the first entropy weight.
[0073] Among them, the first energy step size, the first contrast step size, the first correlation step size, and the first entropy step size can all be determined according to experiments or set according to experience. However, it should be noted that the sum of the first energy step size and the first contrast step size should be equal to the sum of the first correlation step size and the first entropy step size so that the weights are integrated to 1. The initial weights can be evenly distributed or set according to personal needs.
[0074] Adjust the weights of multiple evaluation results based on the second weight adjustment strategy, including: Decrease the weight of the energy evaluation result based on the second energy step size, decrease the weight of the contrast evaluation result based on the second contrast step size, increase the weight of the correlation evaluation result based on the second correlation step size, and increase the weight of the entropy evaluation result based on the second entropy step size.
[0075] For pit-like features, a pit, as a kind of blocky surface defect, will seriously damage the linear relationship between its internal and surrounding pixels. In the normal stainless-steel surface texture, there is a certain spatial continuity and linear correlation in the gray values of pixels, and this correlation is formed based on relatively uniform surface reflection and texture structure. The appearance of a pit will break this rule in a local area. The gray values of pixels inside the pit may have no relation to the gray values of pixels in the surrounding normal area due to factors such as lighting, shadow, and depth change, thus greatly reducing the linear correlation of pixel gray values in the entire image. A pit will make the local texture become highly complex and disordered. From the perspective of information theory, the existence of a pit increases the uncertainty factors in the image. The gray distribution inside the pit is irregular, and there may be multiple different gray values. Moreover, the edge part of the pit will also introduce additional texture changes, and these factors together lead to a significant increase in the entropy value.
[0076] Therefore, pit-like features have a relatively large impact on correlation and entropy. So, the weights corresponding to the correlation evaluation result and the entropy evaluation result should be appropriately increased, and the weights corresponding to the energy evaluation result and the contrast evaluation result should be decreased.
[0077] Among them, the second energy step size, the second contrast step size, the second correlation step size, and the second entropy step size can all be determined according to experiments or set according to experience. However, it should be noted that the sum of the second energy step size and the second contrast step size should be equal to the sum of the second correlation step size and the second entropy step size, so that the weights are integrated to 1. The initial weights can be evenly distributed or set according to personal needs.
[0078] The evaluation result obtained by weighted calculation is the target evaluation result. The target evaluation result can be compared with a preset outlier. When the value of the target evaluation result is greater than or equal to the outlier, it is determined that the feature in the quality detection sub-image is the target quality detection feature, and the outlier can be determined according to experiments.
[0079] It can be concluded from the above that according to the different types of features, the present disclosure dynamically adjusts the weights of multiple evaluation results by using different adjustment strategies, taking into account the different impacts of different types of quality defects on the evaluation results, making the final evaluation result more in line with the actual situation, and improving the pertinence and accuracy of the quality detection of stainless steel products. By calculating multiple indicators such as the energy evaluation result, the contrast evaluation result, the correlation evaluation result, and the entropy evaluation result, the present disclosure can comprehensively and meticulously describe the texture features of the quality detection sub-image, reduce the probability of missed detection and misdetection, and improve the accuracy and reliability of the quality detection of stainless steel products.
[0080] In an embodiment of the present disclosure, a method for quality detection of stainless steel products further includes: Determine the first energy adjustment step size based on the first energy step size adjustment formula; Determine the first contrast adjustment step size based on the first contrast step size adjustment formula; Determine the first correlation adjustment step size based on the first correlation step size adjustment formula; Determine the first entropy adjustment step size based on the first entropy step size adjustment formula; Reduce the first energy step size based on the first energy adjustment step size, reduce the first contrast step size based on the first contrast step size, increase the first correlation step size based on the first correlation adjustment step size, and increase the first entropy step size based on the first entropy adjustment step size.
[0081] In this embodiment, considering that for stainless steel products with a relatively high surface roughness, the influence of scratches on energy and contrast is relatively small. Because the rough surface itself has more gray-scale changes and texture fluctuations, the additional energy changes and contrast changes caused by scratches may not be so significant. In this case, the first energy step size and the first contrast step size can be appropriately reduced. However, scratches may further disrupt the original texture correlation and entropy of the surface, making the texture more disordered, so the first correlation step size and the first entropy step size can be considered to be appropriately increased.
[0082] The first energy step size adjustment formula is: , and the first contrast step size adjustment formula is: , and the first correlation step size adjustment formula is: , and the first entropy step size adjustment formula is: .
[0083] Wherein. is the first energy adjustment step size, is the first contrast adjustment step size, is the first correlation adjustment step size, is the first entropy adjustment step size, are the energy step size coefficient, contrast step size coefficient, correlation step size coefficient, and entropy step size coefficient respectively, which can be determined according to experiments or experience, and the values are between 0 and 1, represents the surface roughness parameter of the stainless steel surface.
[0084] The surface roughness is quantified by a method based on the variance of image gray level. The image collected from the surface of the stainless steel product is , and the range of its gray level value is . First, the image is divided into blocks, and the image is divided into non-overlapping sub-blocks, and the size of each sub-block is pixels.
[0085] For the th sub-block, its gray level mean value , where represents the coordinates of the pixels within the sub-block, and then the gray level variance of this sub-block is calculated. The surface roughness parameter of the entire image is defined as the mean value of the gray level variances of all sub-blocks. After normalization, that is , and the above parameters are all numerical values.
[0086] It can be obtained from the above that by introducing the surface roughness parameter and adjusting the step sizes of energy, contrast, correlation, and entropy based on this parameter, the quality detection method can more accurately reflect the influence of scratches on the surface quality of stainless steel products. This adjustment strategy takes into account the differences in gray level changes and texture fluctuations caused by scratches under different surface roughnesses, thereby improving the accuracy of stainless steel product quality detection. This embodiment can perform dynamic adjustment according to the surface roughness of different stainless steel products, making it applicable to the quality detection of stainless steel products with various surface conditions, improving the applicability of the present disclosure, and reducing the dependence on specific surface conditions.
[0087] Corresponding to a stainless steel product quality detection method in the above embodiment, Figure 2The structural block diagram of a quality detection device for stainless steel products provided by an embodiment of the present disclosure. For the sake of convenience, only the parts related to the embodiments of the present disclosure are shown. Refer to Figure 2 As shown in , this quality detection device 20 for stainless steel products includes: an image acquisition module 21, a first feature determination module 22, a second feature determination module 23, and a quality detection module 24.
[0088] Among them, the image acquisition module 21 is used to obtain a quality detection image of the stainless steel product based on a machine learning model; The first feature determination module 22 is used to, in response to the existence of quality detection influencing features in the stainless steel product, determine target quality detection features based on the gray-level co-occurrence matrix and the quality detection image; the quality detection influencing features are features of the same type as the features in the quality detection image; The second feature determination module 23 is used to, in response to the non-existence of quality detection influencing features in the stainless steel product, use the features in the quality detection image as target quality detection features; The quality detection module 24 is used to detect the quality of the stainless steel product based on the target quality detection features to obtain a quality detection result.
[0089] In an embodiment of the present disclosure, the first feature determination module 22 is specifically used to divide the quality detection image into multiple quality detection sub-images; Determine the distance parameter, angle parameter, and gray-level series of the gray-level co-occurrence matrix based on the quality detection sub-images; Calculate the gray-level co-occurrence matrix of the quality detection features based on the distance parameter, angle parameter, and gray-level series; Obtain multiple evaluation results of the quality detection sub-images based on the gray-level co-occurrence matrix; Determine the target quality detection features based on the multiple evaluation results.
[0090] In an embodiment of the present disclosure, the first feature determination module 22 is specifically further used to, in response to the resolution of the quality detection sub-image being greater than or equal to the first resolution, increase the reference value of the distance parameter by the first resolution step to obtain the distance parameter; In response to the resolution of the quality detection sub-image being less than or equal to the second resolution, decrease the reference value of the distance parameter by the second resolution step to obtain the distance parameter; In response to the resolution of the quality detection sub-image being less than the first resolution and greater than the second resolution, use the reference value of the distance parameter as the distance parameter.
[0091] In an embodiment of the present disclosure, the first feature determination module 22 is specifically further used to, in response to the feature type in the quality detection image being a scratch type, adjust the weights of the multiple evaluation results based on the first weight adjustment strategy; In response to the feature type in the quality detection image being a pit type, adjust the weights of multiple evaluation results based on the second weight adjustment strategy; Perform a weighted calculation on multiple evaluation results to obtain a target evaluation result; In response to the target evaluation result being greater than or equal to the outlier value, determine the feature in the quality detection sub-image as the target quality detection feature; Among them, the adjustment directions of the first weight adjustment strategy and the second weight adjustment strategy are different.
[0092] In an embodiment of the present disclosure, the multiple evaluation results include: an energy evaluation result, a contrast evaluation result, a correlation evaluation result, and an entropy evaluation result; The first feature determination module 22 is specifically further configured to increase the weight of the energy evaluation result based on the first energy step, increase the weight of the contrast evaluation result based on the first contrast step, decrease the weight of the correlation evaluation result based on the first correlation step, and decrease the weight of the entropy evaluation result based on the first entropy step.
[0093] In an embodiment of the present disclosure, the quality detection module 24 is specifically configured to detect the quality of the stainless steel product based on the target quality detection feature to obtain a scratch detection result and a pit detection result; Perform a weighted calculation on the scratch detection result and the pit detection result to obtain a quality detection result.
[0094] In an embodiment of the present disclosure, the features in the target quality detection image include: scratches and pits; A quality detection device 20 for stainless steel products further includes: a weight adjustment module; The weight adjustment module is configured to, in response to the area of the pit being less than or equal to the target area, and the length of the scratch being greater than the target length and / or the width of the scratch being greater than the target width, increase the weight of the scratch detection result based on the first scratch step, and decrease the weight of the pit detection result based on the first scratch step; In response to the area of the pit being greater than the target area, and the length of the scratch being less than or equal to the target length, and the width of the scratch being less than or equal to the target width, increase the weight of the pit detection result based on the first pit step, and decrease the weight of the scratch detection result based on the first pit step.
[0095] See Figure 3 , Figure 3 is a schematic block diagram of an electronic device provided in an embodiment of the present disclosure. As Figure 3The electronic device 300 in the present embodiment shown may include: one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The above-mentioned processors 301, input devices 302, output devices 303, and memories 304 communicate with each other through a communication bus 305. The memory 304 is used to store a computer program, and the computer program includes program instructions. The processor 301 is used to execute the program instructions stored in the memory 304. Among them, the processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above device embodiments, for example Figure 2 the functions of the modules 21 to 24 shown.
[0096] It should be understood that in the embodiments of the present disclosure, the so-called processor 301 may be a central processing unit (CPU), and this processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or this processor may also be any conventional processor, etc.
[0097] The input device 302 may include a touchpad, a fingerprint acquisition sensor (for acquiring the fingerprint information and the direction information of the fingerprint of the user), a microphone, etc., and the output device 303 may include a display (such as an LCD), a speaker, etc.
[0098] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A part of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.
[0099] In specific implementation, the processors 301, input devices 302, and output devices 303 described in the embodiments of the present disclosure may execute the implementation manners described in the first embodiment and the second embodiment of a method for detecting the quality of stainless steel products provided by the embodiments of the present disclosure, and may also execute the implementation manner of the electronic device described in the embodiments of the present disclosure, which will not be elaborated here.
[0100] In another embodiment of the present disclosure, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, all or part of the processes in the methods of the above embodiments are implemented. It can also be completed by instructing relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0101] The computer-readable storage medium can be an internal storage unit of the electronic device in any of the foregoing embodiments, such as the hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk equipped on the electronic device, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the computer-readable storage medium can also include both the internal storage unit and the external storage device of the electronic device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store the data that has been output or will be output.
[0102] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.
[0103] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described electronic devices and units can refer to the corresponding processes in the foregoing method embodiments and will not be described in detail here.
[0104] In several embodiments provided by this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed coupling or direct coupling or communication connection to each other can be an indirect coupling or communication connection through some interfaces or units, or can also be an electrical, mechanical or other form of connection.
[0105] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or can also be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present disclosure.
[0106] In addition, in each embodiment of the present disclosure, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0107] The above is only the specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present disclosure can easily think of various equivalent modifications or replacements, and these modifications or replacements should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A method for detecting the quality of stainless steel products, characterized in that: include: Acquire quality inspection images of stainless steel products based on machine learning models; In response to the presence of quality inspection influencing features in the stainless steel product, a target quality inspection feature is determined based on a gray level co-occurrence matrix and the quality inspection image; the quality inspection influencing feature is a feature of the same type as a feature in the quality inspection image; In response to the stainless steel product not having a quality inspection-affecting feature, taking a feature in the quality inspection image as a target quality inspection feature; The quality of the stainless steel product is detected based on the target quality detection feature to obtain a quality detection result.
2. A stainless steel product quality inspection method according to claim 1, characterized in that: The determining of target quality detection features based on the gray level co-occurrence matrix and the quality detection image includes: Dividing the quality detection image into a plurality of quality detection sub-images; Determine the distance parameter, angle parameter and gray level of the gray level co-occurrence matrix based on the quality detection sub-image; Calculate the gray level co-occurrence matrix of the quality detection feature based on the distance parameter, the angle parameter and the gray level number; Obtaining multiple evaluation results of the quality detection sub-image based on the gray level co-occurrence matrix; A target quality detection feature is determined based on the multiple evaluation results.
3. A stainless steel product quality inspection method as claimed in claim 2, characterized in that: The determining the distance parameter of the gray level co-occurrence matrix based on the quality detection sub-image comprises: In response to a resolution of the quality detection sub-image being greater than or equal to a first resolution, increasing a reference value of the distance parameter by a step size of the first resolution to obtain the distance parameter; In response to the resolution of the quality detection sub-image being less than or equal to the second resolution, reducing the reference value of the distance parameter by a second resolution step size to obtain the distance parameter; In response to a resolution of the quality detection sub-image being smaller than the first resolution and larger than the second resolution, a reference value of the distance parameter is used as the distance parameter.
4. A stainless steel product quality inspection method as claimed in claim 2, characterized in that: The determining of target quality detection features based on the multiple evaluation results includes: In response to the feature type in the quality inspection image being a scratch type, adjusting the weights of the plurality of evaluation results based on a first weight adjustment strategy; In response to the feature type in the quality detection image being a pothole type, adjusting the weights of the plurality of evaluation results based on a second weight adjustment strategy; Performing weighted calculation on the multiple evaluation results to obtain a target evaluation result; In response to the target evaluation result being greater than or equal to an abnormal value, determining a feature in the quality detection sub-image as a target quality detection feature; The first weight adjustment strategy and the second weight adjustment strategy have different adjustment directions.
5. A stainless steel product quality inspection method as claimed in claim 4, characterized in that: The multiple evaluation results include: energy evaluation results, contrast evaluation results, correlation evaluation results and entropy evaluation results; The step of adjusting the weights of the plurality of evaluation results based on the first weight adjustment strategy includes: The weight of the energy evaluation result is increased based on the first energy step, the weight of the contrast evaluation result is increased based on the first contrast step, the weight of the correlation evaluation result is reduced based on the first correlation step, and the weight of the entropy evaluation result is reduced based on the first entropy step.
6. A stainless steel product quality inspection method according to claim 1, characterized in that: The quality of the stainless steel product is detected based on the target quality detection feature to obtain a quality detection result, including: The quality of the stainless steel product is detected based on the target quality detection feature to obtain scratch detection results and pothole detection results; The scratch detection result and the pothole detection result are weightedly calculated to obtain a quality detection result.
7. A stainless steel product quality inspection method according to claim 6, characterized in that: The features in the target quality detection image include: scratches and potholes; A method for detecting quality of stainless steel products, further comprising: In response to the area of the pothole being less than or equal to the target area, and the length of the scratch being greater than the target length and / or the width of the scratch being greater than the target width, increasing the weight of the scratch detection result based on a first scratch step length, and decreasing the weight of the pothole detection result based on the first scratch step length; In response to the area of the pothole being greater than the target area, the length of the scratch being less than or equal to the target length, and the width of the scratch being less than or equal to the target width, the weight of the pothole detection result is increased based on the first pothole step length, and the weight of the scratch detection result is reduced based on the first pothole step length.
8. A stainless steel product quality inspection device, characterized in that: include: An image acquisition module, used to acquire quality inspection images of stainless steel products based on a machine learning model; A first feature determination module is used to determine a target quality detection feature based on a gray level co-occurrence matrix and the quality detection image in response to the presence of a quality detection influencing feature in the stainless steel product; the quality detection influencing feature is a feature of the same type as a feature in the quality detection image; A second feature determination module is used for, in response to the stainless steel product not having a quality inspection influencing feature, using a feature in the quality inspection image as a target quality inspection feature; The quality detection module is used to detect the quality of the stainless steel product based on the target quality detection feature to obtain a quality detection result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Deformed steel bar abnormity judgment method based on attention mechanism
CN114998323A
Button hole defect detection method
CN115272305A
Stainless steel product quality detection method based on image recognition
CN115375676A
Method for detecting scratches on surface of electronic component
CN116228768A
Rapid detection method for surface defects of fireproof plate
CN116758065A