Detection of Defects in Rolled Stainless Steel Plates by Machine Learning Models

Iron metal is the most widely used metal type. This metal, which is used in countless sectors, is processed in different ways and turned into steel. Since steel has a brittle structure compared to iron, defects may occur in the plates during the rolling process. Detection of these defects at the production stage is of great importance in terms of commercial and safety. Machine learning methods can be used in such problems for fast and high accuracy detection. For this purpose, using a dataset obtained from stainless steel surface defects in this study, classification processes were carried out to detect defects with four different machine learning methods. Logistic Regression (LR), Decision Tree (DT), Support Vector Machine (SVM) and Random Forest (RF) algorithms were used for classification processes. The highest classification accuracy was obtained from the 79.44% RF model. Correlation analysis was performed in order to analyze the effects of the features in the dataset on the classification results. It is thought that the classification accuracy of the proposed models is satisfactory for this challenging problem, but needs to be upgraded.


Introduction
Today, with the developing technologies, the production sector has advanced considerably.Thanks to these developments, many methods have emerged to produce and shape the materials used.When we look at today's manufacturing sector, one of the most used materials is steel.Steel is made into a semi-finished product for the area where it will be used by going through multiple plastic forming processes.The most basic forming process used in these stages is rolling.The steel to be used in the rolling process can be passed between two rollers rotating around its own axis and can form a sheet of desired thickness with the applied compression forces.With the rolling process, it is possible to produce materials such as plates, rails, steel profiles, pipes, sheet metal and foil.The most important point to consider here is temperature.Because the temperature value used during the process greatly affects the mechanical properties of the material.For this reason, if temperature control cannot be achieved during the rolling process, defects may occur in the produced materials [1].First of all, it is very important that the raw material used is undamaged (without cracks and crusts).If the casting temperature of the raw material to be used is higher than it should be, micro or macro cracks can be seen in the material.In addition, defects on the surfaces of the casting mold also affect the raw material.In short, it is seen that the effect of temperature, casting mold and casting speed is important in the casting of metal materials [2].During rolling, care should be taken to keep the gap between the rolls the same, the speed of the rolling and the rolls not to bend in the vertical direction.In order to prevent defects, many factors such as temperature control, intermediate annealing, use of perfect raw materials, scale formation, lubrication and surface conditions of the rolls should be considered [3].
The most common material defects after rolling are cracks, uneven elongation, expansion and undulation.Using roller arrangements that apply different driving forces in the opposite direction and rollers that are curved in the opposite direction according to the resulting roller deflection prevent these errors [4].Metal materials have a very large area of use in our lives.The quality of these materials used for important sectors (automotive, aviation, etc.) is also a very important issue.For these reasons, it is important that the materials are produced in a flawless and flawless manner.Predicting possible errors and taking precautions is seen as a problem that needs to be solved today.In addition, although the errors in the machines used in metal processing methods such as rolling can be seen with the eye, cracks etc. in the produced material.problems are not immediately noticeable [5].Many studies have been conducted on the errors, defects and their effects in the rolling process, which is frequently used today.In a study, product defects arising from the production process were determined in sheet materials produced by rolling.Afterwards, the risk priority numbers (ROS) were determined by using the FMEA method for these errors.Suggestions for the measures to be taken in order to prevent or reduce the high-risk errors in the production process are presented [6].In another study, the rolling force was examined and calculations were made with both analytical and numerical methods.The results calculated by these methods were compared with the experimental study data.Afterwards, the cold rolling line and the material used were modeled using finite element software.Rolling simulation was done with the parameters in the experimental study, and the rolling force was obtained.The results of all analyzes were compared and it was seen that the values were close to each other.As a result of the study, it has been predicted how a material that has not been rolled before will behave during rolling or how it can be rolled with which parameters [7].In this and similar studies, artificial intelligence, image processing, etc. Innovative technologies such as However, it is an inevitable fact that technology should be used in every field.
When the recent academic studies on the subject are examined, it is seen that innovative technologies such as image processing are used for the detection of defects in materials.Traditional materials inspection methods used for a long time no longer meet real production needs.For this reason, it has become an important issue to conduct indepth research on steel surface flaw inspection systems and to develop them technologically.Instead of the accuracy and low performance of traditional detection methods, a machine vision-based surface defect detection method, which has high accuracy, can give results quickly and has intelligent processing features, should be developed and used [8].
In one of the scientific studies, a system was developed to help detect the crack on the metal body without disassembling any machine used in the manufacturing process.With this developed system, it has become possible to detect the exact size and location of micro and nano cracks.Digital image processing concepts are used to enable the system to identify the crack on a metal body.In order to detect the crack on the metal body to be examined first, body scanning was performed with the help of scanning mechanism (ultrasonic, x-ray, gamma rays or radiography).The image of the metal body obtained as a result of scanning was added to the systems and the image was processed using different image processing algorithms.First, the image was converted to black and white form and then the image was digitized.Based on the digitized data and using the segmentation process, the exact location of the crack was determined, and the length and width of the crack on the metal body were determined [9].In another study designed in line with these goals, the unchanging moment properties of cracks, holes, scratches, oil stains and other images on the steel plate were taken, the data results were extracted and analyzed.Then, the texture properties of the defective images were reexamined and digitized by image processing [4].
In another paper study completed for the detection of defects on the metal surface, the developed system presented an effective approach to detect and classify metal material defects by using computer vision and machine learning technologies.Surface quality tests must be completed before the materials most used in the industry, namely metals, are ready for processing.Because, in order to avoid errors that may occur after production, the metals with defective surfaces must be determined first.Early detection of defects minimizes product damage and production cost.Defects in materials reduce the production rate, which affects the market value of the products [10].
In another study using edge detection filters such as LoG, canny, roberts, perwitt and sobel in the analysis phase, SSIM (Structural Symmetry Indicator Matrix), MSE (Mean Square Error), IEF (Image Enhancement Factor) and PSNR (Peak Signal to Noise Ratio) parameters were calculated.In the analysis, the optimized k-Winsorized showed optimal results for the average noise removal capacity, and this analysis has proven to be an effective technique for detecting defects in stainless steel plates [11].
Automatic fault detection on rolled steel surfaces is very difficult due to the fact that it is done on a large surface, both due to the diversity in appearance and their rarity.This problem has led researchers to derive defect descriptors by processing good quality images selected from surface images.These descriptors, when trained with appropriate machine learning algorithms, are able to distinguish various surface defects.In today's world, where raw material resources are gradually depleted, it is of great importance to realize more sensitive manufacturing by reducing the error rates and the number of scraps.Reducing the heat treatment steps applied while recycling the materials used in the Iron-Steel industry provides a solution for raw material and energy saving in sheet metal forming processes for "Solutions for Zero-Carbon Production in the Iron-Steel Industry" [12].
Based on the studies in the literature, the main contributions of the study can be listed as follows: • With four different machine learning methods, faults on steel surfaces will be detected and production will be carried out flawlessly and quickly.• The features that play an important role in the detection of defects on steel surfaces will be determined by the correlation analysis.• The way to use machine learning models in decision support systems to be used in the production phase in the Iron and Steel industry will be paved.The study is organized under four main headings.The first section includes the studies in the literature and the motivation of the study.The second section contains information about the dataset used, machine learning methods and performance evaluations.The third section contains the experimental results and the fourth section contains the conclusions and recommendations.

Faulty Steel Plates Dataset
The dataset used in this study was created by Semeion, Research Center of Sciences of Communication [13].In order to detect surface defects in stainless steel plates, they took 27 different measurements and analyzed 6 different defects and other defects in 7 classes in total.As a result, they created a 7-class dataset containing 27 features.The distribution according to the classes in the dataset is shown in Figure 1.Sheets with a thickness of 1.5 mm and above, which were made to create the dataset, were examined.It has been observed that errors such as corrosion, scratches (zscratch, k-scatch), stain formations, pollution and mound formations occur in case a homogeneous heat distribution is not made during the heat treatment applied to the examined sheet materials.The main purpose of the research is to correctly classify the surface defects that occur in stainless steel plates with six types of possible defects.The input vector consists of 27 indicators that approximately define the geometric shape and outline of the defect.Frequency of feature values is a must-know information in classification problems.In this way, preliminary information about the classification success can be obtained.In Figure 2, the frequencies of the data according to the characteristics are shown.

Logistic Regression (LR)
Logistic regression is a machine learning algorithm used to estimate the probability that a dependent variable belongs to one of two categorical classes.This algorithm predicts which class a sample in the dataset belongs to by analyzing the effects of independent variables.The main purpose of logistic regression is to solve classification problems.Predict whether each sample in the data set belongs to a particular class or to another class.For example, logistic regression can be used to predict whether a patient has a disease or whether a customer will buy a product.Logistic regression uses a sigmoid function to estimate the effects of independent variables [14].This function expresses the probability that a sample belongs to a class, as a value between 0 and 1.These values are then compared with a threshold value to determine which class the sample belongs to.Logistic regression also uses a technique called multiple logistic regression to analyze the effects of many independent variables simultaneously.
This technique can improve classification accuracy by analyzing interactions between independent variables.Logistic regression is often used in areas such as statistical analysis, medical research, marketing and financial analysis.It also plays an important role in many machine learning applications [15].

Decision Tree (DT)
A decision tree is a machine learning algorithm used to classify or regress data in a dataset.Decision trees help to classify the dataset using tree structure.The tree structure consists of many nodes and leaves that branch off from a root node.The decision tree algorithm creates a decision tree for each sample in the dataset.The decision tree fluctuates according to the values of the arguments and finally gives a result.The decision tree is used to classify or regress with the tree structure [16].The decision tree performs a test for each feature in the dataset to construct the tree structure.This test creates branches of the tree by dividing the data according to the values of the properties.This process starts from a root node and continues until the last leaves, performing a test on each branch.The last leaves contain the classified results.The decision tree algorithm analyzes the relationship between the features in the dataset [17].These relationships can be considered an important attribute for each feature in the dataset.The decision tree algorithm uses a technique called feature selection to determine how important a feature is to it.The decision tree is especially used in solving classification and regression problems.For example, it can be used to predict whether a customer will buy a product or whether a patient has a disease.It is also an important algorithm used in many machine learning applications [18].

Support vector machine (SVM)
Support vector machines (SVM) is a machine learning algorithm used for data classification and regression analysis.SVM is used to classify data in a dataset or to perform regression analysis [19].SVM classifies each instance in the dataset according to its class label for classification.SVM can be used to classify data in a dataset into two classes, but it can also be adapted for multi classification.SVM creates a hyperplane for classification.A hyperplane is a plane that separates the class labels.SVM optimizes this hyperplane to make the best separation in the dataset.This best separation means getting the best margin in the dataset.Margin is the distance between the hyperplane and the nearest data points.SVM tries to get the best margin to separate the data in the dataset for classification.SVM specifically uses a technique known as the "kernel trick" to create the best hyperplane separating class labels.This technique provides better discrimination by representing the data in the dataset in a higher dimensional space.SVM can use different kernel functions depending on the size of the data in the dataset.These kernel functions are used to represent the data in the dataset in higher dimensional space.SVM can use different kernel functions such as linear, polynomial, RBF (radial basis function).SVM is used in many machine learning applications.For example, it can be used to predict whether a patient has a disease or whether a customer will buy a product.SVM is also effective for high-dimensional datasets and can be used to solve classification and regression problems [20].

Random Forest (RF)
The random forest algorithm is a machine learning method and is used to solve problems such as classification and regression analysis [21].Random forest is an ensemble learning method by combining multiple decision trees.The random forest uses many decision trees to find a solution to a classification or regression problem.Each decision tree has a tree structure using properties and target variable.The random forest algorithm is a learning method in which each decision tree is trained on a different subset of the dataset.These subsets are created by randomly selecting samples from the original dataset.Each tree can produce different results as it is trained using random samples.Random forest combines the results of these trees to produce a more accurate result.This makes the random forest have less variance than other classification and regression methods.Since the random forest is an ensemble method formed by the combination of decision trees, it gives effective results especially in highdimensional datasets.It can also be used in many machine learning applications such as random forest, classification, and regression.The random forest algorithm has a wide range of applications.For example, it can be used to predict the probability of a patient contracting a disease, to predict whether a customer will buy a product, or to classify data in a dataset [22].

Performance metrics and confusion matrix
Performance metrics are metrics used to measure the performance of an Artificial Intelligence (AI) model.These metrics evaluate different characteristics of a model, such as accuracy, precision, learning speed, and generalization ability [23,24].Some common performance metrics are: Accuracy: The proportion of data points that a classification model predicts correctly.It is often used as the most basic performance metric.
Precision: The rate at which data points predicted as positive are actually positive.Sensitivity is used to reduce the effect of false positive predictions.
Recall: Measures how many of the positive data points were correctly predicted.The callback is used to reduce the impact of false negative predictions.
F1 Score: It is the harmonic mean of sensitivity and recall.This combines the model taking into account both precision and callback [25].The formulas of the performance metrics used in the study are given in Table 1.A complexity matrix is a tool used to measure the performance of an algorithm or system design.The matrix contains different combinations of performance metrics such as the algorithm's processing time or processor usage [26].Usually, the complexity matrix is in the form of a two-dimensional table.Rows represent the complexity of the input sizes and the columns represent the complexity of the algorithm's processing time, memory usage, or other metrics.Each cell of the matrix represents the complexity of the algorithm for a given input size and a given performance measure.The complexity matrix is a useful tool for analyzing the performance of an algorithm, increasing its efficiency and understanding how it behaves in different scenarios.It is particularly useful for understanding how the performance of the algorithm changes as the input size increases [27].A confusion matrix created for two classes and the parameters it contains are given in Table 2. True Positive (TP); correctly classified positive samples, True Negative (TN); correctly classified negative samples, False Positive (FP); falsely classified positive samples and False Negative (FN); refers to negative samples that were incorrectly classified [28,29].

Experimental Results
In this section, the classification of defects on stainless steel surfaces is carried out based on numerical data.There are 27 features and 7 classes in the dataset used.The dataset contains a total of 1941 rows of data.The dataset is divided into 95% train and 5% test to detect defects on stainless steel surfaces.The reason for this division is that the performance of classification models can be determined exactly and the usability of the models in real life can be measured.In the study, a computer with Intel® Core i7™ 12700K 3.61 GHz, NVIDIA GeForce RTX 3080Ti, 64GB RAM was used to run the algorithms.Python programming language and libraries were used to create algorithms for classification models.Four different classification models were used in the study.Training and testing processes were carried out with LR, DT, SVM and RF machine learning methods.As a result of the classifications, the confusion matrix obtained from the LR model is shown in Figure 2, the confusion matrix obtained from the DT model is shown in Figure 3, the confusion matrix obtained from the SVM model is shown in Figure 4 and the confusion matrix obtained from the RF model is shown in Figure 5.  Precision, recall and F1 Score values were calculated using the confusion matrix data of the models.These values are given as macro and weighted for the detailed analysis of the classification performances of the models.The performance metrics of the models are shown in Table 3.According to Table 3, the highest precision, recall and F1 Score values belong to the RF model.In parallel with these values, the classification success of the RF model is higher than other models.Classification successes of all models are given in Table 4.According to Table 4, the lowest classification successes belong to the LR and SVM models.The highest classification success belongs to the RF model.It is important that the features in the dataset are related in classification processes.By eliminating the features that contribute to the classification at a low level, classification operations can be performed with a small number of features.The heatmap showing the correlation relationship of 27 features in the dataset is shown in Figure 6.

Conclusions
In this study, a dataset containing 27 features and 7 classes was used to detect defects on stainless steel surfaces.The dataset contains a total of 1941 rows of data.Using these data, classification processes were carried out with four different machine learning models.Training and testing processes were carried out with LR, DT, SVM and RF models.When the models are compared, the highest classification success was obtained from the RF model.In addition to these, correlation analysis of the data in the dataset was also carried out.The highest classification success, 79.44%, is a value that needs to be increased to detect defects on stainless steel surfaces.It is thought that more data is needed to increase this value.In addition, classification success can be increased with different machine learning methods.If the classification success is increased, faults on stainless steel surfaces will be detected automatically.As a result of all researches and examinations, this study focused on these needs in the manufacturing sector; In order not to affect the rolling geometry due to thermal expansions and to prevent the formation of wavy forms in steel products, it will be possible to control the production with image processing algorithms.In this way, errors that may occur during production will be prevented.

Figure 1 .
Figure 1.Distribution by classes in the dataset

Figure 2 .
Figure 2. Frequencies of data by features

Figure 5 .
Figure 5. Confusion matrix of RF model

Table 1 .
Performance metrics equation for two class

Table 2 .
Confusion matris for two class

Table 3 .
Performance metrics of all models

Table 4 .
Classification accuracy of all models (%)