원시데이터 수집 시스템
선정목록으로

Detection and Classification of Surface Defects on Hot-Rolled Steel using Vision Transformers

관련 필름·전자재료 · (13) 프리즘 필름

기본 정보

저자
  1. Vinod Vasan — School of Mechanical Engineering (SMEC), Vellore Institute of Technology Chennai Campus, Vandalur Kelambakkam Road, Chennai, 600127, India.
  2. Naveen Venkatesh Sridharan — Division of Operation and Maintenance Engineering, Luleå University of Technology, 97187, Luleå, Sweden.
  3. V. Sugumaran — School of Mechanical Engineering (SMEC), Vellore Institute of Technology Chennai Campus, Vandalur Kelambakkam Road, Chennai, 600127, India.
  4. Mohammadreza Aghaei — Department of Ocean Operations and Civil Engineering, Norwegian University of Science and Technology (NTNU), 6009, Ålesund, Norway.|||Department of Sustainable Systems Engineering (INATECH), University of Freiburg, 79110, Freiburg, Germany.
DOI
10.1016/j.heliyon.2024.e38498
저널
Heliyon
발행년도
2024
발행기관
Elsevier BV
피인용수
10
라이선스
cc-by-nc-nd
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1016/j.heliyon.2024.e38498
토픽
Surface Roughness and Optical Measurements
OpenAlex ID
W4403097855

평가 내용

관련도
관련
사업분야
필름·전자재료 · (13) 프리즘 필름
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > 프리즘 필름' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

This study proposes a vision transformer to detect visual defects on steel surfaces. The proposed approach utilizes an open-source image dataset to classify steel surface conditions into six fault categories namely, crazing, inclusion, rolled in, pitted surface, scratches and patches. The defect images are first subject to resizing and then fed into a vision transformer subject to different hyperparameter configurations to determine the most optimal setting to render highest classification performance. The performance of the model is evaluated for different hyperparameter configurations, and the most optimal configuration is examined using the associated confusion matrices. It was observed that the proposed model presents a high overall accuracy of 96.39 % for detection and classification of steel surface faults. The study presents a descriptive insight into the vision transformer architecture and in addition, compares the performance of the current model with the results of other approaches suggested for application in literature. Vision transformers can serve as standalone approaches and suitable alternatives to the widely used convolution neural networks (CNNs) by actuating complex defect detection and classification tasks in real-time, enabling efficient and robust condition monitoring of a wide range of defects.

본문 91,541자

본문 펼치기
y ( ) Contents lists available at ScienceDirect # Heliyon [journal homepage: www.cell.com/heliyon](https://www.cell.com/heliyon) Research article ## Detection and classification of surface defects on hot-rolled steel using vision transformers Vinod Vasan <sup>a</sup>, Naveen Venkatesh Sridharan <sup>b</sup>, Sugumaran Vaithiyanathan <sup>a</sup>, Mohammadreza Aghaei <sup>c,d,*</sup> a _School of Mechanical Engineering (SMEC), Vellore Institute of Technology Chennai Campus, Vandalur Kelambakkam Road, Chennai, 600127,_ _India_ b _Division of Operation and Maintenance Engineering, Luleå University of Technology, 97187, Luleå, Sweden_ c _Department of Ocean Operations and Civil Engineering, Norwegian University of Science and Technology (NTNU), 6009, Ålesund, Norway_ d _Department of Sustainable Systems Engineering (INATECH), University of Freiburg, 79110, Freiburg, Germany_ A R T I C L E I N F O _Keywords:_ Deep neural network Vision transformers Automated defect identification Steel surface defects Non-destructive testing Non-contact testing 1. Introduction A B S T R A C T This study proposes a vision transformer to detect visual defects on steel surfaces. The proposed approach utilizes an open-source image dataset to classify steel surface conditions into six fault categories namely, crazing, inclusion, rolled in, pitted surface, scratches and patches. The defect images are first subject to resizing and then fed into a vision transformer subject to different hyperparameter configurations to determine the most optimal setting to render highest classifi­ cation performance. The performance of the model is evaluated for different hyperparameter configurations, and the most optimal configuration is examined using the associated confusion matrices. It was observed that the proposed model presents a high overall accuracy of 96.39 % for detection and classification of steel surface faults. The study presents a descriptive insight into the vision transformer architecture and in addition, compares the performance of the current model with the results of other approaches suggested for application in literature. Vision transformers can serve as standalone approaches and suitable alternatives to the widely used convolution neural networks (CNNs) by actuating complex defect detection and classification tasks in real<u>time, enabling efficient and robust condition monitoring of a wide range of defects.</u> Effective metal quality inspection methodologies are crucial for the identification and addressal of critical flaws to prevent the end effects of catastrophic mechanical failures. Defective metals are unsuitable for use in their intended applications due to the deviations from product requirements and the potential hazards they pose to the environment and consumer safety. Steel, being a versatile and essential material for structural purposes, plays a vital role in the economic development of globalized nations. With crude steel production surpassing 1870 million tonnes globally for the year 2019 [1] and 1950 million tons in 2021, the steel industry ranks as the second-largest energy consumer on the global industrial front. Steel is favored for mechanical structural applications due to its desirable properties such as weldability, formability, corrosion resistance, machinability, recyclability, low production cost and - Corresponding author. Department of Ocean Operations and Civil Engineering, Norwegian University of Science and Technology (NTNU), 6009, Ålesund, Norway. _E-mail address:_ [mohammadreza.aghaei@ntnu.no](mailto:mohammadreza.aghaei@ntnu.no) (M. Aghaei). [https://doi.org/10.1016/j.heliyon.2024.e38498](https://doi.org/10.1016/j.heliyon.2024.e38498) Received 10 February 2024; Received in revised form 22 August 2024; Accepted 25 September 2024 Available online 3 October 2024 2405-8440/© 2024 The Author(s). Published by Elsevier Ltd. This is an open access article under the CC BY-NC-ND license [( http://creativecommons.org/licenses/by-nc-nd/4.0/ ).](http://creativecommons.org/licenses/by-nc-nd/4.0/) _y_ _(_ _)_ comparatively high energy efficiency in extraction. Structural materials such as steel are not exempt from surface and sub-surface defects due to various factors involved in its pro­ duction, handling, and operational processes. Surface defects, including crazing, inclusions, and scratches, are commonly observed in steel, and must be detected early on. The increasing stringency of customer requirements for dimensional accuracy reaching micronlevel precision necessitates strict adherence to such standards to ensure the long-term operational sustainability on part of both the manufacturers and customers. Minimizing rejections of manufactured components before distribution is crucial to avoid economic disadvantages for production enterprises. Monitoring the quality of manufactured steel allows for the assessment and evaluation of the robustness and refinement of the manufacturing processes within the production facility. Metal defects can arise from inherent issues in the base material or as a result of faulty operations along the production lines. Therefore, quality inspection processes, particularly non-contact and non-destructive testing (NDT) based inspection approaches, are pivotal in ensuring adherence to quality standards, safety parameters, and customer commitments regarding overall product batch quality and quantity. In a highly competitive market with a near-perpetual requirement for raw materials to cater to increasing consumer needs, time is of the essence. Thus, it becomes essential to achieve near-instantaneous results in product quality inspection and promptly execute corrective measures using auto­ mated inspection approaches. This in turn minimizes production and distribution lead time which is particularly crucial for widely used materials like steel. To promote the transition of conventionally employed inspection methodologies into automated strategies, a significant amount of research has been focused on condition monitoring by leveraging the benefits of Artificial Intelligence (AI) in metal inspection techniques. AI-based approaches offer faster and more reliable inspection of metallic raw materials and finished products, overcoming manpower shortages, reducing human errors in classification and enabling the detection of even minute defects. Machine learning algorithms such as Support Vector Machine (SVM), Random Forest and Extreme Learning Machine (ELM), and deep learning models such as Generative Adversarial Networks (GANs), Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) have been employed for metal defect detection and classification. Specifically, deep learning models possess the ability to adapt and classify new input data without the need for human supervision, even after the training phase. Deep learning models offer additional and enhanced decision-making capabilities even when faced with limited availability of data. By leveraging the strengths of deep learning such as its adaptive nature and resemblance to human cognition, the limitations of pure machine learning algorithms can be addressed in the context of defect inspection. Thus, deep learning models are also increasingly adopted in the field of defect inspection, especially in the metallurgical field to enable computationally optimal, faster, diverse and more robust defect classification. Numerous solutions have been explored and recorded by the scientific community to detect metal defects using machine learning and deep learning approaches as explained herewith. Keesug et al. adopted a line scan camera and linear light source to perform defect detection of rolled steel (POSCO steel rolling strip surface inspection system). This identification and classification of six types of rolled steel strip defects were executed using a multi-class Support Vector Machine algorithm coupled with image processing techniques, thereby resulting in a classification accuracy ranging from 87 % to 94 % [2]. A Process Knowledge-based Multi-class Support Vector Machine (PK-MSVM) classification approach for surface defect detection in hot rolled steel was proposed by Agarwal et al. in 2011 which achieved a minimum error rate of 9.2 % [3]. A framework for the detection of surface defects using Scale Invariant Feature Transform (SIFT) and voting strategy with SVM for feature extraction was proposed in 2012 by Suvdaa et al. [4]. Line scan cameras with adaptive local binarization coupled with Discrete Wavelet Transformation (DWT) strategy was advocated by Yun et al. in 2014 to filter out noise from image backgrounds and isolate defects. The performance of this system over 1550 defect images was found to reach 84.7 % as a result of the classification process [5]. In 2016, a genetic algorithm coupled with mathematic morphology-based binarization method for strip steel defect image with non-uniform illumination was explored by Liu et al. [6]. The classification of surface defects in large-scale strip steel image collection was attempted by Hu et al. using a hybrid chromosome genetic algorithm-based approach [7]. Huang et al. examined an intelligent defect detection system for metal products through the use of a GAN architecture in 2018 [8]. The detection of defects in industrial road networks was investigated by Wan et al. via the proposal of an anti-noise dual branch network (ADNet) in 2024 [9]. In 2020, Ryu et al. attained 92.68 % accuracy of classification during the detection of corner crack defects in steel billets using wavelet reconstruction and SVM classifier as part of an examination of adaptive filter parameter selection. This selection was implemented over histogram and morphological features after image segmentation, wavelet transformation (DWT) and wavelet reconstruction followed by enhanced binarization sequentially [10]. The identification of Friction-Stir Weld (FSW) defects on metal surfaces was executed by Praveen et al. in 2021. This involved adopting a fusion of machine vision and classifier-based strategies in which discriminant analysis and nearest neighbor approaches were implemented, resulting in commendably high classification ac­ curacy [11]. Deep learning models such as Single Shot Detector (SSD), Faster-CNN and You Only Look Once (YOLO) were utilized as part of an image-data assessment approach strategy by Lin et al. This was carried out in 2021 as part of a comprehensive combined image-data assessment approach strategy for metal surface defect detection [12]. In 2022, two computationally progressive ap­ proaches were presented for prospective applications along the lines of steel and casting defect inspection. Tian et al. proposed the DCC-CenterNet – a rapid detection method for steel surface defects executed over the GC10 DET steel sheet surface defect dataset [13]. The prediction and detection of surface defects on metal castings collected from steel and cast-iron industries was implemented through data driven models developed by Chen et al. [14]. Evidently, machine and deep learning algorithms are indeed prospective implementations well suited for handling numerical data with high accuracy of results for applications that aim at solving diverse challenges [15]. A novel approach encompassing an aggregation network with contextual awareness (CANet) for the detection of surface defects in general was proposed by Wan et al., in 2023 [16]. The application of vision transformers in the detection of metal defects at large and steel surface defects in particular has been gaining attention gradually in recent years. Vision transformers, also known as ViTs, are deep learning models that apply transformer _y_ _(_ _)_ architectures to process visual data. Traditionally, CNNs have been widely used for computer vision tasks, including defect detection in steel surfaces as mentioned above. However, vision transformers offer a more promising alternative by leveraging the self-attention mechanism present in transformers, which allows them to capture global relationships within an image. In the context of steel sur­ face defect detection, vision transformers have shown great potential. They can effectively learn representations from images, enabling the detection of subtle defects and complex patterns on steel surfaces. The self-attention mechanism in vision transformers enables the model to focus on relevant regions of the image, facilitating the identification of defects and distinguishing them from normal regions. The implementation of vision transformers for steel surface defect detection offers several advantages. More specifically, in a Vision Transformer (ViT), A self-attention mechanism is implemented in ViT by dividing an image in patches followed by their embedding into vectors. These embeddings are passed through transformer layers where the multi-head self-attention mechanism computes re­ lationships between all patches by creating Query, Key, and Value matrices. The attention scores, derived from the dot product of Query and Key, determine how much each patch should focus on others. The weighted sum of Values gives a self-attended repre­ sentation, which is then processed through a feed-forward network. Vision transformers can capture global context information in an image allowing for better understanding of complex defect patterns. Additionally, ViTs can generalize well to unseen defects and adapt to different lighting conditions and viewpoints. The ability of ViT to learn from large-scale datasets also facilitates avenues for transfer learning in which pre-trained models can be fine-tuned on smaller, domain-specific datasets to improve performance. The potential benefits of vision transformers are realized in multiple fields including the biomedical domain for classification of brain tumour [17], retinopathy [18], femur fracture classification [19], COVID-19 screening using radiography [20] and even skin cancer classification via medical vision transformers [21]. Deploying vision transformers in industrial visual inspection domains has been proved feasible by means of a comparative overview with CNN networks performed by Hütten et al. in 2022. This study was suggestive of the capability of ViTs to not only exhibit equivalent performance as that of CNN networks with sparse data but also surpass them in progressively complicated classification tasks [22]. A versatile vision transformer (‘crossformer’) based on cross scale attention was proposed by Wang et al. that aims at compensating for the general drawback of compromising on small scale features of embeddings to lower the resource requirements of self-attention modules. This was actuated through the proposal of a self-bias mechanism to make the popular relative position bias apply to variable sized images as well [23]. In 2022, a culmination of sequential advancements in the adoption of the transformer architecture for use in industry-grade fault diagnosis presented promising paths for real-time application. A Siamese vision transformer for bearing fault diagnosis was developed and examined by He et al. [24]. This approach involved a combination of the Siamese network and vision transformer deployed over the Case Western Reserve University and Paderborn dataset, achieving higher mean classification than Siamese CNNs, Hierarchical Convolutional Autoencoder (HCAE) and Wide Deep Convolutional Neural Networks (WDCNNs). A defect detection model for industrial products based on attention and knowledge distillation over four public industrial defect detection datasets including steel surface defects was examined by Zhang et al. [25]. Crack identification of cottonseed using air coupled ultrasound with sound to image encoding and a light weight ViT to constitute sound features was proposed by Zhang et al. that yielded 90.7 % classification accuracy [26]. MSFT-YOLO – an improved YOLOv5 model based on transformer structure for steel surface defect detection rendered commendable precision of classification upon examination by Guo et al. [27]. CAS-VSWIN transformer – a Variant-SWIN transformer for surface defect detection was an improved transformer design explored by Guo et al. which strengthened feature transfer between windows and made the framework more capable of serving as a backbone for efficient surface defect detection in industrial environments [28]. Zhang et al. proposed a novel approach modelling rail sample backgrounds in view of paucity of rail defect information in public repositories, rendering an effective inspection model via a memory linked metric learning of anomalies [29]. A comprehensive review of the performance of contemporary machine learning models for the purposes of steel surface defect detection was also undertaken comprehensively by Wen et al., in 2022, bringing out the importance of developing diagnostic solutions for critical material inspection [30]. The detection of defects on steel surfaces also finds applications of the transformer approach. Lu et al. proposed a vision transformer approach for the detection of defects on rails over rail defect B-Scan image data rendering just over 90 % model accuracy [31]. An overall accuracy of 96.25 % was attained for classification on four widely used hyperspectral datasets using a Convolutional Autoencoder (CAEVT) with lightweight vision transformer for hyperspectral image classification by Zhang et al. [32]. End to end steel surface defect detection approach via SWIN Transformer using Feature Pyramid Networks (FPN) and Region Proposal Networks (RPN) to achieve 81.1 % mAP was performed by Tang et al. [33]. The defect detection and classification of strip steel based on improved VIT Model (SFN VIT – Improved Shuffle Network Unite Vision Transformer) over NEU-CLS dataset (Tohoku University strip steel surface Table 1 <u>Contemporary studies on metal surface defect detection and classification.</u> <u>Application</u> <u>Reference</u> Visual Inspection System (VIS) of steel rails using DLBP. [36] Multispectral vision sensing fusion system for non-destructive defect detection [37] Surface defect detection of gun barrels using machine learning algorithms. [38] Unsupervised Haar-Weibull Variance model for steel defect detection [39] Casting defect detection using K-Means partitioning for image segmentation. [40] Galvanized stamping part defect detection using full CNN. [41] Multi-label classification of steel surface defects using transfer learning and vision transformers [42] Detection of Surface Defects on Strip Steel using Multiscale Interactive Network (MINet) [43] <u>Railway inspection system using electromagnetic and thermographic sensing approach</u> <u>[44]</u> _y_ _(_ _)_ defect categories dataset) was performed by Xing et al. rendering 91.7 % average classification accuracy [34]. Defect-aware trans­ former network for intelligent visual surface defect detection was proposed by Shang et al. to classify physically induced blade and tool wears through custom datasets [35]. An overview of additional contemporary works including studies that involve the use of transformer architecture is presented below in Table 1. The following inferences could be derived from the literature works examined above. (i) Scarcity of publicly accessible datasets specifically tailored for condition monitoring tasks can hinder the development and evaluation of machine learning or deep learning models for defect classification or condition monitoring. Having access to diverse and labeled datasets is crucial for training accurate and robust models that can effectively detect and classify defects. This is particularly critical for condition monitoring applications involving important structural materials such as steel. This in turn necessitates custom data set collection and strategies such as data augmentation which is resource and time consuming. (ii) The implementation of vision transformers as potential alternatives to conventional CNN models is still in its nascent stages of development and application. The field of condition monitoring needs architectures that provide robust classification accuracy with ease of implementation for large scale, user intuitive applications which consume minimal computational time and resources. (iii) The total number of works that implement the transformer architecture in a field as demanding and critical as structural and mechanical condition monitoring is highly limited. Of these, there are but few or no precursors to the current study which implements the identification of catastrophic surface defects using transformers, let alone vision transformers. (iv) The development of a progressively optimized transformer model which can achieve steel surface defect classification with a high degree of accuracy whilst analyzing the impact of each hyperparameter on the overall model performance is a critical aspect. This governs the further development and progress of the current model and other approaches which may be based on the current study. In lieu of this constraint, few studies present an optimization roadmap which clearly establish the most optimal set of hyperparameters that constitute a given transformer architecture in addition to the logical reasoning behind the selection of such a configuration. (v) The classification accuracies attained through careful examination of available transformers and other DNN approaches as examined earlier were found commendable. However, the primary objective of instantaneous and robust defect detection can be achieved only if the system under development exhibits very little or no margin for error under prolonged operation conditions. (vi) The evaluation of different transformers and Deep Neural Network (DNN) approaches for defect classification yielded commendable results in terms of classification accuracies. These findings indicate that these models are capable of accurately categorizing defects based on the available data. (vii) However, it is crucial to recognize that achieving accurate classification is just one aspect of the broader objective of defect detection in real-world scenarios. In practical applications, it is equally important for the system to exhibit a high level of robustness and reliability during prolonged operation conditions. When a defect detection system operates continuously over extended periods, it may encounter various challenges such as changes in environmental conditions, variations in defect pat­ terns, or fluctuations in input data quality. To ensure reliable defect detection under such circumstances, the system should be designed to minimize or ideally eliminate any margin for error. (viii) Having very little or no margin for error means that the system should be highly resilient to noise, variations, or uncertainties that may arise during prolonged operation. It should be capable of maintaining a consistently high level of accuracy and performance, regardless of changing conditions or potential disturbances. Achieving this level of robustness requires careful consideration of various factors during the development process. It may involve implementing advanced techniques such as data augmentation, regularization, ensemble learning, or utilizing appropriate error handling mechanisms. Additionally, thorough testing and fine-tuning of the model and system parameters are essential to ensure optimal performance and reliability. This study focuses on the development of a specialized model for robust steel surface defect detection that attempts to rectify the aforementioned challenges. This model adopts a transformer-based approach known as vision transformers (ViT), and incorporates data augmentation techniques to enhance its performance and resilience. The model utilizes vision transformers which have emerged as a powerful architecture in the field of computer vision. Unlike traditional convolutional neural networks, vision transformers leverage self-attention mechanisms to capture long-range dependencies in images. By adopting ViT, the model aims to effectively learn and represent complex patterns and relationships within the steel surface images, improving the accuracy of defect detection. Data augmentation techniques are employed to augment the available training data. By applying transformations such as rotations, translations, flips, or introducing noise, the model generates additional augmented samples. Training on augmented data helps the model generalize better and become more robust to variations, enhancing its ability to detect defects accurately even in the presence of environmental or operational changes. The combination of the specialized ViT architecture and data augmentation techniques enables the proposed model to achieve robust steel surface defect detection. This approach addresses the limitations of traditional methods by leveraging the power of transformers and enhancing the model ability to generalize from limited training data. By utilizing ViT and data augmentation together, the model aims to provide accurate and reliable defect detection results, improving the efficiency and effectiveness of condition monitoring systems in industrial settings. Thus, the technical contributions of the paper have been presented herewith. _y_ _(_ _)_ 1. A vision transformer was developed for detection of six primary types of steel surface defects, namely, crazing, inclusion, rolled in, pitted surface, scratches, and patches. 2. The image data set deployed for this study was obtained from the open-source repository Northeastern University (NEU-DET) surface defect dataset. 3. The feasibility of transformer architecture application in general and vision transformers for defect detection on hot rolled steel surfaces in specific is examined and particularly evaluated statistically in this paper. 4. An overview of crucial hyperparameters and the impact each parameter has on the performance of the classification model is further presented in this study for background analysis. Result interpretation in terms of overall classification performance metrics and a complete breakdown of the confusion matrix obtained to mark the performance of the optimally configured vision trans­ former model proposed in this body of work. 5. The classification performance of the proposed model for different hyperparameter configurations varied sequentially and logically is evaluated against the performance accuracy of the same model for the most optimal hyperparameter configuration proposed in the study as well. 6. A comparative analysis of the classification results obtained in this study is performed with those of contemporary approaches and inferences are successively drawn. The computational performance and requirements of the developed approach are comparatively analyzed and elucidated in this body of work. The objective of this body of work is to examine and present a vision transformer-based approach that can efficiently detect and classify the different types of defects that may arise on structural steel surface. The outline of this work is as follows. Section 2 provides a description of the experimental procedure advocated in this study, an overview of the different types of steel surface defects being detected and classified, and the methodology adopted for the purposes of this study. Section 3 presents a detailed understanding of vision transformers and their suitability for implementation in the defect identification and classification domain, as an extension of the elaboration presented above in Section 1. A detailed analysis of the critical hyperparameters that have a considerable impact on classifier performance is thereafter presented in Section 4. This is followed by an examination of the experimental results which are presented for each range of hyperparameter variations in Section 5 in addition to a note on the current, most optimal model hyper­ parameter settings, training, and performance analysis presented in Section 6. Section 6 compares the results obtained from the proposed model with existing works spanning steel surface defect detection. This evaluation showcases the advancements and su­ periority of the current model. Section 7 concludes the paper by summarizing the proceedings, findings and highlights the contri­ butions of the proposed model in addition to discussing the implications of the current research. Fig. 1. Process-flow of proposed Vision Transformer (ViT) model for classification of NEU-DET Steel Surface Defect Image Data for a representative defect image sample. _y_ _(_ _)_ 2. Experimental process The transformer-based approach proposed in this study classifies the current metallic surface state into one of six different fault categories. A descriptive overview of the experimental setup, data acquisition, operational procedure, and an insight into the various types of surface defects that may arise in hot rolled steel is presented in this section. Fig. 1 presents the general process flow that constitutes the structure and execution approach of the proposed model. _2.1._ _Preliminary experimental quantifications_ The Keras API from the TensorFlow library in Python was utilized to develop the proposed vision transformer model, which was executed on the Google COLAB cloud computing platform using the integrated COLAB cloud graphical processing unit (virtual-GPU). The dataset used for training and testing the model consisted of images depicting various types of surface defects found in hot-rolled steel strips, sourced from the NEU-DET open-source repository. This dataset contains a total of 1800 grayscale images, with 300 samples available for each of the six surface defect categories. To divide the images for training and testing purposes, the 300 sample images within each defect class were further split in a ratio of 0.8:0.2. Thus, 80 % (240 images) were assigned for training, while the remaining 20 % (60 images) were allocated for testing in each class. The proposed Vision Transform model for the detection of defects on hot-rolled steel was trained with data from the ground up. _2.2._ _Surface defects on steel_ Surface defects refer to superficial irregularities found on steel surfaces, which can occur due to inadequate material milling or subsequent post-milling processes. Major factors contributing to steel defects include external damage and unevenness in roll-milling, resulting in detrimental impacts on the acceptability of steel units intended for consumer distribution. Fig. 3 below represents a steel sample without featuring any of the six defects as presented from (a)–(f) in Fig. 2 of Section 2.1. With due reference to Fig. 2 in Section 2.1, in accordance with the classification objectives of the current study and model, Table 2 provides a comprehensive list of commonly observed surface defects in steel. Furthermore, an exhaustive elaboration on the physical constitution and morphological analysis of the different types of defects that may arise in stainless steel was performed by Konovalenko et al., in 2021. This body of work further presented a commendable classifier performance of around 91 % for different defect images as well [45]. Fig. 2 presents sample images representing each class of steel surface defects that are input for classification by the ViT model. _2.3._ _Experimental procedure_ Images from different classes (pitted surface, scratches, rolled-in, patches, inclusion and crazing) are converted to RGB format and Fig. 2. Representative images of six steel surface faults (a–f) utilized for training the model. _y_ _(_ _)_ Fig. 3. A steel surface sample without any defect such as pitted surface, scratch, roll-in, patch, inclusion or crazing. Table 2 <u>Typical defects that can arise on hot-rolled steel surface.</u> S. <u>No.</u> Defect Type Cause of defect Effect on Manufactured Components 1 Crazing [46] High tensile stress on metal surface Visual crack development on surface leading to structural and substructural failure 2 Pitted Corrosion resulting in cavities or ‘holes’ on metal surfaces. Structural damage and possible failure of entire component Surfaces Corrosion resulting in cavities or ‘holes’ on metal surfaces. Structural damage and possible failure of entire component 3 Scratches [47] 3 Scratches Micro-crevices induced due to abrasive operations on metal Visual unacceptability and probability of expansion into fracture-like [47] surface. dimensions leading to further quality compromise. 4 Rolled In Non-uniform rolling temperature and uneven rolling of steel Surface irregularity and biased grain flow leading to reduction of strips. structural strength. Micro-crevices induced due to abrasive operations on metal surface. 4 Rolled In Non-uniform rolling temperature and uneven rolling of steel Surface irregularity and biased grain flow leading to reduction of strips. structural strength. 5 Patches Deposition of oxides on corrosion-prone zones of base metal. Greater rejection rate of produced pieces due to reduced surface finish quality and reduced mechanical strength. 6 Inclusion Metallic oxides and sulfides crystallize into phases different Adversely impact and reduce mechanical, and structural integrity. <u>[48]</u> <u>from steel during solidification of base metal.</u> Metallic oxides and sulfides crystallize into phases different <u>from steel during solidification of base metal.</u> Adversely impact and reduce mechanical, and structural integrity. resized to a fixed size of 32 × 32 pixels. The data is thereafter split into training and testing sets following which hyperparameters such as learning rate, weight decay, batch size, number of epochs, image size, patch size, projection dimension, number of heads, trans­ former units, and MLP head units are defined. This is followed by data augmentation and creation of multilayer perceptron (MLP) layers with dropout regularization. Multiple layers of the transformer block are created, which consist of layer normalization, multihead attention, skip connections, and MLP layers. The final encoded representation is flattened and passed through MLP layers for classification. The model outputs logits, which are passed through a SoftMax activation during training and evaluation. The AdamW optimizer from the TensorFlow Addons library is used, which applies weight decay during optimization. The model is compiled with the sparse categorical cross-entropy loss function and evaluation metrics, such as accuracy and top-5 accuracy. Training is performed using the ′fit′ method, with the training and validation data, batch size, number of epochs, and a checkpoint callback to save the best model weights based on validation accuracy. After training, the model weights with the best validation accuracy are loaded. The model is evaluated on the test set using the ′evaluate′ method, and the accuracy and top-5 accuracy are printed. The predicted labels (′pr′) and true labels (′y_test′) are used to compute the confusion matrix which provides a visual representation of the model performance of classification. 3. Architecture of vision transformers (ViTs) Vision transformers (ViTs) have emerged as a notable category of deep learning models in the field of computer vision challenging the dominance of convolutional neural networks (CNNs) in image classification tasks. Rather than relying on CNNs, ViTs propose a different approach inspired by self-attention mechanisms commonly used in natural language processing. Dosovitskiy et al. in 2020 _y_ _(_ _)_ introduced ViT and demonstrated its effectiveness in image classification [49]. The core of a ViT lies in the transformer architecture originally designed for natural language processing which consists of an encoder-decoder framework with self-attention mechanisms. Self-attention enables the model to weigh the importance of different input elements when generating representations. In ViTs, the key component is the transformer encoder. To apply transformers to images, the first step is to convert the two-dimensional spatial input into a one-dimensional sequence of tokens through tokenization. Each token represents a patch of the input image, and the tokens are reshaped into a sequence. To encode spatial information, positional embeddings are added. Additionally, a linear projection is applied to each patch independently to convert them into meaningful representations known as "patch embeddings". Fig. 4 represents the patch distribution of a sample input steel surface defect image. Positional encodings play a vital role in incorporating the spatial layout information of the image into the tokenized sequence. These capture the relative and absolute po­ sitions of the tokens using functions such as sine and cosine with different frequencies. The tokenized sequence is processed by the transformer encoder, which repeatedly applies self-attention and feed-forward neural networks. Each transformer layer consists of a multi-head self-attention mechanism and a position-wise feed-forward network. The self-attention mechanism computes attention weights between each token and all other tokens in the sequence, allowing the model to capture dependencies and relationships among different patches. The attention weights are determined through a weighted sum of three linear projections: query, key, and value. These projections enable the model to compare the similarity between tokens and attend to relevant information, influencing the final output. ViTs present an alternative approach to image classification by leveraging self-attention mechanisms borrowed from natural language processing. They showcase their effectiveness through the encoder-decoder framework of the transformer architecture and the tokenization process. The self-attention mechanism plays a crucial role in ViTs by generating an attention matrix that represents the similarity scores between each pair of tokens. These scores are calculated by taking the dot product between the query and key vectors and scaling the result by the square root of the feature dimension. The attention scores undergo a SoftMax operation to normalize them into a probability distribution, ensuring that the weights sum up to 1. The values are then multiplied by the attention weights and summed up to obtain the weighted sum. To enable smooth gradient flow during training, residual connections are introduced around each sub-layer (attention and feed-forward networks) within the transformer encoder. Layer normalization is applied to normalize the intermediate representations. The feed-forward networks in the Transformer Encoder consist of two linear transformations with a non-linear activation function, typically ReLU, in between. These networks introduce a non-linear transformation to the outputs of the self-attention mechanism, enhancing the expressive power of the model. At the top of the transformer encoder, a classification head is typically added to produce the final class predictions. It consists of a linear layer followed by a SoftMax function to compute the class probabilities. ViTs are typically trained using supervised learning with a large, labeled dataset. The model is trained to minimize a suitable loss function such as cross-entropy loss. Stochastic gradient descent (SGD) or its variants are commonly used for optimization. To effectively train ViTs, a two-step process is often followed. In the pre-training phase, models are trained on large-scale datasets using self-supervised learning or unsupervised tasks such as image inpainting or colorization. In the fine-tuning phase, the pre-trained models are further fine-tuned on specific downstream tasks using labeled data. In simpler terms, vision transformers are a powerful alternative to Convolutional Neural Networks (CNNs) for image classification. They adapt the transformer architecture from natural language processing to process images. ViTs start by breaking the input image into patches and converting them into a sequence of tokens. Positional embeddings capture spatial information, and a transformer encoder processes the token sequence. This encoder employs self-attention to analyze relationships between tokens, allowing the Fig. 4. Bifurcation of sample input image into smaller patches for model input. _y_ _(_ _)_ model to understand image content. Residual connections and normalization ensure smooth training. Feed-forward networks add nonlinearity to enhance model capabilities. A classification head produces final predictions. ViTs are trained through supervised learning, minimizing a loss function with optimization methods like SGD. SGD is used to train a vision transformer because it efficiently handles the large number of parameters in these models and helps in generalization by introducing noise through small random batches during updates. This noise helps the model avoid overfitting and find better minima, making SGD particularly effective for training large-scale models like ViTs. Training involves pre-training on large datasets and fine-tuning on specific tasks with labeled data. ViT offers the following advantages over traditional deep learning and other CNN-based approaches which has motivated its adoption in the present body of work. (i) Increased Global Context: The self-attention mechanism allows ViTs to capture long-range dependencies in images, enabling them to understand global context better. (ii) Flexibility: ViTs can process images of arbitrary sizes since they operate on tokenized sequences. This flexibility eliminates the need for fixed input sizes and allows handling both large and small images. (iii) Translation Invariance: Unlike CNNs, ViTs do not rely on local convolutional filters, which makes them inherently translation invariant and eliminates the need for pooling operations. (iv) Cross-Modality Application: The tokenization process allows ViTs to handle various modalities, such as combining images and text, by treating them as different input channels. The implementation of vision transformers for steel surface defect detection typically involves several steps. First, a dataset of labeled images containing defective steel surfaces is collected. This dataset serves as the training data for the vision transformer model. The images are preprocessed, which may include resizing, normalization, and augmentation techniques to improve the model generalization capabilities. Next, the vision transformer model is constructed using transformer layers. The input images are divided into patches, which are then linearly embedded to generate a sequence of embeddings. These embeddings, along with positional encodings, are fed into the transformer layers, where the self-attention mechanism allows the model to capture global relationships between the patches. During the training phase, the model is optimized using appropriate loss functions, such as binary cross-entropy or focal loss, to differentiate between normal and defective regions. The model learns to classify the images and identify the presence of defects accurately. Training is typically performed on high-performance hardware, such as graphical processing units (GPUs) or tensor processing units (TPUs), to handle the computational complexity of vision transformers. Once the vision transformer model is trained, it can be deployed for defect detection in real-world scenarios. New steel surface images can be fed into the model, and it will analyze the images to identify and localize any defects present. The model predictions can be further post-processed to enhance the inter­ pretability of the results, such as generating bounding boxes around detected defects or generating defect severity scores. Vision transformers have emerged as a promising alternative to CNNs for image classification tasks, leveraging the power of self-attention mechanisms to capture long-range dependencies and global context in images. Principally, vision transformers provide a promising approach for the detection of steel surface defects. Their ability to capture global relationships in images and learn from large-scale datasets makes them well-suited for this task. With further research and advancements, vision transformers do have the potential to become a valuable tool in ensuring the quality and safety of steel materials. 4. Critical hyperparameters in deep learning networks In deep learning, hyperparameters are parameters that are set prior to the training of a model that can impact the model learning process. These parameters are not learned from the data but are instead specified by the user or model architect. Hyperparameters define the overall architecture and behavior of the deep learning model including its capacity, complexity, and generalization ability. Some common hyperparameters in deep learning include learning rate, number of layers, number of neurons per layer, activation functions, regularization parameters, batch size and dropout rate. The hyperparameters which are varied for the purpose of optimizing the classification performance of the proposed ViT model is highlighted herewith. _4.1._ _Learning rate_ The learning rate (LR) is a scalar value that determines the step size at which the model parameters are updated during the training process. It controls the magnitude of the parameter updates based on the gradients computed using backpropagation. The learning rate is a critical hyperparameter, as it influences the convergence and stability of the training algorithm. A higher learning rate allows for faster convergence but can cause overshooting, leading to unstable training. On the other hand, while a lower value of learning rate ensures stability and avoids overshooting, it may result in slow convergence or trapping at suboptimal solutions. _4.2._ _Batch size_ Batch size refers to the number of training examples processed in parallel during a single forward and backward pass of the neural network. In deep learning, training data is divided into mini-batches, and the model parameters are updated based on the average gradients calculated over each batch. The choice of batch size affects the training dynamics and computational efficiency. Smaller batch sizes enable more frequent parameter updates, leading to potentially smoother convergence trajectories. However, smaller batches can introduce noise due to the high variance in the gradient estimates, which may hinder convergence. Larger batch sizes offer _y_ _(_ _)_ more accurate gradient estimates and take better advantage of parallel processing which can speed up training. However, larger batches may converge to flatter minima or require more memory and computational resources. _4.3._ _Patch size_ Patch size is primarily used in convolutional neural networks (CNNs) for image processing tasks. It represents the dimensions of the receptive field, which is the local region of the input image that each convolutional kernel examines. The patch size determines the spatial extent of information considered by the network. Larger patch sizes capture more global features and provide a broader context for understanding the input. However, they may result in reduced spatial resolution and the loss of fine-grained details. Smaller patch sizes capture more local and detailed information however may struggle to capture global relationships and large-scale structures. The choice of patch size depends on the characteristics of the dataset and the complexity of the underlying patterns. _4.4._ _Number of heads_ The number of heads is a hyperparameter commonly associated with attention mechanisms, notably in the transformer archi­ tecture. Attention mechanisms allow the model to focus on different parts of the input sequence when making predictions. The number of heads determines how many parallel attention mechanisms or "viewpoints" the model employs to attend to different aspects of the input. Increasing the number of heads provides more capacity for the model to capture diverse and fine-grained relationships within the data. Each head can learn different patterns or dependencies, enhancing the model ability to capture complex interactions. However, a higher number of heads also increases the computational complexity of the model and may require more memory and training data to generalize effectively. _4.5._ _Number of MLP layers_ Multi-Layer Perceptron (MLP) layers are fully connected layers that transform the input data using non-linear activation functions. The number of MLP layers determines the depth of the neural network. Deeper networks can learn more complex representations by capturing higher-order interactions and hierarchies of features. Each additional layer enables the network to model increasingly abstract and intricate patterns in the data. However, deep models are more prone to overfitting, especially when the training data is limited or when regularization techniques are not appropriately employed. Training deep models can also be computationally expensive due to the increased number of parameters and the need for more extensive computational resources. Optimizing these hyperparameters is crucial for achieving good performance in deep learning models. Typically, finding the optimal values involves a process of hyperparameter tuning, where different combinations of values are evaluated through techniques like grid search, random search, or more advanced methods such as Bayesian Optimization. Additionally, techniques like learning rate schedules, where the learning rate is adjusted during training, and techniques like batch normalization and regularization can help stabilize and improve the training process. The optimal choice of hyperparameters depends on the specific problem, dataset size, model architecture, and computational resources available. 5. Experimental results The current study evaluates the performance of the proposed defect detection and classification model based on transformer ar­ chitecture developed for diagnosing different surface defects of steel. The grey-scaled surface defect image data set obtained from the NEU-DET repository was initially pre-processed before being passed on patch-wise post-flattening for classification by the ViT model. This section focuses on highlighting the performance of the proposed model in addition to presenting a comparative overview of the model performance with contemporary techniques presented in literature. It is important to note that each label in the confusion matrices represent distinct defect types prevalent on hot rolled steel surfaces. In this study, label 0 represents scratches, label 1 represents crazing defect, label 2 represents inclusion defect, label 3 represents patch defect, label 4 represents pitted surface while label 5 represents rolled-in defect. _5.1._ _Impact and variation of learning rate_ In this study, the performance of the ViT model was evaluated for five different values of learning rates – 0.1, 0.01, 0.001, 0.0001 and 0.00001. The proposed model presents a relatively dispersed range of performance characteristics across the prescribed limits of learning rate values. The accuracies for different values of learning rates along with associated computational times have been sur­ mised in Table 3. Table 3 <u>Impact of learning rate on classifier performance.</u> <u>Learning rate</u> <u>0.1</u> <u>0.01</u> <u>0.001</u> <u>0.0001</u> <u>0.00001</u> Test Accuracy (%) 16.39 21.11 93.06 92.50 83.89 <u>Computational Time (s)</u> <u>815</u> <u>877</u> <u>813</u> <u>813</u> <u>835</u> _y_ _(_ _)_ The model under discussion exhibited the lowest classification accuracy of 16.39 % for a learning rate of 0.1 over a computational time of 815 s. On the other hand, the highest accuracy of classification is exhibited for a learning rate value of 0.001 at 93.06 % with effective computational model training time of 813 s. Evidently, for the learning rate of 0.001, the suggested model not only exhibits a drastically improved classification performance test accuracy statistic but also consumes a nominally shorter time for model training which establishes the robustness of the ViT architecture. Fig. 5 (a) represents the progressively increasing classification accuracy of the model for each of the learning rate values over 200 epochs of training. The model exhibits the second highest classification accuracy of 92.5 % for a learning rate value of 0.0001 over 813 s while the second lowest accuracy of classification was achieved for learning rate of 0.01 at 21.11 % over 877 s. An accuracy of 83.89 % was achieved for a learning rate of 0.00001 over 835 s of computation. Therefore, the most optimal learning rate value of 0.001 is suggested for implementation in the proposed model to attain the requisite degree of classification performance. This is in turn coupled with default patch size and batch size of 8, 4 heads and 8 MLP layers respectively. Additionally, Fig. 5 (b) suggests poor training and learning capabilities for learning rates of 0.1 and 0.01, and therefore exhibits high loss values for these learning rates as depicted in Fig. 5 (a) and 5 (b). The confusion matrix corresponding to the accuracies mentioned in Table 3 is presented below in Fig. 6. _5.2._ _Impact and variation of patch size_ The performance of the ViT model was evaluated over patch size values of 8, 16, 32 and 64 for a learning rate value of 0.001. An overview of the classification accuracies presented by the suggested model is provided below in Table 4. The highest performance was achieved for a patch size of 8 at 93.89 % classification accuracy over 918 s of computational time while the least performance was achieved over 813 s of computation for a patch size of 32 at 75.00 %. The model exhibited commendable classification capability for a learning rate value of 92.22 % for patch size of 16 (over 819 s model training), 78.33 % for patch size 64 over 809 s and 75.00 % for 32 patch size over 813 s. Fig. 7 (a) and 7 (b) above presents the progress in training robustness of the proposed model through increase in classification performance repeatedly over 200 epochs of model training and gradual reduction in loss values over the training period. The loss characteristics of the model for different values of patch size for a learning rate of 0.0001 has been presented in Fig. 7 (b). Thus, a patch size of 8 with learning rate of 0.001 is recommended to be adopted by the deep learning model before proceeding with further per­ formance enhancement through variation in other hyperparameter values as discussed in the following sections. This is associated with a value of 8 for batch size, 4 heads and 8 MLP layers. A distinction between convergence of the model for different patch sizes and the respective end-of-training classification accuracies is observed in Fig. 7 (a), and the loss trend distinction is observed in Fig. 7 (b). To account for adequate number of elements per patch with progressively increasing patch size, the values of image size was varied as well - 72 by 72 for patch sizes 8, 16 and 32, and 228 by 228 for patch size of 64. The confusion matrix depicting the number of correct and incorrect classification instances during testing has been presented below in Fig. 8. _5.3._ _Impact and variation of batch size_ The prescribed model is iterated through a series of batch size values - 8, 16, 24, 32 and 64 – whilst taking learning rate and patch size values as 0.001 and 8 respectively (as presented in sub-sections 5.1 and 5.2 above). The accuracies of classification presented by the proposed model coupled with corresponding batch size and computational time values is surmised below in Table 5. Fig. 5. The (a) training curve and (b) loss curve for different values of learning rates. _y_ _(_ _)_ Fig. 6. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001 rendering 93.06 % classification accuracy. Table 4 <u>Impact of patch size on classifier performance.</u> <u>Patch Size</u> <u>8</u> <u>16</u> <u>32</u> <u>64</u> Test Accuracy (%) 93.89 92.22 75.00 78.33 <u>Computational Time (s)</u> <u>918</u> <u>819</u> <u>813</u> <u>809</u> Fig. 7. The (a) training curve and (b) loss curve for different values of patch sizes. The model presents the highest accuracy of classification for 96.39 % for a batch size of 64 over just 317 s of computation. In addition, the model is observed to exhibit comparably high classification accuracies of 96.11 %, 95.56 %, 95.28 % and 93.61 % respectively for batch sizes 16, 8, 32 and 24 respectively (over 453, 813, 455 and 393 s respectively). The relatively low deviation of classification accuracy performance metric for all prescribed batch sizes adopted throughout this experimental variation coupled with significantly lower computational times is suggestive of even more effective model training and robustness in classification on part of the suggested ViT method. Fig. 9 (a) and 9 (b) above present the progress in training classification accuracy and training loss with increase in training epochs for different batch size values. In effect, a batch size of 64 with learning rate of 0.001 and patch size of 8 over 200 epochs of training is _y_ _(_ _)_ Fig. 8. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001 and patch size 8, rendering 93.89 % classification accuracy. Table 5 <u>Impact of batch size on classifier performance.</u> <u>Batch Size</u> <u>8</u> <u>16</u> <u>24</u> <u>32</u> <u>64</u> Test Accuracy (%) 95.56 96.11 93.61 95.28 96.39 <u>Computational Time (s)</u> <u>813</u> <u>453</u> <u>393</u> <u>455</u> <u>317</u> suggested before further progress is initiated. This is coupled with a default value of 4 heads and 8 MLP layers. The model converges to a high classification accuracy of 96.39 % gradually over 317 s while a progressively reducing trend is exhibited by the loss curve as depicted by Fig. 9(a) and (b) respectively. An overview of the correctly and incorrectly classified instances during testing for the configuration mentioned above is presented using the confusion matrix in Fig. 10 below. _5.4._ _Impact and variation of number of heads_ The classification performance for different values of number of heads – 4, 6, 8, 12 and 16 – has been presented below in Table 6. Fig. 9. The (a) training curve and (b) loss curve for different values of batch sizes. _y_ _(_ _)_ A high classification accuracy of 95.00 % is attributable to 16 heads over 656 s. Accuracies of 94.17 % and 93.89 % is attributed to 6 and 12 heads respectively. Interestingly, a common classification accuracy of 93.61 % was attained for number of heads as 4 and 8 as well. The relatively lower deviation of classification accuracies from one another and the higher average classification performance threshold (greater than 90 % here), is suggestive of optimality hyperparameter configuration enabling effective defect detection and classification. Figs. 11 (a) and 11 (b) correspond to variations in training classification accuracy and training loss over 200 epochs respectively. Therefore, a value of 16 heads yields comparatively higher accuracy of classification over other values of number of heads. The confusion matrix highlighting the classification and misclassification instances corresponding to Table 6 above is presented in Fig. 12 below. The loss curve exhibits a gradually decreasing trend with increase in epochs indicative of efficient training and consequently, acceptable convergence to the desired result towards the end of the 200th epoch. _5.5._ _Impact and variation of multi-layer perceptron (MLP) layers_ Table 7 presents classification accuracies for 8, 12, 16 and 24 MLP layers in total. A high classification accuracy of 95.83 % for 24 layers was observed but obviously, at the cost of increased computational time of over 1871 s. This is followed by an accuracy of 95.28 % achieved for 16 layers over 1200 s, 94.17 % achieved for 8 layers over 638 s and 92.50 % achieved for 12 layers over 942 s. Figs. 13 (a) and 13 (b) represent the progressively increasing classification accuracy and gradually reducing training loss with number of epochs respectively. Evidently, the loss value exhibited a gradual decrease with increase in the number of epochs during training, suggesting sufficient and effective convergence of the proposed model to enable accurate fault classification. The confusion matrix highlighting the per­ formance of the proposed model for this configuration of hyperparameters is presented below in Fig. 14. 6. Discussion and inferences This section aims at presenting a detailed description and interpretation of the results consolidated in Section 5 above. The most optimal configuration of hyperparameters which enable the proposed transformer architecture to render the highest classification accuracy in this study is prescribed and briefly analyzed in this section. In addition, the performance of the suggested model is examined further and compared against the results of other contemporary works that have been performed for the same or similar purpose shared by the current study. _6.1._ _Most optimal model hyperparameter configuration_ The current research study has utilized a ViT model to categorize different steel surface defect conditions, including crazing, in­ clusion, rolled in, pitted surface, scratches, and patches. The performance trend of the proposed ViT model is represented in Figs. 15 and 16, which depict the classification accuracy and loss curves respectively for the most optimal configuration of model hyper­ parameters namely, learning rate, patch size, batch size, number of heads and number of Multi-Layer Perceptron (MLP) layers. The choice of optimal hyperparameters has been surmised below in Table 8. Clearly, the training and validation loss exhibits a gradual reduction, leading to an improvement in training and validation ac­ curacies. The results suggest that the training process of the Vision Transformer was indeed effective and converged onto the defect image dataset. To assess the performance of the model, a confusion matrix was designed to provide a clear insight into the prediction level of the trained model. In a confusion matrix, the rows and columns represent the actual and predicted test conditions of the steel surface (here). Additionally, the shape of the confusion matrix is determined based on the total number of test conditions adopted. The diagonal elements of a confusion matrix represent the correctly classified instances, while the other elements represent mis­ classifications. Fig. 17 represents the confusion matrix obtained as a measure of the performance of the proposed vision-transformer model for the proposed optimal hyperparameter configuration suggested in Table 8. A total of 1800 greyscale images representing common defects that could arise on hot-rolled steel surfaces were collected. For each of the six defect classes, 300 sample images were considered in each class, which were further split into 240 and 60 images for training and model testing respectively per condition class. This amounts to a total of 1440 image data for training and 360 images for testing. Using the totality of 1800 test samples, for the hyperparameter configuration stipulated in Table 8, the proposed model achieved a high classification accuracy of 96.39 %. Interference, signal noise in images, similarities in features and therefore image resemblance are specific reasons for misclassification which may result in minor deviations from perfect accuracy in the case of most contemporary deep learning models. In retrospect, with reference to the confusion matrix for the optimized model configuration above in Fig. 17, we observe the occurrence of just 13 misclassification instances out of a total of 360 test defect instances. This implies that a total of 347 image captures out of 360 (testing data) were correctly classified as per the respective defects suggesting that features are indeed learnt effectively by the proposed vision transformer model. In particular, three instances of actual label 2 (inclusion defect), were found to be misclassified as label 4 (pitted surface defect), and three instances of actual label 4 (pitted surface defect) were incorrectly classified as label 1 (crazing defect). Subsequently, two instances of actual labels 2 and 4 (inclusion and pitted surface defects) were incorrectly predicted as apparent labels 5 and 2 (rolled in and inclusion defect) respectively, with one instance of true label 4 (pitted surface defect) misclassified as apparent label 0 (scratches). These instances of misclassification are in much smaller proportion when compared with the overall number of correct classifications since many of the defect images extremely appear similar to one another _y_ _(_ _)_ Fig. 10. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001, patch size 8 and batch size 64, rendering 96.39 % classification accuracy. Table 6 <u>Impact of number of heads on classifier performance.</u> <u>No. of Heads</u> <u>4</u> <u>6</u> <u>8</u> <u>12</u> <u>16</u> Test Accuracy (%) 93.61 94.17 93.61 93.89 95.00 <u>Computational Time (s)</u> <u>336</u> <u>397</u> <u>456</u> <u>576</u> <u>656</u> Fig. 11. The (a) training curve and (b) loss curve for different values of number of heads. and may deceive even the most well-trained human eye in this domain as well. _6.2._ _Comparative performance analysis of proposed ViT model_ This study focuses on determining the effectiveness of the proposed model in performing real time classification of surface defects of steel using transformer architecture. Table 9 presents a comparison of the classification performance of different machine learning approaches adopted for the purposes of steel surface defect detection. It may be useful to note that while Table 8 dives into the layers of optimality behind the hyperparameter configuration rendering the highest classification accuracy in the study, Table 9 solely serves to _y_ _(_ _)_ Fig. 12. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001, patch size 8, batch size 64 and 16 heads, rendering 95.00 % classification accuracy. Table 7 <u>Impact of number of MLP Layers on classifier performance.</u> <u>No. of Layers</u> <u>8</u> <u>12</u> <u>16</u> <u>24</u> Test Accuracy (%) 94.17 92.50 95.28 95.83 <u>Computational Time (s)</u> <u>638</u> <u>942</u> <u>1200</u> <u>1871</u> Fig. 13. The (a) training curve and (b) loss curve for different values of number of MLP layers. compare and put into perspective the results of the current development and study, with those of contemporary efforts and literature. Based on contemporary literature and implementations, we could observe that very few works have adopted the vision transformer architecture for performing the classification of defects on the surface of hot-rolled steel, and even less so by working on data from the NEU-DET repository. Evidently, it could be observed that other models adopting DNN strategy exhibited appreciable classification performance above 90.0 % for similar applications. Crucially, from Table 9, the only transformer approach that could enable the detection and classification of strip steel with an acceptable accuracy was constituted by Chu et al. resulting in 91.7 % accuracy of classification over the NEU-CLS data set (Northeastern University strip steel surface defect categories dataset) [34]. This approach was found to render almost similar results as that produced by the model adopting small sample learning developed by Wu et al. rendering _y_ _(_ _)_ Fig. 14. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001, patch size 8, batch size 64, 16 heads and 24 MLP layers, rendering 95.83 % Classification Accuracy. Fig. 15. Training progress characteristics of proposed model. 92.0 % classification accuracy [50]. However, this approach does not employ the transformer architecture, paving way for further scope in classification progress. It is therefore further evident that the proposed model of detection serves as a forerunner in the steel surface fault detection domain using vision transformers, and stands equal to or better than many other machine and deep learning approaches in terms of classi­ fication performance on account of its strong feature learning and exceptional classification ability. Admittedly, the RepVGG algorithm proposed by Feng et al. with spatial attention provision for operation on the X-SDD data set achieved just over 95 % classification accuracy [51]. Nonetheless, this is clearly suggestive of the superiority in performance of the model proposed in this paper due to the high accuracy results achieved in this study. The proposed model was developed and deployed over a cloud-based platform and thus, computational time can be further reduced when run natively on target systems offline especially on systems employing dedicated computation-ready hardware such as graphical processing units. The developed model can therefore find practical applications on account of being able to achieve a target blend of high classification performance with low computational time over an extended data set. This approach is therefore economical and is prescribed for deployment in real-time condition monitoring. 7. Conclusion This experimental study aimed to address the detection of visual faults on steel surfaces, including crazing, inclusion, rolled in, pitted surface, scratches, and patches, by developing and analysing a vision transformer (ViT) model. The ViT model leverages the transformer architecture for effective classification. The selection of the NEU-DET image database for training and testing the model _y_ _(_ _)_ Fig. 16. Loss-curve for optimal hyperparameter settings of the proposed ViT model. Table 8 <u>An overview of the current optimal hyperparameter configuration of the ViT producing 96.39 % classification accuracy.</u> <u>Learning Rate</u> <u>Patch Size</u> <u>Batch Size</u> <u>No. of heads</u> <u>MLP Layers</u> <u>Epochs</u> <u>Classification Accuracy (%)</u> <u>0.001</u> <u>8</u> <u>8</u> <u>4</u> <u>8</u> <u>200</u> <u>96.39</u> Fig. 17. Confusion matrix of proposed vision transformer model configured with optimized set of hyperparameters obtained after the training process. ensured a diverse range of steel surface defect samples. During the experiment, a dataset comprising 1800 greyscale image samples was utilized. The proposed ViT model exhibited exceptional performance, achieving an impressive overall classification accuracy of 96.39 %. This accuracy surpassed the performance of various pre-trained deep learning models and machine learning classifiers, including conventional convolutional neural networks, and existing vision transformer models tailored for the current application under dis­ cussion. These results suggest that the ViT model is highly effective in accurately identifying and classifying visual faults on steel surfaces. Notably, the proposed ViT model demonstrated superior performance in terms of accuracy, which indicates its potential for real-world applications. Compared to other models, the ViT model exhibited higher efficiency and required minimal hardware re­ sources. These advantages make it an appealing and cost-effective solution for real-time deployment in industrial settings where realtime diagnosis of steel surface defects is crucial. Furthermore, the findings of this study present an opportunity for integrating the proposed ViT model into existing inspection systems, providing enhanced quality assurance capabilities. This integration could lead to improved detection and timely identification of visual defects in metals used for commercial purposes. The modular nature of the _y_ _(_ _)_ Table 9 <u>Comparison of proposed technique with performance of other deep learning models proposed for steel surface defect detection.</u> <u>Approach</u> <u>Classification accuracy (%)</u> <u>Reference</u> Multi-class classification for steel surface defects using Quantile Hypersphere 87.00 [52] Description Data (QHDD) Semi-supervised CNN 90.70 [53] Defect detection and classification of strip steel based on improved SFN VIT model 91.70 [34] Steel surface defect classification based on Small Sample Learning 92.00 [50] VSD network using VGG19 93.70 [54] GAN and one-class classifier 94.00 [55] Attention Mechanism and MSMP using ResNet50 94.73 [56] Ensemble DNN ResNet-50 with FcaNet and CBAM 94.80 [57] RepVGG algorithm with Spatial Attention (SA) on X-SDD set 95.10 [51] <u>Proposed Method</u> <u>96.39</u> proposed model facilitates its seamless incorporation into existing systems with appropriate graphical processing sequence and dis­ plays, thereby contributing to more comprehensive, user-friendly and efficient quality control processes. In conclusion, the proposed vision transformer (ViT) model presents a highly effective solution for the real-time diagnosis of visual faults on hot-rolled steel surfaces. Its commendable performance, efficiency, and cost-effectiveness make it suitable for implementation in industrial settings. By integrating the ViT model into existing inspection systems, companies can enhance their quality assurance processes and enable timely detection of visual defects in metals. The future scope of the proposed model would include the exploration of multiple roadmaps for possibly attaining higher classification performance over a much more diverse, custom dataset for the current application. This would also include provision of functionalities that can extend classification operation of the ViT model over a wider range of defect types under demanding equipment operating conditions upon deployment on the field through use of modular and easy-to-use fault diagnosis systems. Funding source No funding source is involved in the present work. Data availability statement The dataset used in the study was adopted from the public repository of Northeastern University (NEU). The link for the dataset is as [follows: http://faculty.neu.edu.cn/songkc/en/zdylm/263265/list/index.htm.](http://faculty.neu.edu.cn/songkc/en/zdylm/263265/list/index.htm) CRediT authorship contribution statement Vinod Vasan: Writing - original draft, Visualization, Software, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Naveen Venkatesh Sridharan: Writing – review & editing, Validation, Software, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Sugumaran Vaithiyanathan: Writing – review & editing, Visualization, Super­ vision, Project administration, Methodology, Investigation, Formal analysis, Data curation, Conceptualization. Mohammadreza Aghaei: Writing - review & editing, Validation, Supervision, Resources, Investigation, Funding acquisition, Formal analysis, Conceptualization. Declaration of competing interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. References [1] W. Sun, Q. Wang, Y. Zhou, J. Wu, Material and energy flows of the iron and steel industry: status quo, challenges and perspectives, Appl. Energy 268 (2020), [https://doi.org/10.1016/j.apenergy.2020.114946.](https://doi.org/10.1016/j.apenergy.2020.114946) [2] C. Keesug, K. Kyungmo, J.S. Lee, Development of defect classification algorithm for POSCO rolling strip surface inspection system, in: 2006 SICE-ICASE [International Joint Conference, 2006, https://doi.org/10.1109/SICE.2006.314681.](https://doi.org/10.1109/SICE.2006.314681) [3] K. Agarwal, R. Shivpuri, Y. Zhu, T.S. Chang, H. Huang, Process knowledge based multi-class support vector classification (PK-MSVM) approach for surface [defects in hot rolling, Expert Syst. Appl. 38 (2011), https://doi.org/10.1016/j.eswa.2010.12.026.](https://doi.org/10.1016/j.eswa.2010.12.026) [4] [B. Suvdaa, J. Ahn, J. Ko, Steel surface defects detection and classification using SIFT and voting strategy, International Journal of Software Engineering and Its](http://refhub.elsevier.com/S2405-8440%0x2824%0x2914529-X/sref4) [Applications 6 (2012).](http://refhub.elsevier.com/S2405-8440%0x2824%0x2914529-X/sref4) [5] J.P. Yun, D.C. Choi, Y.J. Jeon, C. Park, S.W. Kim, Defect inspection system for steel wire rods produced by hot rolling process, Int. J. Adv. Manuf. Technol. 70 [(2014), https://doi.org/10.1007/s00170-013-5397-8.](https://doi.org/10.1007/s00170-013-5397-8) [6] M. Liu, Y. Liu, H. Hu, L. Nie, Genetic algorithm and mathematical morphology based binarization method for strip steel defect image with non-uniform [illumination, J. Vis. Commun. Image Represent. 37 (2016), https://doi.org/10.1016/j.jvcir.2015.04.005.](https://doi.org/10.1016/j.jvcir.2015.04.005) [7] H. Hu, Y. Liu, M. Liu, L. Nie, Surface defect classification in large-scale strip steel image collection via hybrid chromosome genetic algorithm, Neurocomputing [181 (2016), https://doi.org/10.1016/j.neucom.2015.05.134.](https://doi.org/10.1016/j.neucom.2015.05.134) _y_ _(_ _)_ [8] [C.C. Huang, X.P. Lin, Study on machine learning based intelligent defect detection system, in: MATEC Web of Conferences, 2018, https://doi.org/10.1051/](https://doi.org/10.1051/matecconf/201820101010) [matecconf/201820101010.](https://doi.org/10.1051/matecconf/201820101010) [9] B. Wan, X. Zhou, Y. Sun, T. Wang, C. lv, S. Wang, H. Yin, C. Yan, ADNet: anti-noise dual-branch network for road defect detection, Eng. Appl. Artif. Intell. 132 [(2024), https://doi.org/10.1016/j.engappai.2024.107963.](https://doi.org/10.1016/j.engappai.2024.107963) [10] S.G. Ryu, G. Koo, S.W. Kim, An adaptive selection of filter parameters: defect detection in steel image using wavelet reconstruction method, ISIJ Int. 60 (2020), [https://doi.org/10.2355/isijinternational.ISIJINT-2019-464.](https://doi.org/10.2355/isijinternational.ISIJINT-2019-464) [11] R. Praveen Kumar, R. Deivanathan, R. Jegadeeshwaran, Welding defect identification with machine vision system using machine learning, in: J Phys Conf Ser, [IOP Publishing Ltd, 2021, https://doi.org/10.1088/1742-6596/1716/1/012023.](https://doi.org/10.1088/1742-6596/1716/1/012023) [12] [H.I. Lin, F.S. Wibowo, Image data assessment approach for deep learning-based metal surface defect-detection systems, IEEE Access 9 (2021), https://doi.org/](https://doi.org/10.1109/ACCESS.2021.3068256) [10.1109/ACCESS.2021.3068256.](https://doi.org/10.1109/ACCESS.2021.3068256) [13] [R. Tian, M. Jia, DCC-CenterNet: a rapid detection method for steel surface defects, Measurement 187 (2022), https://doi.org/10.1016/j.](https://doi.org/10.1016/j.measurement.2021.110211) [measurement.2021.110211.](https://doi.org/10.1016/j.measurement.2021.110211) [14] [S. Chen, T. Kaufmann, Development of data-driven machine learning models for the prediction of casting surface defects, Metals 12 (2022), https://doi.org/](https://doi.org/10.3390/met12010001) [10.3390/met12010001.](https://doi.org/10.3390/met12010001) [15] S. Naveen Venkatesh, B. Rebecca Jeyavadhanam, A.M. Moradi Sizkouhi, S.M. Esmailifar, M. Aghaei, V. Sugumaran, Automatic detection of visual faults on [photovoltaic modules using deep ensemble learning network, Energy Rep. 8 (2022) 14382–14395, https://doi.org/10.1016/j.egyr.2022.10.427.](https://doi.org/10.1016/j.egyr.2022.10.427) [16] B. Wan, X. Zhou, B. Zhu, M. Xiao, Y. Sun, B. Zheng, J. Zhang, C. Yan, CANet: context-aware aggregation network for salient object detection of surface defects, [J. Vis. Commun. Image Represent. 93 (2023), https://doi.org/10.1016/j.jvcir.2023.103820.](https://doi.org/10.1016/j.jvcir.2023.103820) [17] S. Tummala, S. Kadry, S.A.C. Bukhari, H.T. Rauf, Classification of brain tumor from magnetic resonance imaging using vision transformers ensembling, Curr. [Oncol. 29 (2022), https://doi.org/10.3390/curroncol29100590.](https://doi.org/10.3390/curroncol29100590) [18] Z. Jiang, L. Wang, Q. Wu, Y. Shao, M. Shen, W. Jiang, C. Dai, Computer-aided diagnosis of retinopathy based on vision transformer, J Innov Opt Health Sci 15 [(2022), https://doi.org/10.1142/S1793545822500092.](https://doi.org/10.1142/S1793545822500092) [19] [L. Tanzi, A. Audisio, G. Cirrincione, A. Aprato, E. Vezzetti, Vision Transformer for femur fracture classification, Injury 53 (2022), https://doi.org/10.1016/j.](https://doi.org/10.1016/j.injury.2022.04.013) [injury.2022.04.013.](https://doi.org/10.1016/j.injury.2022.04.013) [20] A.K. Mondal, A. Bhattacharjee, P. Singla, A.P. Prathosh, XViTCOS: explainable vision transformer based COVID-19 screening using radiography, IEEE J Transl [Eng Health Med 10 (2022), https://doi.org/10.1109/JTEHM.2021.3134096.](https://doi.org/10.1109/JTEHM.2021.3134096) [21] S. Aladhadh, M. Alsanea, M. Aloraini, T. Khan, S. Habib, M. Islam, An effective skin cancer classification mechanism via medical vision transformer, Sensors 22 [(2022), https://doi.org/10.3390/s22114008.](https://doi.org/10.3390/s22114008) [22] [N. Hütten, R. Meyes, T. Meisen, Vision transformer in industrial visual inspection, Appl. Sci. 12 (2022), https://doi.org/10.3390/app122311981.](https://doi.org/10.3390/app122311981) [23] [W. Wang, L. Yao, L. Chen, D. Cai, X. He, W. Liu, Crossformer: A Versatile Vision Transformer Based on Cross-Scale Attention, ArXiv E-Prints, 2021.](http://refhub.elsevier.com/S2405-8440%0x2824%0x2914529-X/sref23) [24] [Q. He, S. Li, Q. Bai, A. Zhang, J. Yang, M. Shen, A siamese vision transformer for bearings fault diagnosis, Micromachines 13 (2022), https://doi.org/10.3390/](https://doi.org/10.3390/mi13101656) [mi13101656.](https://doi.org/10.3390/mi13101656) [25] Z.K. Zhang, M. Le Zhou, R. Shao, M. Li, G. Li, A defect detection model for industrial products based on attention and knowledge distillation, Comput. Intell. [Neurosci. 2022 (2022), https://doi.org/10.1155/2022/6174255.](https://doi.org/10.1155/2022/6174255) [26] C. Zhang, W. Huang, X. Liang, X. He, X. Tian, L. Chen, Q. Wang, Slight crack identification of cottonseed using air-coupled ultrasound with sound to image [encoding, Front. Plant Sci. 13 (2022), https://doi.org/10.3389/fpls.2022.956636.](https://doi.org/10.3389/fpls.2022.956636) [27] [Z. Guo, C. Wang, G. Yang, Huang, G. Li, MSFT-YOLO: improved YOLOv5 based on transformer for detecting defects of steel surface, Sensors 22 (2022), https://](https://doi.org/10.3390/s22093467) [doi.org/10.3390/s22093467.](https://doi.org/10.3390/s22093467) [28] [L. Gao, J. Zhang, C. Yang, Y. Zhou, Cas-VSwin transformer: a variant swin transformer for surface-defect detection, Comput. Ind. 140 (2022), https://doi.org/](https://doi.org/10.1016/j.compind.2022.103689) [10.1016/j.compind.2022.103689.](https://doi.org/10.1016/j.compind.2022.103689) [29] X. Zhang, B. Gao, Y. Shi, W.L. Woo, H. Li, Memory linked anomaly metric learning of thermography rail defects detection system, IEEE Sens J 21 (2021), [https://doi.org/10.1109/JSEN.2021.3112698.](https://doi.org/10.1109/JSEN.2021.3112698) [30] [X. Wen, J. Shan, Y. He, K. Song, Steel surface defect recognition: a survey, Coatings 13 (2023), https://doi.org/10.3390/coatings13010017.](https://doi.org/10.3390/coatings13010017) [31] [S. Lu, J. Wang, G. Jing, W. Qiang, M.M. Rad, Rail defect classification with deep learning method, Acta Polytechnica Hungarica 19 (2022).](http://refhub.elsevier.com/S2405-8440%0x2824%0x2914529-X/sref31) [32] Z. Zhang, T. Li, X. Tang, X. Hu, Y. Peng, CAEVT: convolutional autoencoder meets lightweight vision transformer for hyperspectral image classification, Sensors [22 (2022), https://doi.org/10.3390/s22103902.](https://doi.org/10.3390/s22103902) [33] [B. Tang, Z.K. Song, W. Sun, X.D. Wang, An end-to-end steel surface defect detection approach via Swin transformer, IET Image Process. (2022), https://doi.org/](https://doi.org/10.1049/ipr2.12715) [10.1049/ipr2.12715.](https://doi.org/10.1049/ipr2.12715) [34] [L. Xing, T. Li, H. Fan, H. Zhu, Defect detection and classification of strip steel based on improved VIT model, in: IFIP Adv Inf Commun Technol, 2022, https://](https://doi.org/10.1007/978-3-031-03948-5_26) [doi.org/10.1007/978-3-031-03948-5_26.](https://doi.org/10.1007/978-3-031-03948-5_26) [35] [H. Shang, C. Sun, J. Liu, X. Chen, R. Yan, Defect-aware transformer network for intelligent visual surface defect detection, Adv. Eng. Inf. 55 (2023), https://doi.](https://doi.org/10.1016/j.aei.2023.101882) [org/10.1016/j.aei.2023.101882.](https://doi.org/10.1016/j.aei.2023.101882) [36] [Q. Li, S. Ren, A real-time visual inspection system for discrete surface defects of rail heads, IEEE Trans. Instrum. Meas. 61 (2012), https://doi.org/10.1109/](https://doi.org/10.1109/TIM.2012.2184959) [TIM.2012.2184959.](https://doi.org/10.1109/TIM.2012.2184959) [37] J. Li, B. Gao, W.L. Woo, J. Xu, L. Liu, Y. Zeng, A novel multispectral fusion defect detection framework with coarse-to-fine multispectral registration, IEEE Trans. [Instrum. Meas. 73 (2024), https://doi.org/10.1109/TIM.2023.3344145.](https://doi.org/10.1109/TIM.2023.3344145) [38] R. Shanmugamani, M. Sadique, B. Ramamoorthy, Detection and classification of surface defects of gun barrels using computer vision and machine learning, [Measurement 60 (2015), https://doi.org/10.1016/j.measurement.2014.10.009.](https://doi.org/10.1016/j.measurement.2014.10.009) [39] K. Liu, H. Wang, H. Chen, E. Qu, Y. Tian, H. Sun, Steel surface defect detection using a new haar-weibull-variance model in unsupervised manner, IEEE Trans. [Instrum. Meas. 66 (2017), https://doi.org/10.1109/TIM.2017.2712838.](https://doi.org/10.1109/TIM.2017.2712838) [40] F. Riaz, K. Kamal, T. Zafar, R. Qayyum, An inspection approach for casting defects detection using image segmentation, in: 2017 International Conference on [Mechanical, System and Control Engineering, ICMSC 2017, 2017, https://doi.org/10.1109/ICMSC.2017.7959451.](https://doi.org/10.1109/ICMSC.2017.7959451) [41] [Y. Leng, Z. Xiao, L. Geng, J. Xi, Defect detection and classification of galvanized stamping parts based on fully convolution neural network. https://doi.org/10.](https://doi.org/10.1117/12.2303601) [1117/12.2303601, 2018.](https://doi.org/10.1117/12.2303601) [42] A. Komijani, F. Vafaeinezhad, J. Khoramdel, Y. Borhani, E. Najafi, Multi-label classification of steel surface defects using transfer learning and vision [transformer, in: Proceedings of the 13th International Conference on Information and Knowledge Technology, IKT 2022, 2022, https://doi.org/10.1109/](https://doi.org/10.1109/IKT57960.2022.10039038) [IKT57960.2022.10039038.](https://doi.org/10.1109/IKT57960.2022.10039038) [43] K. Shen, X. Zhou, Z. Liu, MINet: multiscale interactive network for real-time salient object detection of strip steel surface defects, IEEE Trans Industr Inform 20 [(2024), https://doi.org/10.1109/TII.2024.3366221.](https://doi.org/10.1109/TII.2024.3366221) [44] H. Li, B. Gao, X. Lu, X. Zhang, Y. Shi, G. Ru, W. Woo, Dynamic rail near-surface inspection of multiphysical coupled electromagnetic and thermography sensing [system, IEEE Trans. Instrum. Meas. 72 (2023), https://doi.org/10.1109/TIM.2022.3224531.](https://doi.org/10.1109/TIM.2022.3224531) [45] I. Konovalenko, P. Maruschak, H. Kozbur, J. Brezinova, J. Brezina, A. Guzanov´ ´a, Defectoscopic and geometric features of defects that occur in sheet metal and [their description based on statistical analysis, Metals 11 (2021), https://doi.org/10.3390/met11111851.](https://doi.org/10.3390/met11111851) [46] [L. Wang, S. Zhang, J. Dong, W. Ke, C. Liu, Surface crazing of Mn-Cu weathering steel, Jinshu Xuebao/Acta Metallurgica Sinica 46 (2010), https://doi.org/](https://doi.org/10.3724/SP.J.1037.2010.00723) [10.3724/SP.J.1037.2010.00723.](https://doi.org/10.3724/SP.J.1037.2010.00723) [47] [H.Y. Qu, J.Y. Hu, L. Zhao, P.C. Han, Y. Zhang, Y.H. Jai, Judge of surface scratch defects on automobile steel sheets by laser induced breakdown spectrometry,](http://refhub.elsevier.com/S2405-8440%0x2824%0x2914529-X/sref47) [Yejin Fenxi/Metallurgical Analysis 33 (2013).](http://refhub.elsevier.com/S2405-8440%0x2824%0x2914529-X/sref47) [48] H.X. Yu, C.X. Ji, B. Chen, C. Wang, Y.H. Zhang, Characteristics and evolution of inclusion induced surface defects of cold rolled IF sheet, J. Iron Steel Res. Int. 22 [(2015), https://doi.org/10.1016/S1006-706X(15)30132-1.](https://doi.org/10.1016/S1006-706X%0x2815%0x2930132-1) _y_ _(_ _)_ [49] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, N. Houlsby, An [image is worth 16x16 words: transformers for image recognition at scale. http://arxiv.org/abs/2010.11929, 2020.](http://arxiv.org/abs/2010.11929) [50] [S. Wu, S. Zhao, Q. Zhang, L. Chen, C. Wu, Steel surface defect classification based on small sample learning, Appl. Sci. 11 (2021), https://doi.org/10.3390/](https://doi.org/10.3390/app112311459) [app112311459.](https://doi.org/10.3390/app112311459) [51] [X. Feng, X. Gao, L. Luo, X-sdd: a new benchmark for hot rolled steel strip surface defects detection, Symmetry (Basel) 13 (2021), https://doi.org/10.3390/](https://doi.org/10.3390/sym13040706) [sym13040706.](https://doi.org/10.3390/sym13040706) [52] M. Chu, J. Zhao, X. Liu, R. Gong, Multi-class classification for steel surface defects based on machine learning with quantile hyper-spheres, Chemometr. Intell. [Lab. Syst. 168 (2017) 15–27, https://doi.org/10.1016/j.chemolab.2017.07.008.](https://doi.org/10.1016/j.chemolab.2017.07.008) [53] Y. Gao, L. Gao, X. Li, X. Yan, A semi-supervised convolutional neural network-based method for steel surface defect recognition, Robot Comput Integr Manuf 61 [(2020), https://doi.org/10.1016/j.rcim.2019.101825.](https://doi.org/10.1016/j.rcim.2019.101825) [54] S. Guan, M. Lei, H. Lu, A steel surface defect recognition algorithm based on improved deep learning network model using feature visualization and quality [evaluation, IEEE Access 8 (2020), https://doi.org/10.1109/ACCESS.2020.2979755.](https://doi.org/10.1109/ACCESS.2020.2979755) [55] K. Liu, A. Li, X. Wen, H. Chen, P. Yang, Steel surface defect detection using GAN and one-class classifier, in: ICAC 2019 - 2019 25th IEEE International [Conference on Automation and Computing, 2019, https://doi.org/10.23919/IConAC.2019.8895110.](https://doi.org/10.23919/IConAC.2019.8895110) [56] M. Tang, Y. Li, W. Yao, L. Hou, Q. Sun, J. Chen, A strip steel surface defect detection method based on attention mechanism and multi-scale maxpooling, Meas. [Sci. Technol. 32 (2021), https://doi.org/10.1088/1361-6501/ac0ca8.](https://doi.org/10.1088/1361-6501/ac0ca8) [57] [X. Feng, X. Gao, L. Luo, A resnet50-based method for classifying surface defects in hot-rolled strip steel, Mathematics 9 (2021), https://doi.org/10.3390/](https://doi.org/10.3390/math9192359) [math9192359.](https://doi.org/10.3390/math9192359)

섹션 본문 92문단 · 65,768자

(제목 없음)

1This study proposes a vision transformer to detect visual defects on steel surfaces.The proposed approach utilizes an open-source image dataset to classify steel surface conditions into six fault categories namely, crazing, inclusion, rolled in, pitted surface, scratches and patches.The defect images are first subject to resizing and then fed into a vision transformer subject to different hyperparameter configurations to determine the most optimal setting to render highest classification performance.The performance of the model is evaluated for different hyperparameter configurations, and the most optimal configuration is examined using the associated confusion matrices.It was observed that the proposed model presents a high overall accuracy of 96.39 % for detection and classification of steel surface faults.The study presents a descriptive insight into the vision transformer architecture and in addition, compares the performance of the current model with the results of other approaches suggested for application in literature.Vision transformers can serve as standalone approaches and suitable alternatives to the widely used convolution neural networks (CNNs) by actuating complex defect detection and classification tasks in realtime, enabling efficient and robust condition monitoring of a wide range of defects.

Introduction

2Effective metal quality inspection methodologies are crucial for the identification and addressal of critical flaws to prevent the end effects of catastrophic mechanical failures.Defective metals are unsuitable for use in their intended applications due to the deviations from product requirements and the potential hazards they pose to the environment and consumer safety.Steel, being a versatile and essential material for structural purposes, plays a vital role in the economic development of globalized nations.With crude steel production surpassing 1870 million tonnes globally for the year 2019 [1] and 1950 million tons in 2021, the steel industry ranks as the second-largest energy consumer on the global industrial front.Steel is favored for mechanical structural applications due to its desirable properties such as weldability, formability, corrosion resistance, machinability, recyclability, low production cost and comparatively high energy efficiency in extraction.

3Structural materials such as steel are not exempt from surface and sub-surface defects due to various factors involved in its production, handling, and operational processes.Surface defects, including crazing, inclusions, and scratches, are commonly observed in steel, and must be detected early on.The increasing stringency of customer requirements for dimensional accuracy reaching micronlevel precision necessitates strict adherence to such standards to ensure the long-term operational sustainability on part of both the manufacturers and customers.Minimizing rejections of manufactured components before distribution is crucial to avoid economic disadvantages for production enterprises.Monitoring the quality of manufactured steel allows for the assessment and evaluation of the robustness and refinement of the manufacturing processes within the production facility.Metal defects can arise from inherent issues in the base material or as a result of faulty operations along the production lines.Therefore, quality inspection processes, particularly non-contact and non-destructive testing (NDT) based inspection approaches, are pivotal in ensuring adherence to quality standards, safety parameters, and customer commitments regarding overall product batch quality and quantity.In a highly competitive market with a near-perpetual requirement for raw materials to cater to increasing consumer needs, time is of the essence.Thus, it becomes essential to achieve near-instantaneous results in product quality inspection and promptly execute corrective measures using automated inspection approaches.This in turn minimizes production and distribution lead time which is particularly crucial for widely used materials like steel.

4To promote the transition of conventionally employed inspection methodologies into automated strategies, a significant amount of research has been focused on condition monitoring by leveraging the benefits of Artificial Intelligence (AI) in metal inspection techniques.AI-based approaches offer faster and more reliable inspection of metallic raw materials and finished products, overcoming manpower shortages, reducing human errors in classification and enabling the detection of even minute defects.Machine learning algorithms such as Support Vector Machine (SVM), Random Forest and Extreme Learning Machine (ELM), and deep learning models such as Generative Adversarial Networks (GANs), Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs) have been employed for metal defect detection and classification.Specifically, deep learning models possess the ability to adapt and classify new input data without the need for human supervision, even after the training phase.Deep learning models offer additional and enhanced decision-making capabilities even when faced with limited availability of data.By leveraging the strengths of deep learning such as its adaptive nature and resemblance to human cognition, the limitations of pure machine learning algorithms can be addressed in the context of defect inspection.Thus, deep learning models are also increasingly adopted in the field of defect inspection, especially in the metallurgical field to enable computationally optimal, faster, diverse and more robust defect classification.

5Numerous solutions have been explored and recorded by the scientific community to detect metal defects using machine learning and deep learning approaches as explained herewith.Keesug et al. adopted a line scan camera and linear light source to perform defect detection of rolled steel (POSCO steel rolling strip surface inspection system).This identification and classification of six types of rolled steel strip defects were executed using a multi-class Support Vector Machine algorithm coupled with image processing techniques, thereby resulting in a classification accuracy ranging from 87 % to 94 % [2].A Process Knowledge-based Multi-class Support Vector Machine (PK-MSVM) classification approach for surface defect detection in hot rolled steel was proposed by Agarwal et al. in 2011 which achieved a minimum error rate of 9.2 % [3].A framework for the detection of surface defects using Scale Invariant Feature Transform (SIFT) and voting strategy with SVM for feature extraction was proposed in 2012 by Suvdaa et al. [4].Line scan cameras with adaptive local binarization coupled with Discrete Wavelet Transformation (DWT) strategy was advocated by Yun et al. in 2014 to filter out noise from image backgrounds and isolate defects.The performance of this system over 1550 defect images was found to reach 84.7 % as a result of the classification process [5].In 2016, a genetic algorithm coupled with mathematic morphology-based binarization method for strip steel defect image with non-uniform illumination was explored by Liu et al. [6].The classification of surface defects in large-scale strip steel image collection was attempted by Hu et al. using a hybrid chromosome genetic algorithm-based approach [7].Huang et al. examined an intelligent defect detection system for metal products through the use of a GAN architecture in 2018 [8].The detection of defects in industrial road networks was investigated by Wan et al. via the proposal of an anti-noise dual branch network (ADNet) in 2024 [9].

6In 2020, Ryu et al. attained 92.68 % accuracy of classification during the detection of corner crack defects in steel billets using wavelet reconstruction and SVM classifier as part of an examination of adaptive filter parameter selection.This selection was implemented over histogram and morphological features after image segmentation, wavelet transformation (DWT) and wavelet reconstruction followed by enhanced binarization sequentially [10].The identification of Friction-Stir Weld (FSW) defects on metal surfaces was executed by Praveen et al. in 2021.This involved adopting a fusion of machine vision and classifier-based strategies in which discriminant analysis and nearest neighbor approaches were implemented, resulting in commendably high classification accuracy [11].Deep learning models such as Single Shot Detector (SSD), Faster-CNN and You Only Look Once (YOLO) were utilized as part of an image-data assessment approach strategy by Lin et al.This was carried out in 2021 as part of a comprehensive combined image-data assessment approach strategy for metal surface defect detection [12].In 2022, two computationally progressive approaches were presented for prospective applications along the lines of steel and casting defect inspection.Tian et al. proposed the DCC-CenterNeta rapid detection method for steel surface defects executed over the GC10 DET steel sheet surface defect dataset [13].The prediction and detection of surface defects on metal castings collected from steel and cast-iron industries was implemented through data driven models developed by Chen et al. [14].Evidently, machine and deep learning algorithms are indeed prospective implementations well suited for handling numerical data with high accuracy of results for applications that aim at solving diverse challenges [15].A novel approach encompassing an aggregation network with contextual awareness (CANet) for the detection of surface defects in general was proposed by Wan et al., in 2023 [16].

7The application of vision transformers in the detection of metal defects at large and steel surface defects in particular has been gaining attention gradually in recent years.Vision transformers, also known as ViTs, are deep learning models that apply transformer architectures to process visual data.Traditionally, CNNs have been widely used for computer vision tasks, including defect detection in steel surfaces as mentioned above.However, vision transformers offer a more promising alternative by leveraging the self-attention mechanism present in transformers, which allows them to capture global relationships within an image.In the context of steel surface defect detection, vision transformers have shown great potential.They can effectively learn representations from images, enabling the detection of subtle defects and complex patterns on steel surfaces.The self-attention mechanism in vision transformers enables the model to focus on relevant regions of the image, facilitating the identification of defects and distinguishing them from normal regions.The implementation of vision transformers for steel surface defect detection offers several advantages.More specifically, in a Vision Transformer (ViT), A self-attention mechanism is implemented in ViT by dividing an image in patches followed by their embedding into vectors.These embeddings are passed through transformer layers where the multi-head self-attention mechanism computes relationships between all patches by creating Query, Key, and Value matrices.The attention scores, derived from the dot product of Query and Key, determine how much each patch should focus on others.The weighted sum of Values gives a self-attended representation, which is then processed through a feed-forward network.Vision transformers can capture global context information in an image allowing for better understanding of complex defect patterns.Additionally, ViTs can generalize well to unseen defects and adapt to different lighting conditions and viewpoints.The ability of ViT to learn from large-scale datasets also facilitates avenues for transfer learning in which pre-trained models can be fine-tuned on smaller, domain-specific datasets to improve performance.The potential benefits of vision transformers are realized in multiple fields including the biomedical domain for classification of brain tumour [17], retinopathy [18], femur fracture classification [19], COVID-19 screening using radiography [20] and even skin cancer classification via medical vision transformers [21].

8Deploying vision transformers in industrial visual inspection domains has been proved feasible by means of a comparative overview with CNN networks performed by Hütten et al. in 2022.This study was suggestive of the capability of ViTs to not only exhibit equivalent performance as that of CNN networks with sparse data but also surpass them in progressively complicated classification tasks [22].A versatile vision transformer ('crossformer') based on cross scale attention was proposed by Wang et al. that aims at compensating for the general drawback of compromising on small scale features of embeddings to lower the resource requirements of self-attention modules.This was actuated through the proposal of a self-bias mechanism to make the popular relative position bias apply to variable sized images as well [23].In 2022, a culmination of sequential advancements in the adoption of the transformer architecture for use in industry-grade fault diagnosis presented promising paths for real-time application.A Siamese vision transformer for bearing fault diagnosis was developed and examined by He et al. [24].This approach involved a combination of the Siamese network and vision transformer deployed over the Case Western Reserve University and Paderborn dataset, achieving higher mean classification than Siamese CNNs, Hierarchical Convolutional Autoencoder (HCAE) and Wide Deep Convolutional Neural Networks (WDCNNs).A defect detection model for industrial products based on attention and knowledge distillation over four public industrial defect detection datasets including steel surface defects was examined by Zhang et al. [25].Crack identification of cottonseed using air coupled ultrasound with sound to image encoding and a light weight ViT to constitute sound features was proposed by Zhang et al. that yielded 90.7 % classification accuracy [26].MSFT-YOLOan improved YOLOv5 model based on transformer structure for steel surface defect detection rendered commendable precision of classification upon examination by Guo et al. [27].CAS-VSWIN transformera Variant-SWIN transformer for surface defect detection was an improved transformer design explored by Guo et al. which strengthened feature transfer between windows and made the framework more capable of serving as a backbone for efficient surface defect detection in industrial environments [28].Zhang et al. proposed a novel approach modelling rail sample backgrounds in view of paucity of rail defect information in public repositories, rendering an effective inspection model via a memory linked metric learning of anomalies [29].A comprehensive review of the performance of contemporary machine learning models for the purposes of steel surface defect detection was also undertaken comprehensively by Wen et al., in 2022, bringing out the importance of developing diagnostic solutions for critical material inspection [30].

9The detection of defects on steel surfaces also finds applications of the transformer approach.Lu et al. proposed a vision transformer approach for the detection of defects on rails over rail defect B-Scan image data rendering just over 90 % model accuracy [31].An overall accuracy of 96.25 % was attained for classification on four widely used hyperspectral datasets using a Convolutional Autoencoder (CAEVT) with lightweight vision transformer for hyperspectral image classification by Zhang et al. [32].End to end steel surface defect detection approach via SWIN Transformer using Feature Pyramid Networks (FPN) and Region Proposal Networks (RPN) to achieve 81.1 % mAP was performed by Tang et al. [33].The defect detection and classification of strip steel based on improved VIT Model (SFN VIT -Improved Shuffle Network Unite Vision Transformer) over NEU-CLS dataset (Tohoku University strip steel surface

Table 1

10Contemporary studies on metal surface defect detection and classification.

Application Reference

11Visual Inspection System (VIS) of steel rails using DLBP.

12[36] Multispectral vision sensing fusion system for non-destructive defect detection [37] Surface defect detection of gun barrels using machine learning algorithms.

13[38] Unsupervised Haar-Weibull Variance model for steel defect detection [39] Casting defect detection using K-Means partitioning for image segmentation.

14[40] Galvanized stamping part defect detection using full CNN.

15[41] Multi-label classification of steel surface defects using transfer learning and vision transformers [42]

Detection of Surface Defects on Strip Steel using Multiscale Interactive Network (MINet)

16[43] Railway inspection system using electromagnetic and thermographic sensing approach [44] V [35].An overview of additional contemporary works including studies that involve the use of transformer architecture is presented below in Table 1.

17The following inferences could be derived from the literature works examined above.

18(i) Scarcity of publicly accessible datasets specifically tailored for condition monitoring tasks can hinder the development and evaluation of machine learning or deep learning models for defect classification or condition monitoring.Having access to diverse and labeled datasets is crucial for training accurate and robust models that can effectively detect and classify defects.This is particularly critical for condition monitoring applications involving important structural materials such as steel.This in turn necessitates custom data set collection and strategies such as data augmentation which is resource and time consuming.(ii) The implementation of vision transformers as potential alternatives to conventional CNN models is still in its nascent stages of development and application.The field of condition monitoring needs architectures that provide robust classification accuracy with ease of implementation for large scale, user intuitive applications which consume minimal computational time and resources.(iii) The total number of works that implement the transformer architecture in a field as demanding and critical as structural and mechanical condition monitoring is highly limited.Of these, there are but few or no precursors to the current study which implements the identification of catastrophic surface defects using transformers, let alone vision transformers.(iv) The development of a progressively optimized transformer model which can achieve steel surface defect classification with a high degree of accuracy whilst analyzing the impact of each hyperparameter on the overall model performance is a critical aspect.This governs the further development and progress of the current model and other approaches which may be based on the current study.In lieu of this constraint, few studies present an optimization roadmap which clearly establish the most optimal set of hyperparameters that constitute a given transformer architecture in addition to the logical reasoning behind the selection of such a configuration.(v) The classification accuracies attained through careful examination of available transformers and other DNN approaches as examined earlier were found commendable.However, the primary objective of instantaneous and robust defect detection can be achieved only if the system under development exhibits very little or no margin for error under prolonged operation conditions.(vi) The evaluation of different transformers and Deep Neural Network (DNN) approaches for defect classification yielded commendable results in terms of classification accuracies.These findings indicate that these models are capable of accurately categorizing defects based on the available data.(vii) However, it is crucial to recognize that achieving accurate classification is just one aspect of the broader objective of defect detection in real-world scenarios.In practical applications, it is equally important for the system to exhibit a high level of robustness and reliability during prolonged operation conditions.When a defect detection system operates continuously over extended periods, it may encounter various challenges such as changes in environmental conditions, variations in defect patterns, or fluctuations in input data quality.To ensure reliable defect detection under such circumstances, the system should be designed to minimize or ideally eliminate any margin for error.(viii) Having very little or no margin for error means that the system should be highly resilient to noise, variations, or uncertainties that may arise during prolonged operation.It should be capable of maintaining a consistently high level of accuracy and performance, regardless of changing conditions or potential disturbances.Achieving this level of robustness requires careful consideration of various factors during the development process.It may involve implementing advanced techniques such as data augmentation, regularization, ensemble learning, or utilizing appropriate error handling mechanisms.Additionally, thorough testing and fine-tuning of the model and system parameters are essential to ensure optimal performance and reliability.

19This study focuses on the development of a specialized model for robust steel surface defect detection that attempts to rectify the aforementioned challenges.This model adopts a transformer-based approach known as vision transformers (ViT), and incorporates data augmentation techniques to enhance its performance and resilience.The model utilizes vision transformers which have emerged as a powerful architecture in the field of computer vision.Unlike traditional convolutional neural networks, vision transformers leverage self-attention mechanisms to capture long-range dependencies in images.By adopting ViT, the model aims to effectively learn and represent complex patterns and relationships within the steel surface images, improving the accuracy of defect detection.Data augmentation techniques are employed to augment the available training data.By applying transformations such as rotations, translations, flips, or introducing noise, the model generates additional augmented samples.Training on augmented data helps the model generalize better and become more robust to variations, enhancing its ability to detect defects accurately even in the presence of environmental or operational changes.The combination of the specialized ViT architecture and data augmentation techniques enables the proposed model to achieve robust steel surface defect detection.This approach addresses the limitations of traditional methods by leveraging the power of transformers and enhancing the model ability to generalize from limited training data.By utilizing ViT and data augmentation together, the model aims to provide accurate and reliable defect detection results, improving the efficiency and effectiveness of condition monitoring systems in industrial settings.Thus, the technical contributions of the paper have been presented herewith.

201.A vision transformer was developed for detection of six primary types of steel surface defects, namely, crazing, inclusion, rolled in, pitted surface, scratches, and patches.2. The image data set deployed for this study was obtained from the open-source repository Northeastern University (NEU-DET) surface defect dataset.3. The feasibility of transformer architecture application in general and vision transformers for defect detection on hot rolled steel surfaces in specific is examined and particularly evaluated statistically in this paper.4.An overview of crucial hyperparameters and the impact each parameter has on the performance of the classification model is further presented in this study for background analysis.Result interpretation in terms of overall classification performance metrics and a complete breakdown of the confusion matrix obtained to mark the performance of the optimally configured vision transformer model proposed in this body of work. 5.The classification performance of the proposed model for different hyperparameter configurations varied sequentially and logically is evaluated against the performance accuracy of the same model for the most optimal hyperparameter configuration proposed in the study as well.6.A comparative analysis of the classification results obtained in this study is performed with those of contemporary approaches and inferences are successively drawn.The computational performance and requirements of the developed approach are comparatively analyzed and elucidated in this body of work.

21The objective of this body of work is to examine and present a vision transformer-based approach that can efficiently detect and classify the different types of defects that may arise on structural steel surface.The outline of this work is as follows.Section 2 provides a description of the experimental procedure advocated in this study, an overview of the different types of steel surface defects being detected and classified, and the methodology adopted for the purposes of this study.Section 3 presents a detailed understanding of vision transformers and their suitability for implementation in the defect identification and classification domain, as an extension of the elaboration presented above in Section 1.A detailed analysis of the critical hyperparameters that have a considerable impact on classifier performance is thereafter presented in Section 4. This is followed by an examination of the experimental results which are presented for each range of hyperparameter variations in Section 5 in addition to a note on the current, most optimal model hyperparameter settings, training, and performance analysis presented in Section 6. Section 6 compares the results obtained from the proposed model with existing works spanning steel surface defect detection.This evaluation showcases the advancements and superiority of the current model.Section 7 concludes the paper by summarizing the proceedings, findings and highlights the contributions of the proposed model in addition to discussing the implications of the current research.

Experimental process

22The transformer-based approach proposed in this study classifies the current metallic surface state into one of six different fault categories.A descriptive overview of the experimental setup, data acquisition, operational procedure, and an insight into the various types of surface defects that may arise in hot rolled steel is presented in this section.Fig. 1 presents the general process flow that constitutes the structure and execution approach of the proposed model.

Preliminary experimental quantifications

23The Keras API from the TensorFlow library in Python was utilized to develop the proposed vision transformer model, which was executed on the Google COLAB cloud computing platform using the integrated COLAB cloud graphical processing unit (virtual-GPU).The dataset used for training and testing the model consisted of images depicting various types of surface defects found in hot-rolled steel strips, sourced from the NEU-DET open-source repository.This dataset contains a total of 1800 grayscale images, with 300 samples available for each of the six surface defect categories.To divide the images for training and testing purposes, the 300 sample images within each defect class were further split in a ratio of 0.8:0.2.Thus, 80 % (240 images) were assigned for training, while the remaining 20 % (60 images) were allocated for testing in each class.The proposed Vision Transform model for the detection of defects on hot-rolled steel was trained with data from the ground up.

Surface defects on steel

24Surface defects refer to superficial irregularities found on steel surfaces, which can occur due to inadequate material milling or subsequent post-milling processes.Major factors contributing to steel defects include external damage and unevenness in roll-milling, resulting in detrimental impacts on the acceptability of steel units intended for consumer distribution.With due reference to Fig. 2 in Section 2.1, in accordance with the classification objectives of the current study and model, Table 2 provides a comprehensive list of commonly observed surface defects in steel.Furthermore, an exhaustive elaboration on the physical constitution and morphological analysis of the different types of defects that may arise in stainless steel was performed by Konovalenko et al., in 2021.This body of work further presented a commendable classifier performance of around 91 % for different defect images as well [45].Fig. 2 presents sample images representing each class of steel surface defects that are input for classification by the ViT model.

Experimental procedure

25Images from different classes (pitted surface, scratches, rolled-in, patches, inclusion and crazing) are converted to RGB format and

Architecture of vision transformers (ViTs)

26Vision transformers (ViTs) have emerged as a notable category of deep learning models in the field of computer vision challenging the dominance of convolutional neural networks (CNNs) in image classification tasks.Rather than relying on CNNs, ViTs propose a different approach inspired by self-attention mechanisms commonly used in natural language processing.Dosovitskiy et al. in 2020 Fig. 3.A steel surface sample without any defect such as pitted surface, scratch, roll-in, patch, inclusion or crazing.

Table 2

27Typical defects that can arise on hot-rolled steel surface.Micro-crevices induced due to abrasive operations on metal surface.

28Visual unacceptability and probability of expansion into fracture-like dimensions leading to further quality compromise.

4

29Rolled In Non-uniform rolling temperature and uneven rolling of steel strips.

30Surface irregularity and biased grain flow leading to reduction of structural strength.

5

31Patches Deposition of oxides on corrosion-prone zones of base metal.

32Greater rejection rate of produced pieces due to reduced surface finish quality and reduced mechanical strength.6

33Inclusion [48] Metallic oxides and sulfides crystallize into phases different from steel during solidification of base metal.

34Adversely impact and reduce mechanical, and structural integrity.introduced ViT and demonstrated its effectiveness in image classification [49].The core of a ViT lies in the transformer architecture originally designed for natural language processing which consists of an encoder-decoder framework with self-attention mechanisms.

35Self-attention enables the model to weigh the importance of different input elements when generating representations.In ViTs, the key component is the transformer encoder.To apply transformers to images, the first step is to convert the two-dimensional spatial input into a one-dimensional sequence of tokens through tokenization.Each token represents a patch of the input image, and the tokens are reshaped into a sequence.To encode spatial information, positional embeddings are added.Additionally, a linear projection is applied to each patch independently to convert them into meaningful representations known as "patch embeddings".Fig. 4 represents the patch distribution of a sample input steel surface defect image.Positional encodings play a vital role in incorporating the spatial layout information of the image into the tokenized sequence.These capture the relative and absolute positions of the tokens using functions such as sine and cosine with different frequencies.The tokenized sequence is processed by the transformer encoder, which repeatedly applies self-attention and feed-forward neural networks.Each transformer layer consists of a multi-head self-attention mechanism and a position-wise feed-forward network.The self-attention mechanism computes attention weights between each token and all other tokens in the sequence, allowing the model to capture dependencies and relationships among different patches.The attention weights are determined through a weighted sum of three linear projections: query, key, and value.These projections enable the model to compare the similarity between tokens and attend to relevant information, influencing the final output.ViTs present an alternative approach to image classification by leveraging self-attention mechanisms borrowed from natural language processing.They showcase their effectiveness through the encoder-decoder framework of the transformer architecture and the tokenization process.The self-attention mechanism plays a crucial role in ViTs by generating an attention matrix that represents the similarity scores between each pair of tokens.These scores are calculated by taking the dot product between the query and key vectors and scaling the result by the square root of the feature dimension.

36The attention scores undergo a SoftMax operation to normalize them into a probability distribution, ensuring that the weights sum up to 1.The values are then multiplied by the attention weights and summed up to obtain the weighted sum.To enable smooth gradient flow during training, residual connections are introduced around each sub-layer (attention and feed-forward networks) within the transformer encoder.Layer normalization is applied to normalize the intermediate representations.The feed-forward networks in the Transformer Encoder consist of two linear transformations with a non-linear activation function, typically ReLU, in between.These networks introduce a non-linear transformation to the outputs of the self-attention mechanism, enhancing the expressive power of the model.At the top of the transformer encoder, a classification head is typically added to produce the final class predictions.It consists of a linear layer followed by a SoftMax function to compute the class probabilities.ViTs are typically trained using supervised learning with a large, labeled dataset.The model is trained to minimize a suitable loss function such as cross-entropy loss.Stochastic gradient descent (SGD) or its variants are commonly used for optimization.To effectively train ViTs, a two-step process is often followed.In the pre-training phase, models are trained on large-scale datasets using self-supervised learning or unsupervised tasks such as image inpainting or colorization.In the fine-tuning phase, the pre-trained models are further fine-tuned on specific downstream tasks using labeled data.

37In simpler terms, vision transformers are a powerful alternative to Convolutional Neural Networks (CNNs) for image classification.They adapt the transformer architecture from natural language processing to process images.ViTs start by breaking the input image into patches and converting them into a sequence of tokens.Positional embeddings capture spatial information, and a transformer encoder processes the token sequence.This encoder employs self-attention to analyze relationships between tokens, allowing the Fig. 4. Bifurcation of sample input image into smaller patches for model input.(i) Increased Global Context: The self-attention mechanism allows ViTs to capture long-range dependencies in images, enabling them to understand global context better.(ii) Flexibility: ViTs can process images of arbitrary sizes since they operate on tokenized sequences.This flexibility eliminates the need for fixed input sizes and allows handling both large and small images.(iii) Translation Invariance: Unlike CNNs, ViTs do not rely on local convolutional filters, which makes them inherently translationinvariant and eliminates the need for pooling operations.(iv) Cross-Modality Application: The tokenization process allows ViTs to handle various modalities, such as combining images and text, by treating them as different input channels.

38The implementation of vision transformers for steel surface defect detection typically involves several steps.First, a dataset of labeled images containing defective steel surfaces is collected.This dataset serves as the training data for the vision transformer model.The images are preprocessed, which may include resizing, normalization, and augmentation techniques to improve the model generalization capabilities.Next, the vision transformer model is constructed using transformer layers.The input images are divided into patches, which are then linearly embedded to generate a sequence of embeddings.These embeddings, along with positional encodings, are fed into the transformer layers, where the self-attention mechanism allows the model to capture global relationships between the patches.During the training phase, the model is optimized using appropriate loss functions, such as binary cross-entropy or focal loss, to differentiate between normal and defective regions.The model learns to classify the images and identify the presence of defects accurately.Training is typically performed on high-performance hardware, such as graphical processing units (GPUs) or tensor processing units (TPUs), to handle the computational complexity of vision transformers.Once the vision transformer model is trained, it can be deployed for defect detection in real-world scenarios.New steel surface images can be fed into the model, and it will analyze the images to identify and localize any defects present.The model predictions can be further post-processed to enhance the interpretability of the results, such as generating bounding boxes around detected defects or generating defect severity scores.Vision transformers have emerged as a promising alternative to CNNs for image classification tasks, leveraging the power of self-attention mechanisms to capture long-range dependencies and global context in images.Principally, vision transformers provide a promising approach for the detection of steel surface defects.Their ability to capture global relationships in images and learn from large-scale datasets makes them well-suited for this task.With further research and advancements, vision transformers do have the potential to become a valuable tool in ensuring the quality and safety of steel materials.

Critical hyperparameters in deep learning networks

39In deep learning, hyperparameters are parameters that are set prior to the training of a model that can impact the model learning process.These parameters are not learned from the data but are instead specified by the user or model architect.Hyperparameters define the overall architecture and behavior of the deep learning model including its capacity, complexity, and generalization ability.Some common hyperparameters in deep learning include learning rate, number of layers, number of neurons per layer, activation functions, regularization parameters, batch size and dropout rate.The hyperparameters which are varied for the purpose of optimizing the classification performance of the proposed ViT model is highlighted herewith.

Learning rate

40The learning rate (LR) is a scalar value that determines the step size at which the model parameters are updated during the training process.It controls the magnitude of the parameter updates based on the gradients computed using backpropagation.The learning rate is a critical hyperparameter, as it influences the convergence and stability of the training algorithm.A higher learning rate allows for faster convergence but can cause overshooting, leading to unstable training.On the other hand, while a lower value of learning rate ensures stability and avoids overshooting, it may result in slow convergence or trapping at suboptimal solutions.

Batch size

41Batch size refers to the number of training examples processed in parallel during a single forward and backward pass of the neural network.In deep learning, training data is divided into mini-batches, and the model parameters are updated based on the average gradients calculated over each batch.The choice of batch size affects the training dynamics and computational efficiency.Smaller batch sizes enable more frequent parameter updates, leading to potentially smoother convergence trajectories.However, smaller batches can introduce noise due to the high variance in the gradient estimates, which may hinder convergence.Larger batch sizes offer more accurate gradient estimates and take better advantage of parallel processing which can speed up training.However, larger batches may converge to flatter minima or require more memory and computational resources.

Patch size

42Patch size is primarily used in convolutional neural networks (CNNs) for image processing tasks.It represents the dimensions of the receptive field, which is the local region of the input image that each convolutional kernel examines.The patch size determines the spatial extent of information considered by the network.Larger patch sizes capture more global features and provide a broader context for understanding the input.However, they may result in reduced spatial resolution and the loss of fine-grained details.Smaller patch sizes capture more local and detailed information however may struggle to capture global relationships and large-scale structures.The choice of patch size depends on the characteristics of the dataset and the complexity of the underlying patterns.

Number of heads

43The number of heads is a hyperparameter commonly associated with attention mechanisms, notably in the transformer architecture.Attention mechanisms allow the model to focus on different parts of the input sequence when making predictions.The number of heads determines how many parallel attention mechanisms or "viewpoints" the model employs to attend to different aspects of the input.Increasing the number of heads provides more capacity for the model to capture diverse and fine-grained relationships within the data.Each head can learn different patterns or dependencies, enhancing the model ability to capture complex interactions.However, a higher number of heads also increases the computational complexity of the model and may require more memory and training data to generalize effectively.

Number of MLP layers

44Multi-Layer Perceptron (MLP) layers are fully connected layers that transform the input data using non-linear activation functions.The number of MLP layers determines the depth of the neural network.Deeper networks can learn more complex representations by capturing higher-order interactions and hierarchies of features.Each additional layer enables the network to model increasingly abstract and intricate patterns in the data.However, deep models are more prone to overfitting, especially when the training data is limited or when regularization techniques are not appropriately employed.Training deep models can also be computationally expensive due to the increased number of parameters and the need for more extensive computational resources.

45Optimizing these hyperparameters is crucial for achieving good performance in deep learning models.Typically, finding the optimal values involves a process of hyperparameter tuning, where different combinations of values are evaluated through techniques like grid search, random search, or more advanced methods such as Bayesian Optimization.Additionally, techniques like learning rate schedules, where the learning rate is adjusted during training, and techniques like batch normalization and regularization can help stabilize and improve the training process.The optimal choice of hyperparameters depends on the specific problem, dataset size, model architecture, and computational resources available.

Experimental results

46The current study evaluates the performance of the proposed defect detection and classification model based on transformer architecture developed for diagnosing different surface defects of steel.The grey-scaled surface defect image data set obtained from the NEU-DET repository was initially pre-processed before being passed on patch-wise post-flattening for classification by the ViT model.This section focuses on highlighting the performance of the proposed model in addition to presenting a comparative overview of the model performance with contemporary techniques presented in literature.It is important to note that each label in the confusion matrices represent distinct defect types prevalent on hot rolled steel surfaces.In this study, label 0 represents scratches, label 1 represents crazing defect, label 2 represents inclusion defect, label 3 represents patch defect, label 4 represents pitted surface while label 5 represents rolled-in defect.

Impact and variation of learning rate

47In this study, the performance of the ViT model was evaluated for five different values of learning rates -0.1, 0.01, 0.001, 0.0001 and 0.00001.The proposed model presents a relatively dispersed range of performance characteristics across the prescribed limits of learning rate values.The accuracies for different values of learning rates along with associated computational times have been surmised in Table 3.

Table 3

48Impact of learning rate on classifier performance.The model under discussion exhibited the lowest classification accuracy of 16.39 % for a learning rate of 0.1 over a computational time of 815 s.On the other hand, the highest accuracy of classification is exhibited for a learning rate value of 0.001 at 93.06 % with effective computational model training time of 813 s.Evidently, for the learning rate of 0.001, the suggested model not only exhibits a drastically improved classification performance test accuracy statistic but also consumes a nominally shorter time for model training which establishes the robustness of the ViT architecture.

49Fig. 5 (a) represents the progressively increasing classification accuracy of the model for each of the learning rate values over 200 epochs of training.The model exhibits the second highest classification accuracy of 92.5 % for a learning rate value of 0.0001 over 813 s while the second lowest accuracy of classification was achieved for learning rate of 0.01 at 21.11 % over 877 s.An accuracy of 83.89 % was achieved for a learning rate of 0.00001 over 835 s of computation.Therefore, the most optimal learning rate value of 0.001 is suggested for implementation in the proposed model to attain the requisite degree of classification performance.This is in turn coupled with default patch size and batch size of 8, 4 heads and 8 MLP layers respectively.Additionally, Fig. 5 (b) suggests poor training and learning capabilities for learning rates of 0.1 and 0.01, and therefore exhibits high loss values for these learning rates as depicted in Fig. 5 (a) and 5 (b).The confusion matrix corresponding to the accuracies mentioned in Table 3 is presented below in Fig. 6.

Impact and variation of patch size

50The performance of the ViT model was evaluated over patch size values of 8, 16, 32 and 64 for a learning rate value of 0.001.An overview of the classification accuracies presented by the suggested model is provided below in Table 4.

51The highest performance was achieved for a patch size of 8 at 93.89 % classification accuracy over 918 s of computational time while the least performance was achieved over 813 s of computation for a patch size of 32 at 75.00 %.The model exhibited commendable classification capability for a learning rate value of 92.22 % for patch size of 16 (over 819 s model training), 78.33 % for patch size 64 over 809 s and 75.00 % for 32 patch size over 813 s.Fig. 7 (a) and 7 (b) above presents the progress in training robustness of the proposed model through increase in classification performance repeatedly over 200 epochs of model training and gradual reduction in loss values over the training period.The loss characteristics of the model for different values of patch size for a learning rate of 0.0001 has been presented in Fig. 7 (b).Thus, a patch size of 8 with learning rate of 0.001 is recommended to be adopted by the deep learning model before proceeding with further performance enhancement through variation in other hyperparameter values as discussed in the following sections.This is associated with a value of 8 for batch size, 4 heads and 8 MLP layers.A distinction between convergence of the model for different patch sizes and the respective end-of-training classification accuracies is observed in Fig. 7 (a), and the loss trend distinction is observed in Fig. 7 (b).To account for adequate number of elements per patch with progressively increasing patch size, the values of image size was varied as well -72 by 72 for patch sizes 8, 16 and 32, and 228 by 228 for patch size of 64.The confusion matrix depicting the number of correct and incorrect classification instances during testing has been presented below in Fig. 8.

Impact and variation of batch size

52The prescribed model is iterated through a series of batch size values -8, 16, 24, 32 and 64 -whilst taking learning rate and patch size values as 0.001 and 8 respectively (as presented in sub-sections 5.1 and 5.2 above).The accuracies of classification presented by the proposed model coupled with corresponding batch size and computational time values is surmised below in Table 5.The model presents the highest accuracy of classification for 96.39 % for a batch size of 64 over just 317 s of computation.In addition, the model is observed to exhibit comparably high classification accuracies of 96.11 %, 95.56 %, 95.28 % and 93.61 % respectively for batch sizes 16, 8, 32 and 24 respectively (over 453, 813, 455 and 393 s respectively).The relatively low deviation of classification accuracy performance metric for all prescribed batch sizes adopted throughout this experimental variation coupled with significantly lower computational times is suggestive of even more effective model training and robustness in classification on part of the suggested ViT method.suggested before further progress is initiated.This is coupled with a default value of 4 heads and 8 MLP layers.The model converges to a high classification accuracy of 96.39 % gradually over 317 s while a progressively reducing trend is exhibited by the loss curve as depicted by Fig. 9(a) and (b) respectively.An overview of the correctly and incorrectly classified instances during testing for the configuration mentioned above is presented using the confusion matrix in Fig. 10 below.

Impact and variation of number of heads

53The classification performance for different values of number of heads -4, 6, 8, 12 and 16 -has been presented below in Table 6.A high classification accuracy of 95.00 % is attributable to 16 heads over 656 s.Accuracies of 94.17 % and 93.89 % is attributed to 6 and 12 heads respectively.Interestingly, a common classification accuracy of 93.61 % was attained for number of heads as 4 and 8 as well.

54The relatively lower deviation of classification accuracies from one another and the higher average classification performance threshold (greater than 90 % here), is suggestive of optimality hyperparameter configuration enabling effective defect detection and classification.Figs.11 (a) and 11 (b) correspond to variations in training classification accuracy and training loss over 200 epochs respectively.Therefore, a value of 16 heads yields comparatively higher accuracy of classification over other values of number of heads.The confusion matrix highlighting the classification misclassification instances corresponding to Table 6 above is presented in Fig. 12 below.The loss curve exhibits a gradually decreasing trend with increase in epochs indicative of efficient training and consequently, acceptable convergence to the desired result towards the end of the 200th epoch.

Impact and variation of multi-layer perceptron (MLP) layers

55Table 7 presents classification accuracies for 8, 12, 16 and 24 MLP layers in total.A high classification accuracy of 95.83 % for 24 layers was observed but obviously, at the cost of increased computational time of over 1871 s.This is followed by an accuracy of 95.28 % achieved for 16 layers over 1200 s, 94.17 % achieved for 8 layers over 638 s and 92.50 % achieved for 12 layers over 942 s.Figs. 13 (a) and 13 (b) represent the progressively increasing classification accuracy and gradually reducing training loss with number of epochs respectively.

56Evidently, the loss value exhibited a gradual decrease with increase in the number of epochs during training, suggesting sufficient and effective convergence of the proposed model to enable accurate fault classification.The confusion matrix highlighting the performance of the proposed model for this configuration of hyperparameters is presented below in Fig. 14.

Discussion and inferences

57This section aims at presenting a detailed description and interpretation of the results consolidated in Section 5 above.The most optimal configuration of hyperparameters which enable the proposed transformer architecture to render the highest classification accuracy in this study is prescribed and briefly analyzed in this section.In addition, the performance of the suggested model is examined further and compared against the results of other contemporary works that have been performed for the same or similar purpose shared by the current study.

Most optimal model hyperparameter configuration

58The current research study has utilized a ViT model to categorize different steel surface defect conditions, including crazing, inclusion, rolled in, pitted surface, scratches, and patches.The performance trend of the proposed ViT model is represented in Figs. 15 and 16, which depict the classification accuracy and loss curves respectively for the most optimal configuration of model hyperparameters namely, learning rate, patch size, batch size, number of heads and number of Multi-Layer Perceptron (MLP) layers.The choice of optimal hyperparameters has been surmised below in Table 8.

59Clearly, the training and validation loss exhibits a gradual reduction, leading to an improvement in training and validation accuracies.The results suggest that the training process of the Vision Transformer was indeed effective and converged onto the defect image dataset.To assess the performance of the model, a confusion matrix was designed to provide a clear insight into the prediction level of the trained model.In a confusion matrix, the rows and columns represent the actual and predicted test conditions of the steel surface (here).Additionally, the shape of the confusion matrix is determined based on the total number of test conditions adopted.The diagonal elements of a confusion matrix represent the correctly classified instances, while the other elements represent misclassifications.Fig. 17 represents the confusion matrix obtained as a measure of the performance of the proposed vision-transformer model for the proposed optimal hyperparameter configuration suggested in Table 8.

60A total of 1800 greyscale images representing common defects that could arise on hot-rolled steel surfaces were collected.For each of the six defect classes, 300 sample images were considered in each class, which were further split into 240 and 60 images for training and model testing respectively per condition class.This amounts to a total of 1440 image data for training and 360 images for testing.Using the totality of 1800 test samples, for the hyperparameter configuration stipulated in Table 8, the proposed model achieved a high classification accuracy of 96.39 %.Interference, signal noise in images, similarities in features and therefore image resemblance are specific reasons for misclassification which may result in minor deviations from perfect accuracy in the case of most contemporary deep learning models.

61In retrospect, with reference to the confusion matrix for the optimized model configuration above in Fig. 17, we observe the occurrence of just 13 misclassification instances out of a total of 360 test defect instances.This implies that a total of 347 image captures out of 360 (testing data) were correctly classified as per the respective defects suggesting that features are indeed learnt effectively by the proposed vision transformer model.In particular, three instances of actual label 2 (inclusion defect), were found to be misclassified as label 4 (pitted surface defect), and three instances of actual label 4 (pitted surface defect) were incorrectly classified as label 1 (crazing defect).Subsequently, two instances of actual labels 2 and 4 (inclusion and pitted surface defects) were incorrectly predicted as apparent labels 5 and 2 (rolled in and inclusion defect) respectively, with one instance of true label 4 (pitted surface defect) misclassified as apparent label 0 (scratches).These instances of misclassification are in much smaller proportion when compared with the overall number of correct classifications since many of the defect images extremely appear similar to one another and may deceive even the most well-trained human eye in this domain as well.

Comparative performance analysis of proposed ViT model

62This study focuses on determining the effectiveness of the proposed model in performing real time classification of surface defects of steel using transformer architecture.Table 9 presents a comparison of the classification performance of different machine learning approaches adopted for the purposes of steel surface defect detection.It may be useful to note that while Table 8 dives into the layers of optimality behind the hyperparameter configuration rendering the highest classification accuracy in the study, Table 9 solely serves to Based on contemporary literature and implementations, we could observe that very few works have adopted the vision transformer architecture for performing the classification of defects on the surface of hot-rolled steel, and even less so by working on data from the NEU-DET repository.Evidently, it could be observed that other models adopting DNN strategy exhibited appreciable classification performance above 90.0 % for similar applications.Crucially, from 92.0 % classification accuracy [50].However, this approach does not employ the transformer architecture, paving way for further scope in classification progress.

63It is therefore further evident that the proposed model of detection serves as a forerunner in the steel surface fault detection domain using vision transformers, and stands equal to or better than many other machine and deep learning approaches in terms of classification performance on account of its strong feature learning and exceptional classification ability.Admittedly, the RepVGG algorithm proposed by Feng et al. with spatial attention provision for operation on the X-SDD data set achieved just over 95 % classification accuracy [51].Nonetheless, this is clearly suggestive of the superiority in performance of the model proposed in this paper due to the high accuracy results achieved in this study.The proposed model was developed and deployed over a cloud-based platform and thus, computational time can be further reduced when run natively on target systems offline especially on systems employing dedicated computation-ready hardware such as graphical processing units.The developed model can therefore find practical applications on account of being able to achieve a target blend of high classification performance with low computational time over an extended data set.This approach is therefore economical and is prescribed for deployment in real-time condition monitoring.%.This accuracy surpassed the performance of various pre-trained deep learning models and machine learning classifiers, including conventional convolutional neural networks, and existing vision transformer models tailored for the current application under discussion.These results suggest that the ViT model is highly effective in accurately identifying and classifying visual faults on steel surfaces.Notably, the proposed ViT model demonstrated superior performance in terms of accuracy, which indicates its potential for real-world applications.Compared to other models, the ViT model exhibited higher efficiency and required minimal hardware resources.These advantages make it an appealing and cost-effective solution for real-time deployment in industrial settings where realtime diagnosis of steel surface defects is crucial.Furthermore, the findings of this study present an opportunity for integrating the proposed ViT model into existing inspection systems, providing enhanced quality assurance capabilities.This integration could lead to improved detection and timely identification of visual defects in metals used for commercial purposes.The modular nature of the proposed model facilitates its seamless incorporation into existing systems with appropriate graphical processing sequence and displays, thereby contributing to more comprehensive, user-friendly and efficient quality control processes.In conclusion, the proposed vision transformer (ViT) model presents a highly effective solution for the real-time diagnosis of visual faults on hot-rolled steel surfaces.Its commendable performance, efficiency, and cost-effectiveness make it suitable for implementation in industrial settings.By integrating the ViT model into existing inspection systems, companies can enhance their quality assurance processes and enable timely detection of visual defects in metals.The future scope of the proposed model would include the exploration of multiple roadmaps for possibly attaining higher classification performance over a much more diverse, custom dataset for the current application.This would also include provision of functionalities that can extend classification operation of the ViT model over a wider range of defect types under demanding equipment operating conditions upon deployment on the field through use of modular and easy-to-use fault diagnosis systems.

Funding source

64No funding source is involved in the present work.

Fig. 1 .

65Fig. 1.Process-flow of proposed Vision Transformer (ViT) model for classification of NEU-DET Steel Surface Defect Image Data for a representative defect image sample.

66Fig. 3 below represents a steel sample without featuring any of the six defects as presented from (a)-(f) in Fig. 2 of Section 2.1.

Fig. 2 .

67Fig. 2. Representative images of six steel surface faults (a-f) utilized for training the model.

68tensile stress on metal surface Visual crack development on surface leading to structural and substructural failure 2 Pitted Surfaces Corrosion resulting in cavities or 'holes' on metal surfaces.Structural damage and possible failure of entire component

V

69. Vasan et al.Heliyon 10 (2024) e38498

Fig.

70Fig. The (a) training curve and (b) loss curve for different values of learning rates.

Fig. 9 (

71a) and 9 (b) above present the progress in training classification accuracy and training loss with increase in training epochs for different batch size values.In effect, a batch size of 64 with learning rate of 0.001 and patch size of 8 over 200 epochs of training is

Fig. 6 .

72Fig. 6.Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001 rendering 93.06 % classification accuracy.

Fig. 7 .

73Fig. 7.The (a) training curve and (b) loss curve for different values of patch sizes.

Fig. 8 .

74Fig. 8. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001 and patch size 8, rendering 93.89 % classification accuracy.

Fig. 10 .

75Fig. 10.Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001, patch size 8 and batch size 64, rendering 96.39 % classification accuracy.

Fig. 11 .

76Fig. 11.The (a) training curve and (b) loss curve for different values of number of heads.

Fig. 12 .

77Fig. 12. Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001, patch size 8, batch size 64 and 16 heads, rendering 95.00 % classification accuracy.

Fig. 13 .

78Fig. 13.The (a) training curve and (b) loss curve for different values of number of MLP layers.

79This experimental study aimed to address the detection of visual faults on steel surfaces, including crazing, inclusion, rolled in, pitted surface, scratches, and patches, by developing and analysing a vision transformer (ViT) model.The ViT model leverages the transformer architecture for effective classification.The selection of the NEU-DET image database for training and testing the model

Fig. 14 .

80Fig. 14.Confusion matrix depicting the classification performance of the model configuration with learning rate of 0.001, patch size 8, batch size 64, 16 heads and 24 MLP layers, rendering 95.83 % Classification Accuracy.

Fig. 15 .

81Fig. 15.Training progress characteristics of proposed model.

Fig. 16 .

82Fig. 16.Loss-curve for optimal hyperparameter settings of the proposed ViT model.

Fig. 17 .

83Fig. 17.Confusion matrix of proposed vision transformer model configured with optimized set of hyperparameters obtained after the training process.

84Residual connections and normalization ensure smooth training.Feed-forward networks add nonlinearity to enhance model capabilities.A classification head produces final predictions.ViTs are trained through supervised learning, minimizing a loss function with optimization methods like SGD.SGD is used to train a vision transformer because it efficiently handles the large number of parameters in these models and helps in generalization by introducing noise through small random batches during updates.This noise helps the model avoid overfitting and find better minima, making SGD particularly effective for training large-scale models like ViTs.Training involves pre-training on large datasets and fine-tuning on specific tasks with labeled data.ViT offers the following advantages over traditional deep learning and other CNN-based approaches which has motivated its adoption in the present body of work.

Table 4

85Impact of patch size on classifier performance.

Table 5

86Impact of batch size on classifier performance.

87Fig. 9.The (a) training curve and (b) loss curve for different values of batch sizes.V. Vasan et al.Heliyon 10 (2024) e38498

Table 6

88Impact of number of heads on classifier performance.

Table 9

89[34]e only transformer approach that could enable the detection and classification of strip steel with an acceptable accuracy was constituted by Chu et al. resulting in 91.7 % accuracy of classification over the NEU-CLS data set (Northeastern University strip steel surface defect categories dataset)[34].This approach was found to render almost similar results as that produced by the model adopting small sample learning developed byWu et al. rendering

Table 7

90Impact of number of MLP Layers on classifier performance.

Table 8

91An overview of the current optimal hyperparameter configuration of the ViT producing 96.39 % classification accuracy.

Table 9

92Comparison of proposed technique with performance of other deep learning models proposed for steel surface defect detection.

참고문헌 51건

  1. Detection and classification of surface defects of gun barrels using computer vision and machine learning Measurement · Elsevier BV · 2014 10.1016/j.measurement.2014.10.009
  2. Process knowledge based multi-class support vector classification (PK-MSVM) approach for surface defects in hot rolling Expert Systems with Applications · Elsevier BV · 2010 10.1016/j.eswa.2010.12.026
  3. Genetic algorithm and mathematical morphology based binarization method for strip steel defect image with non-uniform illumination Journal of Visual Communication and Image Representation · Elsevier BV · 2015 10.1016/j.jvcir.2015.04.005
  4. Defect inspection system for steel wire rods produced by hot rolling process The International Journal of Advanced Manufacturing Technology · Springer Science+Business Media · 2013 10.1007/s00170-013-5397-8
  5. A Real-Time Visual Inspection System for Discrete Surface Defects of Rail Heads IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2012 10.1109/tim.2012.2184959
  6. Steel Surface Defects Detection and Classification Using SIFT and Voting Strategy 2013
  7. Surface defect classification in large-scale strip steel image collection via hybrid chromosome genetic algorithm Neurocomputing · Elsevier BV · 2015 10.1016/j.neucom.2015.05.134
  8. Characteristics and evolution of inclusion induced surface defects of cold rolled IF sheet Journal of Iron and Steel Research International · Springer Nature · 2015 10.1016/s1006-706x(15)30132-1
  9. SURFACE CRAZING OF Mn--Cu WEATHERING STEEL ACTA METALLURGICA SINICA · Science Press · 2010 10.3724/sp.j.1037.2010.00723
  10. Judge of surface scratch defects on automobile steel sheets by laser induced breakdown spectrometry 2013
  11. Steel Surface Defect Detection Using a New Haar–Weibull-Variance Model in Unsupervised Manner IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2017 10.1109/tim.2017.2712838
  12. Multi-class classification for steel surface defects based on machine learning with quantile hyper-spheres Chemometrics and Intelligent Laboratory Systems · Elsevier BV · 2017 10.1016/j.chemolab.2017.07.008
  13. A semi-supervised convolutional neural network-based method for steel surface defect recognition Robotics and Computer-Integrated Manufacturing · Elsevier BV · 2019 10.1016/j.rcim.2019.101825
  14. A Steel Surface Defect Recognition Algorithm Based on Improved Deep Learning Network Model Using Feature Visualization and Quality Evaluation IEEE Access · Institute of Electrical and Electronics Engineers · 2020 10.1109/access.2020.2979755
  15. Material and energy flows of the iron and steel industry: Status quo, challenges and perspectives Applied Energy · Elsevier BV · 2020 10.1016/j.apenergy.2020.114946
  16. An Adaptive Selection of Filter Parameters: Defect Detection in Steel Image Using Wavelet Reconstruction Method ISIJ International · The Iron and Steel Institute of Japan · 2020 10.2355/isijinternational.isijint-2019-464
  17. Image Data Assessment Approach for Deep Learning-Based Metal Surface Defect-Detection Systems IEEE Access · Institute of Electrical and Electronics Engineers · 2021 10.1109/access.2021.3068256
  18. X-SDD: A New Benchmark for Hot Rolled Steel Strip Surface Defects Detection Symmetry · Multidisciplinary Digital Publishing Institute · 2021 10.3390/sym13040706
  19. A strip steel surface defect detection method based on attention mechanism and multi-scale maxpooling Measurement Science and Technology · IOP Publishing · 2021 10.1088/1361-6501/ac0ca8
  20. CrossFormer: A Versatile Vision Transformer Based on Cross-scale Attention arXiv (Cornell University) · Cornell University · 2021
  21. A ResNet50-Based Method for Classifying Surface Defects in Hot-Rolled Strip Steel Mathematics · Multidisciplinary Digital Publishing Institute · 2021 10.3390/math9192359
  22. Memory Linked Anomaly Metric Learning of Thermography Rail Defects Detection System IEEE Sensors Journal · IEEE Sensors Council · 2021 10.1109/jsen.2021.3112698
  23. DCC-CenterNet: A rapid detection method for steel surface defects Measurement · Elsevier BV · 2021 10.1016/j.measurement.2021.110211
  24. Defectoscopic and Geometric Features of Defects That Occur in Sheet Metal and Their Description Based on Statistical Analysis Metals · Multidisciplinary Digital Publishing Institute · 2021 10.3390/met11111851
  25. Computer-aided diagnosis of retinopathy based on vision transformer Journal of Innovative Optical Health Sciences · World Scientific · 2021 10.1142/s1793545822500092
  26. Steel Surface Defect Classification Based on Small Sample Learning Applied Sciences · Multidisciplinary Digital Publishing Institute · 2021 10.3390/app112311459
  27. Development of Data-Driven Machine Learning Models for the Prediction of Casting Surface Defects Metals · Multidisciplinary Digital Publishing Institute · 2021 10.3390/met12010001
  28. Vision Transformer for femur fracture classification Injury · Elsevier BV · 2022 10.1016/j.injury.2022.04.013
  29. Cas-VSwin transformer: A variant swin transformer for surface-defect detection Computers in Industry · Elsevier BV · 2022 10.1016/j.compind.2022.103689
  30. MSFT-YOLO: Improved YOLOv5 Based on Transformer for Detecting Defects of Steel Surface Sensors · Multidisciplinary Digital Publishing Institute · 2022 10.3390/s22093467
  31. xViTCOS: Explainable Vision Transformer Based COVID-19 Screening Using Radiography IEEE Journal of Translational Engineering in Health and Medicine · Institute of Electrical and Electronics Engineers · 2021 10.1109/jtehm.2021.3134096
  32. ICAC'18 2018 24th IEEE International Conference on Automation and Computing 2022 27th International Conference on Automation and Computing (ICAC) · 2018 10.23919/iconac.2018.8749097
  33. 2017 International Conference on Mechanical, System and Control Engineering (ICMSC) 2017 10.1109/icmsc41078.2017
  34. 2006 SICE-ICASE International Joint Conference 2006 SICE-ICASE International Joint Conference · 2006 10.1109/ieeeconf11602.2006
  35. CAEVT: Convolutional Autoencoder Meets Lightweight Vision Transformer for Hyperspectral Image Classification Sensors · Multidisciplinary Digital Publishing Institute · 2022 10.3390/s22103902
  36. An Effective Skin Cancer Classification Mechanism via Medical Vision Transformer Sensors · Multidisciplinary Digital Publishing Institute · 2022 10.3390/s22114008
  37. Slight crack identification of cottonseed using air-coupled ultrasound with sound to image encoding Frontiers in Plant Science · Frontiers Media · 2022 10.3389/fpls.2022.956636
  38. Classification of Brain Tumor from Magnetic Resonance Imaging Using Vision Transformers Ensembling Current Oncology · Multidisciplinary Digital Publishing Institute · 2022 10.3390/curroncol29100590
  39. A Siamese Vision Transformer for Bearings Fault Diagnosis Micromachines · Multidisciplinary Digital Publishing Institute · 2022 10.3390/mi13101656
  40. A Defect Detection Model for Industrial Products Based on Attention and Knowledge Distillation Computational Intelligence and Neuroscience · Hindawi Publishing Corporation · 2022 10.1155/2022/6174255
  41. Automatic detection of visual faults on photovoltaic modules using deep ensemble learning network Energy Reports · Elsevier BV · 2022 10.1016/j.egyr.2022.10.427
  42. Vision Transformer in Industrial Visual Inspection Applied Sciences · Multidisciplinary Digital Publishing Institute · 2022 10.3390/app122311981
  43. Dynamic Rail Near-Surface Inspection of Multiphysical Coupled Electromagnetic and Thermography Sensing System IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2022 10.1109/tim.2022.3224531
  44. Steel Surface Defect Recognition: A Survey Coatings · Multidisciplinary Digital Publishing Institute · 2022 10.3390/coatings13010017
  45. An end‐to‐end steel surface defect detection approach via Swin transformer IET Image Processing · Institution of Engineering and Technology · 2022 10.1049/ipr2.12715
  46. Defect-aware transformer network for intelligent visual surface defect detection Advanced Engineering Informatics · Elsevier BV · 2023 10.1016/j.aei.2023.101882
  47. CANet: Context-aware Aggregation Network for Salient Object Detection of Surface Defects Journal of Visual Communication and Image Representation · Elsevier BV · 2023 10.1016/j.jvcir.2023.103820
  48. Rail Defect Classification with Deep Learning Method Acta Polytechnica Hungarica · Óbuda University · 2022 10.12700/aph.19.6.2022.6.16
  49. A Novel Multispectral Fusion Defect Detection Framework With Coarse-to-Fine Multispectral Registration IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2023 10.1109/tim.2023.3344145
  50. ADNet: Anti-noise dual-branch network for road defect detection Engineering Applications of Artificial Intelligence · Elsevier BV · 2024 10.1016/j.engappai.2024.107963
  51. MINet: Multiscale Interactive Network for Real-Time Salient Object Detection of Strip Steel Surface Defects IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2024 10.1109/tii.2024.3366221