Application of Hierarchical Clustering Approach for Prediction of Grain Size in Heat-Treated EN9 Steel

One of the simplest, most popular, and productive ways to conduct research and testing in the field of materials science is through the use of metallographic study. Technological boon in the field of metallographic study, opens new gateway for materials characterization through image processing technologies. Image segmentation, edge detection, and roughly estimating grain size are the three main goals of metallographic image processing. The objective of this paper was to determine the grain size of EN9 steel by applying different clustering techniques to the image textured data, collected from EN9 steel metallographic specimens in normalized and annealed condition. In order to determine the average grain size in EN9 steel specimens when seen with a metallurgical microscope, this article blends the ideas of image processing with various hierarchical clustering methodologies to study material characteristics.

Major improvements have been made in the steel production industry over the past 30 years. The most significant alloy utilized as a structural material is steel. Depending on the type, steel is an alloy made of iron and a little amount of carbon (0.2% to 2.1% by weight). According to Lackhtin, 1 carbon is the best substance for making iron to connect with steel since the presence of the carbon makes the steel stronger and harder than pure iron. The higher the percentage of carbon, the harder the steel becomes. As it works as a hardening agent. So, basically the impurity of Carbon in Iron stops the dislocation of the Iron atoms in the lattice from sliding past one another. The amount of this impurity is used to control the hardness, ductility and tensile strength.
The most commercial steel is medium carbon steel, often known as EN9 steel. It is suitable for various engineering applications due of its reasonably inexpensive cost and improved mechanical qualities, including great strength and durability in heat treated conditions. [2][3][4][5] Carbon content in this grade of steel ranges from 0.3% to 0.8%. The machinability of this type of steel is in the range of 60% to 70%, so it cuts a little bit better than low carbon steels. These steels machined more effectively as compared to high carbon steel, which is a highly hard steel, and it is less machinable. The improved properties of steel are due to the microstructural changes after heat treatment.
To study these microstructural changes many methods are available but image processing techniques are the most reliable one in the 21st century. This paper establishes a new concept of microstructural study by taking image segmentation into consideration.
In this study, a clustering-based technique for edge detection in images of the optical microstructure of EN9 steel is proposed. Pixel intensity is useful for determining how similar two pixels are, making it useful for picture segmentation. However, it is not useful for detecting edges when measuring sudden changes. For that, the pixel gradient value is considerably more suitable. In order to avoid this, we first think of each pixel in our method as a point in the spectral space made up of gradient values in all image bands rather than intensity values. The image's edge and non-edge pixels are then separated using a clustering technique in the spectral domain. The results are then improved using a thresholding method that is similar to the Canny edge detection technique. 6 The rest of this paper is organized as follows: Section 2 presents the experimental procedure for sample preparation and image acquisition, followed by the explanation of the proposed method for edge detection in optical microstructure images in Section 3. To demonstrate its effectiveness, experimental results and comparison with different methods are given in Section 4. Conclusion remarks are drawn in Section 5.

Experimental
The study of microstructure is primarily done by establishing the concept of digital image processing adopted which is followed by the sample preparation to collect the digital images. Thereafter, processing of the data is done to study its behavior in different heattreating condition like annealing at 800°C (furnace cooling), Normalizing at 800°C (air cooling), and tempering at 200°C for 1 h (air cooling). All the heat-treated samples re soaked in the furnace for 1 h. The tempered samples are firstly treated at 800°C for 1 h and then water quenched. The different steps to process an image is as follows: ) where x and y are spatial coordinates, is the definition of an image. At every given place, the values of f are proportional to the brightness or gray scale of the image there. An image can be thought of as a matrix, where each row and column denote a particular point in the image and the matching matrix element value denotes the amount of grayscale at that location. Each such point value is a digital number known as pixel.
The recognition of objects or structures from images using their properties-which may be geometrical or material is known as computer vision. The goal of computer vision is to distinguish between the state of the physical world and cluttered or unclear visuals. Its main focus is on deducing the surface and characteristics of three-dimensional objects from their two-dimensional representations.
The smallest unit of visual communication is a dot. Dots can create patterns like a line or a circle when they are very near to one another. This result is referred to as grouping. The perception of an image may also be globally unrealized, which means that the entire imagined three-dimensional object cannot be physically constructed from what is seen, rather than ambiguous or illusory.
Computerized methods of metallographic image analysis are favored, due to their reliability and consistency in interpreting data, z E-mail: tapasminisahoo@soa.ac.in and in some cases, they have been found to be up to 100x faster than human interpretation. 7 According to Grande, 8 a subset of these computerized techniques called "digital image processing" is becoming more and more popular.
The segmentation and edge detection of the image are the fundamental components of metallographical image processing, which is crucial for computer-aided quantitative metallographic analysis. Therefore, scientific researchers have given the edge detection and segmentation method in image processing technology a great deal of attention, and excellent algorithms have been proposed. However, because the differential operator in the edge detection algorithm has a directivity performance and is anisotropic, it is very difficult to detect the edges of an image such as metallographical image when it has a lot of rich detail and is used to detect a complex image. 9 Our extensive testing has shown that, when using the aforementioned technique to locate the edge of a metallographical image, every one of them consistently displays a double boundary, though occasionally they may lose or enlarge the boundary, which results in an inaccurate location of the grain boundary. The quantitative metallographic analysis' accuracy will be impacted by this. It is important to investigate edge detection techniques that are more efficient.
In this piece of work hierarchical clustering approach is applied to metallographical images of EN9 steel specimen to detect the grain boundary and thereafter the average grain size is determined.
Sample preparation.-In order to acquire the images for image processing process, steel samples have to be ready for metallurgical microscope viewing. The sample is obtained from AISI1055 or EN9 OR Ck55 medium carbon steel. It is one of the American standard requirements for medium carbon steel, and it has high hardness, moderate ductility, and high strength as defined below. This steel also has a pearlitic matrix and a nearly equal quantity of ferrite. Therefore, it can also be said that it is specifically a mixture of pearlitic and ferritic minerals. Table I provides the information about the specimen's chemical composition.
Heat treatment should be performed before the samples taken for test. The main purpose of heat-treating medium carbon steel is to produce matrix microstructures and related mechanical qualities that are difficult to get in the as-cast condition. Depending on the substance size and alloy composition, as-cast grounded substance microstructures typically contain ferrite, pearlite, or mixtures of the two. A number of different heat treatment techniques such as annealing, normalizing, quenching and tempering are used in this piece of work and thereafter the images of the structure is acquired. The brief explanation of the heat treatment techniques utilized in this study for the sample preparation is as follows.
Annealing.-• Temperature of 800°C was used to anneal the specimen. • The specimen was kept at 800°C for an hour. • The furnace was turned off after the specimen had soaked for an hour so that the temperature would drop at the same rate as the furnace.
The specimen will be homogenized after being held at 800°C for an hour. 800°C is above A3 temperature, giving the specimen at that temperature enough time to become homogenized. After one day, when the furnace temperature had already approached room temperature, the specimen was removed. Normalizing.- • The specimen was heated to 8000 C in the beginning. • The specimen was left there for an hour.
• The furnace was turned off and the specimen was removed after the desired amount of soaking time.
• The specimen is now allowed to cool in a normal atmosphere, using air cooling to bring it to room temperature.
Normalizing is the process of heating a sample above the A3 temperature line and letting it cool naturally.
Quenching and tempering.-This is a significant experiment that was conducted with the intention of softening the material to some extent by heating to a moderate temperature range.
• Some of the specimens were heated to 800°C for an hour before being cooled in a water bath kept at room temperature.
• Some of the specimens among them were heated to 200°C for varying lengths of time-1 h, 1 1/2 h, and 2 h, respectively.
• Additional specimens were now heated to 400°C for the same lengths of time.
• The remaining specimens underwent the same heating at 600°C for 1 h, 1 1/2 h, and 2 h, respectively.
After the heat treatment the specimens were subjected to micro structural study using Optical Microscopy Study. The specimen size was taken as 10 mm diameter with 10 mm thickness. Before taking images, specimens were thoroughly polished by different grade papers and also by fine polishing machines. The samples taken for the study are named as S1(annealed), S2 (normalised) and S3 (tempered).

Clustering Methodology for Grain Size Determination
Clustering can be thought of as the most significant unsupervised learning problem for discovering a structure in a set of unlabeled data. The act of grouping objects into units that have similarities among their members could be described as clustering. Therefore, a cluster is a group of items that are "similar" to one another and "dissimilar" to those in other clusters.
The proposed approach yields microstructure images of detail grain structures with their defined boundaries which thereafter enable further study of the material structure to be optimized for statistical measurements of average grain size. This process is explained through the block diagram in Fig. 1.
With the widespread use of digital imaging in metallographic analysis today, the quality of digital microstructure images becomes an important issue. To achieve the best possible detection, it is important that the optical microstructure images be sharp, clear, and free of noise and artifacts. While the technologies for acquiring digital optical microstructure images continue to improve, resulting in images of higher and higher resolution and quality, noise remains an issue for many such images. Removing noise in these digital images remains one of the major challenges in the study of optical microstructure imaging. 10 Noise is introduced in the images due to various reasons. In optical imaging, noise degrades the quality of images. This degradation includes suppression of edges, blurring boundaries etc. 11 Image de-noising has become an essential exercise in such cases. In recent years, technological development has significantly improved in analyzing optical microstructure images. Image enhancement has attracted much attention during the detection process. Enhanced images are desired by the proposed segmentation approach to detect the boundaries of the grains present in the microstructure images.
The proposed methodology for granule segmentation encompasses a preprocessing task of image enhancement in the spatial domain, which includes histogram processing and spatial filtering by virtue of wiener filtering on the microstructure image as depicted in Fig. 1. As a point processing method for image improvement, histogram equalization is applied in this case. Adjusting image intensities to improve contrast is done by a nonlinear point operation in image processing. Specifically, the intensity spectrum of the image is expanded to effectively distribute the most frequently utilized intensity levels.
In the proposed approach Wiener filter is used as a tool for image denoising in the preprocessing stage. The Wiener filtering is a linear estimation of the original image. 12 The important use of Wiener filter is to reduce the amount of noise present in an image by comparison with an estimation of the desired noiseless signal. It is based on a statistical approach. The Wiener filter minimizes the mean square error between the estimated process and the desired process.
Image segmentation (k-means clustering).-K-means is an example of unsupervised learning techniques that address the wellknown clustering problem. The method uses an a priori fixed number of clusters (let's say k clusters) to categorise a given collection of data. [13][14][15][16] The objective of this algorithm is to minimise a squared error function stated below. ∥ − ∥ is chosen as distance measure between a data point x j and the cluster centre c j is an indicator of the distance of the N data points from their respective cluster centres.
The following steps make up the algorithm: 1. Insert k points into the area that the objects in the cluster represent. These positions are the centroids of the first group.
2. Assign each item to the group whose centroid is closest to it. 3. Recalculate the k centroids' positions once all of the items have been assigned. When the centroids stop moving, repeat Steps 2 and 3 once again. As a result, the items are divided into groups, from which the metric that needs to be minimised can be determined.
Image segmentation (fuzzy C-means clustering).-Image segmentation is a crucial stage in the processing of images. Pixels can be divided into backgrounds and foregrounds via segmentation. The segmentation technique used without supervision is clustering. Finding natural groupings of points in the data is the goal of data clustering. The clustering method groups the data associated with the same object based on the shared characteristics of the data. One of the well-known fuzzy clustering techniques is FCM. 17 Dunn initially proposed FCM in 1973. 18 Each data point is fuzzily assigned to each of the potential clusters via the FCM algorithm. The membership value linked to a data point determines whether it belongs to a specific cluster. It makes an effort to reduce the sum of square error.
The objective function for FCM is, where c is the overall number of cluster centres, p denotes the overall number of data points, m denotes the fuzziness index, and u ij denotes the fuzzy membership of the jth data point for the ith cluster centre.
Image segmentation (adaptive fuzzy C-means clustering).-The fuzzy c-mean clustering method is also changed in AFCM clustering. 19 However, in FCM, the fundamental approach is used to classify pixels without taking spatial information into account. For segmentation, spatial data is regarded as a crucial parameter. Combining the adjacent effect of the classified pixel with the flaw is one way to suppress it. Numerous statistic estimators can perform the same task.
There are two statistical decision descriptors for spatial configuration, and they are as follows: (i) The standard deviation (σ) that describes as the dynamic distribution of the pixel that is being classified.
Here x is the input image.
(ii) The knn that describes as the number of nearest neighbors in context of grey level with respect to the considered pixels.
Here ST is the chosen threshold based on the experimental values.
A new similarity distance is introduced which uses a dynamic and weighted distance obtained from the Euclidian distance.
Here D is the bi-dimensional distance considering the both GL and spatial feature. In this the weight p j permits to constraint the significance of both feature of the pixel x j cluster. If p j is having higher value then we consider the spatial feature or else we consider the grey level feature.

Result and Discussion
MATLAB has been used to implement the suggested algorithms. The results are shown below in Fig. 2. The effectiveness of different image segmentation methods is examined and discussed. Image segmentation is a challenging concept to quantify. There isn't a standard algorithm for segmenting images. The effectiveness of the image segmentation could be evaluated statistically. 20,21 The performance is assessed using the rand index (RI), global consistency error (GCE), boundary displacement error (BDE), and variations of information (VOI). The following section provides a full explanation of the RI, GCE, BDE, and VOI parameters along with formulae.
Rand index (RI).-Rand index parameter between the obtained clustered image and its ground truth is determined by computing the percentage of paired pixel whose labelling is consistent, which averages numerous ground truth segmentations. 20 The RI measure compute the similarity between the two clustered image i.e. the proposed clustered image and its ground truth.
Given a collection of n pixels and two partitions of S to compare, the following are defined: (i). how many pairs of pixels in S belong to the same set in both M and GT. (ii). how many pixels in S are found in two different sets, i.e., M and GT. (iii). how many sets of M but distinct sets in GT include at least one pair of S elements Figure 2. Results of S1, S2 and S3 after image processing.
(iv). how many elements in S have different sets in M but the same set in GT.
Where M is the obtained clustered image and GT is the ground truth of the input image. The Rand index (R) is, C+D represent the number of agreements between M and GT, and E+F represent the number of conflicts between M and GT. The minimum value of RI is 0 and the maximum value is 1. When there is no agreement between the two clustered images on any pair of points, the RI value is 0, whereas RI value is 1 when they are equal.
Variation of information (VOI).-VOI measure is defined as the amount of unpredictability in a clustered image which cannot be measured by the other image by calculating the average conditional entropy of one segmentation given the other. 20 Consider two clusters (the partition of a set into multiple subsets) A and B, where , , ......, The VOI between two clusters is: In this case, the entropy of A is H(A), and A and B's mutual information is I (A, B). If the other clustering is given, the uncertainty of one clustering is lost, and this is the mutual information of two clustering.
Global consistency error (GCE).-The GCE calculates how closely one segmentation can be compared to another. 20 Related segmentations are viewed as consistent because they might depict the same segmented result at different scales.
Simply dividing an image's pixels into sets is segmentation. The segments are sets of pixels. In the refinement area a pixel is present and if one segment is a proper subset of the other, the GCE is considered as 0.
The two segments overlap inconsistently if there is no subset link. The GCE is expressed mathematically as: i i Where, s 1 and s 2 are two segments that includes pixel pi, the GCE measure generates a real valued output within the range of 0 and 1.
Boundary displacement error (BDE).-BDE measure difference between the nearest boundary pixels in one segmentation and the average displacement error of a pixel located at boundary. 20 The fuzzy relation is described by a membership function indicated u v , LA μ ( ) as. Using k means, FCM, and improved fuzzy c means algorithms, the proposed method was run on the three images, and the findings are displayed in Fig. 1. The performance evaluation of the proposed method with different statistical parameters are reflected in Table I.  Table II displays the average grain size of the respective data set that was considered. The segmentation strategy is superior if the RI value is larger and the GCE, BDE, and VOI values are lower. Table III shows the average grain size of the detected grains by virtue of adaptive FCM segmentationmethodology , which seems to be the best as compared to the other state of art methodologies.

Conclusions
This study's major objective was to examine the effectiveness of various clustering algorithms in identifying grain boundaries and then estimating the average grain size from microstructure images of the EN9 steel phases. It has taken two decades to establish methods for implementing digital image processing in the field of metallography. With the help of this research, it will be possible to automatically identify grains in metals with precise grain boundaries. The foundation of a quantitative metallographic study is the edge detection and segmentation of the metallographical image. Cluster-based methods were presented for image segmentation based on the characteristics of the metallographical images. In various microstructural images of EN9, clustering approaches such k means, fuzzy c means, and adaptive fuzzy c means were investigated. The segmentation parameters RI, GCE, VOI, and BDE are used to evaluate the performance of the suggested algorithms. The computational outcomes demonstrated that, despite taking less time, K means image segmentation produces subpar results. While the classic FCM takes more time and produces good results, the adaptive FCM algorithm takes less time and produces good results. The adaptive FCM method outperformed the other proposed algorithms in terms of performance accuracy and higher convergence rate, according to the computational results.
The experimental results showed that this method is very effective. Images evaluated using this method have extracted boundaries that are more continuous and smoother, with fewer discontinuous points, compared to images analyzed using the conventional edge detection method, which have less boundaries lost, excessive, or erroneous. Furthermore, they don't contain a double border, making the boundary localization more precise. The outcomes of the quantitative metallographic study will be enhanced by everything mentioned above. Consequently, this technique is one of the crucial techniques for processing metallographical images.