Strip steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree
By combining gray-level co-occurrence matrix and decision tree, the problem of automatic grading in cold-rolled strip surface quality inspection system has been solved, realizing automated sorting and grading, improving inspection efficiency and accuracy, and meeting the detailed management needs of steel enterprises for surface quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- UNIV OF SCI & TECH BEIJING
- Filing Date
- 2023-10-10
- Publication Date
- 2026-07-03
AI Technical Summary
Existing surface quality inspection systems for cold-rolled strip steel cannot automatically perform sorting and grading, resulting in low efficiency and insufficient accuracy of manual judgment, which makes it difficult to meet the detailed management needs of steel companies for surface quality.
A method based on gray-level co-occurrence matrix and decision tree is adopted to construct a surface quality sorting and grading model for cold-rolled strip steel by acquiring image and text data of the surface. The defect feature value is calculated by gray-level co-occurrence matrix and automatically graded by combining decision tree algorithm.
It enables automatic sorting and grading of the surface quality of cold-rolled strip steel, reduces the rate of missed inspections, improves the efficiency and accuracy of the production process, and reduces quality disputes in downstream processes.
Smart Images

Figure CN117314871B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of metallurgical machinery and automation technology, and in particular to a method and apparatus for sorting and classifying strip steel based on gray-level co-occurrence matrix and decision tree. Background Technology
[0002] As the automotive industry, high-end home appliances, and other sectors impose increasingly stringent quality requirements on steel products, personalized product demands are also growing. While ensuring basic quality indicators are met, steel companies and downstream users are shifting their focus to more detailed surface quality issues. Due to the lengthy process involved, complex formation mechanisms, and high frequency of occurrence, surface quality has a significant impact on the final product quality and is considered one of the most important and difficult-to-control quality indicators. Precisely because of the complexity of surface quality, major steel companies attach great importance to the management of cold-rolled strip steel surface quality, hoping to improve product quality and achieve greater commercial value.
[0003] Determining the surface quality of cold-rolled strip steel remains a challenge. While cold-rolled strip steel production lines are equipped with surface inspection systems (SMIS), these systems can only identify the type of defects and often lack the ability to classify and grade the surface quality of the strip steel. Unlike other performance indicators that are automatically determined based on parameter thresholds, SMISS systems have limitations such as complex working environments, high false alarm rates, and the inability to assess the severity of defects. Therefore, the surface quality inspection process still requires manual inspection of each product off the line. The judgment method based on human experience is difficult to replace with automation, impacting the efficiency and accuracy of the entire production process. Summary of the Invention
[0004] This invention addresses the problems of existing methods for automatically judging the surface quality of cold-rolled strip steel based on defect information from surface quality inspection systems and the process concept of manual steel judgment. These problems include the large variety and quantity of surface defects in cold-rolled strip steel, inaccurate sorting and grading of various defects under basic rules, multiple dimensions and irregular formats of raw defect data, lack of uniformity in the dimensions of each data sample, and the difficulty in quantifying the sorting and grading of defects into specific grading rules, as defect sorting and grading is a multivariate coupled classification problem.
[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0006] On one hand, this invention provides a strip steel sorting and grading method based on gray-level co-occurrence matrix and decision tree. This method is implemented by electronic equipment and includes:
[0007] S1. Obtain image data and text data of the surface of the cold-rolled strip steel to be graded.
[0008] S2. Input the image data and text data into the constructed surface quality sorting and grading model of cold-rolled strip steel.
[0009] S3. Based on the image data, text data, and the surface quality sorting grading model of cold-rolled strip steel, obtain the surface quality sorting grading results of cold-rolled strip steel.
[0010] Optionally, the process of constructing the surface quality sorting grading model for cold-rolled strip steel in S2 includes:
[0011] S21. Obtain the dataset; wherein the dataset includes defect image information of the surface of cold-rolled strip steel, defect text information of the surface of cold-rolled strip steel, and defect quality sorting level of the surface of cold-rolled strip steel.
[0012] S22. Based on the dataset and the gray-level co-occurrence matrix algorithm, calculate the feature values of the defective image.
[0013] S23. Based on the eigenvalues and the defect text information of the cold-rolled strip surface, establish the surface quality feature vector of the cold-rolled strip.
[0014] S24. Based on the surface quality feature vector of cold-rolled strip steel and the dataset, establish a decision rule model based on the decision tree algorithm.
[0015] S25. Based on the classification function of the judgment rule model, construct a grading model for the surface quality sorting degree of cold-rolled strip steel.
[0016] Optionally, the defect text information of the cold-rolled strip surface in S21 includes:
[0017] The relative coordinates, defect area, defect length, and defect width of the region of interest on the surface of cold-rolled strip steel.
[0018] Optionally, in step S22, the feature values of the defect image are calculated based on the dataset and the gray-level co-occurrence matrix algorithm, including:
[0019] S221. Obtain the structural parameters of the gray-level co-occurrence matrix determined based on pre-training; wherein, the structural parameters include the generation step size, image gray level, and generation direction.
[0020] S222. Based on the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the dataset to obtain the energy value, entropy value, contrast and correlation of the clustered defects on the surface of cold-rolled strip steel.
[0021] Optionally, in step S23, a surface quality feature vector for cold-rolled strip is established based on the feature values and the textual information about defects on the surface of the cold-rolled strip, including:
[0022] Based on the eigenvalues and the defect text information of the cold-rolled strip surface, the clustered defect features of the cold-rolled strip surface are calculated to obtain the surface quality feature vector of the cold-rolled strip, as shown in the following formula (1):
[0023] (1)
[0024] in, This indicates the total number of clustered defects on a coil of cold-rolled strip steel. Indicates the aspect ratio of the defect. Indicates the area of the defect. Indicates energy value. Represents the entropy value. Indicates contrast. Indicates correlation.
[0025] Optionally, in S24, a decision rule model based on a decision tree algorithm is established based on the surface quality feature vector of cold-rolled strip steel and the dataset, including:
[0026] S241. The grid search method is used to adjust the parameters of the decision tree algorithm, determine the range of parameter values, and establish multiple decision tree models; among them, the parameters include the maximum tree depth and the minimum number of samples required for the branch.
[0027] S242. Calculate the standard Gini coefficient of the features for the training set in the dataset.
[0028] S243. Based on the characteristic standard Gini coefficient, calculate the Gini coefficient for each surface quality feature vector of cold-rolled strip steel to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision rule model based on the decision tree algorithm under different parameters.
[0029] S244. The decision tree model under different parameters is processed by the pre-pruning method to obtain the decision rule model based on the decision tree algorithm.
[0030] Optionally, in S242, the standard Gini coefficient of the features is calculated for the training set in the dataset, as shown in equation (2) below:
[0031] (2)
[0032] in, This represents the probability that two randomly selected samples from the dataset belong to different classes. Indicates the number of categories. Representing categories The probability of occurrence.
[0033] Alternatively, the Gini coefficient in S243 is shown in equation (3) below:
[0034] (3)
[0035] in, Indicates in features Lower Gini coefficient, Indicates features, Represents a dataset, , Indicates based on features value The training samples for each feature are divided into two parts. Indicates training samples from features The probability that two randomly selected samples belong to different categories. Indicates training samples from features The probability that two samples are randomly selected from the sample and their categories are different.
[0036] Optionally, in S244, the pre-pruning method is used to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm, including:
[0037] For the test set in the dataset, a confusion matrix of the decision tree model under different parameters is established. By calculating the accuracy of the decision tree model under different parameter combinations, the optimal parameters are selected to obtain the decision rule model based on the decision tree algorithm.
[0038] On the other hand, the present invention provides a strip steel sorting and grading device based on a gray-level co-occurrence matrix and a decision tree. This device is used to implement a strip steel sorting and grading method based on a gray-level co-occurrence matrix and a decision tree. The device includes:
[0039] The acquisition module is used to acquire image data and text data of the surface of the cold-rolled strip steel to be graded.
[0040] The input module is used to input image data and text data into the constructed surface quality sorting and grading model of cold-rolled strip steel.
[0041] The output module is used to obtain the surface quality sorting and grading results of cold-rolled strip steel based on image data, text data, and the surface quality sorting and grading model of cold-rolled strip steel.
[0042] Optionally, the input module is further used for:
[0043] S21. Obtain the dataset; wherein the dataset includes defect image information of the surface of cold-rolled strip steel, defect text information of the surface of cold-rolled strip steel, and defect quality sorting level of the surface of cold-rolled strip steel.
[0044] S22. Based on the dataset and the gray-level co-occurrence matrix algorithm, calculate the feature values of the defective image.
[0045] S23. Based on the eigenvalues and the defect text information of the cold-rolled strip surface, establish the surface quality feature vector of the cold-rolled strip.
[0046] S24. Based on the surface quality feature vector of cold-rolled strip steel and the dataset, establish a decision rule model based on the decision tree algorithm.
[0047] S25. Based on the classification function of the judgment rule model, construct a grading model for the surface quality sorting degree of cold-rolled strip steel.
[0048] Optionally, the defect text information of the cold-rolled strip surface includes:
[0049] The relative coordinates, defect area, defect length, and defect width of the region of interest on the surface of cold-rolled strip steel.
[0050] Optionally, the input module is further used for:
[0051] S221. Obtain the structural parameters of the gray-level co-occurrence matrix determined based on pre-training; wherein, the structural parameters include the generation step size, image gray level, and generation direction.
[0052] S222. Based on the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the dataset to obtain the energy value, entropy value, contrast and correlation of the clustered defects on the surface of cold-rolled strip steel.
[0053] Optionally, the input module is further used for:
[0054] Based on the eigenvalues and the defect text information of the cold-rolled strip surface, the clustered defect features of the cold-rolled strip surface are calculated to obtain the surface quality feature vector of the cold-rolled strip, as shown in the following formula (1):
[0055] (1)
[0056] in, This indicates the total number of clustered defects on a coil of cold-rolled strip steel. Indicates the aspect ratio of the defect. Indicates the area of the defect. Indicates energy value. Represents the entropy value. Indicates contrast. Indicates correlation.
[0057] Optionally, the input module is further used for:
[0058] S241. The grid search method is used to adjust the parameters of the decision tree algorithm, determine the range of parameter values, and establish multiple decision tree models; among them, the parameters include the maximum tree depth and the minimum number of samples required for the branch.
[0059] S242. Calculate the standard Gini coefficient of the features for the training set in the dataset.
[0060] S243. Based on the characteristic standard Gini coefficient, calculate the Gini coefficient for each surface quality feature vector of cold-rolled strip steel to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision rule model based on the decision tree algorithm under different parameters.
[0061] S244. The decision tree model under different parameters is processed by the pre-pruning method to obtain the decision rule model based on the decision tree algorithm.
[0062] Optionally, for the training set in the dataset, the standard Gini coefficient of the features is calculated as shown in equation (2) below:
[0063] (2)
[0064] in, This represents the probability that two randomly selected samples from the dataset belong to different classes. Indicates the number of categories. Representing categories The probability of occurrence.
[0065] Alternatively, the Gini coefficient is shown in equation (3) below:
[0066] (3)
[0067] in, Indicates in features Lower Gini coefficient, Indicates features, Represents a dataset, , Indicates based on features value The training samples for each feature are divided into two parts. Indicates training samples from features The probability that two randomly selected samples belong to different categories. Indicates training samples from features The probability that two samples are randomly selected from the sample and their categories are different.
[0068] Optionally, a pre-pruning method is used to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm, including:
[0069] For the test set in the dataset, a confusion matrix of the decision tree model under different parameters is established. By calculating the accuracy of the decision tree model under different parameter combinations, the optimal parameters are selected to obtain the decision rule model based on the decision tree algorithm.
[0070] On the one hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, which is loaded and executed by the processor to implement the above-mentioned strip steel sorting and grading method based on gray-level co-occurrence matrix and decision tree.
[0071] On the one hand, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the above-mentioned strip steel sorting and grading method based on gray-level co-occurrence matrix and decision tree.
[0072] The above technical solution has at least the following advantages compared with the existing technology:
[0073] The above solution provides a method for classifying the surface quality of cold-rolled strip steel based on gray-level co-occurrence matrix and decision tree rules. This method can automatically classify the surface quality of cold-rolled strip steel, thereby reducing the rate of missed inspections of strip steel surface quality and reducing quality disputes in downstream processes. Attached Figure Description
[0074] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0075] Figure 1 This is a schematic diagram of the strip steel sorting and grading method based on gray-level co-occurrence matrix and decision tree provided in an embodiment of the present invention;
[0076] Figure 2 This is a flowchart illustrating the method for determining the sorting degree of surface quality of cold-rolled strip steel based on grayscale value statistics and decision tree rules, as provided in an embodiment of the present invention.
[0077] Figure 3 This is the decision tree structure provided in the embodiments of the present invention;
[0078] Figure 4 This is a schematic diagram of an S1-level defect image provided in an embodiment of the present invention;
[0079] Figure 5 This is a schematic diagram of an S2-level defect image provided in an embodiment of the present invention;
[0080] Figure 6 This is a schematic diagram of an S4 level defect image provided in an embodiment of the present invention;
[0081] Figure 7 This is a block diagram of a strip steel sorting and grading device based on gray-level co-occurrence matrix and decision tree provided in an embodiment of the present invention;
[0082] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0083] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0084] like Figure 1 As shown, this embodiment of the invention provides a method for classifying and grading strip steel based on a gray-level co-occurrence matrix and a decision tree. This method can be implemented by electronic equipment. Figure 1 The flowchart shown is for a strip steel sorting and grading method based on gray-level co-occurrence matrix and decision tree. The processing flow of this method may include the following steps:
[0085] S1. Obtain image data and text data of the surface of the cold-rolled strip steel to be graded.
[0086] In one feasible implementation, data can be acquired using a surface inspection system.
[0087] S2. Input the image data and text data into the constructed surface quality sorting and grading model of cold-rolled strip steel.
[0088] The sorting process involves selecting materials that can be downgraded from a batch of qualified and unqualified materials.
[0089] Optionally, such as Figure 2 As shown, the construction process of the surface quality sorting and grading model for cold-rolled strip steel in S2 can include the following steps S21-S25:
[0090] S21. Obtain the dataset.
[0091] In one feasible implementation, image and text information of clustered defects on the surface of cold-rolled strip steel are collected. The text information may include: relative coordinates of the region of interest of the defect, defect area, defect length, defect width, etc., and the surface quality sorting grade of each coil of strip steel is obtained. A dataset is created based on the above three-in-one data.
[0092] S22. Based on the dataset and the gray-level co-occurrence matrix algorithm, the feature values of the defect image are calculated, which may include the following steps S221-S222:
[0093] S221. Obtain the structural parameters of the gray-level co-occurrence matrix determined based on pre-training; wherein, the structural parameters include the generation step size d, the image gray level G, and the generation direction θ.
[0094] S222. Based on the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the dataset to obtain the energy value, entropy value, contrast and correlation of the clustered defects on the surface of cold-rolled strip steel.
[0095] In one feasible implementation, each obtained defect image is converted to grayscale, and based on the grayscale values... The original image point to the original image gray level is The probability of a point, yes , The correspondence between two points determines the positional relationship between two pixels in an image. , =0,1,2,... -1, If we represent the gray level of a pixel, then the gray-level co-occurrence matrix can be represented as: .
[0096] Furthermore, suppose there is a point in the defect image If it can be moved, then different results will be obtained. ,but The combinations are We count the number of occurrences of each case and arrange them into a matrix. In this embodiment, the total number of occurrences Z for all cases is:
[0097] (1)
[0098] Furthermore, the grayscale matrix for:
[0099] (2)
[0100] (3)
[0101] in, express Each element in; This represents the grayscale level of a pixel.
[0102] energy:
[0103] (4)
[0104] Entropy value:
[0105] (5)
[0106] Contrast:
[0107] (6)
[0108] Correlation:
[0109] (7)
[0110] in, grayscale The original image point to the original image gray level is The probability of a point, where G is the gray level.
[0111] S23. Based on the eigenvalues and the defect text information of the surface of cold-rolled strip steel, a feature vector is constructed by calculating all the clustered defect features on the surface of a coil of strip steel, as shown in the following formula (8):
[0112] (8)
[0113] in, This indicates the total number of clustered defects on a coil of cold-rolled strip steel. Indicates the aspect ratio of the defect. Indicates the area of the defect. Indicates energy value. Represents the entropy value. Indicates contrast. Indicates correlation.
[0114] S24. Based on the surface quality feature vector of cold-rolled strip steel and the dataset, establish a decision rule model based on the decision tree algorithm.
[0115] In one feasible implementation, the obtained feature vectors are used as leaf nodes to build the decision tree. To ensure the accuracy of the decision tree model and avoid overfitting, a pre-pruning method is used, which prunes the tree by stopping its construction early. The CART decision tree algorithm is used, and the selected feature criterion is the Gini coefficient. The model construction may include the following steps S241-S244:
[0116] S241. The grid search method is used to adjust the parameters of the decision tree algorithm, determine the range of parameter values, and establish multiple decision tree models; among them, the parameters include the maximum tree depth and the minimum number of samples required for the branch.
[0117] S242. For the training set in the dataset, calculate the standard Gini coefficient of the features, as shown in the following formula (9):
[0118] (9)
[0119] in, This represents the probability that two randomly selected samples from the dataset belong to different classes. Indicates the number of categories. Representing categories The probability of occurrence.
[0120] S243. Based on the standard Gini coefficient of the features, calculate the Gini coefficient under each feature to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision rule model based on the decision tree algorithm under different parameters.
[0121] For each feature For each of its possible values According to the value Divide each feature training sample into and Two parts, obtained from the Gini coefficient formula, in the characteristic The lower Gini coefficient is shown in equation (10) below:
[0122] (10)
[0123] in, Indicates in features Lower Gini coefficient, Indicates features, Represents a dataset, , Indicates based on features value The training samples for each feature are divided into two parts. Indicates training samples from features The probability that two randomly selected samples belong to different categories. Indicates training samples from features The probability that two samples are randomly selected from the sample and their categories are different.
[0124] Furthermore, regarding the dataset Calculate the Gini coefficient for each feature to obtain the decision tree model with the current maximum tree depth and the minimum number of samples required for each branch.
[0125] S244. For the test set in the dataset, establish the confusion matrix of the decision tree model under different parameters. By calculating the accuracy of the decision tree model under different parameter combinations, select the optimal parameters, implement decision tree pre-pruning, and obtain the decision rule model based on the decision tree algorithm.
[0126] S25. Based on the classification function of the judgment rule model, construct a grading model for the surface quality sorting degree of cold-rolled strip steel.
[0127] S3. Based on the image data, text data, and the surface quality sorting grading model of cold-rolled strip steel, obtain the surface quality sorting grading results of cold-rolled strip steel.
[0128] In one feasible implementation, surface quality feature vectors are obtained by using surface inspection instrument data as input and the above steps are followed. Then, the surface quality sorting and grading of cold-rolled strip steel is achieved through a decision tree model classification function.
[0129] Specifically, taking the defects detected by the surface inspection system of a cold-rolled continuous annealing production line of a steel company as an example, the specific implementation method of this patent will be described below in conjunction with the content of this invention, specifically including the following steps:
[0130] Step 1: Images of strip steel with clustered defects and their defect area geometry were obtained through the existing surface inspection system. Based on human experience, each surface defect sample was marked into three levels according to the severity of the defect. A total of 50 rolls of strip steel data of level S1, 50 rolls of strip steel data of level S2, and 50 rolls of strip steel data of level S4 were collected. The number of samples of each level was relatively even.
[0131] Step 2: Calculate the energy value, entropy value, correlation, and contrast of each clustered defect using the gray-level co-occurrence matrix. Then, calculate the energy value, entropy value, correlation, and contrast of each strip surface. The strip surface characteristic values are shown in Table 1.
[0132] Table 1
[0133]
[0134] Step 3: After obtaining the geometric information of surface defects and the statistical information of gray-level co-occurrence matrix for each coil of strip steel, calculate the surface feature vector for each coil of strip steel. The feature vectors of 150 coils of strip steel are shown in Table 2 below:
[0135] Table 2
[0136]
[0137] Step 4: Use the obtained feature vectors as leaf nodes to build the decision tree. To ensure the accuracy of the decision tree model and avoid overfitting, a pre-pruning method is used, which prunes the tree by stopping its construction early. The CART decision tree algorithm is used, and the Gini coefficient is selected as the feature criterion. The decision tree structure is as follows: Figure 3 As shown in Table 3, the model accuracy under different parameter combinations is as follows:
[0138] Table 3
[0139]
[0140] Among them, the model accuracy is highest when the maximum tree depth is 5 and the minimum number of samples required for the branch is 1. Therefore, it is selected as the pre-pruning structure parameter of the decision tree.
[0141] Step 5: Using the surface inspection instrument data as input, obtain the surface quality feature vector through steps 2 and 3, and realize the sorting degree classification of cold-rolled strip surface quality through the decision tree model classification function.
[0142] The decision tree classification function is as follows:
[0143] (11)
[0144] Furthermore, using 45 coils of strip steel data as input, its feature vector is extracted, and the final output of the classification system is the surface quality sorting grade of the cold-rolled strip steel, namely, grade S1 (e.g., ...). Figure 4 As shown), S2 level (such as Figure 5 (as shown) or S4 level (such as) Figure 6 As shown in the figure), the prediction results are shown in Table 4:
[0145] Table 4
[0146]
[0147] The prediction results were statistically graded. The samples whose prediction results matched the sample labels at each grade were 16 volumes at grade S1, 9 volumes at grade S2, and 17 volumes at grade S4. The prediction accuracy was 100% for grade S1, 90% for grade S2, and 89.47% for grade S4. There were no serious misjudgments, i.e., grade S4 defects were misjudged as grade S1 defects. This data is lower than the misjudgment rate of manual classification of defect images (3%).
[0148] In this embodiment, to further understand the surface quality sorting and grading method for cold-rolled strip steel based on gray-level co-occurrence matrix and decision tree described in this invention, the invention is applied to a cold-rolled continuous annealing production line of a steel company. Starting with the day shift production on the first Monday of each month, 1000 coils of strip steel that are automatically judged are continuously selected, and their judgment results are used as samples for error evaluation. The actual application effect analysis results are shown in Table 5 below:
[0149] Table 5
[0150]
[0151] In this embodiment of the invention, a method for sorting and classifying the surface quality of cold-rolled strip steel based on gray-level co-occurrence matrix and decision tree rules is provided. This method can automatically sort and classify the surface quality of cold-rolled strip steel, thereby reducing the rate of missed inspections of strip steel surface quality and reducing quality disputes in downstream processes.
[0152] like Figure 7 As shown, this embodiment of the invention provides a strip steel sorting and grading device 700 based on a gray-level co-occurrence matrix and a decision tree. This device 700 is used to implement a strip steel sorting and grading method based on a gray-level co-occurrence matrix and a decision tree. The device 700 includes:
[0153] The acquisition module 710 is used to acquire image data and text data of the surface of the cold-rolled strip steel to be graded.
[0154] Input module 720 is used to input image data and text data into the constructed surface quality sorting and grading model of cold-rolled strip steel.
[0155] The output module 730 is used to obtain the surface quality sorting and grading results of cold-rolled strip steel based on image data, text data, and the surface quality sorting and grading model of cold-rolled strip steel.
[0156] Optionally, the input module 720 is further used for:
[0157] S21. Obtain the dataset; wherein the dataset includes defect image information of the surface of cold-rolled strip steel, defect text information of the surface of cold-rolled strip steel, and defect quality sorting level of the surface of cold-rolled strip steel.
[0158] S22. Based on the dataset and the gray-level co-occurrence matrix algorithm, calculate the feature values of the defective image.
[0159] S23. Based on the eigenvalues and the defect text information of the cold-rolled strip surface, establish the surface quality feature vector of the cold-rolled strip.
[0160] S24. Based on the surface quality feature vector of cold-rolled strip steel and the dataset, establish a decision rule model based on the decision tree algorithm.
[0161] S25. Based on the classification function of the judgment rule model, construct a grading model for the surface quality sorting degree of cold-rolled strip steel.
[0162] Optionally, the defect text information of the cold-rolled strip surface includes:
[0163] The relative coordinates, defect area, defect length, and defect width of the region of interest on the surface of cold-rolled strip steel.
[0164] Optionally, the input module 720 is further used for:
[0165] S221. Obtain the structural parameters of the gray-level co-occurrence matrix determined based on pre-training; wherein, the structural parameters include the generation step size, image gray level, and generation direction.
[0166] S222. Based on the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the dataset to obtain the energy value, entropy value, contrast and correlation of the clustered defects on the surface of cold-rolled strip steel.
[0167] Optionally, the input module 720 is further used for:
[0168] Based on the eigenvalues and the defect text information of the cold-rolled strip surface, the clustered defect features of the cold-rolled strip surface are calculated to obtain the surface quality feature vector of the cold-rolled strip, as shown in the following formula (1):
[0169] (1)
[0170] in, This indicates the total number of clustered defects on a coil of cold-rolled strip steel. Indicates the aspect ratio of the defect. Indicates the area of the defect. Indicates energy value. Represents the entropy value. Indicates contrast. Indicates correlation.
[0171] Optionally, the input module 720 is further used for:
[0172] S241. The grid search method is used to adjust the parameters of the decision tree algorithm, determine the range of parameter values, and establish multiple decision tree models; among them, the parameters include the maximum tree depth and the minimum number of samples required for the branch.
[0173] S242. Calculate the standard Gini coefficient of the features for the training set in the dataset.
[0174] S243. Based on the characteristic standard Gini coefficient, calculate the Gini coefficient for each surface quality feature vector of cold-rolled strip steel to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision rule model based on the decision tree algorithm under different parameters.
[0175] S244. The decision tree model under different parameters is processed by the pre-pruning method to obtain the decision rule model based on the decision tree algorithm.
[0176] Optionally, for the training set in the dataset, the standard Gini coefficient of the features is calculated as shown in equation (2) below:
[0177] (2)
[0178] in, This represents the probability that two randomly selected samples from the dataset belong to different classes. Indicates the number of categories. Representing categories The probability of occurrence.
[0179] Alternatively, the Gini coefficient under the characteristic is shown in equation (3) below:
[0180] (3)
[0181] in, Indicates in features Lower Gini coefficient, Indicates features, Represents a dataset, , Indicates based on features value The training samples for each feature are divided into two parts. Indicates training samples from features The probability that two randomly selected samples belong to different categories. Indicates training samples from features The probability that two samples are randomly selected from the sample and their categories are different.
[0182] Optionally, a pre-pruning method is used to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm, including:
[0183] For the test set in the dataset, a confusion matrix of the decision tree model under different parameters is established. By calculating the accuracy of the decision tree model under different parameter combinations, the optimal parameters are selected to obtain the decision rule model based on the decision tree algorithm.
[0184] In this embodiment of the invention, a method for sorting and classifying the surface quality of cold-rolled strip steel based on gray-level co-occurrence matrix and decision tree rules is provided. This method can automatically sort and classify the surface quality of cold-rolled strip steel, thereby reducing the rate of missed inspections of strip steel surface quality and reducing quality disputes in downstream processes.
[0185] Figure 8 This is a schematic diagram of the structure of an electronic device 800 provided in an embodiment of the present invention. The electronic device 800 can vary considerably due to differences in configuration or performance. It may include one or more central processing units (CPUs) 801 and one or more memories 802. The memory 802 stores at least one instruction, which is loaded and executed by the processor 801 to implement the following strip steel sorting and grading method based on gray-level co-occurrence matrix and decision tree:
[0186] S1. Obtain image data and text data of the surface of the cold-rolled strip steel to be graded.
[0187] S2. Input the image data and text data into the constructed surface quality sorting and grading model of cold-rolled strip steel.
[0188] S3. Based on the image data, text data, and the surface quality sorting grading model of cold-rolled strip steel, obtain the surface quality sorting grading results of cold-rolled strip steel.
[0189] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions that can be executed by a processor in a terminal to complete the strip sorting and grading method based on gray-level co-occurrence matrix and decision tree. For example, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0190] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0191] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for classifying and grading strip steel based on gray-level co-occurrence matrix and decision tree, characterized in that, The method includes: S1. Obtain image data and text data of the surface of the cold-rolled strip steel to be graded; S2. Input the image data and text data into the constructed cold-rolled strip surface quality sorting and grading model. S3. Based on the image data, text data, and the surface quality sorting grading model of cold-rolled strip steel, obtain the surface quality sorting grading result of cold-rolled strip steel. The construction process of the surface quality sorting and grading model for cold-rolled strip steel in S2 includes: S21. Obtain the dataset; wherein the dataset includes defect image information of the surface of cold-rolled strip steel, defect text information of the surface of cold-rolled strip steel, and defect quality sorting level of the surface of cold-rolled strip steel. S22. Based on the dataset and the gray-level co-occurrence matrix algorithm, the feature values of the defective image are calculated; S23. Based on the feature values and the defect text information of the cold-rolled strip surface, establish a surface quality feature vector of the cold-rolled strip. S24. Based on the surface quality feature vector of the cold-rolled strip steel and the dataset, establish a decision rule model based on the decision tree algorithm; S25. Based on the classification function of the judgment rule model, construct a grading model for the surface quality sorting degree of cold-rolled strip steel; The defect text information on the surface of the cold-rolled strip in S21 includes: The relative coordinates, defect area, defect length, and defect width of the region of interest on the surface of cold-rolled strip steel; The step S24, which establishes a decision rule model based on a decision tree algorithm according to the surface quality feature vector of the cold-rolled strip and the dataset, includes: S241. The grid search method is used to adjust the parameters of the decision tree algorithm, determine the range of parameter values, and establish multiple decision tree models; wherein, the parameters include the maximum tree depth and the minimum number of samples required for a branch; S242. For the training set in the dataset, calculate the standard Gini coefficient of the features; S243. Based on the Gini coefficient of the characteristic standard, calculate the Gini coefficient for each surface quality feature vector of cold-rolled strip steel to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision rule model based on the decision tree algorithm under different parameters. S244. The decision tree model under different parameters is processed by the pre-pruning method to obtain the decision rule model based on the decision tree algorithm.
2. The method according to claim 1, characterized in that, The step S22, which calculates the feature values of the defect image based on the dataset and the gray-level co-occurrence matrix algorithm, includes: S221. Obtain the structural parameters of the gray-level co-occurrence matrix determined based on pre-training; wherein, the structural parameters include the generation step size, image gray level, and generation direction; S222. Based on the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the dataset to obtain the energy value, entropy value, contrast and correlation of the clustered defects on the surface of cold-rolled strip steel.
3. The method according to claim 1, characterized in that, The step S23, which establishes a surface quality feature vector for cold-rolled strip steel based on the feature values and the defect text information of the cold-rolled strip steel surface, includes: Based on the eigenvalues and the defect text information of the cold-rolled strip surface, the clustered defect features of the cold-rolled strip surface are calculated to obtain the surface quality feature vector of the cold-rolled strip, as shown in the following formula (1): (1) in, This indicates the total number of clustered defects on a coil of cold-rolled strip steel. Indicates the aspect ratio of the defect. Indicates the area of the defect. Indicates energy value. Represents the entropy value. Indicates contrast. Indicates correlation.
4. The method according to claim 1, characterized in that, In step S242, the standard Gini coefficient of the features is calculated for the training set in the dataset, as shown in equation (2) below: (2) in, This represents the probability that two randomly selected samples from the dataset belong to different classes. Indicates the number of categories. Representing categories The probability of occurrence.
5. The method according to claim 1, characterized in that, The Gini coefficient in S243 is shown in equation (3) below: (3) in, Indicates in features Lower Gini coefficient, Indicates features, Represents a dataset, , Indicates based on features value The training samples for each feature are divided into two parts. Indicates training samples from features The probability that two randomly selected samples belong to different categories. Indicates training samples from features The probability that two samples are randomly selected from the sample and their categories are different.
6. The method according to claim 1, characterized in that, In step S244, a pre-pruning method is used to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm, including: For the test set in the dataset, a confusion matrix of the decision tree model under different parameters is established. By calculating the accuracy of the decision tree model under different parameter combinations, the optimal parameters are selected to obtain the decision rule model based on the decision tree algorithm.
7. A strip steel sorting and grading device based on gray-level co-occurrence matrix and decision tree, characterized in that, The device includes: The acquisition module is used to acquire image data and text data of the surface of the cold-rolled strip steel to be graded; The input module is used to input the image data and text data into the constructed cold-rolled strip surface quality sorting and grading model; The output module is used to obtain the surface quality sorting and grading results of cold-rolled strip steel based on the image data, text data, and the surface quality sorting and grading model of cold-rolled strip steel. The construction process of the surface quality sorting and grading model for cold-rolled strip steel includes: S21. Obtain the dataset; wherein the dataset includes defect image information of the surface of cold-rolled strip steel, defect text information of the surface of cold-rolled strip steel, and defect quality sorting level of the surface of cold-rolled strip steel. S22. Based on the dataset and the gray-level co-occurrence matrix algorithm, the feature values of the defective image are calculated; S23. Based on the feature values and the defect text information of the cold-rolled strip surface, establish a surface quality feature vector of the cold-rolled strip. S24. Based on the surface quality feature vector of the cold-rolled strip steel and the dataset, establish a decision rule model based on the decision tree algorithm; S25. Based on the classification function of the judgment rule model, construct a grading model for the surface quality sorting degree of cold-rolled strip steel; The defect text information on the surface of the cold-rolled strip in S21 includes: The relative coordinates, defect area, defect length, and defect width of the region of interest on the surface of cold-rolled strip steel; The step S24, which establishes a decision rule model based on a decision tree algorithm according to the surface quality feature vector of the cold-rolled strip and the dataset, includes: S241. The grid search method is used to adjust the parameters of the decision tree algorithm, determine the range of parameter values, and establish multiple decision tree models; wherein, the parameters include the maximum tree depth and the minimum number of samples required for a branch; S242. For the training set in the dataset, calculate the standard Gini coefficient of the features; S243. Based on the Gini coefficient of the characteristic standard, calculate the Gini coefficient for each surface quality feature vector of cold-rolled strip steel to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision rule model based on the decision tree algorithm under different parameters. S244. The decision tree model under different parameters is processed by the pre-pruning method to obtain the decision rule model based on the decision tree algorithm.