CN117314871A - Band steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree - Google Patents
Band steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree Download PDFInfo
- Publication number
- CN117314871A CN117314871A CN202311310069.XA CN202311310069A CN117314871A CN 117314871 A CN117314871 A CN 117314871A CN 202311310069 A CN202311310069 A CN 202311310069A CN 117314871 A CN117314871 A CN 117314871A
- Authority
- CN
- China
- Prior art keywords
- cold
- rolled strip
- decision tree
- surface quality
- defect
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003066 decision tree Methods 0.000 title claims abstract description 98
- 238000000034 method Methods 0.000 title claims abstract description 67
- 239000011159 matrix material Substances 0.000 title claims abstract description 54
- 229910000831 Steel Inorganic materials 0.000 title claims abstract description 48
- 239000010959 steel Substances 0.000 title claims abstract description 48
- 238000013145 classification model Methods 0.000 claims abstract description 10
- 230000007547 defect Effects 0.000 claims description 108
- 238000012549 training Methods 0.000 claims description 30
- 239000013598 vector Substances 0.000 claims description 28
- 230000008569 process Effects 0.000 claims description 15
- 238000013138 pruning Methods 0.000 claims description 13
- 238000010276 construction Methods 0.000 claims description 6
- 238000012360 testing method Methods 0.000 claims description 5
- 238000007689 inspection Methods 0.000 abstract description 7
- 230000006870 function Effects 0.000 description 8
- 238000001514 detection method Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 6
- 230000015654 memory Effects 0.000 description 6
- 238000003860 storage Methods 0.000 description 6
- 238000011143 downstream manufacturing Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 3
- 238000005097 cold rolling Methods 0.000 description 2
- 238000010924 continuous production Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000009918 complex formation Effects 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000001788 irregular Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000031068 symbiosis, encompassing mutualism through parasitism Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0004—Industrial image inspection
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/213—Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/01—Dynamic search techniques; Heuristics; Dynamic trees; Branch-and-bound
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/764—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
- G06V10/765—Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects using rules for classification or partitioning the feature space
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30108—Industrial image inspection
- G06T2207/30136—Metal
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/30—Subject of image; Context of image processing
- G06T2207/30168—Image quality inspection
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Medical Informatics (AREA)
- Mathematical Physics (AREA)
- Databases & Information Systems (AREA)
- Multimedia (AREA)
- Computational Linguistics (AREA)
- Health & Medical Sciences (AREA)
- Quality & Reliability (AREA)
- General Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
- Image Analysis (AREA)
Abstract
本发明公开了一种基于灰度共生矩阵与决策树的带钢分选度分级方法及装置,涉及冶金机械及自动化技术领域。包括:获取待分级的冷轧带钢表面的图像数据以及文本数据;将图像数据以及文本数据输入到构建好的冷轧带钢表面质量分选度分级模型;根据图像数据、文本数据以及冷轧带钢表面质量分选度分级模型,得到冷轧带钢表面质量分选度分级结果。通过本发明,可以更好实现冷轧带钢表面质量智能判定,提高表面质量判定准确率,让判定系统结果更贴近质检人员。
The invention discloses a strip steel sorting degree grading method and device based on a grayscale co-occurrence matrix and a decision tree, and relates to the technical fields of metallurgical machinery and automation. Including: obtaining the image data and text data of the cold-rolled strip surface to be graded; inputting the image data and text data into the constructed cold-rolled strip surface quality sorting degree grading model; based on the image data, text data and cold-rolled The surface quality sorting degree classification model of strip steel is used to obtain the surface quality sorting degree classification results of cold-rolled strip steel. Through the present invention, the intelligent determination of surface quality of cold-rolled strip steel can be better realized, the accuracy of surface quality determination can be improved, and the results of the determination system can be closer to the quality inspection personnel.
Description
技术领域Technical field
本发明涉及冶金机械及自动化技术领域,尤其涉及一种基于灰度共生矩阵与决策树的带钢分选度分级方法及装置。The invention relates to the technical fields of metallurgical machinery and automation, and in particular to a strip steel sorting degree grading method and device based on a grayscale co-occurrence matrix and a decision tree.
背景技术Background technique
随着汽车工业、高端家电等行业对钢材产品的质量要求日趋严格,产品的个性化需求也越来越多。在基本质量指标合格的前提下,钢铁企业和下游用户转为开始关注更为细节的表面质量问题,由于涉及流程较长、形成机理复杂、发生频次高,对产品的最终质量影响大,表面质量被认为是最重要、最难控制的质量指标之一。正是由于表面质量的复杂性,各大钢铁企业对冷轧带钢表面质量的管理十分重视,期望以此提高产品品质,实现更大的商业价值。As the automotive industry, high-end home appliances and other industries have increasingly stringent quality requirements for steel products, there are also increasing demands for personalized products. On the premise that the basic quality indicators are qualified, steel companies and downstream users have begun to pay attention to more detailed surface quality issues. Due to the long process involved, complex formation mechanisms, and high frequency of occurrence, it has a great impact on the final quality of the product, and the surface quality It is considered to be one of the most important and difficult to control quality indicators. Due to the complexity of surface quality, major steel companies attach great importance to the management of surface quality of cold-rolled strip steel, hoping to improve product quality and achieve greater commercial value.
冷轧带钢表面质量的判定是目前面临的难题,冷轧带钢生产线安装有表面检测系统(简称:表检系统),但其仅能对缺陷的种类进行辨别,往往不具备对带钢表面质量分选度分级功能。不同于其他性能指标依据参数阈值的自动判定方式,由于表检系统存在工作环境复杂、缺陷检出虚警率过高、无法对缺陷严重级别评估等局限性,表面质量的质检环节仍需要人工对下线产品进行逐个检查,基于人工经验的判定方法难以被自动化方法替代,影响了整个生产流程的效率和准确率。Determining the surface quality of cold-rolled strip steel is currently a difficult problem. The cold-rolled strip steel production line is equipped with a surface inspection system (referred to as: surface inspection system), but it can only identify the types of defects and often does not have the ability to detect the strip surface. Quality sorting grading function. Different from other automatic determination methods of performance indicators based on parameter thresholds, due to the limitations of the surface inspection system such as complex working environment, high false alarm rate of defect detection, and inability to evaluate the severity of defects, the surface quality inspection process still requires manual labor. The off-line products are inspected one by one. The judgment method based on manual experience is difficult to be replaced by automated methods, which affects the efficiency and accuracy of the entire production process.
发明内容Contents of the invention
本发明针对现有基于表面质量检测系统的缺陷信息,结合人工判钢的工艺思想来实现带钢表面质量的自动判定的方法存在的由于冷轧带钢表面缺陷种类多、数量多,各类缺陷在基础规则下的分选度分级不准确问题、缺陷的原始数据维度多、格式不规整,没有统一每一个数据样本的维度问题、由于缺陷的分选度分级是一个多变量耦合的分类问题,难以量化为具体的分级规则问题,提出了本发明。This invention aims at the existing defect information based on the surface quality detection system and combines the process ideas of manual steel judgment to realize the method of automatic judgment of the strip surface quality. Due to the large number and variety of surface defects of cold-rolled strip steel, various types of defects exist. The problem of inaccurate sorting degree grading under basic rules, the original data of defects has many dimensions, irregular format, and the problem of not unifying the dimensions of each data sample, because the sorting degree grading of defects is a multi-variable coupling classification problem. It is difficult to quantify the problem into specific classification rules, so the present invention is proposed.
为解决上述技术问题,本发明提供如下技术方案:In order to solve the above technical problems, the present invention provides the following technical solutions:
一方面,本发明提供了一种基于灰度共生矩阵与决策树的带钢分选度分级方法,该方法由电子设备实现,该方法包括:On the one hand, the present invention provides a strip sorting degree grading method based on a gray level co-occurrence matrix and a decision tree. The method is implemented by electronic equipment. The method includes:
S1、获取待分级的冷轧带钢表面的图像数据以及文本数据。S1. Obtain the image data and text data of the cold-rolled strip surface to be graded.
S2、将图像数据以及文本数据输入到构建好的冷轧带钢表面质量分选度分级模型。S2. Input the image data and text data into the constructed cold-rolled strip surface quality sorting degree model.
S3、根据图像数据、文本数据以及冷轧带钢表面质量分选度分级模型,得到冷轧带钢表面质量分选度分级结果。S3. According to the image data, text data and the cold-rolled strip surface quality sorting degree grading model, obtain the cold-rolled strip surface quality sorting degree grading results.
可选地,S2中的冷轧带钢表面质量分选度分级模型的构建过程,包括:Optionally, the construction process of the cold-rolled strip surface quality sorting model in S2 includes:
S21、获取数据集;其中,数据集包括冷轧带钢表面的缺陷图像信息、冷轧带钢表面的缺陷文本信息以及冷轧带钢表面的缺陷质量分选度等级。S21. Obtain a data set; wherein, the data set includes defect image information on the surface of cold-rolled strip steel, text information on defects on the surface of cold-rolled strip steel, and quality sorting grade of defects on the surface of cold-rolled strip steel.
S22、根据数据集以及灰度共生矩阵算法,计算得到缺陷图像的特征值。S22. According to the data set and the gray level co-occurrence matrix algorithm, calculate the eigenvalues of the defect image.
S23、根据特征值以及冷轧带钢表面的缺陷文本信息,建立冷轧带钢表面质量特征向量。S23. Establish a cold-rolled strip surface quality feature vector based on the characteristic values and the defect text information on the cold-rolled strip surface.
S24、根据冷轧带钢表面质量特征向量以及数据集,建立基于决策树算法的判定规则模型。S24. Based on the cold-rolled strip surface quality feature vector and data set, establish a decision rule model based on the decision tree algorithm.
S25、根据判定规则模型的分类函数,构建冷轧带钢表面质量分选度分级模型。S25. Construct a cold-rolled strip surface quality sorting degree classification model based on the classification function of the decision rule model.
可选地,S21中的冷轧带钢表面的缺陷文本信息,包括:Optionally, the defect text information on the cold-rolled strip surface in S21 includes:
冷轧带钢表面的缺陷感兴趣区域相对坐标、缺陷面积、缺陷长度以及缺陷宽度。The relative coordinates, defect area, defect length and defect width of the defect area of interest on the cold rolled strip surface.
可选地,S22中的根据数据集以及灰度共生矩阵算法,计算得到缺陷图像的特征值,包括:Optionally, in S22, based on the data set and the gray level co-occurrence matrix algorithm, the characteristic values of the defect image are calculated, including:
S221、获取基于预训练确定的灰度共生矩阵的结构参数;其中,结构参数包括生成步长、图片灰度级以及生成方向。S221. Obtain the structural parameters of the gray level co-occurrence matrix determined based on pre-training; where the structural parameters include the generation step size, the image gray level and the generation direction.
S222、根据灰度共生矩阵,计算数据集中每张缺陷图像的灰度共生矩阵,得到冷轧带钢表面的聚集型缺陷的能量值、熵值、对比度以及相关性。S222. According to the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the data set, and obtain the energy value, entropy value, contrast and correlation of the aggregated defects on the surface of the cold-rolled strip steel.
可选地,S23中的根据特征值以及冷轧带钢表面的缺陷文本信息,建立冷轧带钢表面质量特征向量,包括:Optionally, in S23, a cold-rolled strip surface quality feature vector is established based on the characteristic values and the defect text information on the cold-rolled strip surface, including:
根据特征值以及冷轧带钢表面的缺陷文本信息,计算冷轧带钢表面的聚集型缺陷特征,得到冷轧带钢表面质量特征向量,如下式(1)所示:According to the characteristic values and the defect text information on the surface of the cold-rolled strip, the aggregated defect characteristics on the surface of the cold-rolled strip are calculated, and the surface quality feature vector of the cold-rolled strip is obtained, as shown in the following formula (1):
其中,F1表示一卷冷轧带钢上所有聚集性缺陷的个数,F2i表示缺陷长宽比,F3i表示缺陷面积,W1i表示能量值,W2i表示熵值,W3i表示对比度,W4i表示相关性。Among them, F1 represents the number of all aggregated defects on a roll of cold-rolled strip steel, F2 i represents the defect aspect ratio, F3 i represents the defect area, W1 i represents the energy value, W2 i represents the entropy value, and W3 i represents the contrast. W4 i represents correlation.
可选地,S24中的根据冷轧带钢表面质量特征向量以及数据集,建立基于决策树算法的判定规则模型,包括:Optionally, in S24, a decision rule model based on the decision tree algorithm is established based on the cold-rolled strip surface quality feature vector and data set, including:
S241、采用网格搜索法,对决策树算法的参数进行调整,确定参数的取值限定范围,并建立多个决策树模型;其中,参数包括最大树深度和分支所需最少样本数。S241. Use the grid search method to adjust the parameters of the decision tree algorithm, determine the value limit range of the parameters, and establish multiple decision tree models; the parameters include the maximum tree depth and the minimum number of samples required for branches.
S242、对数据集中的训练集,计算特征标准基尼系数。S242. Calculate the feature standard Gini coefficient for the training set in the data set.
S243、根据特征标准基尼系数,对每一个冷轧带钢表面质量特征向量,计算基尼系数,得到当前参数下的基于决策树算法的判定规则模型,进而得到不同参数下的基于决策树算法的判定规则模型。S243. According to the characteristic standard Gini coefficient, calculate the Gini coefficient for each cold-rolled strip surface quality feature vector to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision based on the decision tree algorithm under different parameters. Rule model.
S244、采用预剪枝方法对不同参数下的决策树模型进行处理,得到基于决策树算法的判定规则模型。S244. Use the pre-pruning method to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm.
可选地,S242中的对数据集中的训练集,计算特征标准基尼系数,如下式(2)所示:Optionally, in S242, calculate the feature standard Gini coefficient for the training set in the data set, as shown in the following equation (2):
其中,Gini(D)表示从数据集中随机抽取两个样本,其类别不一致的概率,k表示分类的数目,p(xi)表示分类xi出现的概率。Among them, Gini(D) represents the probability that two samples are randomly selected from the data set and their categories are inconsistent, k represents the number of categories, and p( xi ) represents the probability that category xi appears.
可选地,S243中的基尼系数,如下式(3)所示:Optionally, the Gini coefficient in S243 is as shown in the following equation (3):
其中,Gini(D,A)表示在特征A下基尼系数,A表示特征,D表示数据集,D1、D2表示根据特征A的值ai将每一个特征训练样本分成的两部分,Gini(D1)表示从特征训练样本D1中随机抽取两个样本,其类别不一致的概率,Gini(D2)表示从特征训练样本D2中随机抽取两个样本。Among them, Gini(D,A) represents the Gini coefficient under feature A, A represents the feature, D represents the data set, D1 and D2 represent the two parts that divide each feature training sample according to the value a i of feature A, Gini(D1 ) represents the probability that two samples randomly selected from feature training sample D1 have inconsistent categories, and Gini(D2) represents two samples randomly selected from feature training sample D2.
可选地,S244中的采用预剪枝方法对不同参数下的决策树模型进行处理,得到基于决策树算法的判定规则模型,包括:Optionally, the pre-pruning method in S244 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 data set, 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 a decision rule model based on the decision tree algorithm.
另一方面,本发明提供了一种基于灰度共生矩阵与决策树的带钢分选度分级装置,该装置应用于实现基于灰度共生矩阵与决策树的带钢分选度分级方法,该装置包括:On the other hand, the present invention provides a strip sorting degree grading device based on a gray level co-occurrence matrix and a decision tree, which device is used to implement a strip steel sorting degree grading method based on a gray level co-occurrence matrix and a decision tree. Devices include:
获取模块,用于获取待分级的冷轧带钢表面的图像数据以及文本数据。The acquisition module is used to acquire the image data and text data of the cold-rolled strip surface to be graded.
输入模块,用于将图像数据以及文本数据输入到构建好的冷轧带钢表面质量分选度分级模型。The input module is used to input image data and text data into the constructed cold-rolled strip surface quality sorting degree model.
输出模块,用于根据图像数据、文本数据以及冷轧带钢表面质量分选度分级模型,得到冷轧带钢表面质量分选度分级结果。The output module is used to obtain the cold-rolled strip surface quality sorting degree grading results based on the image data, text data and the cold-rolled strip surface quality sorting degree grading model.
可选地,输入模块,进一步用于:Optionally, input modules are further used to:
S21、获取数据集;其中,数据集包括冷轧带钢表面的缺陷图像信息、冷轧带钢表面的缺陷文本信息以及冷轧带钢表面的缺陷质量分选度等级。S21. Obtain a data set; wherein, the data set includes defect image information on the surface of cold-rolled strip steel, text information on defects on the surface of cold-rolled strip steel, and quality sorting grade of defects on the surface of cold-rolled strip steel.
S22、根据数据集以及灰度共生矩阵算法,计算得到缺陷图像的特征值。S22. According to the data set and the gray level co-occurrence matrix algorithm, calculate the eigenvalues of the defect image.
S23、根据特征值以及冷轧带钢表面的缺陷文本信息,建立冷轧带钢表面质量特征向量。S23. Establish a cold-rolled strip surface quality feature vector based on the characteristic values and the defect text information on the cold-rolled strip surface.
S24、根据冷轧带钢表面质量特征向量以及数据集,建立基于决策树算法的判定规则模型。S24. Based on the cold-rolled strip surface quality feature vector and data set, establish a decision rule model based on the decision tree algorithm.
S25、根据判定规则模型的分类函数,构建冷轧带钢表面质量分选度分级模型。S25. Construct a cold-rolled strip surface quality sorting degree classification model based on the classification function of the decision rule model.
可选地,冷轧带钢表面的缺陷文本信息,包括:Optionally, the defect text information on the cold-rolled strip surface includes:
冷轧带钢表面的缺陷感兴趣区域相对坐标、缺陷面积、缺陷长度以及缺陷宽度。The relative coordinates, defect area, defect length and defect width of the defect area of interest on the cold rolled strip surface.
可选地,输入模块,进一步用于:Optionally, input modules are further used to:
S221、获取基于预训练确定的灰度共生矩阵的结构参数;其中,结构参数包括生成步长、图片灰度级以及生成方向。S221. Obtain the structural parameters of the gray level co-occurrence matrix determined based on pre-training; where the structural parameters include the generation step size, the image gray level and the generation direction.
S222、根据灰度共生矩阵,计算数据集中每张缺陷图像的灰度共生矩阵,得到冷轧带钢表面的聚集型缺陷的能量值、熵值、对比度以及相关性。S222. According to the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the data set, and obtain the energy value, entropy value, contrast and correlation of the aggregated defects on the surface of the cold-rolled strip steel.
可选地,输入模块,进一步用于:Optionally, input modules are further used to:
根据特征值以及冷轧带钢表面的缺陷文本信息,计算冷轧带钢表面的聚集型缺陷特征,得到冷轧带钢表面质量特征向量,如下式(1)所示:According to the characteristic values and the defect text information on the surface of the cold-rolled strip, the aggregated defect characteristics on the surface of the cold-rolled strip are calculated, and the surface quality feature vector of the cold-rolled strip is obtained, as shown in the following formula (1):
其中,F1表示一卷冷轧带钢上所有聚集性缺陷的个数,F2i表示缺陷长宽比,F3i表示缺陷面积,W1i表示能量值,W2i表示熵值,W3i表示对比度,W4i表示相关性。Among them, F1 represents the number of all aggregated defects on a roll of cold-rolled strip steel, F2 i represents the defect aspect ratio, F3 i represents the defect area, W1 i represents the energy value, W2 i represents the entropy value, and W3 i represents the contrast. W4 i represents correlation.
可选地,输入模块,进一步用于:Optionally, input modules are further used to:
S241、采用网格搜索法,对决策树算法的参数进行调整,确定参数的取值限定范围,并建立多个决策树模型;其中,参数包括最大树深度和分支所需最少样本数。S241. Use the grid search method to adjust the parameters of the decision tree algorithm, determine the value limit range of the parameters, and establish multiple decision tree models; the parameters include the maximum tree depth and the minimum number of samples required for branches.
S242、对数据集中的训练集,计算特征标准基尼系数。S242. Calculate the feature standard Gini coefficient for the training set in the data set.
S243、根据特征标准基尼系数,对每一个冷轧带钢表面质量特征向量,计算基尼系数,得到当前参数下的基于决策树算法的判定规则模型,进而得到不同参数下的基于决策树算法的判定规则模型。S243. According to the characteristic standard Gini coefficient, calculate the Gini coefficient for each cold-rolled strip surface quality feature vector to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision based on the decision tree algorithm under different parameters. Rule model.
S244、采用预剪枝方法对不同参数下的决策树模型进行处理,得到基于决策树算法的判定规则模型。S244. Use the pre-pruning method to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm.
可选地,对数据集中的训练集,计算特征标准基尼系数,如下式(2)所示:Optionally, for the training set in the data set, calculate the feature standard Gini coefficient, as shown in the following equation (2):
其中,Gini(D)表示从数据集中随机抽取两个样本,其类别不一致的概率,k表示分类的数目,p(xi)表示分类xi出现的概率。Among them, Gini(D) represents the probability that two samples are randomly selected from the data set and their categories are inconsistent, k represents the number of categories, and p( xi ) represents the probability that category xi appears.
可选地,基尼系数,如下式(3)所示:Optionally, the Gini coefficient is as shown in the following equation (3):
其中,Gini(D,A)表示在特征A下基尼系数,A表示特征,D表示数据集,D1、D2表示根据特征A的值ai将每一个特征训练样本分成的两部分,Gini(D1)表示从特征训练样本D1中随机抽取两个样本,其类别不一致的概率,Gini(D2)表示从特征训练样本D2中随机抽取两个样本。Among them, Gini(D,A) represents the Gini coefficient under feature A, A represents the feature, D represents the data set, D1 and D2 represent the two parts that divide each feature training sample according to the value a i of feature A, Gini(D1 ) represents the probability that two samples randomly selected from feature training sample D1 have inconsistent categories, and Gini(D2) represents two samples randomly selected from feature training sample D2.
可选地,采用预剪枝方法对不同参数下的决策树模型进行处理,得到基于决策树算法的判定规则模型,包括:Optionally, use the pre-pruning method 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 data set, 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 a decision rule model based on the decision tree algorithm.
一方面,提供了一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现上述基于灰度共生矩阵与决策树的带钢分选度分级方法。On the one hand, an electronic device is provided. The electronic device includes a processor and a memory. At least one instruction is stored in the memory. The at least one instruction is loaded and executed by the processor to implement the above-mentioned grayscale-based symbiosis. Strip sorting degree classification method using matrix and decision tree.
一方面,提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现上述基于灰度共生矩阵与决策树的带钢分选度分级方法。On the one hand, a computer-readable storage medium is provided. At least one instruction is stored in the storage medium. The at least one instruction is loaded and executed by a processor to implement the above-mentioned strip classification based on gray-scale co-occurrence matrix and decision tree. Selection grading method.
上述技术方案,与现有技术相比至少具有如下有益效果:Compared with the existing technology, the above technical solution has at least the following beneficial effects:
上述方案,提供了一种基于灰度共生矩阵与决策树规则的冷轧带钢表面质量分选度分级方法,能够对冷轧带钢表面质量自动进行分选度分级,从而降低带钢表面质量漏检率,降低了下游工序质量异议。The above scheme provides a sorting and grading method for the surface quality of cold-rolled strip based on gray-scale co-occurrence matrix and decision tree rules, which can automatically classify the surface quality of cold-rolled strip and thereby reduce the surface quality of the strip. The missed detection rate reduces quality objections in downstream processes.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1是本发明实施例提供的基于灰度共生矩阵与决策树的带钢分选度分级方法流程示意图;Figure 1 is a schematic flow chart of the strip sorting degree grading method based on the gray level co-occurrence matrix and decision tree provided by the embodiment of the present invention;
图2是本发明实施例提供的基于灰度值统计与决策树规则的冷轧带钢表面质量分选度分级判定方法的流程示意图;Figure 2 is a schematic flow chart of a cold-rolled strip surface quality sorting degree grading determination method based on gray value statistics and decision tree rules provided by an embodiment of the present invention;
图3是本发明实施例提供的决策树树形;Figure 3 is a decision tree provided by an embodiment of the present invention;
图4是本发明实施例提供的S1级缺陷图像示意图;Figure 4 is a schematic diagram of an S1 level defect image provided by an embodiment of the present invention;
图5是本发明实施例提供的S2级缺陷图像示意图;Figure 5 is a schematic diagram of an S2 level defect image provided by an embodiment of the present invention;
图6是本发明实施例提供的S4级缺陷图像示意图;Figure 6 is a schematic diagram of an S4 level defect image provided by an embodiment of the present invention;
图7是本发明实施例提供的基于灰度共生矩阵与决策树的带钢分选度分级装置框图;Figure 7 is a block diagram of a strip sorting degree grading device based on a gray level co-occurrence matrix and a decision tree provided by an embodiment of the present invention;
图8是本发明实施例提供的一种电子设备的结构示意图。Figure 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例的附图,对本发明实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本发明的一部分实施例,而不是全部的实施例。基于所描述的本发明的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the described embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
如图1所示,本发明实施例提供了一种基于灰度共生矩阵与决策树的带钢分选度分级方法,该方法可以由电子设备实现。如图1所示的基于灰度共生矩阵与决策树的带钢分选度分级方法流程图,该方法的处理流程可以包括如下的步骤:As shown in Figure 1, an embodiment of the present invention provides a strip sorting degree grading method based on a gray-level co-occurrence matrix and a decision tree. This method can be implemented by electronic equipment. As shown in Figure 1, the flow chart of the strip sorting degree classification method based on gray level co-occurrence matrix and decision tree, the processing flow of this method can include the following steps:
S1、获取待分级的冷轧带钢表面的图像数据以及文本数据。S1. Obtain the image data and text data of the cold-rolled strip surface to be graded.
一种可行的实施方式中,可以通过表面检测系统进行数据的获取。In a feasible implementation, data can be acquired through a surface detection system.
S2、将图像数据以及文本数据输入到构建好的冷轧带钢表面质量分选度分级模型。S2. Input the image data and text data into the constructed cold-rolled strip surface quality sorting degree model.
其中,分选度是从一堆包括合格品和不合格品材料中,挑选出可降级使用的材料的过程。Among them, sorting is the process of selecting materials that can be downgraded from a pile of qualified and unqualified materials.
可选地,如图2所示,S2中的冷轧带钢表面质量分选度分级模型的构建过程,可以包括如下步骤S21-S25:Optionally, as shown in Figure 2, the construction process of the cold-rolled strip surface quality sorting model in S2 may include the following steps S21-S25:
S21、获取数据集。S21. Obtain the data set.
一种可行的实施方式中,收集冷轧带钢表面聚集型缺陷的图像信息与文本信息,文本信息可以包括:缺陷感兴趣区域相对坐标、缺陷面积、缺陷长度、缺陷宽度等,并且获得每卷带钢的表面质量分选度等级。根据上述三合一数据制作数据集。In a feasible implementation, image information and text information of aggregated defects on the surface of cold-rolled strip steel are collected. The text information can include: relative coordinates of the defect area of interest, defect area, defect length, defect width, etc., and obtain each roll Surface quality sorting grade of strip steel. Create a data set based on the above three-in-one data.
S22、根据数据集以及灰度共生矩阵算法,计算得到缺陷图像的特征值,可以包括如下步骤S221-S222:S22. Calculate the characteristic value of the defect image according to the data set and the gray level co-occurrence matrix algorithm, which may include the following steps S221-S222:
S221、获取基于预训练确定的灰度共生矩阵的结构参数;其中,结构参数包括生成步长d、图片灰度级G以及生成方向θ。S221. Obtain the structural parameters of the gray level co-occurrence matrix determined based on pre-training; where the structural parameters include the generation step size d, the image gray level G, and the generation direction θ.
S222、根据灰度共生矩阵,计算数据集中每张缺陷图像的灰度共生矩阵,得到冷轧带钢表面的聚集型缺陷的能量值、熵值、对比度以及相关性。S222. According to the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the data set, and obtain the energy value, entropy value, contrast and correlation of the aggregated defects on the surface of the cold-rolled strip steel.
一种可行的实施方式中,将得到的每一幅缺陷图像进行灰度化,根据从灰度i的原始图像点到原图像灰度为j的点的概率,d=(Dx,Dy)是i,j两个点的对应关系式,决定了图像中两个像素的位置关系,i,j=0,1,2,...L-1,L表示像素的灰度级,则灰度共生矩阵可以表示为P(i,j)。In a feasible implementation, each obtained defect image is grayscaled. According to the probability from the original image point with grayscale i to the point with grayscale j in the original image, d=(Dx,Dy) is The corresponding relationship between the two points i and j determines the positional relationship between the two pixels in the image. i, j=0,1,2,...L-1, L represents the gray level of the pixel, then the gray level The co-occurrence matrix can be expressed as P(i,j).
进一步地,假设缺陷图像的某一点(x,y)可以移动,那么会得到不同的(Ii,Ij),则(Ii,Ij)的组合有L×L个,统计出每一种出现的次数,排列成一个矩阵,本实施例中,所有情况的总次数Z为:Furthermore, assuming that a certain point (x, y) of the defect image can be moved, then different (Ii, Ij) will be obtained. Then there are L×L combinations of (Ii, Ij), and the number of occurrences of each type can be counted. , arranged into a matrix. In this embodiment, the total number Z of all situations is:
进一步地,灰度矩阵PL×L为:Further, the grayscale matrix P L×L is:
其中,C(Ii,Ij)表示PL×L中的每一个元素;L表示像素的灰度级。Among them, C(Ii,Ij) represents each element in P L×L ; L represents the gray level of the pixel.
能量:energy:
熵值:Entropy value:
对比度:Contrast:
相关性:Correlation:
其中,P(i,j,d,θ)为灰度i的原始图像点到原图像灰度为j的点的概率,G为灰度级。Among them, P (i, j, d, θ) is the probability of the original image point with gray level i to the point with gray level j in the original image, and G is the gray level.
S23、根据特征值以及冷轧带钢表面的缺陷文本信息,通过计算一卷带钢表面的所有聚集型缺陷特征,构成特征向量,如下式(8)所示:S23. Based on the eigenvalues and the defect text information on the surface of the cold-rolled strip, calculate all the aggregated defect characteristics on the surface of a roll of strip to form a eigenvector, as shown in the following equation (8):
其中,F1表示一卷冷轧带钢上所有聚集性缺陷的个数,F2i表示缺陷长宽比,F3i表示缺陷面积,W1i表示能量值,W2i表示熵值,W3i表示对比度,W4i表示相关性。Among them, F1 represents the number of all aggregated defects on a roll of cold-rolled strip steel, F2 i represents the defect aspect ratio, F3 i represents the defect area, W1 i represents the energy value, W2 i represents the entropy value, and W3 i represents the contrast. W4 i represents correlation.
S24、根据冷轧带钢表面质量特征向量以及数据集,建立基于决策树算法的判定规则模型。S24. Based on the cold-rolled strip surface quality feature vector and data set, establish a decision rule model based on the decision tree algorithm.
一种可行的实施方式中,将得到的特征向量作为决策树的叶子节点建立决策树,为确保决策树模型精度与避免过拟合,采用预剪枝方法,通过提前停止树的构建而对树进行剪枝。其中决策树算法采用cart决策树算法,其选取的特征标准为基尼系数,模型构建可以包括如下步骤S241-S244:In a feasible implementation, the obtained feature vectors are used as leaf nodes of the decision tree to build a decision tree. In order to ensure the accuracy of the decision tree model and avoid overfitting, a pre-pruning method is used to stop the construction of the tree in advance. Perform pruning. The decision tree algorithm uses the cart decision tree algorithm, and the selected feature standard is the Gini coefficient. The model construction may include the following steps S241-S244:
S241、采用网格搜索法,对决策树算法的参数进行调整,确定参数的取值限定范围,并建立多个决策树模型;其中,参数包括最大树深度和分支所需最少样本数。S241. Use the grid search method to adjust the parameters of the decision tree algorithm, determine the value limit range of the parameters, and establish multiple decision tree models; the parameters include the maximum tree depth and the minimum number of samples required for branches.
S242、对数据集中的训练集,计算特征标准基尼系数,如下式(9)所示:S242. For the training set in the data set, calculate the feature standard Gini coefficient, as shown in the following equation (9):
其中,Gini(D)表示从数据集中随机抽取两个样本,其类别不一致的概率,k表示分类的数目,p(xi)表示分类xi出现的概率。Among them, Gini(D) represents the probability that two samples are randomly selected from the data set and their categories are inconsistent, k represents the number of categories, and p( xi ) represents the probability that category xi appears.
S243、根据特征标准基尼系数,对每一个特征,计算特征下的基尼系数,得到当前参数下的基于决策树算法的判定规则模型,进而得到不同参数下的基于决策树算法的判定规则模型。S243. According to the feature standard Gini coefficient, for each feature, calculate the Gini coefficient under the 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.
其中,对于每一个特征A,对其可能取得的每一个值a。根据值ai将每一个特征训练样本分为D1和D2两部分,由基尼系数公式得到在特征A下基尼系数,如下式(10)所示:Among them, for each feature A, each possible value a can be obtained. Divide each feature training sample into two parts, D1 and D2, according to the value ai. The Gini coefficient under feature A is obtained from the Gini coefficient formula, as shown in the following equation (10):
其中,Gini(D,A)表示在特征A下基尼系数,A表示特征,D表示数据集,D1、D2表示根据特征A的值ai将每一个特征训练样本分成的两部分,Gini(D1)表示从特征训练样本D1中随机抽取两个样本,其类别不一致的概率,Gini(D2)表示从特征训练样本D2中随机抽取两个样本。Among them, Gini(D,A) represents the Gini coefficient under feature A, A represents the feature, D represents the data set, D1 and D2 represent the two parts that divide each feature training sample according to the value a i of feature A, Gini(D1 ) represents the probability that two samples randomly selected from feature training sample D1 have inconsistent categories, and Gini(D2) represents two samples randomly selected from feature training sample D2.
进一步地,针对数据集D,计算每一个特征的基尼系数,得到当前最大树深度与分支所需最少样本数下的决策树模型。Furthermore, for the data set D, the Gini coefficient of each feature is calculated to obtain the decision tree model under the current maximum tree depth and the minimum number of samples required for branches.
S244、对数据集中的测试集,建立不同参数下的决策树模型的混淆矩阵,通过计算不同参数组合下的决策树模型的正确率,选取最优参数,实现决策树预剪枝,得到基于决策树算法的判定规则模型。S244. For the test set in the data set, establish a 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 pre-pruning of the decision tree, and obtain the decision-based Decision rule model of tree algorithm.
S25、根据判定规则模型的分类函数,构建冷轧带钢表面质量分选度分级模型。S25. Construct a cold-rolled strip surface quality sorting degree classification model based on the classification function of the decision rule model.
S3、根据图像数据、文本数据以及冷轧带钢表面质量分选度分级模型,得到冷轧带钢表面质量分选度分级结果。S3. According to the image data, text data and the cold-rolled strip surface quality sorting degree grading model, obtain the cold-rolled strip surface quality sorting degree grading results.
一种可行的实施方式中,以表面检测仪数据为输入项,通过上述步骤得到表面质量特征向量,通过决策树模型分类函数,实现冷轧带钢表面质量分选度分级。In a feasible implementation, the surface detector data is used as input, the surface quality feature vector is obtained through the above steps, and the surface quality sorting degree classification of cold-rolled strip steel is realized through the decision tree model classification function.
具体地,以某钢铁企业冷轧连退产线表检系统检出的缺陷为例,下面将结合本发明的内容来介绍本专利的具体实施方式,具体包括以下步骤:Specifically, taking the defects detected by the meter inspection system of a cold rolling continuous production line of a steel company as an example, the specific implementation of this patent will be introduced below in conjunction with the content of the present invention, which specifically includes the following steps:
步骤1:通过已有的表检系统获得了具有聚集型缺陷的带钢图像及其缺陷区域几何信息,并结合人工经验对每个表面缺陷样本按缺陷严重程度标记出三个等级,其中,共收集S1等级带钢数据50卷、S2等级带钢数据50卷、S4等级带钢数据50卷,各等级样本数较为均匀。Step 1: Obtain the strip image with clustered defects and the geometric information of the defect area through the existing surface inspection system. Combined with manual experience, each surface defect sample is marked with three levels according to the severity of the defect. Among them, a total of Collect 50 rolls of S1 grade strip data, 50 rolls of S2 grade strip data, and 50 rolls of S4 grade strip data. The number of samples for each grade is relatively even.
步骤2:通过灰度共生矩阵计算出每个聚集型缺陷的能量值、熵值、相关性、对比度,并通过计算,得到每卷带钢表面的能量值、熵值、相关性、对比度,带钢表面特征值结果如表1所示:Step 2: Calculate the energy value, entropy value, correlation, and contrast of each aggregated defect through the gray level co-occurrence matrix, and through calculation, obtain the energy value, entropy value, correlation, and contrast of the surface of each strip steel strip. The steel surface characteristic value results are shown in Table 1:
表1Table 1
步骤3:获取到每卷带钢表面缺陷几何信息和灰度共生矩阵统计信息后,计算每卷带钢表面特征向量,150卷带钢的特征向量如下表2所示:Step 3: After obtaining the geometric information of surface defects and gray level co-occurrence matrix statistical information of each roll of strip, calculate the surface feature vector of each roll of strip. The feature vectors of 150 rolls of strip are shown in Table 2 below:
表2Table 2
步骤4:将得到的特征向量作为决策树的叶子节点建立决策树,为确保决策树模型精度与避免过拟合,采用预剪枝方法,通过提前停止树的构建而对树进行剪枝。其中决策树算法采用cart决策树算法,其选取的特征标准为基尼系数。决策树树形如图3所示,不同参数组合下的模型正确率如下表3所示:Step 4: Use the obtained feature vectors as leaf nodes of the decision tree to build a decision tree. In order to ensure the accuracy of the decision tree model and avoid overfitting, the pre-pruning method is used to prune the tree by stopping the construction of the tree in advance. The decision tree algorithm uses the cart decision tree algorithm, and the feature standard selected is the Gini coefficient. The decision tree shape is shown in Figure 3. The model accuracy under different parameter combinations is shown in Table 3 below:
表3table 3
其中,最大树深度为5且分支所需最少样本数为1时模型准确率达到最高,故选定其作为决策树预剪枝结构参数。Among them, the model accuracy reaches the highest when the maximum tree depth is 5 and the minimum number of samples required for branches is 1, so it is selected as the pre-pruning structural parameter of the decision tree.
步骤5:以表面检测仪数据为输入项,通过步骤2、3得到表面质量特征向量,通过决策树模型分类函数,实现冷轧带钢表面质量分选度分级。Step 5: Using the surface detector data as input, the surface quality feature vector is obtained through steps 2 and 3, and the surface quality sorting degree classification of cold-rolled strip steel is realized through the decision tree model classification function.
其中,决策树分类函数为:Among them, the decision tree classification function is:
进一步地,45卷带钢数据作为输入,提取其特征向量,最终分类系统的输出为冷轧带钢表面质量分选度等级,即S1级(如图4所示)、S2级(如图5所示)或S4级(如图6所示),预测结果如表4所示:Furthermore, 45 coils of strip steel data are used as input to extract their feature vectors. The final output of the classification system is the surface quality sorting grade of cold rolled strip steel, namely S1 level (as shown in Figure 4) and S2 level (as shown in Figure 5). (shown in Figure 6) or S4 level (shown in Figure 6), the prediction results are shown in Table 4:
表4Table 4
对预测结果进行统计分级,各等级下预测结果与样本标签一致的样本分别为S1级16卷、S2级9卷例、S4级17卷例;S1级预测准确率100%、S2级预测准确率90%、S3级预测准确率89.47%,其中不存在严重误判,即将S4级缺陷误判为S1级缺陷,这一数据低于人工对缺陷图像的分级误判率(3%)。The prediction results are statistically graded. The samples with consistent prediction results and sample labels at each level are S1 level 16 volumes, S2 level 9 volumes, and S4 level 17 volumes. The S1 level prediction accuracy is 100%, and the S2 level prediction accuracy is 100%. The prediction accuracy of S3 level is 90% and 89.47%. There is no serious misjudgment, that is, S4 level defects are misjudged as S1 level defects. This data is lower than the manual misjudgment rate of defect images (3%).
本实施例中,为了进一步理解本发明实施例所述的基于灰度共生矩阵和决策树的冷轧带钢表面质量分选度分级方法,将本发明应用于某钢铁企业冷轧连退产线,以每个月第一个周一的白班生产开始,连续选取自动判定参与的1000卷带钢,将其判定结果作为样本进行误差评价,实际应用效果分析结果如下表5所示:In this embodiment, in order to further understand the cold-rolled strip surface quality sorting method based on the gray-scale co-occurrence matrix and decision tree described in the embodiment of the present invention, the present invention is applied to the cold rolling continuous production line of a steel enterprise , starting from the day shift production on the first Monday of each month, 1,000 coils of strip steel participating in the automatic judgment are continuously selected, and the judgment results are used as samples for error evaluation. The actual application effect analysis results are shown in Table 5 below:
表5table 5
本发明实施例中,提供了一种基于灰度共生矩阵与决策树规则的冷轧带钢表面质量分选度分级方法,能够对冷轧带钢表面质量自动进行分选度分级,从而降低带钢表面质量漏检率,降低了下游工序质量异议。In the embodiment of the present invention, a cold-rolled strip surface quality sorting method based on gray-scale co-occurrence matrix and decision tree rules is provided, which can automatically classify the cold-rolled strip surface quality, thereby reducing the strip surface quality. The missed detection rate of steel surface quality reduces quality objections in downstream processes.
如图7所示,本发明实施例提供了一种基于灰度共生矩阵与决策树的带钢分选度分级装置700,该装置700应用于实现基于灰度共生矩阵与决策树的带钢分选度分级方法,该装置700包括:As shown in Figure 7, the embodiment of the present invention provides a strip sorting and grading device 700 based on a gray-level co-occurrence matrix and a decision tree. The device 700 is used to implement strip sorting based on a gray-level co-occurrence matrix and a decision tree. Selectivity grading method, the device 700 includes:
获取模块710,用于获取待分级的冷轧带钢表面的图像数据以及文本数据。The acquisition module 710 is used to acquire image data and text data of the cold-rolled strip surface to be graded.
输入模块720,用于将图像数据以及文本数据输入到构建好的冷轧带钢表面质量分选度分级模型。The input module 720 is used to input image data and text data into the constructed cold-rolled strip surface quality sorting degree classification model.
输出模块730,用于根据图像数据、文本数据以及冷轧带钢表面质量分选度分级模型,得到冷轧带钢表面质量分选度分级结果。The output module 730 is used to obtain the cold-rolled strip surface quality sorting degree grading results based on the image data, text data and the cold-rolled strip surface quality sorting degree grading model.
可选地,输入模块720,进一步用于:Optionally, the input module 720 is further used for:
S21、获取数据集;其中,数据集包括冷轧带钢表面的缺陷图像信息、冷轧带钢表面的缺陷文本信息以及冷轧带钢表面的缺陷质量分选度等级。S21. Obtain a data set; wherein, the data set includes defect image information on the surface of cold-rolled strip steel, text information on defects on the surface of cold-rolled strip steel, and quality sorting grade of defects on the surface of cold-rolled strip steel.
S22、根据数据集以及灰度共生矩阵算法,计算得到缺陷图像的特征值。S22. According to the data set and the gray level co-occurrence matrix algorithm, calculate the eigenvalues of the defect image.
S23、根据特征值以及冷轧带钢表面的缺陷文本信息,建立冷轧带钢表面质量特征向量。S23. Establish a cold-rolled strip surface quality feature vector based on the characteristic values and the defect text information on the cold-rolled strip surface.
S24、根据冷轧带钢表面质量特征向量以及数据集,建立基于决策树算法的判定规则模型。S24. Based on the cold-rolled strip surface quality feature vector and data set, establish a decision rule model based on the decision tree algorithm.
S25、根据判定规则模型的分类函数,构建冷轧带钢表面质量分选度分级模型。S25. Construct a cold-rolled strip surface quality sorting degree classification model based on the classification function of the decision rule model.
可选地,冷轧带钢表面的缺陷文本信息,包括:Optionally, the defect text information on the cold-rolled strip surface includes:
冷轧带钢表面的缺陷感兴趣区域相对坐标、缺陷面积、缺陷长度以及缺陷宽度。The relative coordinates, defect area, defect length and defect width of the defect area of interest on the cold rolled strip surface.
可选地,输入模块720,进一步用于:Optionally, the input module 720 is further used for:
S221、获取基于预训练确定的灰度共生矩阵的结构参数;其中,结构参数包括生成步长、图片灰度级以及生成方向。S221. Obtain the structural parameters of the gray level co-occurrence matrix determined based on pre-training; where the structural parameters include the generation step size, the image gray level and the generation direction.
S222、根据灰度共生矩阵,计算数据集中每张缺陷图像的灰度共生矩阵,得到冷轧带钢表面的聚集型缺陷的能量值、熵值、对比度以及相关性。S222. According to the gray-level co-occurrence matrix, calculate the gray-level co-occurrence matrix of each defect image in the data set, and obtain the energy value, entropy value, contrast and correlation of the aggregated defects on the surface of the cold-rolled strip steel.
可选地,输入模块720,进一步用于:Optionally, the input module 720 is further used for:
根据特征值以及冷轧带钢表面的缺陷文本信息,计算冷轧带钢表面的聚集型缺陷特征,得到冷轧带钢表面质量特征向量,如下式(1)所示:According to the characteristic values and the defect text information on the surface of the cold-rolled strip, the aggregated defect characteristics on the surface of the cold-rolled strip are calculated, and the surface quality feature vector of the cold-rolled strip is obtained, as shown in the following formula (1):
其中,f1表示一卷冷轧带钢上所有聚集性缺陷的个数,F2i表示缺陷长宽比,F3i表示缺陷面积,W1i表示能量值,W2i表示熵值,W3i表示对比度,W4i表示相关性。Among them, f1 represents the number of all aggregated defects on a roll of cold-rolled strip steel, F2 i represents the defect aspect ratio, F3 i represents the defect area, W1 i represents the energy value, W2 i represents the entropy value, W3 i represents the contrast, W4 i represents correlation.
可选地,输入模块720,进一步用于:Optionally, the input module 720 is further used for:
S241、采用网格搜索法,对决策树算法的参数进行调整,确定参数的取值限定范围,并建立多个决策树模型;其中,参数包括最大树深度和分支所需最少样本数。S241. Use the grid search method to adjust the parameters of the decision tree algorithm, determine the value limit range of the parameters, and establish multiple decision tree models; the parameters include the maximum tree depth and the minimum number of samples required for branches.
S242、对数据集中的训练集,计算特征标准基尼系数。S242. Calculate the feature standard Gini coefficient for the training set in the data set.
S243、根据特征标准基尼系数,对每一个冷轧带钢表面质量特征向量,计算基尼系数,得到当前参数下的基于决策树算法的判定规则模型,进而得到不同参数下的基于决策树算法的判定规则模型。S243. According to the characteristic standard Gini coefficient, calculate the Gini coefficient for each cold-rolled strip surface quality feature vector to obtain the decision rule model based on the decision tree algorithm under the current parameters, and then obtain the decision based on the decision tree algorithm under different parameters. Rule model.
S244、采用预剪枝方法对不同参数下的决策树模型进行处理,得到基于决策树算法的判定规则模型。S244. Use the pre-pruning method to process the decision tree model under different parameters to obtain a decision rule model based on the decision tree algorithm.
可选地,对数据集中的训练集,计算特征标准基尼系数,如下式(2)所示:Optionally, for the training set in the data set, calculate the feature standard Gini coefficient, as shown in the following equation (2):
其中,Gini(D)表示从数据集中随机抽取两个样本,其类别不一致的概率,k表示分类的数目,p(xi)表示分类xi出现的概率。Among them, Gini(D) represents the probability that two samples are randomly selected from the data set and their categories are inconsistent, k represents the number of categories, and p( xi ) represents the probability that category xi appears.
可选地,特征下的基尼系数,如下式(3)所示:Optionally, the Gini coefficient under the characteristic is as shown in the following equation (3):
其中,Gini(D,A)表示在特征A下基尼系数,A表示特征,D表示数据集,D1、D2表示根据特征A的值ai将每一个特征训练样本分成的两部分,Gini(D1)表示从特征训练样本D1中随机抽取两个样本,其类别不一致的概率,Gini(D2)表示从特征训练样本D2中随机抽取两个样本。Among them, Gini(D,A) represents the Gini coefficient under feature A, A represents the feature, D represents the data set, D1 and D2 represent the two parts that divide each feature training sample according to the value a i of feature A, Gini(D1 ) represents the probability that two samples randomly selected from feature training sample D1 have inconsistent categories, and Gini(D2) represents two samples randomly selected from feature training sample D2.
可选地,采用预剪枝方法对不同参数下的决策树模型进行处理,得到基于决策树算法的判定规则模型,包括:Optionally, use the pre-pruning method 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 data set, 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 a decision rule model based on the decision tree algorithm.
本发明实施例中,提供了一种基于灰度共生矩阵与决策树规则的冷轧带钢表面质量分选度分级方法,能够对冷轧带钢表面质量自动进行分选度分级,从而降低带钢表面质量漏检率,降低了下游工序质量异议。In the embodiment of the present invention, a cold-rolled strip surface quality sorting method based on gray-scale co-occurrence matrix and decision tree rules is provided, which can automatically classify the cold-rolled strip surface quality, thereby reducing the strip surface quality. The missed detection rate of steel surface quality reduces quality objections in downstream processes.
图8是本发明实施例提供的一种电子设备800的结构示意图,该电子设备800可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(centralprocessing units,CPU)801和一个或一个以上的存储器802,其中,存储器802中存储有至少一条指令,至少一条指令由处理器801加载并执行以实现下述基于灰度共生矩阵与决策树的带钢分选度分级方法:FIG. 8 is a schematic structural diagram of an electronic device 800 provided by an embodiment of the present invention. The electronic device 800 may vary greatly due to different configurations or performance, and may include one or more processors (central processing units, CPUs) 801 and one or more memories 802, wherein at least one instruction is stored in the memory 802, and at least one instruction is loaded and executed by the processor 801 to implement the following strip sorting degree classification method based on gray level co-occurrence matrix and decision tree :
S1、获取待分级的冷轧带钢表面的图像数据以及文本数据。S1. Obtain the image data and text data of the cold-rolled strip surface to be graded.
S2、将图像数据以及文本数据输入到构建好的冷轧带钢表面质量分选度分级模型。S2. Input the image data and text data into the constructed cold-rolled strip surface quality sorting degree model.
S3、根据图像数据、文本数据以及冷轧带钢表面质量分选度分级模型,得到冷轧带钢表面质量分选度分级结果。S3. According to the image data, text data and the cold-rolled strip surface quality sorting degree grading model, obtain the cold-rolled strip surface quality sorting degree grading results.
在示例性实施例中,还提供了一种计算机可读存储介质,例如包括指令的存储器,上述指令可由终端中的处理器执行以完成上述基于灰度共生矩阵与决策树的带钢分选度分级方法。例如,计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions. The instructions can be executed by a processor in a terminal to complete the above-mentioned strip sorting degree based on gray-level co-occurrence matrix and decision tree. Grading method. For example, computer-readable storage media may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned The storage media mentioned can be read-only memory, magnetic disks or optical disks, etc.
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection of the present invention. within the range.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311310069.XA CN117314871A (en) | 2023-10-10 | 2023-10-10 | Band steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311310069.XA CN117314871A (en) | 2023-10-10 | 2023-10-10 | Band steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117314871A true CN117314871A (en) | 2023-12-29 |
Family
ID=89255003
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311310069.XA Pending CN117314871A (en) | 2023-10-10 | 2023-10-10 | Band steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117314871A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117934459A (en) * | 2024-03-21 | 2024-04-26 | 锦诚实业科技(深圳)有限公司 | Food material encapsulation opening defect detection method |
-
2023
- 2023-10-10 CN CN202311310069.XA patent/CN117314871A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117934459A (en) * | 2024-03-21 | 2024-04-26 | 锦诚实业科技(深圳)有限公司 | Food material encapsulation opening defect detection method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108647643B (en) | An online identification method of liquid flooding state of packed tower based on deep learning | |
CN101661004B (en) | A Visual Inspection Method of Circuit Board Soldering Quality Based on Support Vector Machine | |
CN114092389A (en) | A surface defect detection method for glass panels based on small sample learning | |
US12025552B1 (en) | Quality detection method for porous metal material | |
CN108470022B (en) | Intelligent work order quality inspection method based on operation and maintenance management | |
Ren et al. | Dynamic causality between global supply chain pressures and China's resource industries: A time-varying Granger analysis | |
CN111402236B (en) | Hot rolled strip steel surface defect grading method based on image gray value | |
CN118037137B (en) | A method for determining the number of product quality accidents based on convolutional neural networks | |
CN114399719B (en) | Transformer substation fire video monitoring method | |
CN113808079B (en) | Industrial product surface defect self-adaptive detection method based on deep learning model AGLNet | |
CN110737641A (en) | Construction method, device and system of confidence and audit models | |
CN117314871A (en) | Band steel sorting degree grading method and device based on gray level co-occurrence matrix and decision tree | |
CN107610119A (en) | The accurate detection method of steel strip surface defect decomposed based on histogram | |
CN115082444A (en) | Copper pipe weld defect detection method and system based on image processing | |
CN116883393A (en) | Metal surface defect detection method based on anchor frame-free target detection algorithm | |
Liu et al. | Research on surface defect detection based on semantic segmentation | |
CN113781479B (en) | Semiconductor appearance defect quantification method based on image segmentation algorithm | |
CN118411576B (en) | A carton classification method and device based on data processing | |
Zhou et al. | Machine Vision-Based Defect Classification Algorithm for Rolled Packages | |
CN118570194A (en) | Method and system for detecting defects of inner surface of special-shaped bushing based on three-dimensional point cloud | |
Xin et al. | YOLOv5-ACCOF Steel Surface Defect Detection Algorithm | |
CN114418600B (en) | A food import risk monitoring and early warning method | |
CN112966870B (en) | Cold rolled silicon steel quality defect prediction method based on neural network | |
CN115393258A (en) | Visual defect detection method based on transformer substation instrument | |
CN104502557A (en) | Multi-index water quality evaluation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |