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

A steel defect detection method based on edge feature extraction via the Sobel operator

관련 산업용 섬유 · (9) 타이어코드

기본 정보

저자
  1. Yuanyuan Wang — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China. zhfwyy@hyit.edu.cn|||Laboratory for Internet of Things and Mobile Internet Technology of Jiangsu Province, Huaian, 223001, China. zhfwyy@hyit.edu.cn
  2. Tongtong Yin — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China
  3. Xiuchuan Chen — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China
  4. Abdullahi Suleiman Hauwa — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China
  5. Boyang Deng — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China
  6. Yemeng Zhu — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China
  7. Shangbing Gao — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China|||Laboratory for Internet of Things and Mobile Internet Technology of Jiangsu Province, Huaian, 223001, China
  8. Haiyan Zang — College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian, 223003, China|||Laboratory for Internet of Things and Mobile Internet Technology of Jiangsu Province, Huaian, 223001, China
  9. Hu Zhao — Jiangsu Kesheng Xuanyi Technology Co., Ltd., Huaian, 223300, Jiangsu, China
DOI
10.1038/s41598-024-79205-5
저널
Scientific Reports
발행년도
2024
발행기관
Nature Portfolio
피인용수
20
라이선스
cc-by-nc-nd
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1038/s41598-024-79205-5
토픽
Surface Roughness and Optical Measurements
OpenAlex ID
W4404282763

평가 내용

관련도
관련
사업분야
산업용 섬유 · (9) 타이어코드
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '산업용 섬유 > 타이어코드' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Scratches and cracks in steel severely affect its service life and performance. However, owing to the irregular shapes and sizes of steel surface defects, defects within the same class may be different, whereas defects between classes may be similar. Existing methods focus only on spatial information, resulting in low detection accuracy. To alleviate these problems, this paper proposes the ECDY (EIFEM CARAFE DyHead) network to enhance the detection capability of steel defects. We first design a feature extraction module that focuses on the edge information of feature contours. This module uses the Sobel operator to extract the edge information of a feature and fuses it with the overall spatial information so that richer semantic information can be obtained. The module has improved accuracy in the YOLOv5, YOLOv8, and YOLOv10 versions, and uses fewer parameters and calculations. In particular, in YOLOv8x, mAP@0.5 increased by 2.5%, and the number of parameters was reduced by 12.4 M. Second, to retain the detailed information in the feature pyramid, and to better reconstruct features, we choose the content-aware reassembly feature method (CARAFE) as the upsampling method. Finally, the detection head was replaced with a dynamic unified detection head (DyHead) to adapt to different defect sizes and different task requirements. Compared with YOLOv8s, the proposed method improves precision by 1.6%, recall by 4%, and mAP@0.5 by 4%. This value is 4.2% higher than the mAP@0.5 of the current SOTA model RT-DETR-L in the field of object detection and has 23.2 M fewer parameters.

본문 71,166자

본문 펼치기
## OPEN # A steel defect detection method based on edge feature extraction via the Sobel operator Yuanyuan Wang <sup>1,2</sup> <sup></sup> , Tongtong Yin <sup>1</sup> , Xiuchuan Chen <sup>1</sup> , Abdullahi Suleiman Hauwa <sup>1</sup> , Boyang Deng <sup>1</sup> , Yemeng Zhu <sup>1</sup> , Shangbing Gao <sup>1,2</sup> , Haiyan Zang <sup>1,2</sup> & Hu Zhao <sup>3</sup> Scratches and cracks in steel severely affect its service life and performance. However, owing to the irregular shapes and sizes of steel surface defects, defects within the same class may be different, whereas defects between classes may be similar. Existing methods focus only on spatial information, resulting in low detection accuracy. To alleviate these problems, this paper proposes the ECDY (EIFEM CARAFE DyHead) network to enhance the detection capability of steel defects. We first design a feature extraction module that focuses on the edge information of feature contours. This module uses the Sobel operator to extract the edge information of a feature and fuses it with the overall spatial information so that richer semantic information can be obtained. The module has improved accuracy in the YOLOv5, YOLOv8, and YOLOv10 versions, and uses fewer parameters and calculations. In particular, in YOLOv8x, mAP@0.5 increased by 2.5%, and the number of parameters was reduced by 12.4 M. Second, to retain the detailed information in the feature pyramid, and to better reconstruct features, we choose the content-aware reassembly feature method (CARAFE) as the upsampling method. Finally, the detection head was replaced with a dynamic unified detection head (DyHead) to adapt to different defect sizes and different task requirements. Compared with YOLOv8s, the proposed method improves precision by 1.6%, recall by 4%, and mAP@0.5 by 4%. This value is 4.2% higher than the mAP@0.5 of the current SOTA model RT-DETR-L in the field of object detection and has 23.2 M fewer parameters. Keywords Steel defect, ECDY, Sobel operator, CARAFE, DyHead Steel is one of the essential raw materials for national infrastructure; it is used in everything from bridge and road construction to medical devices and bearing balls. However, owing to the special nature of steel, a series of steps in production and storage may cause the steel to fail to meet the use requirements. These defects have a serious impact on the strength and service life of steel <sup>1</sup> . If these defective steels are not detected, many hidden dangers will remain to affect future safety. Therefore, it is necessary to detect steel defects. Traditional steel defect detection involves manual sampling, infrared detection, and magnetic flux leakage detection. However, the manual sampling method cannot detect all samples, and there may be defects that are invisible to the human eye. This approach is not only time-consuming and labour-intensive but also has low detection accuracy. Infrared detection may not be able to determine the type of defects, and magnetic flux leakage detection cannot detect subtle defects. Overall, traditional steel defect detection methods have low detection efficiency and poor accuracy. In recent years, deep learning has gradually emerged, and deep learning-based object detection algorithms <sup>2</sup> have made great progress in the field of steel defects. From the two-stage detection algorithms represented by R-CNN <sup>3</sup> and Faster R-CNN <sup>4,5</sup> to the one-stage detection algorithms represented by the YOLO series <sup>6</sup>, although the detection accuracy and efficiency of steel defects have improved, owing to the influence of light and material on the dataset, the differences between the steel defects are small, but the differences within the classes are large. In addition, because steel defects vary in size, have irregular shapes, and there is considerable noise in the image, we need to pay attention to the edge contour information, which is important for defect detection, whereas the existing models focus only on spatial information and may introduce noise, resulting in low model accuracy. Therefore, in this paper, we propose an edge information <sup>7</sup> extraction module (EIFEM) that focuses on the characteristic contours of steel defects. Specifically, we design an edge information extraction convolution 1College of Computer and Software Engineering, Huaiyin Institute of Technology, Huaian 223003, China. 2Laboratory for Internet of Things and Mobile Internet Technology of Jiangsu Province, Huaian 223001, China. <sup>3</sup> Jiangsu Kesheng Xuanyi Technology Co., Ltd., Huaian 223300, Jiangsu, China. <sup></sup> email: zhfwyy@hyit.edu.cn (EIEConv) by using the Sobel operator <sup>8</sup> in convolution. EIEConv extracts the edge contour information of the image by calculating the horizontal and vertical directions; it then removes irrelevant information and retains important structural information. The Sobel operator is a combination of Gaussian smoothing and differential operations <sup>9</sup>, so it has strong noise resistance and a smoothing effect on the noise in the dataset. EIFEM fuses the edge information extracted by EIEConv, and the spatial information extracted by the convolution branch, to obtain richer semantic information while ensuring a small number of parameters. The module has improved accuracy in the YOLOv5, YOLOv8, and YOLOv10 versions, and the number of parameters and calculations have been greatly reduced. To further improve the accuracy of steel defect detection, and reduce the number of model parameters, we design an ECDY (EIFEM CARAFE DyHead) network based on YOLOv8s. First, we replace the BottleNeck of C2f with the EIFEM module we designed. Compared with C2f, the improved module can smooth the noise in the grayscale image and obtain rich information on the fusion of edge information and spatial information; second, to obtain more accurate feature reconstructions, we replace the upsampling method with the upsampling method of content-aware reassembly features. This method can learn the convolution kernel suitable for its feature information through the encoder to guide a more accurate feature reconstruction; finally, the original detection head is replaced with a dynamic unified detection head to address different defect sizes and change positions. Because of this detection head, we can dynamically adapt to different sizes, positions, and tasks without changing the detection head. Related work Traditional steel testing methods Traditional steel inspection methods include manual sampling, magnetic flux leakage inspection, and infrared inspection <sup>10</sup> . Manual sampling mainly involves employees taking steel samples for visual inspection. This method is not only time-consuming and labour-intensive but also has some minor defects that may be overlooked by the human eye. Magnetic flux leakage inspection mainly detects magnetic fields on steel surfaces. If the magnetic field on the surface of steel changes, that is, a magnetic flux leakage occurs, it means that there are defects on the steel surface. However, although this method is much more efficient than manual sampling, many minor defects, such as plaques and small pits, may be missed. Infrared inspection determines whether there are defects on the basis of the change in the temperature of the steel surface. Compared with the first two methods, infrared inspection is more accurate, but because steel has different infrared absorption capabilities, it may misjudge the type of defect. Traditional inspection methods not only require considerable manpower but also have extremely low efficiency and accuracy, making it difficult to detect defects in time. Target detection methods In recent years, the rapid development of deep learning has set off a wave in various fields. Compared with traditional methods, deep learning-based object detection algorithms automatically extract features for defect detection through convolutional neural networks <sup>11</sup>, which not only saves considerable manpower but also greatly improves accuracy and real-time performance. At present, deep learning-based object detection algorithms can be divided into two main categories: two-stage detection algorithms and one-stage detection algorithms. A two-stage detection algorithm is divided into two stages. The first stage extracts the regions of interest and then classifies and regresses these regions. The main representative algorithms are the RCNN and Faster RCNN series. To effectively apply these target detection algorithms to the field of steel defect detection, He et al. <sup>12</sup> proposed a multilevel feature fusion network (MFN) to fuse multiple layers of features. This fusion operation enables richer semantic information to be obtained, and a region proposal network (RPN) is used to generate regions of interest. A defect detection dataset, NEU-DET, was established, which has promoted research on steel defects. Akhyar et al. <sup>13</sup> used R-CNN as the backbone network and improved it through deformable convolution and deformable RoI pooling to adapt to the location and size of the defects, and to locate the defects more accurately. To improve the detection rate, Li et al. <sup>14</sup> first performed a data enhancement on the NEU-DET dataset, improved the Faster R-CNN and FPN networks, and used multiscale feature fusion to encourage the reuse of low-level features, thereby enhancing the detection effect of small defects. Unlike the two-stage detection algorithm, the one-stage detection algorithm directly predicts the category and position of the bounding box in the network at the same time without generating candidate regions separately. This integrated design simplifies the processing flow and improves the detection speed. The main representative algorithms include SSD, RetinaNet, FCOS, CenterNet, YOLO series, etc. Akhyar et al. <sup>15</sup> used feature pyramid networks and focal loss optimization based on RetinaNet to alleviate the problems of too few defect targets and imbalanced foreground and background samples to a certain extent. To consider the accuracy of the defect category and location, Cheng et al. <sup>16</sup> embedded a novel channel attention mechanism based on RetinaNet to prevent information loss, and used an adaptive spatial feature fusion module to fuse shallow and deep features. To achieve a balance between accuracy and speed, Tian et al. <sup>17</sup> proposed an expansion feature enhancement model based on CenterNet, expanded the receptive field, and proposed a new centre point function for more accurate keypoint detection. Kou et al. <sup>18</sup> introduced their dense convolutional blocks into the YOLOv3 model to extract rich feature information and to enhance the representation ability of the network. To improve the learning ability of complex textures and defect scale changes, Guo et al. <sup>19</sup> added the TRANS module based on the Transformer design to the backbone network and detection head of YOLOv5, enhancing the dynamic adjustment of the detection head to defects of different sizes. Yang et al. <sup>20</sup> used Real-ESRGAN to enhance image resolution, effectively alleviating the tiny defect challenges in the steel defect dataset, and designed a module based on CBAM and SCSE attention to promote the fusion of channel information and spatial information, and to improve the expression ability of the model. To eliminate the negative impact of NMS on the speed and accuracy of the YOLO model, Zhao et al. <sup>21</sup> proposed the RT-DETR model, which processes multiscale features by decoupling intrascale interactions and cross-scale fusion to improve speed, and proposed the minimum uncertainty query selection to improve accuracy. In summary, traditional steel inspection methods and object detection methods each have certain limitations and drawbacks. Traditional inspection methods primarily consist of manual sampling and automated methods, which are time-consuming and labor-intensive, with low detection accuracy and a propensity for false positives, making real-time defect detection challenging. Existing object detection methods, which are mainly one-stage and two-stage detection algorithms, have indeed improved detection accuracy compared to traditional methods, but there is still room for improvement. Moreover, these methods often fail to detect smaller defects. Therefore, this paper proposes a defect edge detection algorithm specifically tailored for steel defects to accurately locate imperfections. Methods To learn richer image features and obtain more important edge information in steel defect detection, we propose the EIFEM module, which has been improved in YOLOv5, YOLOv8, and YOLOv10. In addition, we designed an ECDY network based on YOLOv8s, which has the highest indicators compared with those of other mainstream models. We introduce the designed EIFEM module in the first section and the designed ECDY network in the second section. EIFEM module Since the steel defect detection dataset is a grayscale image, and the various defects are of different sizes and irregular shapes, special attention needs to be given to the contour information of the defects. To more effectively identify defects in steel, and accurately classify them, we propose a new EIFEM module, which is designed to be an efficient front-end module in image recognition tasks. While learning edge information, it has a certain resistance to noise in the steel defect dataset. First, the module extracts the edge contour information of the image features through the edge information extraction convolution (EIEConv), which we designed. Second, it extracts spatial information through a convolution branch, and then fuses the features extracted from the two parts to learn a richer image feature representation. The EIFEM structure diagram is shown in Fig. 1. _Edge convolution branch_ Convolutional neural networks (CNNs) are generally good at learning spatial information but may be slightly insufficient for extracting edge information from images. Despite the prowess of CNNs in feature extraction, they may introduce unwanted background details when capturing subtle or faint edges <sup>22</sup> . Edge information often requires a finer spatial resolution and sensitivity to detail, yet the convolutional layers of CNNs can blur certain image details <sup>23</sup>, especially after multiple convolutions and pooling operations. Given the presence of numerous minute defects in steel, precise localization of defect edges is crucial. The proposed algorithm in this paper targets the detection of steel defect edges to accurately pinpoint imperfections. We explicitly extract the edge contour features of the image through the edge convolution branch. Since the datasets used for steel defect detection are all grayscale images, the edge contour information is particularly important. Edge information refers mainly to the most significant grayscale changes in an image <sup>24</sup> . These significant changes often reflect important changes in attributes, such as surface direction discontinuity, depth discontinuity, material attribute changes, and scene light changes. Edge detection <sup>25</sup> is a research field in feature extraction. Image edge detection reduces a large amount of data, eliminates irrelevant information, and retains important structural attributes of the image. This approach is highly important for steel defect detection and the identification of the defects and their categories. Fig. 1 . EIFEM structure diagram (the structure obtains richer semantic information through feature fusion of the edge information extraction convolution branch and spatial information convolution branch). The edge detection operator uses the sudden change in the grayscale of the image edge to detect the edge contour information. Among the various edge detection operators, the Roberts, Prewitt, Laplacian, Canny, and Sobel operators stand out. The Roberts operator, while simple, can miss edges, lacks noise suppression, and is not precise in edge localization. The Prewitt operator, though straightforward, offers some noise resistance but may result in a coarse edge representation, neglecting the impact of the proximity of neighboring pixels to the current pixel. The Laplacian operator excels at detecting subtle edges but is susceptible to noise, potentially leading to a significant noise response and the loss of directional edge information. The Canny operator is adept at producing fine edges and effectively suppresses noise, yet its complexity and computational demands are considerable. The Sobel operator, on the other hand, balances these considerations, offering superior performance on noisy images and accurate edge localization. Although it may not match the Canny operator in detection precision, its simplicity makes it ideal for real-time applications. Consequently, after a thorough evaluation, we opt for the Sobel operator to conduct edge detection. The Sobel operator is a classic edge detection filter <sup>26</sup> that can effectively capture sudden changes in the intensity of an image, thereby obtaining important edge information. The Sobel operator contains two sets of 3 × 3 filters, which extract edge-sensitive information in the horizontal and vertical directions. The Sobel operator reaches the extreme value at the edge on the basis of the weighted difference in the grayscales of the upper and lower, and the left and right, neighbouring points of the pixel <sup>27</sup>, thereby effectively detecting the edge. The Sobel operator is a combination of Gaussian smoothing and differential operations, so it has a smoothing effect on noise, and provides more accurate edge direction information. It is a more commonly used edge detection method. The edge information extraction convolution (EIEConv) we designed applies the Sobel operator to the weight of the 3D convolution to perform edge detection in the horizontal and vertical directions. The convolution structure diagram is shown in Fig. 2. The 3D convolution is chosen because the traditional convolution traverses all the channels to extract horizontal and vertical features at a slow speed. The Sobel operator contains two _3 × 3_ matrices _Sx, Sy_, and _Sx, Sy_ as shown in Eq. (1). Expanding _Sx, Sy_ to five dimensions, that is, _B × C × D × 3 × 3_, is used as the weight of the 3D convolution _Wx, Wy_, where _B_ is the batch size, _C_ is the number of channels, and _B_ and _C_ are consistent with the input image. The input image is also added with the depth dimension to the fivedimensional image and multiplied by _Wx, Wy_ ; the horizontal edge detection result is _Gx_ = _Wx × Aex_, where _Aex_ is the expanded original image; and the vertical edge detection result is _Gy_ = _Wy × Aex_ . Therefore, the final output after EIEConv is _G_ = _Gx_ + _Gy_, and the depth dimension in _G_ is removed to return it to the dimension of the original input image, that is, _B × C × H × W_, the output feature size dimension is the same as the input.     _, Sy_ = 1 0 _−_ 1 _−_ 1 _−_ 2 _−_ 1 0 0 0 2 0 _−_ 2 1 0 _−_ 1 (1)   _Sx_ =   1 2 1 _Spatial convolution branch_ In addition to the edge contour information, the spatial information in the steel defect images is equally important. The EIFEM module extracts spatial information through an additional spatial convolution branch. Unlike the edge convolution branch, the spatial convolution branch extracts the features of the original image and can retain rich spatial details. Spatial convolution is through the CBS module, which consists of a convolution layer, a batch normalization layer, and an activation function. The spatial convolution branch plays a role in extracting Fig. 2 . EIEConv structure diagram (the input features are extracted through an x-direction convolution and y-direction convolution to extract the horizontal and vertical information, respectively, and finally fused to obtain the edge contour information, and the output feature size dimension is the same as the input). spatial features and enhancing the model’s expression capabilities in the EIFEM module. The structure of this module is shown in Fig. 3. _Feature fusion_ The edge contour information extracted by the edge convolution branch, and the spatial information extracted by the spatial convolution branch. are fused to form semantically rich feature information. These two parts of information are then added to the initial information after deeper information is extracted through convolution and then sent to the convolution module, which helps to learn the residual information and improves the training stability. This fusion operation allows the learned features to retain the structural properties of steel defects while learning rich spatial information. ECDY network In response to the need for steel defect detection, we design the ECDY network to further improve the accuracy of steel defect detection and reduce the number of calculations. The model structure diagram is shown in Fig. 4. The network is improved on the basis of YOLOv8s. First, we replace the BottleNeck in C2F based on the EIFEM module mentioned in the first section to design the C2F_EIFEM module so that the network pays more attention to the edge contour information we need, and has a certain resistance to the noise in grayscale images. Second, to enable the adaptive and more accurate reconstruction of features, we replace the upsampling method with CARAFE, a lighter operator. Finally, a unified dynamic target detection head (DyHead) based on the attention mechanism is used in the head to dynamically adapt to steel defects of different sizes and angles and the needs of tasks. _C2F_EIFEM_ In the C2f module of YOLOv8, rich feature interactions and conversions are achieved through segmentation and multichannel design. However, C2f uses a fixed receptive field. This fixed structure feature extraction lacks the edge information needed for steel defect detection and may introduce noise during training. To solve the above Fig. 3 . Spatial convolution structure diagram. Fig. 4 . ECDY network structure diagram (compared with YOLOv8, C2f is mainly replaced by C2f_EIFEM designed in this paper, upsampling is replaced by CARAFE, and the detection head is replaced by DyHead). problems, we replace the BottleNeck network with the EIFEM module proposed in Sect. 3.1 on the basis of C2f, and name it C2f_EIFEM; its structure is shown in Fig. 5. As shown in Sect. 3.1, the EIFEM module extracts edge information and spatial information through edge convolution branches and spatial convolution branches for feature fusion, and obtains richer semantic information than BottleNeck does. In addition, the edge convolution branch uses the Sobel operator as the convolution weight, which has a smoothing effect on the noise in the steel defect image. _CARAFE_ The current mainstream upsampling methods are nearest neighbour interpolation and bilinear interpolation <sup>28</sup>, which guide information reconstruction through the feature distance between adjacent pixels. However, nearest neighbour interpolation and bilinear interpolation consider only subpixel neighbourhoods and cannot capture rich semantic information in the global context. Another method to achieve adaptive upsampling is deconvolution; however, it has two major disadvantages. First, the deconvolution operator applies the same kernel to the entire image and cannot change the convolution kernel according to the feature content, which limits the ability to respond to different image changes. Second, when a larger kernel is used, the number of parameters and computational workload will be large. In the steel defect dataset, different types of defects vary greatly in size and shape, and it is difficult for mainstream methods to adaptively respond to changes in defects and reconstruct features. CARAFE (content-aware reassembly of FEatures) <sup>29</sup> is an upsampling method for enhancing convolutional neural network feature maps. The core idea of CARAFE is to use the content of the input features to guide the upsampling process, thereby achieving a more accurate and efficient feature reconstruction. CARAFE can be used in processes that require fine upsampling. The steel defect detection we are conducting attaches great importance to feature details because some defects, such as cracks, are often small and difficult to detect. This Fig. 5 . Comparison between C2f_EIFEM (left) and C2f (right), mainly showing the replacement of BottleNeck in C2f with the EIFEM module designed in this paper. Fig. 6 . CARAFE consists of a kernel prediction module and a content-aware reconstruction module. _H × W ×_ _C_ is upsampled to _σH × σW_ _<u>× C</u>_, where _σ_ is the upsampling ratio. method improves the detail preservation and reconstruction quality of the upsampling process, enabling the network to generate clearer and more accurate outputs. CARAFE predicts the recombination kernel by using the underlying information at each location and upsampling the area near the location. Owing to the introduction of the underlying information, CARAFE can use adaptive and optimized recombination kernels at different locations, so that even small defects can be considered in steel defect detection. The CARAFE consists of two steps. First, the recombination kernel _σ_ <sup>2</sup> at each target location is predicted, and then, the features are recombined with the predicted kernel, The overall structure of CARAFE is shown in Fig. 6. In the reorganization kernel prediction module, for an input shape of _H × W × C_, we compress its number of channels to a _1 × 1_ convolution _Cm_ . The compression step reduces the number of calculations. Given the upsampling ratio of _σ_, each source position of the input feature must correspond to, a target position. Assuming _up_ that the upsampling kernel size is _kup × kup_, the output we need to predict is _H_ _× W_ _× Co_, where _Co_ = _σ_ <sup>2</sup> _× k_ <sup>2</sup> _up_ <sup>, an upsampling</sup> _up_ that the upsampling kernel size is _kup × kup_, the output we need to predict is _H_ _× W_ _× Co_, where _Co_ = _σ_ <sup>2</sup> _× k_ <sup>2</sup> , and then we expand the channel dimension in the spatial dimension to obtain _σH × σW_ _× kup_ <sup>2</sup> <sup>, an upsampling</sup> kernel of shape. Then, we normalize the obtained upsampling kernel via softmax so that the sum of the , and then we expand the channel dimension in the spatial dimension to obtain _σH × σW_ _× kup_ <sup>2</sup> <sup>, an upsampling</sup> kernel of shape. Then, we normalize the obtained upsampling kernel via softmax so that the sum of the convolution kernel weights is 1. For the nuclear prediction encoder, the encoder needs to have a convolutional layer with a kernel size _kencoder × kencoder_ . Therefore, the parameters of this nuclear prediction encoder should be _kencoder × kencoder × Cm × Co_, which changes the compressed features into _H_ _× W_ _× Co_, and an increasing _kencoder_ can obtain a larger receptive field and more comprehensive and complete contextual information. However, the number of calculations for increasing the kernel prediction convolution size increases accordingly, and the receptive field does not continue to increase _kencoder_ to a certain range. Therefore, it is necessary to make a balanced adjustment between _kup_ . In the feature reconstruction module, for each position of the input feature _l(i_, _j)_, the corresponding _N_ ( _Xl, kup_ ) square area is removed, that is, _kup × kup_, the area centred on _l_, and the predicted upsampling kernel of the point, are dot products used to obtain the output value. For different channels at the same position, the same upsampling kernel is shared, and the correlation of the channel information is retained, which reduces part of the calculation. _DyHead_ Recent mainstream object detection heads can usually solve only a certain function required by the detection head. However, we hope to have a detection head that can adaptively handle different sizes, spaces, and tasks in a unified manner. In particular, for steel defect detection, such as dense patch defects, there are patch information of different sizes in one image, so a single size cannot meet the needs of diverse objects. Second, the positions and rotation angles of different defects under different lighting and shooting angles are different (such as horizontal scratches, vertical scratches, etc.), which requires the detection head to adapt to different spatial positions. Finally, owing to different task requirements, objects can have different representations (such as bounding boxes, centre points, etc.), and the network for extracting features may be a one-stage algorithm or a two-stage algorithm. These representations and networks have completely different goals and constraints. We expect that steel defect detection can be applied to the needs of different factories, so DyHead <sup>30</sup> is a good choice for our detection task. For the concatenation of _L_ different levels of features in a given feature pyramid, we adjust the size of _Filevel_ = _{Fi}i_ <sup>_L_</sup> =1 <sup>, the</sup> <sup>_L_</sup> <sup>levels of features, by upsampling or downsampling to make them close to the scale of</sup> the intermediate-level features. The rescaled feature pyramid can be represented as a four-dimensional tensor _Filevel_ = _{Fi}i_ <sup>_L_</sup> =1 <sup>, the</sup> <sup>_L_</sup> <sup>levels of features, by upsampling or downsampling to make them close to the scale of</sup> the intermediate-level features. The rescaled feature pyramid can be represented as a four-dimensional tensor _F_ _∈_ _R_ <sup>_L×H×W_</sup> <sup>_×C_</sup>, where _L_ represents the number of layers in the pyramid and _H_, _W_, and _C_ represent the height, width, and number of channels of the intermediate-level features, respectively. To reshape the features into three dimensions, we define _S = H × W_ as spatial information, so the reshaped features _F_ _∈_ _R_ <sup>_L×S×C_</sup> . We began deploying attention mechanisms separately on each dimension. The size-aware attention module is deployed only on the horizontal dimension of the pyramid features. It enhances features at appropriate levels according to the learned information to perceive size information on the basis of the semantics of different levels of pyramidlevel features and the size of each object; the spatial-aware attention module is deployed on the spatial dimension, and the spatial attention module obtains the location information of different objects on the basis of the spatial features; the task-aware attention module is deployed on the channel, and it guides different feature channels to support different tasks according to the different convolution kernel responses of the task objects. Therefore, the attention formula can be expressed as: _W_ ( _F_ ) = _πC_ ( _πS_ ( _πL_ ( _F_ ) _· F_ ) _· F_ ) _· F_ (2) Where _πC_ ( _·_ ), _πS_ ( _·_ ), and _πL_ ( _·_ ) represent the attention functions applied to the channel dimension, spatial dimension, and horizontal dimension, respectively. The processing flow chart of DyHead is shown in Fig. 7. Next, we introduce the specific implementation methods of scale-aware attention, spatial-aware attention, and task-aware attention. _Scale-aware attention pL_ Dynamically fuse features at appropriate levels according to the semantic importance of different sizes. The specific formula is as follows:    _SC_  <sup><u>1</u></sup> _πL_ ( _F_ ) _· F_ = _ϕ_     _f_       (3)   _· F_ _SC_ _S,C_  _F_ Where _ϕ_ ( _x_ ) is a hard-sigmoid function and where _f(x)_ is a linear function approximating _1 × 1_ the convolution layer. _Spatial-aware attention pS_ We use spatial awareness attention to focus on the common areas where features exist in both spatial information and hierarchical information. Because _S_ is a fusion of _H × W_, we first use variable convolution to sparse a part of the learning features to reduce part of the computation and then aggregate this sparse part to the hierarchical features of the same spatial position. The formula for spatial-aware attention is as follows: Fig. 7 . The DyHead processing flow chart, that is, the feature pyramid, is reshaped first _L × S × C_, first through scale-aware attention, then through spatial-aware attention, and finally through task-aware attention to obtain the detection head output. _N_ _n_ =1 _πS_ ( _F_ ) _· F_ = _L_ <sup><u>1</u></sup> _L_ _l_ =1 _wl,n · F_ ( _l_ ; _dn_ + ∆ _dn_ ; _c_ ) _·_ ∆ _pn_ (4) where _N_ is the number of positions for sparse sampling, _l_ is the position in the horizontal dimension, _dn_ + ∆ _dn_ is the position offset after self-learning, ∆ _dn_ is the spatial offset, _c_ is the position in the channel dimension, ∆ _pn_ is _dn_ an important scalar for self-learning at the position, _dn_ + ∆ _dn_, and ∆ _pn_ is learned from the input features of the intermediate level size of _F_ . _Task-aware attention pC_ To adapt to the metrics of different networks and different tasks, task-aware attention is deployed at the end, which dynamically switches the ON and OFF channels of features to adapt to different tasks, Specifically: (5) _πC_ ( _F_ ) _· F_ = max _α_ <sup>1</sup> ( _F_ ) _· Fc_ + _β_ <sup>1</sup> ( _F_ ) _, α_ <sup>2</sup> ( _F_ ) _· Fc_ + _β_ <sup>2</sup> ( _F_ ) - _α_ <sup>1</sup> _, α_ <sup>2</sup> _, β_ <sup>1</sup> _, β_ <sup>2�</sup> <sup>_T_</sup> = _θ_ ( _·_ ) is a hyperfunction , the implementation method first performs global Where _Fc_ is the feature slice of the C-dimensional channel, and where that controls the activation threshold through learning. _θ_ ( _·_ ), the implementation method first performs global average pooling dimensionality reduction on the _L × S_ dimension, then uses two fully connected layers and a normalization layer, and finally uses the shifted sigmoid function to normalize the output to [− 1,1]. For any backbone network to extract feature pyramids, it is further adjusted to the same scale to form a three-dimensional tensor _F_ _∈_ _R_ <sup>_L×S×C_</sup>, which is then used as the input of the dynamic head. Next, the DyHead block consisting of size perception, space perception, and task perception is stacked in sequence, and the output of the dynamic head can be used for different tasks and representations of object detection. The structure of the DyHead block is shown in Fig. 8. Experiment To verify the effectiveness of our proposed EIFEM module and ECDY network, we apply the proposed EIFEM module to the YOLOv5, YOLOv8, and YOLOv10 versions, compare them with the original models, and compare the results of the ECDY network with those of the most advanced methods. Dataset The dataset used in this paper is the steel defect detection dataset (NEU-DET) released by Northeastern University. The dataset contains 1,800 grayscale images, covering six typical steel surface defects <sup>31</sup>, namely, crazing, inclusion, patches, pitted surface, rolled-in scale, and scratches. The resolution of each image is 200 × 200, and the number of samples of each defect image is 300. Figure 9 shows sample images of six typical steel defects. The figure shows that there are great differences in the number of defects within a class. For example, the shapes of patches may differ, and scratches may come from different directions, resulting in great differences within a class. However, some interclass differences, such as oxide scales, cracks, and pitting surfaces, are very small. It is difficult for our eyes to distinguish the differences between classes from pictures. Under the influence of lighting and material, the grayscale changes of the same defect category may also differ. In addition, there are difficult samples in the dataset. Some small crack models are difficult to detect. In the experiment, the dataset is divided into a training set, a validation set, and a test set at a ratio of 8:1:1. Evaluation metrics To objectively measure the detection performance of the model, this experiment uses evaluation indicators, including precision, recall, and mean average precision (mAP), to measure the accuracy of the model <sup>32</sup> ; parameters are used to measure the size and complexity of the model; and Gflops is used to measure the Fig. 8 . DyHead block structure diagram. In the figure, _πL_ there are size-aware attention, _πS_ space-aware attention, _πC_ and task-aware attention. The three attentions make up a DyHead Block. execution time of the model <sup>33</sup> . Precision is the proportion of correct targets among the targets detected by the model; recall is the proportion of targets correctly identified by the model among the total number of real targets. The indicator mAP refers to the AP used to measure N categories. When the IoU is set to 0.5, it is called mAP@0.5; in this article, mAP@0.5 and mAP@0.5:0.95 (the IoU threshold ranges from 0.5 to 0.95) are used as measurement indicators. The formulas for each indicator are as follows: _<u>TP</u>_ _Precision_ = _TP_ + _FP_ (6) _<u>TP</u>_ _Recall_ = _TP_ + _FN_ (7) _AP_ = 0 - 1 _P_ ( _r_ ) _dr_ (8) 0 1 _mAP_ = _<u>i</u>_ <u>=1</u> <sup>_<u>APi</u>_</sup> _N_ <u>�</u> _N_ _N_ (9) _TP_ is the number of correctly identified targets, _FP_ is the number of incorrectly identified targets, and _FN_ is the number of missed targets <sup>34</sup> . _P(r)_ represents the smooth precision‒recall curve, and the area under the smooth curve obtained by integrating it is the _AP_ . _N_ represents the number of detected object categories, which corresponds to the 6 different steel defects in this paper. Implementation details The computer environment used in this article is composed of Python 3.8, CUDA 11.3, an NVIDIA RTX3090 GPU graphics card, and 30 GB of memory. The training hyperparameters are set as follows: the number of training rounds is 200, the batch size is set to 8, and the SGD optimizer is used. EIFEM improvements in various models To verify the effectiveness of the proposed EIFEM module, we add this module to each version of YOLOv5, YOLOv8, and YOLOv10 for comparison. Specifically, YOLOv5 replaces BottleNeck in its C3 module with the EIFEM module, whereas YOLOv8 and YOLOv10 replace BottleNeck in its C2f module; however, the C2fCIB of YOLOv10 remains unchanged. Our EIFEM module is an efficient module that is mainly used to fuse edge contour features and spatial features, and it can effectively extract edge information from grayscale images. The experimental results are shown in Table 1. From the table, we can see that among the various versions of YOLOv5, only YOLOv5n and YOLOv5m have a map@0.5 that is 1.9% lower after adding EIFEM. In each version of YOLOv8, after adding the EIFEM module, map@0.5 is improved, and the number of parameters Fig. 9 . Six defect categories. and calculations are greatly reduced, which is equivalent to using fewer parameters to achieve better results. In particular, in YOLOv8x, mAP@0.5 increases by 2.5%, and the number of parameters decreases by 12.4 M. In each version of YOLOv10, only YOLOv10l and YOLOv10x reduce their map@0.5 by 1.1% and 2.2%, respectively, but their calculations are greatly reduced in each version. Regarding the inferior performance of the EIFEM module when incorporated into YOLOv10 compared to YOLOv8, our analysis identified the following reasons: In YOLOv8, we replaced all BottleNeck components in the C2f with the EIFEM module. However, in YOLOv10, only the BottleNeck modules in C2f were replaced, while the original structure of C2fCIB was retained. It is also noticeable that there are structural differences in YOLOv10’s s, m, l, and x models, with the quantity of C2fCIB increasing incrementally, meaning the largest model has the most C2fCIB, thus having fewer opportunities for the integration of C2f_EIFEM modules. Our observations indicate that for the s and m structures, the inclusion of the EIFEM module outperforms the original model, whereas for the l and x structures, the addition of the EIFEM module does not improve performance over the original model. This further confirms our hypothesis. Notably, our main advantage is that we can achieve good results with very few calculations and parameters. <u>Method</u> _<u>P</u>_ <u>(%)</u> _<u>R</u>_ <u>(%)</u> <u>mAP @0.5(%)</u> <u>mAP @0.5:0.95(%)</u> <u>Parameters</u> <u>Gflops</u> <u>YOLOv5 n</u> <u>0.86</u> <u>0.96</u> <u>0.768</u> <u>0.418</u> <u>1,772,035</u> <u>4.2</u> <u>+EIFEM</u> <u>0.824</u> <u>0.97</u> <u>0.749</u> <u>0.4</u> <u>1,893,507</u> <u>4.7</u> <u>YOLOv5s</u> <u>0.961</u> <u>0.93</u> <u>0.763</u> <u>0.419</u> <u>7,026,307</u> <u>16</u> <u>+EIFEM</u> <u>0.922</u> <u>0.96</u> <u>0.773</u> <u>0.421</u> <u>7,505,059</u> <u>17.3</u> <u>YOLOv5m</u> <u>0.858</u> <u>0.93</u> <u>0.78</u> <u>0.439</u> <u>20,873,139</u> <u>47.9</u> <u>+EIFEM</u> <u>0.958</u> <u>0.95</u> <u>0.761</u> <u>0.417</u> <u>22,988,307</u> <u>54.2</u> <u>YOLOv5l</u> <u>0.908</u> <u>0.9</u> <u>0.786</u> <u>0.432</u> <u>46,165,219</u> <u>108.3</u> <u>+EIFEM</u> <u>0.915</u> <u>0.96</u> <u>0.793</u> <u>0.418</u> <u>51,723,363</u> <u>123.7</u> <u>YOLOv5x</u> <u>0.948</u> <u>0.85</u> <u>0.741</u> <u>0.423</u> <u>86,207,059</u> <u>203.9</u> <u>+EIFEM</u> <u>0.922</u> <u>0.96</u> <u>0.779</u> <u>0.436</u> <u>97,783,699</u> <u>236.2</u> <u>YOLOv8n</u> <u>0.921</u> <u>0.95</u> <u>0.764</u> <u>0.445</u> <u>3,157,184</u> <u>8.9</u> <u>+EIFEM</u> <u>0.873</u> <u>0.96</u> <u>0.771</u> <u>0.437</u> <u>2,703,794</u> <u>8.2</u> <u>YOLOv8s</u> <u>0.914</u> <u>0.92</u> <u>0.77</u> <u>0.439</u> <u>11,166,544</u> <u>28.8</u> <u>+EIFEM</u> <u>0.89</u> <u>0.94</u> <u>0.787</u> <u>0.443</u> <u>9,932,000</u> <u>26</u> <u>YOLOv8m</u> <u>0.849</u> <u>0.95</u> <u>0.771</u> <u>0.446</u> <u>25,902,624</u> <u>79.3</u> <u>+EIFEM</u> <u>0.916</u> <u>0.96</u> <u>0.798</u> <u>0.442</u> <u>21,850,272</u> <u>67.5</u> <u>YOLOv8l</u> <u>0.926</u> <u>0.93</u> <u>0.786</u> <u>0.444</u> <u>43,611,234</u> <u>164.8</u> <u>+EIFEM</u> <u>0.911</u> <u>0.96</u> <u>0.788</u> <u>0.435</u> <u>35,687,970</u> <u>135.7</u> <u>YOLOv8x</u> <u>0.919</u> <u>0.96</u> <u>0.765</u> <u>0.439</u> <u>68,229,632</u> <u>258.5</u> <u>+EIFEM</u> <u>0.921</u> <u>0.95</u> <u>0.79</u> <u>0.443</u> <u>55,750,370</u> <u>210.6</u> <u>YOLOv10s</u> <u>0.912</u> <u>0.94</u> <u>0.761</u> <u>0.431</u> <u>8,070,980</u> <u>24.8</u> <u>+EIFEM</u> <u>0.905</u> <u>0.95</u> <u>0.77</u> <u>0.44</u> <u>7,612,612</u> <u>22.6</u> <u>YOLOv10m</u> <u>0.935</u> <u>0.96</u> <u>0.767</u> <u>0.445</u> <u>16,457,332</u> <u>63.4</u> <u>+EIFEM</u> <u>0.906</u> <u>0.96</u> <u>0.768</u> <u>0.438</u> <u>14,805,460</u> <u>54.4</u> <u>YOLOv10l</u> <u>0.889</u> <u>0.95</u> <u>0.761</u> <u>0.435</u> <u>25,725,620</u> <u>126.4</u> <u>+EIFEM</u> <u>0.877</u> <u>0.95</u> <u>0.75</u> <u>0.437</u> <u>22,514,420</u> <u>106.3</u> <u>YOLOv10x</u> <u>0.952</u> <u>0.94</u> <u>0.767</u> <u>0.43</u> <u>31,666,420</u> <u>171.1</u> <u>+EIFEM</u> <u>0.935</u> <u>0.93</u> <u>0.745</u> <u>0.43</u> <u>30,202,436</u> <u>149.2</u> Table 1 . Performance comparison of the YOLOv5, YOLOv8, and YOLOv10 versions with the EIFEM module added. Figure 10 shows the comparison of the computational complexity, parameter count, and mAP@0.5 of the EIFEM module added to the N/S/M/L/X versions of YOLOv5, YOLOv8, and the S/M/L/X versions of YOLOv10. For various versions of YOLOv5, we find that the larger the model is, the higher the prediction accuracy will be after the EIFEM module is added, while only a small increase in the number of parameters and calculations is observed. In particular, in YOLOv5-X, mAP@0.5 directly increased by 3.8%; in various versions of YOLOv8, it is not difficult to find that the mAP@0.5 of all versions with the EIFEM module has increased substantially, but the number of calculations and parameters are much lower than before. Notably, in YOLOv8-X, the mAP@0.5 with the EIFEM module is 2.5% greater than before, whereas the number of parameters is reduced by 12.48 M. In YOLOv10, we find that the smaller the model is, the greater the mAP after the addition of the EIFEM module; however, regardless of the version, the number of parameters and calculations are greatly reduced. Therefore, although the EIFEM module designed in this paper produced good results in YOLOv5, YOLOv8, and YOLOv10, it had the best overall performance in YOLOv8. Therefore, we chose to design the ECDY network on the basis of YOLOv8s. The second version is chosen because steel defect detection has certain requirements for real-time performance, so the calculation speed must be guaranteed. Ablation experiment In this section, we conduct ablation experiments to analyse the effectiveness of each key component of ECDY, namely, the edge information feature enhancement module (C2f_EIFEM), content-aware reorganization feature module (CARAFE), and dynamic detection head (DyHead). The experimental results are shown in Table 2. 1. Effectiveness of C2f_EIFEM. EIFEM extracts edge information from images and fuses it with spatial infor mation to obtain richer semantic information about the steel defects. In the convolution of edge information extraction, the Sobel operator is used to add features extracted in the horizontal and vertical directions to reduce the number of calculations, and the Sobel operator has a certain resistance to noise in steel defect images. Through the experimental comparison of No. 0 and No. 1, the mAP@0.5 increases by 1.7%, and the Gflops decreases by 2.8%; the experimental comparison of No. 2 and No. 4 reveals that the mAP@0.5 increases by 3%, and the Gflops decreases by 2.8%; and the comparison of the results of No. 6 and No. 7 reveal that the mAP@0.5 increased by 1.9%, which confirms the effectiveness of the C2f_EIFEM module. This approach Fig. 10 . Comparison of YOLOv5, YOLOv8, and YOLOv10 with the EIFEM module in terms of the Gflops accuracy (left) and size accuracy (right) trade-offs. Each point represents the n/s/m/l/x version. <u>No.</u> <u>C2f_EIFEM</u> <u>CARAFE</u> <u>DyHead</u> _<u>P</u>_ <u>(%)</u> _<u>R</u>_ <u>(%)</u> <u>mAP @0.5(%)</u> <u>mAP @0.5:0.95(%)</u> <u>Para</u> <u>Gflops</u> <u>0</u> <u>0.914</u> <u>0.92</u> <u>0.77</u> <u>0.439</u> <u>11,166,544</u> <u>28.8</u> <u>1</u> <u>√</u> <u>0.89</u> <u>0.94</u> <u>0.787</u> <u>0.443</u> <u>9,932,000</u> <u>26</u> <u>2</u> <u>√</u> <u>0.961</u> <u>0.97</u> <u>0.764</u> <u>0.439</u> <u>11,302,914</u> <u>29</u> <u>3</u> <u>√</u> <u>0.897</u> <u>0.96</u> <u>0.776</u> <u>0.447</u> <u>10,853,662</u> <u>28.3</u> <u>4</u> <u>√</u> <u>√</u> <u>0.881</u> <u>0.96</u> <u>0.794</u> <u>0.445</u> <u>10,068,370</u> <u>26.2</u> <u>5</u> <u>√</u> <u>√</u> <u>0.89</u> <u>0.95</u> <u>0.768</u> <u>0.449</u> <u>9,617,854</u> <u>25.3</u> <u>6</u> <u>√</u> <u>√</u> <u>0.882</u> <u>0.92</u> <u>0.791</u> <u>0.439</u> <u>11,057,692</u> <u>28.8</u> <u>7</u> <u>√</u> <u>√</u> <u>√</u> <u>0.93</u> <u>0.96</u> <u>0.81</u> <u>0.448</u> <u>9,823,148</u> <u>26</u> Table 2 . Ablation studies of various components of ECDY. not only improves the accuracy index but also reduces the number of parameters and improves the running speed. 2. Effectiveness of CARAFE. CARAFE guides the upsampling process through the content of the input fea tures themselves, thereby achieving more accurate and efficient feature reconstructions, and by adaptively adjusting the size of the kernel, it accurately reconstructs features while using less computation. For steel defects, the kernel is adaptively adjusted according to the underlying information to guide upsampling so that comprehensive and rich semantic information can be obtained in the feature reconstruction process. A comparison of the No. 1 and No. 4 experiments reveals that the mAP@0.5 increases by 0.7%. Compared with the No. 3 and No. 6 experiments, the mAP@0.5 increases by 1.5%. Compared with the No. 5 and No. 7 experiments, the mAP@0.5 increases by 4.2%, which fully demonstrates the important role of CARAFE in the model. 3. Effectiveness of DyHead. DyHead uses the perceptual attention of three parts to adapt to the size, angle, and task of the target; it also reduces the number of parameters and improves the computational efficiency by calculating the attention of the three parts separately. Using perceptual attention for the three parts separately enables the model to adapt to defects of different sizes and defect positions of different viewing angles and rotation directions. A comparison of experiments No. 0 and No. 3 in the table reveals that the mAP@0.5 increases by 0.6%. Compared with the results of experiments No. 2 and No. 6, the mAP@0.5 increases by 2.7%. Compared with the results of No. 4 and No. 7, the mAP@0.5 increases by 1.6%. The amount of calculation is also reduced, which shows the effectiveness and lightness of DyHead. Comparative test To demonstrate the superiority of our designed ECDY network, we compared it with various mainstream models. The results are shown in Table 3. Most of the methods in the table are one-stage detection algorithms. According to the detection steps, we divide these methods into two groups: one-stage detection algorithms and two-stage <u>Method</u> _<u>P</u>_ <u>(%)</u> _<u>R</u>_ <u>(%)</u> <u>mAP @0.5(%)</u> <u>mAP @0.5:0.95(%)</u> <u>Parameters</u> <u>Gflops</u> <u>Faster R-CNN</u> <u>0.4352</u> <u>0.8488</u> <u>0.7166</u> <u>–</u> <u>–</u> <u>200</u> <u>SSD</u> <u>0.6599</u> <u>0.31355</u> <u>0.6157</u> <u>–</u> <u>–</u> <u>30.7</u> <u>RetinaNet</u> <u>0.8448</u> <u>0.46855</u> <u>0.6307</u> <u>–</u> <u>–</u> <u>83.2</u> <u>CenterNet</u> <u>0.8934</u> <u>0.1661</u> <u>0.6911</u> <u>–</u> <u>–</u> <u>–</u> <u>FCOS</u> <u>0.7273</u> <u>0.68975</u> <u>0.7423</u> <u>–</u> <u>–</u> <u>80.6</u> <u>YOLOv5n</u> <u>0.86</u> <u>0.96</u> <u>0.768</u> <u>0.418</u> <u>1,772,035</u> <u>4.2</u> <u>YOLOv5s</u> <u>0.961</u> <u>0.93</u> <u>0.763</u> <u>0.419</u> <u>7,026,307</u> <u>16</u> <u>YOLOv5m</u> <u>0.858</u> <u>0.93</u> <u>0.78</u> <u>0.439</u> <u>20,873,139</u> <u>47.9</u> <u>YOLOv5l</u> <u>0.908</u> <u>0.9</u> <u>0.786</u> <u>0.432</u> <u>46,165,219</u> <u>108.3</u> <u>YOLOv5x</u> <u>0.948</u> <u>0.85</u> <u>0.741</u> <u>0.423</u> <u>86,207,059</u> <u>203.9</u> <u>YOLOv6n</u> <u>0.832</u> <u>0.97</u> <u>0.771</u> <u>0.421</u> <u>4,500,064</u> <u>11.3</u> <u>YOLOv6s</u> <u>0.924</u> <u>0.96</u> <u>0.796</u> <u>0.446</u> <u>16,306,994</u> <u>44.2</u> <u>YOLOv6x</u> <u>0.868</u> <u>0.97</u> <u>0.76</u> <u>0.445</u> <u>172,986,210</u> <u>611</u> <u>YOLOv8n</u> <u>0.921</u> <u>0.95</u> <u>0.764</u> <u>0.445</u> <u>3,157,184</u> <u>8.9</u> <u>YOLOv8s</u> <u>0.914</u> <u>0.92</u> <u>0.77</u> <u>0.439</u> <u>11,166,544</u> <u>28.8</u> <u>YOLOv8m</u> <u>0.849</u> <u>0.95</u> <u>0.771</u> <u>0.446</u> <u>25,902,624</u> <u>79.3</u> <u>YOLOv8l</u> <u>0.926</u> <u>0.93</u> <u>0.786</u> <u>0.444</u> <u>43,611,234</u> <u>164.8</u> <u>YOLOv8x</u> <u>0.919</u> <u>0.96</u> <u>0.765</u> <u>0.439</u> <u>68,229,632</u> <u>258.5</u> <u>YOLOv9m</u> <u>0.871</u> <u>0.98</u> <u>0.793</u> <u>–</u> <u>32,771,428</u> <u>132.4</u> <u>YOLOv9e</u> <u>0.913</u> <u>0.95</u> <u>0.796</u> <u>0.455</u> <u>68,555,524</u> <u>240.7</u> <u>YOLOv10s</u> <u>0.912</u> <u>0.94</u> <u>0.761</u> <u>0.431</u> <u>8,070,980</u> <u>24.8</u> <u>YOLOv10m</u> <u>0.935</u> <u>0.96</u> <u>0.767</u> <u>0.445</u> <u>16,457,332</u> <u>63.4</u> <u>YOLOv10l</u> <u>0.889</u> <u>0.95</u> <u>0.761</u> <u>0.435</u> <u>25,725,620</u> <u>126.4</u> <u>YOLOv10x</u> <u>0.952</u> <u>0.94</u> <u>0.767</u> <u>0.43</u> <u>31,666,420</u> <u>171.1</u> <u>DAMO-YOLO-s</u> <u>–</u> <u>–</u> <u>0.78</u> <u>0.395</u> <u>15,650,000</u> <u>35.87</u> <u>DAMO-YOLO-t</u> <u>–</u> <u>–</u> <u>0.775</u> <u>0.4</u> <u>8,180,000</u> <u>17.17</u> <u>DAMO-YOLO-m</u> <u>–</u> <u>–</u> <u>0.73</u> <u>0.366</u> <u>27,580,000</u> <u>59.98</u> <u>DAMO-YOLO-l</u> <u>–</u> <u>–</u> <u>0.729</u> <u>0.357</u> <u>41,460,000</u> <u>95.55</u> <u>YOLOX-t</u> <u>–</u> <u>–</u> <u>0.708</u> <u>0.353</u> <u>2,240,000</u> <u>6.94</u> <u>YOLOX-s</u> <u>–</u> <u>–</u> <u>0.768</u> <u>0.438</u> <u>8,940,000</u> <u>26.77</u> <u>YOLOX-m</u> <u>–</u> <u>–</u> <u>0.769</u> <u>0.446</u> <u>25,280,000</u> <u>73.74</u> <u>YOLOX-l</u> <u>–</u> <u>–</u> <u>0.748</u> <u>0.443</u> <u>54,150,000</u> <u>155.69</u> <u>YOLOX-x</u> <u>–</u> <u>–</u> <u>0.751</u> <u>0.439</u> <u>99,000,000</u> <u>282.06</u> <u>Mamba-YOLO-B</u> <u>0.934</u> <u>0.96</u> <u>0.722</u> <u>–</u> <u>21,799,362</u> <u>49.6</u> <u>Mamba-YOLO-T</u> <u>0.882</u> <u>0.97</u> <u>0.715</u> <u>–</u> <u>5,986,522</u> <u>13.6</u> <u>Mamba-YOLO-L</u> <u>0.95</u> <u>0.96</u> <u>0.735</u> <u>–</u> <u>57,588,178</u> <u>156</u> <u>RT-DETR-R18</u> <u>0.826</u> <u>0.99</u> <u>0.663</u> <u>0.368</u> <u>20,184,464</u> <u>58.6</u> <u>RT-DETR-L</u> <u>0.925</u> <u>0.99</u> <u>0.768</u> <u>0.432</u> <u>32,970,732</u> <u>108.3</u> <u>ECDY</u> <u>0.93</u> <u>0.96</u> <u>0.81</u> <u>0.448</u> <u>9,823,148</u> <u>26</u> Table 3 . Performance comparison with the most advanced methods. detection algorithms. Among them, only Faster R-CNN is a two-stage detection algorithm. Compared with the other methods, our ECDY network improves the mAP@0.5 by 9.34%, and the number of Gflops decreases by 174. For the one-stage detection algorithm, ECDY is better than those of all the other networks, with precision reaching 93%, recall reaching 96%, mAP@0.5 reaching 81%, and mAP@0.5:0.95 reaching 44.8%. Compared with other networks, ECDY uses very few parameters and calculations to achieve good results. mAP@0.5 is 4% higher than that of the network YOLOv8s on which it is based, and 4.2% higher than the mAP@0.5 of the current SOTA model RT-DETR-L in the field of target detection. mAP@0.5:0.95 is 1.6% higher, the number of parameters is 23.15 M less than it is, and the amount of computation is 24% of it. Figure 11 shows the change process of mAP@0.5 during the training process. The figure shows that in the first 100 rounds, the mAP fluctuates; this is because the dataset we selected is relatively complex and contains difficult samples. Before 50 rounds, the mAP of YOLOv10s increases rapidly. Between 50 and 150 rounds, each model reaches a stable state. At this time, RT-DETR-L leads the other models in terms of mAP. In the last 50 rounds, all the models almost stopped improving. The ECDY network we designed still improves. Finally, after 200 rounds of training, the mAP of the ECDY network is much greater than that of the other networks. Figure 12 shows the AP comparison between the ECDY network and various mainstream networks in each defect category. The figure shows that for each model, crazing is the most difficult category to predict because some cracks are small and may not be distinguished for light reasons. In addition, it can be seen in the dataset that Fig. 11 . Comparison of the mAP@0.5 curves of the different models. the difference between the crazing and rolled-in scale classes is small, which may lead to model misjudgements. However, our model has the highest prediction accuracy for crazing among all the models. The ECDY network also has a good ability to distinguish difficult samples. Moreover, the prediction accuracy of our model in other categories also surpasses that of other models. Only in the rolled-in scale category is the predicted AP slightly lower than that of YOLOv6s, making it the second most accurate network in this category. Overall, the ECDY network has shown high accuracy in each category, reflecting the superiority of its model. Qualitative results As described in the first part of Sect. 3, the EIFEM improves the detection accuracy while reducing the number of parameters by fusing the edge feature information and spatial information. To evaluate the effectiveness of the EIFEM module we designed, the detection effects of YOLOv5s, YOLOv8s, and YOLOv10s with the EIFEM module are compared, and the detection results are shown in Fig. 13. In the crazing category, YOLOv5s did not detect it, but after adding the EIFEM, two bounding boxes were detected in this category. In YOLOv8s, compared with the version with the EIFEM, the inclusion category misdetected places without inclusions, and the addition of the EIFEM module improved the accuracy of the detection box. In YOLOv10s, the crazing category detected a few fewer cracks, and the rolled-in scale category was not detected; however, after adding the EIFEM module, the above problems improved. For easier categories such as inclusions, patches, and scratches, the detection results are similar, but after adding the EIFEM module, the defect location and size can be determined more accurately. In more difficult categories, such as crazing and rolled-in scales, the original model has difficulty detecting these small defects, and our EIFEM can accurately detect the location and shape of these smaller and subtle defects; this is due mainly to the edge detection ability of our module, which can retrieve the edges of subtle defects. To further demonstrate the utility of the edge convolutional branch and the spatial convolutional branch in the EIFEM module, we analyzed the feature maps during the feature extraction phase of YOLOv8s and ECDY by visualizing them, that is, visualizing the feature maps of the backbone network’s four stages C2f and C2f_EIFEM, and selecting 16 channels of the feature maps for display. The comparison of feature map visualization is shown in Fig. 14. In the stage 2, the features extracted by YOLOv8s and ECDY are not much different, but it can be seen that the features of ECDY are more distinctly three-dimensional; in the stage 4, it can be observed that YOLOv8s Fig. 12 . Prediction accuracy of different networks for six steel defect categories. blurs some features, and the spatial resolution is not as delicate as ECDY; in the stage 6 and stage 8, it can be seen that ECDY’s feature extraction is more concentrated, and the depiction of defect contours is clearer. Figure 15 shows a comparison of the detection effects of our designed ECDY network and current mainstream object detection methods on the dataset. In the crazing category, YOLOv5s did not identify defects, YOLOv9e and YOLOv10s missed detections and detected inaccurate positions, and RT-DETR-L detected the same object multiple times, resulting in overlapping detection frames. The ECDY network proposed in this paper had almost no missed detections or false detections. In the inclusion category, YOLOv6s, YOLOv8s, and RT-DETR-L had false detections, detecting normal places as inclusions. In the patches category, YOLOv6s and RT-DETR-L had false detections, detecting some patches as inclusions, and YOLOv8s, YOLOv9e, and YOLOv10s had missed detections. In the pitted surface category, YOLOv5s does not control the size of the border as well as the other models do. Although all of them detected defects, ECDY had the highest confidence. In the rolled-in scale category, YOLOv6s, YOLOv10s, and RT-DETR-L did not detect defects, and YOLOv5s and YOLOv9e missed detections. In the scratch category, all the networks performed well. In summary, in the categories that are well detected, all the networks have good results, but our ECDY model more accurately predicts the size and position of the defect bounding box, and does not have too many predictions of the same target that would cause the detection box to overlap. For categories that are more difficult to predict, such as very small cracks and oxide rolling, many networks, even relatively large networks, have missed detections and cannot detect defects, but the ECDY network proposed in this article can still accurately determine the defect location and size. To intuitively analyse the attention area of the ECDY network proposed in this paper, we use a heatmap analysis, as shown in Fig. 16, where the dark red area is the area that the model focuses on. We can observe that ECDY primarily focuses on the information surrounding defects, accurately targeting the defect contours and precisely locating them. Especially in the crazing category, we can see that ECDY can accurately pinpoint very fine scratches, while YOLOv8s cannot precisely locate all defects. This is mainly thanks to our designed EIFEM module, which effectively detects edge information. Moreover, from the inclusion category, we can see that YOLOv8s pays attention to the background information on the left and mistakenly identifies it as an inclusion. In the pitted_surface category, it overly focuses on the upper left corner and the right boundary; this is because noise in these areas causes YOLOv8s to pay attention to these unnecessary backgrounds, whereas ECDY has certain resistance to noise. Fig. 13 . Detection effects of YOLOv5s, YOLOv8s, YOLOv10s, and the EIFEM module on six steel defect categories. Conclusion In this paper, we propose an edge information feature extraction module (EIFEM) to learn the edge contour information of steel defects. This module can be adaptively inserted into the network. We insert this module into the YOLOv5, YOLOv8, and YOLOv10 versions, which not only improve the accuracy of network detection but also reduce the number of parameters and calculations, demonstrating the superiority and lightness of our designed module. To further improve detection efficiency in the steel defect field, we propose the ECDY network. Specifically, we rely on YOLOv8s and replace the BottleNeck in the C2f of the YOLOv8 network with our proposed EIFEM module, so that the network pays attention to the edge contour information while paying attention to the spatial information, and fuses the two parts of the features to obtain richer semantic information; we further replace the traditional upsampling with the upsampling method of the content-aware reorganization features (CARAFE), which can better use its feature information to guide itself to accurately and efficiently reconstruct features, and retain more detailed feature information. In addition, to adapt to different defect sizes and locations, different networks, and different task requirements, we replaced the detection head with a dynamic unified detection head. This detection head uses perception attention in multiple dimensions to perform unified detection when dealing with different sizes and tasks, while ensuring computational efficiency. Compared with other mainstream models applied to the public dataset provided by Northeastern University, the significant accuracy improvement and fewer parameters prove the superiority of our proposed ECDY network. Therefore, the network proposed in this article is highly suitable for steel defect detection scenarios. The detection accuracy of crazing in this article can be improved. For each network, crazing is the most difficult category to predict. We will focus on this aspect in subsequent work. Fig. 14 . Visualization and comparison of feature maps in the feature extraction stage of YOLOv8s and ECDY. Fig. 15 . Detection effects of different networks on 6 steel defect categories. Fig. 16 . Detection heatmap of the ECDY network for six steel defect categories. Data availability The datasets used and/or analyzed during the current study are available under dataset name ​“​N​E​U​-​D​E ​ T​”​:​h ​ t ​ t​p ​ : ​ /​/​f​a​c ​ u ​ l ​ t​y ​ .​n​e ​ u​. ​ e​d​u ​ .​c​n​/​s​o​n​g​k​e​c​h​e​n​/​z​h​_​C​N​/​z​d​y​l​m​/​2​6​3​2​7​0​/​l​i​s​t​/​i​n​d​e​x​.​h​t​m​. ​ Received: 17 July 2024; Accepted: 6 November 2024 References 1. Song, K. & Yan, Y. J. A noise robust method based on completed local binary patterns for hot-rolled steel strip surface defects. _S S_ . 285, 858–864 (2013). 2. Hu, K. et al. Overview of temporal action detection based on deep learning. 57, 26 (2024). 3. Girshick, R., Donahue, J., Darrell, T. & Malik, J. in _Proceedings of the IEEE conference on computer vision and pattern recognition._ 580–587. 4. Girshick, R. in _Proceedings of the IEEE international conference on computer vision._ 1440–1448. 5. Ren, S., He, K., Girshick, R. & Sun, J. J. A. i. n. i. p. s. Faster r-cnn: Towards real-time object detection with region proposal networks. 28 (2015). 6. Jiang, P., Ergu, D., Liu, F., Cai, Y. & Ma, B.J. A review of Yolo algorithm developments. _P c s_ . 199, 1066–1073 (2022). 7. Hu, K. et al. Cross-dimensional feature attention aggregation network for cloud and snow recognition of high satellite images. 36, 7779–7798 (2024). 8. Gao, W., Zhang, X., Yang, L. & Liu, H. in _3rd International conference on computer science and information technology._ 67–71 (IEEE). (2010). 9. Vincent, O. R. & Folorunso, O. in _Proceedings of informing science & IT education conference (InSITE)._ 97–107. 10. Luo, Q. et al. Automated visual defect detection for flat steel surface: a survey. 69, 626–644 (2020). 11. Wang, Y. et al. The transmission line foreign body detection algorithm based on weighted spatial attention. 18, 1424158 (2024). 12. He, Y., Song, K., Meng, Q. & Yan, Y. J. I. t. o. i. & measurement. An end-to-end steel surface defect detection approach via fusing multiple hierarchical features. 69, 1493–1504 (2019). 13. Akhyar, F., Liu, Y., Hsu, C. Y., Shih, T. K. & Lin, C. Y. J. T. I. J. o. A. M. T. FDD: a deep learning–based steel defect detectors. 126, 1093–1107 (2023). 14. Li, K., Wang, X. & Ji, L. in _2019 International Conference on Artificial Intelligence and Advanced Manufacturing (AIAM)._ 656–661 (IEEE). 15. Akhyar, F., Lin, C. Y., Muchtar, K., Wu, T. Y. & Ng, H. F. in _16th IEEE International Conference on Advanced Video and Signal Based_ _Surveillance (AVSS)._ 1–4 (IEEE). (2019). 16. Cheng, X. & Yu, J. J. I. T. o. I. & Measurement. RetinaNet with difference channel attention and adaptively spatial feature fusion for steel surface defect detection. 70, 1–11 (2020). 17. Tian, R. & Jia, M. J. M. DCC-CenterNet: a rapid detection method for steel surface defects. 187, 110211 (2022). 18. Kou, X., Liu, S., Cheng, K. & Qian, Y. J. M. Development of a YOLO-V3-based model for detecting defects on steel strip surface. 182, 109454 (2021). 19. Guo, Z., Wang, C., Yang, G., Huang, Z. & Li, G. J. S. Msft-yolo: Improved yolov5 based on transformer for detecting defects of steel surface. 22, 3467 (2022). 20. Yang, S., Zhang, Z., Wang, B. & Wu, J. in _Proceedings of the 2024 7th International Conference on Image and Graphics Processing._ 39–46. 21. Zhao, Y. et al. in _Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition._ 16965–16974. 22. Yin, Z., Wang, Z., Fan, C., Wang, X. & Qiu, T. J. S. Edge detection via fusion difference convolution. 23, 6883 (2023). 23. Chen, L. C., Barron, J. T., Papandreou, G., Murphy, K. & Yuille, A. L. in _Proceedings of the IEEE conference on computer vision and_ _pattern recognition._ 4545–4554. 24. Hagara, M. et al. Grayscale image formats for edge detection and for its FPGA implementation. 75, 103056 (2020). 25. Su, Z. et al. in _Proceedings of the IEEE/CVF international conference on computer vision._ 5117–5127. 26. Han, L., Tian, Y. & Qi, Q. in _MATEC Web of Conferences._ 03031 (EDP Sciences). 27. Lynn, N., Sourav, A. & Santoso, A. in _IOP Conference Series: Materials Science and Engineering._ 012079 (IOP Publishing). 28. Wang, X. in _2nd International Conference on Computer Graphics, Image and Virtualization (ICCGIV)._ 73–77 (IEEE). (2022). 29. Wang, J. et al. in _Proceedings of the IEEE/CVF international conference on computer vision._ 3007–3016. 30. Dai, X. et al. in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition._ 7373–7382. 31. Cui, L. et al. SDDNet: a fast and accurate network for surface defect detection. 70, 1–13 (2021). 32. Song, X., Cao, S., Zhang, J. & Hou, Z. J. E. _Steel Surf. Defect Detect. Algorithm Based YOLOv8_ 13, 988 (2024). 33. Li, Z. et al. A deep learning model for steel surface defect detection. 10, 885–897 (2024). 34. Liyuan, L. et al. Surface defect detection of strip steel based on GT-CutMix augmentation algorithm and improved DSSD model. (2024). Author contributions Y.W., Conceptualization, Funding acquisition, Methodology, Project administration, Supervision, Visualization, Writing–review & editing. T.Y., Conceptualization, Formal analysis, Methodology, Software, Validation, Writing–original draft, Writing–review & editing. X.C., Formal analysis, Software, Validation, Writing–original draft, Writing–review & editing. A.S.H., Validation, Writing–original draft. B.D., Investigation, Visualization, Writing–review & editing. Y.Z., Formal analysis, Writing–review & editing. S.G., Data curation, Resources, Writing–review & editing. Y.Z., Data curation, Resources, Writing–review & editing. H.Z., Investigation, Data curation, Resources. Funding This work was supported by Ministry of Education Humanities and Social Science Research Project (No. 23YJAZH034), The Postgraduate Research and Practice Innovation Program of Jiangsu Province (No. SJCX_2147, SJCX_2148), National Computer Basic Education Research Project in Higher Education Institutions (No. 2024-AFCEC-056, 2024-AFCEC-057), Enterprise Collaboration Project (No. Z421A22349, Z421A22304, Z421A210045). Declarations Competing interests The authors declare no competing interests. Additional information Correspondence and requests for materials should be addressed to Y.W. Reprints and permissions information is available at www.nature.com/reprints. Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Open Access This article is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License, which permits any non-commercial use, sharing, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if you modified the licensed material. You do not have permission under this licence to share adapted material derived from this article or parts of it. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to [obtain permission directly from the copyright holder. To view a copy of this licence, visit ​h​t​t​p​:​/​/​c​r​e​a​t​i​v​e​c​o​m​m​o​](http://creativecommons.org/licenses/by-nc-nd/4.0/) [n​s​.​o​r​g​/​l​i​c​e​n​s​e​s​/​b​y​-​n​c​-​n​d​/​4​.​0​/.](http://creativecommons.org/licenses/by-nc-nd/4.0/) ​​ © The Author(s) 2024

섹션 본문 75문단 · 48,996자

(제목 없음)

1Scratches and cracks in steel severely affect its service life and performance.However, owing to the irregular shapes and sizes of steel surface defects, defects within the same class may be different, whereas defects between classes may be similar.Existing methods focus only on spatial information, resulting in low detection accuracy.To alleviate these problems, this paper proposes the ECDY (EIFEM CARAFE DyHead) network to enhance the detection capability of steel defects.We first design a feature extraction module that focuses on the edge information of feature contours.This module uses the Sobel operator to extract the edge information of a feature and fuses it with the overall spatial information so that richer semantic information can be obtained.The module has improved accuracy in the YOLOv5, YOLOv8, and YOLOv10 versions, and uses fewer parameters and calculations.In particular, in YOLOv8x, mAP@0.5 increased by 2.5%, and the number of parameters was reduced by 12.4 M. Second, to retain the detailed information in the feature pyramid, and to better reconstruct features, we choose the content-aware reassembly feature method (CARAFE) as the upsampling method.Finally, the detection head was replaced with a dynamic unified detection head (DyHead) to adapt to different defect sizes and different task requirements.Compared with YOLOv8s, the proposed method improves precision by 1.6%, recall by 4%, and

2(EIEConv) by using the Sobel operator 8 in convolution.EIEConv extracts the edge contour information of the image by calculating the horizontal and vertical directions; it then removes irrelevant information and retains important structural information.The Sobel operator is a combination of Gaussian smoothing and differential operations 9 , so it has strong noise resistance and a smoothing effect on the noise in the dataset.EIFEM fuses the edge information extracted by EIEConv, and the spatial information extracted by the convolution branch, to obtain richer semantic information while ensuring a small number of parameters.The module has improved accuracy in the YOLOv5, YOLOv8, and YOLOv10 versions, and the number of parameters and calculations have been greatly reduced.

3To further improve the accuracy of steel defect detection, and reduce the number of model parameters, we design an ECDY (EIFEM CARAFE DyHead) network based on YOLOv8s.First, we replace the BottleNeck of C2f with the EIFEM module we designed.Compared with C2f, the improved module can smooth the noise in the grayscale image and obtain rich information on the fusion of edge information and spatial information; second, to obtain more accurate feature reconstructions, we replace the upsampling method with the upsampling method of content-aware reassembly features.This method can learn the convolution kernel suitable for its feature information through the encoder to guide a more accurate feature reconstruction; finally, the original detection head is replaced with a dynamic unified detection head to address different defect sizes and change positions.Because of this detection head, we can dynamically adapt to different sizes, positions, and tasks without changing the detection head.

Related work Traditional steel testing methods

4Traditional steel inspection methods include manual sampling, magnetic flux leakage inspection, and infrared inspection 10 .Manual sampling mainly involves employees taking steel samples for visual inspection.This method is not only time-consuming and labour-intensive but also has some minor defects that may be overlooked by the human eye.Magnetic flux leakage inspection mainly detects magnetic fields on steel surfaces.If the magnetic field on the surface of steel changes, that is, a magnetic flux leakage occurs, it means that there are defects on the steel surface.However, although this method is much more efficient than manual sampling, many minor defects, such as plaques and small pits, may be missed.Infrared inspection determines whether there are defects on the basis of the change in the temperature of the steel surface.Compared with the first two methods, infrared inspection is more accurate, but because steel has different infrared absorption capabilities, it may misjudge the type of defect.Traditional inspection methods not only require considerable manpower but also have extremely low efficiency and accuracy, making it difficult to detect defects in time.

Target detection methods

5In recent years, the rapid development of deep learning has set off a wave in various fields.Compared with traditional methods, deep learning-based object detection algorithms automatically extract features for defect detection through convolutional neural networks 11 , which not only saves considerable manpower but also greatly improves accuracy and real-time performance.At present, deep learning-based object detection algorithms can be divided into two main categories: two-stage detection algorithms and one-stage detection algorithms.

6A two-stage detection algorithm is divided into two stages.The first stage extracts the regions of interest and then classifies and regresses these regions.The main representative algorithms are the RCNN and Faster RCNN series.To effectively apply these target detection algorithms to the field of steel defect detection, He et al. 12 proposed a multilevel feature fusion network (MFN) to fuse multiple layers of features.This fusion operation enables richer semantic information to be obtained, and a region proposal network (RPN) is used to generate regions of interest.A defect detection dataset, NEU-DET, was established, which has promoted research on steel defects.Akhyar et al. 13 used R-CNN as the backbone network and improved it through deformable convolution and deformable RoI pooling to adapt to the location and size of the defects, and to locate the defects more accurately.To improve the detection rate, Li et al. 14 first performed a data enhancement on the NEU-DET dataset, improved the Faster R-CNN and FPN networks, and used multiscale feature fusion to encourage the reuse of low-level features, thereby enhancing the detection effect of small defects.

7Unlike the two-stage detection algorithm, the one-stage detection algorithm directly predicts the category and position of the bounding box in the network at the same time without generating candidate regions separately.This integrated design simplifies the processing flow and improves the detection speed.The main representative algorithms include SSD, RetinaNet, FCOS, CenterNet, YOLO series, etc. Akhyar et al. 15 used feature pyramid networks and focal loss optimization based on RetinaNet to alleviate the problems of too few defect targets and imbalanced foreground and background samples to a certain extent.To consider the accuracy of the defect category and location, Cheng et al. 16 embedded a novel channel attention mechanism based on RetinaNet to prevent information loss, and used an adaptive spatial feature fusion module to fuse shallow and deep features.To achieve a balance between accuracy and speed, Tian et al. 17 proposed an expansion feature enhancement model based on CenterNet, expanded the receptive field, and proposed a new centre point function for more accurate keypoint detection.Kou et al. 18 introduced their dense convolutional blocks into the YOLOv3 model to extract rich feature information and to enhance the representation ability of the network.To improve the learning ability of complex textures and defect scale changes, Guo et al. 19 added the TRANS module based on the Transformer design to the backbone network and detection head of YOLOv5, enhancing the dynamic adjustment of the detection head to defects of different sizes.Yang et al. 20 used Real-ESRGAN to enhance image resolution, effectively alleviating the tiny defect challenges in the steel defect dataset, and designed a module based on CBAM and SCSE attention to promote the fusion of channel information and spatial information, and to improve the expression ability of the model.To eliminate the negative impact of NMS on the speed and accuracy of the YOLO model, Zhao et al. 21proposed the RT-DETR model, which processes multiscale features by decoupling intrascale interactions and cross-scale fusion to improve speed, and proposed the minimum uncertainty query selection to improve accuracy.

8In summary, traditional steel inspection methods and object detection methods each have certain limitations and drawbacks.Traditional inspection methods primarily consist of manual sampling and automated methods, which are time-consuming and labor-intensive, with low detection accuracy and a propensity for false positives, making real-time defect detection challenging.Existing object detection methods, which are mainly one-stage and two-stage detection algorithms, have indeed improved detection accuracy compared to traditional methods, but there is still room for improvement.Moreover, these methods often fail to detect smaller defects.Therefore, this paper proposes a defect edge detection algorithm specifically tailored for steel defects to accurately locate imperfections.

Methods

9To learn richer image features and obtain more important edge information in steel defect detection, we propose the EIFEM module, which has been improved in YOLOv5, YOLOv8, and YOLOv10.In addition, we designed an ECDY network based on YOLOv8s, which has the highest indicators compared with those of other mainstream models.We introduce the designed EIFEM module in the first section and the designed ECDY network in the second section.

EIFEM module

10Since the steel defect detection dataset is a grayscale image, and the various defects are of different sizes and irregular shapes, special attention needs to be given to the contour information of the defects.To more effectively identify defects in steel, and accurately classify them, we propose a new EIFEM module, which is designed to be an efficient front-end module in image recognition tasks.While learning edge information, it has a certain resistance to noise in the steel defect dataset.First, the module extracts the edge contour information of the image features through the edge information extraction convolution (EIEConv), which we designed.Second, it extracts spatial information through a convolution branch, and then fuses the features extracted from the two parts to learn a richer image feature representation.The EIFEM structure diagram is shown in Fig. 1.

Edge convolution branch

11Convolutional neural networks (CNNs) are generally good at learning spatial information but may be slightly insufficient for extracting edge information from images.Despite the prowess of CNNs in feature extraction, they may introduce unwanted background details when capturing subtle or faint edges 22 .Edge information often requires a finer spatial resolution and sensitivity to detail, yet the convolutional layers of CNNs can blur certain image details 23 , especially after multiple convolutions and pooling operations.Given the presence of numerous minute defects in steel, precise localization of defect edges is crucial.The proposed algorithm in this paper targets the detection of steel defect edges to accurately pinpoint imperfections.We explicitly extract the edge contour features of the image through the edge convolution branch.Since the datasets used for steel defect detection are all grayscale images, the edge contour information is particularly important.Edge information refers mainly to the most significant grayscale changes in an image 24 .These significant changes often reflect important changes in attributes, such as surface direction discontinuity, depth discontinuity, material attribute changes, and scene light changes.Edge detection 25 is a research field in feature extraction.Image edge detection reduces a large amount of data, eliminates irrelevant information, and retains important structural attributes of the image.This approach is highly important for steel defect detection and the identification of the defects and their categories.The edge detection operator uses the sudden change in the grayscale of the image edge to detect the edge contour information.Among the various edge detection operators, the Roberts, Prewitt, Laplacian, Canny, and Sobel operators stand out.The Roberts operator, while simple, can miss edges, lacks noise suppression, and is not precise in edge localization.The Prewitt operator, though straightforward, offers some noise resistance but may result in a coarse edge representation, neglecting the impact of the proximity of neighboring pixels to the current pixel.The Laplacian operator excels at detecting subtle edges but is susceptible to noise, potentially leading to a significant noise response and the loss of directional edge information.The Canny operator is adept at producing fine edges and effectively suppresses noise, yet its complexity and computational demands are considerable.The Sobel operator, on the other hand, balances these considerations, offering superior performance on noisy images and accurate edge localization.Although it may not match the Canny operator in detection precision, its simplicity makes it ideal for real-time applications.Consequently, after a thorough evaluation, we opt for the Sobel operator to conduct edge detection.

12The Sobel operator is a classic edge detection filter 26 that can effectively capture sudden changes in the intensity of an image, thereby obtaining important edge information.The Sobel operator contains two sets of 3 × 3 filters, which extract edge-sensitive information in the horizontal and vertical directions.The Sobel operator reaches the extreme value at the edge on the basis of the weighted difference in the grayscales of the upper and lower, and the left and right, neighbouring points of the pixel 27 , thereby effectively detecting the edge.The Sobel operator is a combination of Gaussian smoothing and differential operations, so it has a smoothing effect on noise, and provides more accurate edge direction information.It is a more commonly used edge detection method.

13The edge information extraction convolution (EIEConv) we designed applies the Sobel operator to the weight of the 3D convolution to perform edge detection in the horizontal and vertical directions.The convolution structure diagram is shown in Fig. 2. The 3D convolution is chosen because the traditional convolution traverses all the channels to extract horizontal and vertical features at a slow speed.The Sobel operator contains two 3 × 3 matrices S x , S y , and S x , S y as shown in Eq. ( 1).Expanding S x , S y to five dimensions, that is, B × C × D × 3 × 3, is used as the weight of the 3D convolution W x , W y , where B is the batch size, C is the number of channels, and B and C are consistent with the input image.The input image is also added with the depth dimension to the fivedimensional image and multiplied by W x , W y ; the horizontal edge detection result is G x = W x × A ex , where A ex is the expanded original image; and the vertical edge detection result is G y = W y × A ex .Therefore, the final output after EIEConv is G = G x + G y , and the depth dimension in G is removed to return it to the dimension of the original input image, that is, B × C × H × W, the output feature size dimension is the same as the input.

Spatial convolution branch

14In addition to the edge contour information, the spatial information in the steel defect images is equally important.

15The EIFEM module extracts spatial information through an additional spatial convolution branch.Unlike the edge convolution branch, the spatial convolution branch extracts the features of the original image and can retain rich spatial details.Spatial convolution is through the CBS module, which consists of a convolution layer, a batch normalization layer, and an activation function.The spatial convolution branch plays a role in extracting Fig. 2. EIEConv structure diagram (the input features are extracted through an x-direction convolution and y-direction convolution to extract the horizontal and vertical information, respectively, and finally fused to obtain the edge contour information, and the output feature size dimension is the same as the input).

16spatial features and enhancing the model's expression capabilities in the EIFEM module.The structure of this module is shown in Fig. 3.

Feature fusion

17The edge contour information extracted by the edge convolution branch, and the spatial information extracted by the spatial convolution branch.are fused to form semantically rich feature information.These two parts of information are then added to the initial information after deeper information is extracted through convolution and then sent to the convolution module, which helps to learn the residual information and improves the training stability.This fusion operation allows the learned features to retain the structural properties of steel defects while learning rich spatial information.

ECDY network

18In response to the need for steel defect detection, we design the ECDY network to further improve the accuracy of steel defect detection and reduce the number of calculations.The model structure diagram is shown in Fig. 4.

19The network is improved on the basis of YOLOv8s.First, we replace the BottleNeck in C2F based on the EIFEM module mentioned in the first section to design the C2F_EIFEM module so that the network pays more attention to the edge contour information we need, and has a certain resistance to the noise in grayscale images.Second, to enable the adaptive and more accurate reconstruction of features, we replace the upsampling method with CARAFE, a lighter operator.Finally, a unified dynamic target detection head (DyHead) based on the attention mechanism is used in the head to dynamically adapt to steel defects of different sizes and angles and the needs of tasks.

C2F_EIFEM

20In the C2f module of YOLOv8, rich feature interactions and conversions are achieved through segmentation and multichannel design.However, C2f uses a fixed receptive field.This fixed structure feature extraction lacks the edge information needed for steel defect detection and may introduce noise during training.To solve the above

CARAFE

21The current mainstream upsampling methods are nearest neighbour interpolation and bilinear interpolation 28 , which guide information reconstruction through the feature distance between adjacent pixels.However, nearest neighbour interpolation and bilinear interpolation consider only subpixel neighbourhoods and cannot capture rich semantic information in the global context.Another method to achieve adaptive upsampling is deconvolution; however, it has two major disadvantages.First, the deconvolution operator applies the same kernel to the entire image and cannot change the convolution kernel according to the feature content, which limits the ability to respond to different image changes.Second, when a larger kernel is used, the number of parameters and computational workload will be large.In the steel defect dataset, different types of defects vary greatly in size and shape, and it is difficult for mainstream methods to adaptively respond to changes in defects and reconstruct features.CARAFE (content-aware reassembly of FEatures) 29 is an upsampling method for enhancing convolutional neural network feature maps.The core idea of CARAFE is to use the content of the input features to guide the upsampling process, thereby achieving a more accurate and efficient feature reconstruction.CARAFE can be used in processes that require fine upsampling.The steel defect detection we are conducting attaches great importance to feature details because some defects, such as cracks, are often small and difficult to detect.This method improves the detail preservation and reconstruction quality of the upsampling process, enabling the network to generate clearer and more accurate outputs.

22CARAFE predicts the recombination kernel by using the underlying information at each location and upsampling the area near the location.Owing to the introduction of the underlying information, CARAFE can use adaptive and optimized recombination kernels at different locations, so that even small defects can be considered in steel defect detection.The CARAFE consists of two steps.First, the recombination kernelσ 2 at each target location is predicted, and then, the features are recombined with the predicted kernel, The overall structure of CARAFE is shown in Fig. 6.In the reorganization kernel prediction module, for an input shape of H × W × C, we compress its number of channels to a 1 × 1 convolution C m .The compression step reduces the number of calculations.Given the upsampling ratio of σ, each source position of the input feature must correspond to, a target position.Assuming that the upsampling kernel size is k up × k up , the output we need to predict is

23, and then we expand the channel dimension in the spatial dimension to obtain σH × σW × k 2 up , an upsampling kernel of shape.Then, we normalize the obtained upsampling kernel via softmax so that the sum of the convolution kernel weights is 1.For the nuclear prediction encoder, the encoder needs to have a convolutional layer with a kernel size k encoder × k encoder .Therefore, the parameters of this nuclear prediction encoder should be k encoder × k encoder × C m × C o , which changes the compressed features into H × W × C o , and an increasing k encoder can obtain a larger receptive field and more comprehensive and complete contextual information.However, the number of calculations for increasing the kernel prediction convolution size increases accordingly, and the receptive field does not continue to increase k encoder to a certain range.Therefore, it is necessary to make a balanced adjustment between k up .

24In the feature reconstruction module, for each position of the input feature l(i, j), the corresponding N (X l , k up ) square area is removed, that is, k up × k up , the area centred on l, and the predicted upsampling kernel of the point, are dot products used to obtain the output value.For different channels at the same position, the same upsampling kernel is shared, and the correlation of the channel information is retained, which reduces part of the calculation.

DyHead

25Recent mainstream object detection heads can usually solve only a certain function required by the detection head.However, we hope to have a detection head that can adaptively handle different sizes, spaces, and tasks in a unified manner.In particular, for steel defect detection, such as dense patch defects, there are patch information of different sizes in one image, so a single size cannot meet the needs of diverse objects.Second, the positions and rotation angles of different defects under different lighting and shooting angles are different (such as horizontal scratches, vertical scratches, etc.), which requires the detection head to adapt to different spatial positions.Finally, owing to different task requirements, objects can have different representations (such as bounding boxes, centre points, etc.), and the network for extracting features may be a one-stage algorithm or a two-stage algorithm.These representations and networks have completely different goals and constraints.We expect that steel defect detection can be applied to the needs of different factories, so DyHead 30 is a good choice for our detection task.

26For the concatenation of L different levels of features in a given feature pyramid, we adjust the size of

27, the L levels of features, by upsampling or downsampling to make them close to the scale of the intermediate-level features.The rescaled feature pyramid can be represented as a four-dimensional tensor F ∈ R L×H×W ×C , where L represents the number of layers in the pyramid and H, W, and C represent the height, width, and number of channels of the intermediate-level features, respectively.To reshape the features into three dimensions, we define S = H × W as spatial information, so the reshaped features F ∈ R L×S×C .We began deploying attention mechanisms separately on each dimension.The size-aware attention module is deployed only on the horizontal dimension of the pyramid features.It enhances features at appropriate levels according to the learned information to perceive size information on the basis of the semantics of different levels of pyramidlevel features and the size of each object; the spatial-aware attention module is deployed on the spatial dimension, and the spatial attention module obtains the location information of different objects on the basis of the spatial features; the task-aware attention module is deployed on the channel, and it guides different feature channels to support different tasks according to the different convolution kernel responses of the task objects.Therefore, the attention formula can be expressed as:

28Where π C (•), π S (•), and π L (•) represent the attention functions applied to the channel dimension, spatial dimension, and horizontal dimension, respectively.The processing flow chart of DyHead is shown in Fig. 7.

29Next, we introduce the specific implementation methods of scale-aware attention, spatial-aware attention, and task-aware attention.

Scale-aware attention p L

30Dynamically fuse features at appropriate levels according to the semantic importance of different sizes.The specific formula is as follows:

31Where ϕ (x) is a hard-sigmoid function and where f(x) is a linear function approximating 1 × 1 the convolution layer.

Spatial-aware attention p S

32We use spatial awareness attention to focus on the common areas where features exist in both spatial information and hierarchical information.Because S is a fusion of H × W, we first use variable convolution to sparse a part of the learning features to reduce part of the computation and then aggregate this sparse part to the hierarchical features of the same spatial position.The formula for spatial-aware attention is as follows:

33where N is the number of positions for sparse sampling, l is the position in the horizontal dimension, d n + ∆d n is the position offset after self-learning, ∆d n is the spatial offset, c is the position in the channel dimension, ∆p n is d n an important scalar for self-learning at the position, d n + ∆d n , and ∆p n is learned from the input features of the intermediate level size of F.

Task-aware attention p C

34To adapt to the metrics of different networks and different tasks, task-aware attention is deployed at the end, which dynamically switches the ON and OFF channels of features to adapt to different tasks, Specifically:

35Where F c is the feature slice of the C-dimensional channel, and where α 1 , α 2 , β 1 , β 2 T = θ (•) is a hyperfunction that controls the activation threshold through learning.θ (•), the implementation method first performs global average pooling dimensionality reduction on the L × S dimension, then uses two fully connected layers and a normalization layer, and finally uses the shifted sigmoid function to normalize the output to [− 1,1].For any backbone network to extract feature pyramids, it is further adjusted to the same scale to form a three-dimensional tensor F ∈ R L×S×C , which is then used as the input of the dynamic head.Next, the DyHead block consisting of size perception, space perception, and task perception is stacked in sequence, and the output of the dynamic head can be used for different tasks and representations of object detection.The structure of the DyHead block is shown in Fig. 8.

Experiment

36To verify the effectiveness of our proposed EIFEM module and ECDY network, we apply the proposed EIFEM module to the YOLOv5, YOLOv8, and YOLOv10 versions, compare them with the original models, and compare the results of the ECDY network with those of the most advanced methods.

Dataset

37The dataset used in this paper is the steel defect detection dataset (NEU-DET) released by Northeastern University.The dataset contains 1,800 grayscale images, covering six typical steel surface defects 31 , namely, crazing, inclusion, patches, pitted surface, rolled-in scale, and scratches.The resolution of each image is 200 × 200, and the number of samples of each defect image is 300. Figure 9 shows sample images of six typical steel defects.The figure shows that there are great differences in the number of defects within a class.For example, the shapes of patches may differ, and scratches may come from different directions, resulting in great differences within a class.However, some interclass differences, such as oxide scales, cracks, and pitting surfaces, are very small.It is difficult for our eyes to distinguish the differences between classes from pictures.Under the influence of lighting and material, the grayscale changes of the same defect category may also differ.In addition, there are difficult samples in the dataset.Some small crack models are difficult to detect.In the experiment, the dataset is divided into a training set, a validation set, and a test set at a ratio of 8:1:1.

Evaluation metrics

38To objectively measure the detection performance of the model, this experiment uses evaluation indicators, including precision, recall, and mean average precision (mAP), to measure the accuracy of the model 32 ; parameters are used to measure the size and complexity of the model; and Gflops is used to measure the Fig. 7.The DyHead processing flow chart, that is, the feature pyramid, is reshaped first L × S × C, first through scale-aware attention, then through spatial-aware attention, and finally through task-aware attention to obtain the detection head output.

39execution time of the model 33 .Precision is the proportion of correct targets among the targets detected by the model; recall is the proportion of targets correctly identified by the model among the total number of real targets.The indicator mAP refers to the AP used to measure N categories.When the IoU is set to 0.5, it is called mAP@0.5; in this article, mAP@0.5 and mAP@0.5:0.95(the IoU threshold ranges from 0.5 to 0.95) are used as measurement indicators.The formulas for each indicator are as follows:

40P recision = T P T P + F P (6)

41TP is the number of correctly identified targets, FP is the number of incorrectly identified targets, and FN is the number of missed targets 34 .P(r) represents the smooth precision-recall curve, and the area under the smooth curve obtained by integrating it is the AP.N represents the number of detected object categories, which corresponds to the 6 different steel defects in this paper.

Implementation details

42The computer environment used in this article is composed of Python 3.8, CUDA 11.3, an NVIDIA RTX3090 GPU graphics card, and 30 GB of memory.The training hyperparameters are set as follows: the number of training rounds is 200, the batch size is set to 8, and the SGD optimizer is used.

EIFEM improvements in various models

43To verify the effectiveness of the proposed EIFEM module, we add this module to each version of YOLOv5, YOLOv8, and YOLOv10 for comparison.Specifically, YOLOv5 replaces BottleNeck in its C3 module with the EIFEM module, whereas YOLOv8 and YOLOv10 replace BottleNeck in its C2f module; however, the C2fCIB of YOLOv10 remains unchanged.Our EIFEM module is an efficient module that is mainly used to fuse edge contour features and spatial features, and it can effectively extract edge information from grayscale images.The experimental results are shown in Table 1.From the table, we can see that among the various versions of YOLOv5, only YOLOv5n and YOLOv5m have a map@0.5 that is 1.9% lower after adding EIFEM.In each version of YOLOv8, after adding the EIFEM module, map@0.5 is improved, and the number of parameters and calculations are greatly reduced, which is equivalent to using fewer parameters to achieve better results.In particular, in YOLOv8x, mAP@0.5 increases by 2.5%, and the number of parameters decreases by 12.4 M. In each version of YOLOv10, only YOLOv10l and YOLOv10x reduce their map@0.5 by 1.1% and 2.2%, respectively, but their calculations are greatly reduced in each version.

44Regarding the inferior performance of the EIFEM module when incorporated into YOLOv10 compared to YOLOv8, our analysis identified the following reasons: In YOLOv8, we replaced all BottleNeck components in the C2f with the EIFEM module.However, in YOLOv10, only the BottleNeck modules in C2f were replaced, while the original structure of C2fCIB was retained.It is also noticeable that there are structural differences in YOLOv10's s, m, l, and x models, with the quantity of C2fCIB increasing incrementally, meaning the largest model has the most C2fCIB, thus having fewer opportunities for the integration of C2f_EIFEM modules.Our observations indicate that for the s and m structures, the inclusion of the EIFEM module outperforms the original model, whereas for the l and x structures, the addition of the EIFEM module does not improve performance over the original model.This further confirms our hypothesis.Notably, our main advantage is that we can achieve good results with very few calculations and parameters.Figure 10 shows the comparison of the computational complexity, parameter count, and mAP@0.5 of the EIFEM module added to the N/S/M/L/X versions of YOLOv5, YOLOv8, and the S/M/L/X versions of YOLOv10.For various versions of YOLOv5, we find that the larger the model is, the higher the prediction accuracy will be after the EIFEM module is added, while only a small increase in the number of parameters and calculations is observed.In particular, in YOLOv5-X, mAP@0.5 directly increased by 3.8%; in various versions of YOLOv8, it is not difficult to find that the mAP@0.5 of all versions with the EIFEM module has increased substantially, but the number of calculations and parameters are much lower than before.Notably, in YOLOv8-X, the mAP@0.5 with the EIFEM module is 2.5% greater than before, whereas the number of parameters is reduced by 12.48 M. In YOLOv10, we find that the smaller the model is, the greater the mAP after the addition of the EIFEM module; however, regardless of the version, the number of parameters and calculations are greatly reduced.Therefore, although the EIFEM module designed in this paper produced good results in YOLOv5, YOLOv8, and YOLOv10, it had the best overall performance in YOLOv8.Therefore, we chose to design the ECDY network on the basis of YOLOv8s.The second version is chosen because steel defect detection has certain requirements for real-time performance, so the calculation speed must be guaranteed.

Ablation experiment

45In this section, we conduct ablation experiments to analyse the effectiveness of each key component of ECDY, namely, the edge information feature enhancement module (C2f_EIFEM), content-aware reorganization feature module (CARAFE), and dynamic detection head (DyHead).The experimental results are shown in Table 2.

461. Effectiveness of C2f_EIFEM.EIFEM extracts edge information from images and fuses it with spatial information to obtain richer semantic information about the steel defects.In the convolution of edge information extraction, the Sobel operator is used to add features extracted in the horizontal and vertical directions to reduce the number of calculations, and the Sobel operator has a certain resistance to noise in steel defect images.Through the experimental comparison of No. 0 and No. 1, the mAP@0.5 increases by 1.7%, and the Gflops decreases by 2.8%; the experimental comparison of No. 2 and No. 4 reveals that the mAP@0.5 increases by 3%, and the Gflops decreases by 2.8%; and the comparison of the results of No. 6 and No. 7 reveal that the mAP@0.5 increased by 1.9%, which confirms the effectiveness of the C2f_EIFEM module.This approach Method P (%) R (%) mAP @0.5(%) mAP @0.not only improves the accuracy index but also reduces the number of parameters and improves the running speed.2. Effectiveness of CARAFE.CARAFE guides the upsampling process through the content of the input features themselves, thereby achieving more accurate and efficient feature reconstructions, and by adaptively adjusting the size of the kernel, it accurately reconstructs features while using less computation.For steel defects, the kernel is adaptively adjusted according to the underlying information to guide upsampling so that comprehensive and rich semantic information can be obtained in the feature reconstruction process.A comparison of the No. 1 and No. 4 experiments reveals that the mAP@0.5 increases by 0.7%.Compared with the No. 3 and No. 6 experiments, the mAP@0.5 increases by 1.5%.Compared with the No. 5 and No. 7 experiments, the mAP@0.5 increases by 4.2%, which fully demonstrates the important role of CARAFE in the model.3. Effectiveness of DyHead.DyHead uses the perceptual attention of three parts to adapt to the size, angle, and task of the target; it also reduces the number of parameters and improves the computational efficiency by calculating the attention of the three parts separately.Using perceptual attention for the three parts separately enables the model to adapt to defects of different sizes and defect positions of different viewing angles and rotation directions.A comparison of experiments No. 0 and No. 3 in the table reveals that the mAP@0.5 increases by 0.6%.Compared with the results of experiments No. 2 and No. 6, the mAP@0.5 increases by 2.7%.Compared with the results of No. 4 and No. 7, the mAP@0.5 increases by 1.6%.The amount of calculation is also reduced, which shows the effectiveness and lightness of DyHead.

Comparative test

47To demonstrate the superiority of our designed ECDY network, we compared it with various mainstream models.

48The results are shown in Table 3.Most of the methods in the table are one-stage detection algorithms.According to the detection steps, we divide these methods into two groups: one-stage detection algorithms and two-stage

49No. C2f_EIFEM CARAFE DyHead P (%) R (%) mAP @0.5(%) mAP @0.detection algorithms.Among them, only Faster R-CNN is a two-stage detection algorithm.Compared with the other methods, our ECDY network improves the mAP@0.5 by 9.34%, and the number of Gflops decreases by 174.For the one-stage detection algorithm, ECDY is better than those of all the other networks, with precision reaching 93%, recall reaching 96%, mAP@0.5 reaching 81%, and mAP@0.5:0.95reaching 44.8%.Compared with other networks, ECDY uses very few parameters and calculations to achieve good results.mAP@0.5 is 4% higher than that of the network YOLOv8s on which it is based, and 4.2% higher than the mAP@0.5 of the current SOTA model RT-DETR-L in the field of target detection.mAP@0.5:0.95 is 1.6% higher, the number of parameters is 23.15 M less than it is, and the amount of computation is 24% of it.

50Figure 11 shows the change process of mAP@0.5 during the training process.The figure shows that in the first 100 rounds, the mAP fluctuates; this is because the dataset we selected is relatively complex and contains difficult samples.Before 50 rounds, the mAP of YOLOv10s increases rapidly.Between 50 and 150 rounds, each model reaches a stable state.At this time, RT-DETR-L leads the other models in terms of mAP.In the last 50 rounds, all the models almost stopped improving.The ECDY network we designed still improves.Finally, after 200 rounds of training, the mAP of the ECDY network is much greater than that of the other networks.

51Figure 12 shows the AP comparison between the ECDY network and various mainstream networks in each defect category.The figure shows that for each model, crazing is the most difficult category to predict because some cracks are small and may not be distinguished for light reasons.In addition, it can be seen in the dataset that Method P (%) R (%) mAP @0.5(%) mAP @0. the difference between the crazing and rolled-in scale classes is small, which may lead to model misjudgements.However, our model has the highest prediction accuracy for crazing among all the models.The ECDY network also has a good ability to distinguish difficult samples.Moreover, the prediction accuracy of our model in other categories also surpasses that of other models.Only in the rolled-in scale category is the predicted AP slightly lower than that of YOLOv6s, making it the second most accurate network in this category.Overall, the ECDY network has shown high accuracy in each category, reflecting the superiority of its model.

Qualitative results

52As described in the first part of Sect.3, the EIFEM improves the detection accuracy while reducing the number of parameters by fusing the edge feature information and spatial information.To evaluate the effectiveness of the EIFEM module we designed, the detection effects of YOLOv5s, YOLOv8s, and YOLOv10s with the EIFEM module are compared, and the detection results are shown in Fig. 13.In the crazing category, YOLOv5s did not detect it, but after adding the EIFEM, two bounding boxes were detected in this category.In YOLOv8s, compared with the version with the EIFEM, the inclusion category misdetected places without inclusions, and the addition of the EIFEM module improved the accuracy of the detection box.In YOLOv10s, the crazing category detected a few fewer cracks, and the rolled-in scale category was not detected; however, after adding the EIFEM module, the above problems improved.For easier categories such as inclusions, patches, and scratches, the detection results are similar, but after adding the EIFEM module, the defect location and size can be determined more accurately.In more difficult categories, such as crazing and rolled-in scales, the original model has difficulty detecting these small defects, and our EIFEM can accurately detect the location and shape of these smaller and subtle defects; this is due mainly to the edge detection ability of our module, which can retrieve the edges of subtle defects.

53To further demonstrate the utility of the edge convolutional branch and the spatial convolutional branch in the EIFEM module, we analyzed the feature maps during the feature extraction phase of YOLOv8s and ECDY by visualizing them, that is, visualizing the feature maps of the backbone network's four stages C2f and C2f_EIFEM, and selecting 16 channels of the feature maps for display.The comparison of feature map visualization is shown in Fig. 14.In the stage 2, the features extracted by YOLOv8s and ECDY are not much different, but it can be seen that the features of ECDY are more distinctly three-dimensional; in the stage 4, it can be observed that YOLOv8s blurs some features, and the spatial resolution is not as delicate as ECDY; in the stage 6 and stage 8, it can be seen that ECDY's feature extraction is more concentrated, and the depiction of defect contours is clearer.

54Figure 15 shows a comparison of the detection effects of our designed ECDY network and current mainstream object detection methods on the dataset.In the crazing category, YOLOv5s did not identify defects, YOLOv9e and YOLOv10s missed detections and detected inaccurate positions, and RT-DETR-L detected the same object multiple times, resulting in overlapping detection frames.The ECDY network proposed in this paper had almost no missed detections or false detections.In the inclusion category, YOLOv6s, YOLOv8s, and RT-DETR-L had false detections, detecting normal places as inclusions.In the patches category, YOLOv6s and RT-DETR-L had false detections, detecting some patches as inclusions, and YOLOv8s, YOLOv9e, and YOLOv10s had missed detections.In the pitted surface category, YOLOv5s does not control the size of the border as well as the other models do.Although all of them detected defects, ECDY had the highest confidence.In the rolled-in scale category, YOLOv6s, YOLOv10s, and RT-DETR-L did not detect defects, and YOLOv5s and YOLOv9e missed detections.In the scratch category, all the networks performed well.In summary, in the categories that are well detected, all the networks have good results, but our ECDY model more accurately predicts the size and position of the defect bounding box, and does not have too many predictions of the same target that would cause the detection box to overlap.For categories that are more difficult to predict, such as very small cracks and oxide rolling, many networks, even relatively large networks, have missed detections and cannot detect defects, but the ECDY network proposed in this article can still accurately determine the defect location and size.

55To intuitively analyse the attention area of the ECDY network proposed in this paper, we use a heatmap analysis, as shown in Fig. 16, where the dark red area is the area that the model focuses on.We can observe that ECDY primarily focuses on the information surrounding defects, accurately targeting the defect contours and precisely locating them.Especially in the crazing category, we can see that ECDY can accurately pinpoint very fine scratches, while YOLOv8s cannot precisely locate all defects.This is mainly thanks to our designed EIFEM module, which effectively detects edge information.Moreover, from the inclusion category, we can see that YOLOv8s pays attention to the background information on the left and mistakenly identifies it as an inclusion.In the pitted_surface category, it overly focuses on the upper left corner and the right boundary; this is because noise in these areas causes YOLOv8s to pay attention to these unnecessary backgrounds, whereas ECDY has certain resistance to noise.

Conclusion

56In this paper, we propose an edge information feature extraction module (EIFEM) to learn the edge contour information of steel defects.This module can be adaptively inserted into the network.We insert this module into the YOLOv5, YOLOv8, and YOLOv10 versions, which not only improve the accuracy of network detection but also reduce the number of parameters and calculations, demonstrating the superiority and lightness of our designed module.To further improve detection efficiency in the steel defect field, we propose the ECDY network.Specifically, we rely on YOLOv8s and replace the BottleNeck in the C2f of the YOLOv8 network with our proposed EIFEM module, so that the network pays attention to the edge contour information while paying attention to the spatial information, and fuses the two parts of the features to obtain richer semantic information; we further replace the traditional upsampling with the upsampling method of the content-aware reorganization features (CARAFE), which can better use its feature information to guide itself to accurately and efficiently reconstruct features, and retain more detailed feature information.In addition, to adapt to different defect sizes and locations, different networks, and different task requirements, we replaced the detection head with a dynamic unified detection head.This detection head uses perception attention in multiple dimensions to perform unified detection when dealing with different sizes and tasks, while ensuring computational efficiency.

57Compared with other mainstream models applied to the public dataset provided by Northeastern University, the significant accuracy improvement and fewer parameters prove the superiority of our proposed ECDY network.Therefore, the network proposed in this article is highly suitable for steel defect detection scenarios.

58The detection accuracy of crazing in this article can be improved.For each network, crazing is the most difficult category to predict.We will focus on this aspect in subsequent work.

Fig. 1 .

59Fig. 1.EIFEM structure diagram (the structure obtains richer semantic information through feature fusion of the edge information extraction convolution branch and spatial information convolution branch).

Fig. 3 .

60Fig. 3. Spatial convolution structure diagram.

Fig. 4 .

61Fig. 4. ECDY network structure diagram (compared with YOLOv8, C2f is mainly replaced by C2f_EIFEM designed in this paper, upsampling is replaced by CARAFE, and the detection head is replaced by DyHead).

Fig. 6 .

62Fig. 6.CARAFE consists of a kernel prediction module and a content-aware reconstruction module.H × W × C is upsampled to σH × σW × C, where σ is the upsampling ratio.

Fig. 5 .

63Fig. 5. Comparison between C2f_EIFEM (left) and C2f (right), mainly showing the replacement of BottleNeck in C2f with the EIFEM module designed in this paper.

Fig. 8 .

64Fig. 8. DyHead block structure diagram.In the figure, π L there are size-aware attention, π S space-aware attention, π C and task-aware attention.The three attentions make up a DyHead Block.

Fig. 9 .

65Fig. 9. Six defect categories.

Fig. 10 .

66Fig. 10.Comparison of YOLOv5, YOLOv8, and YOLOv10 with the EIFEM module in terms of the Gflops accuracy (left) and size accuracy (right) trade-offs.Each point represents the n/s/m/l/x version.

Fig. 11 .

67Fig. 11.Comparison of the mAP@0.5 curves of the different models.

Fig. 12 .

68Fig. 12. Prediction accuracy of different networks for six steel defect categories.

Fig. 13 .

69Fig. 13.Detection effects of YOLOv5s, YOLOv8s, YOLOv10s, and the EIFEM module on six steel defect categories.

Fig. 14 .

70Fig. 14.Visualization and comparison of feature maps in the feature extraction stage of YOLOv8s and ECDY.

Fig. 15 .

71Fig. 15.Detection effects of different networks on 6 steel defect categories.

Fig. 16 .

72Fig. 16.Detection heatmap of the ECDY network for six steel defect categories.

Table 1 .

73Performance comparison of the YOLOv5, YOLOv8, and YOLOv10 versions with the EIFEM module added.

Table 2 .

74Ablation studies of various components of ECDY.

Table 3 .

75Performance comparison with the most advanced methods.

참고문헌 20건

  1. Faster R-CNN: Towards Real-Time Object Detection with Region Proposal Networks IEEE Transactions on Pattern Analysis and Machine Intelligence · IEEE Computer Society · 2016 10.1109/tpami.2016.2577031
  2. Faster R-CNN: towards real-time object detection with region proposal networks Neural Information Processing Systems · 2015
  3. An End-to-End Steel Surface Defect Detection Approach via Fusing Multiple Hierarchical Features IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2019 10.1109/tim.2019.2915404
  4. Automated Visual Defect Detection for Flat Steel Surface: A Survey IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2020 10.1109/tim.2019.2963555
  5. Application of Multi-Scale Feature Fusion and Deep Learning in Detection of Steel Strip Surface Defect 2019 10.1109/aiam48774.2019.00136
  6. Grayscale image formats for edge detection and for its FPGA implementation Microprocessors and Microsystems · Elsevier BV · 2020 10.1016/j.micpro.2020.103056
  7. RetinaNet With Difference Channel Attention and Adaptively Spatial Feature Fusion for Steel Surface Defect Detection IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2020 10.1109/tim.2020.3040485
  8. SDDNet: A Fast and Accurate Network for Surface Defect Detection IEEE Transactions on Instrumentation and Measurement · Institute of Electrical and Electronics Engineers · 2021 10.1109/tim.2021.3056744
  9. Development of a YOLO-V3-based model for detecting defects on steel strip surface Measurement · Elsevier BV · 2021 10.1016/j.measurement.2021.109454
  10. DCC-CenterNet: A rapid detection method for steel surface defects Measurement · Elsevier BV · 2021 10.1016/j.measurement.2021.110211
  11. MSFT-YOLO: Improved YOLOv5 Based on Transformer for Detecting Defects of Steel Surface Sensors · Multidisciplinary Digital Publishing Institute · 2022 10.3390/s22093467
  12. FDD: a deep learning–based steel defect detectors The International Journal of Advanced Manufacturing Technology · Springer Science+Business Media · 2023 10.1007/s00170-023-11087-9
  13. Interpolation and Sharpening for Image Upsampling 2022 10.1109/iccgiv57403.2022.00020
  14. Edge Detection via Fusion Difference Convolution Sensors · Multidisciplinary Digital Publishing Institute · 2023 10.3390/s23156883
  15. A deep learning model for steel surface defect detection Complex & Intelligent Systems · Springer Science+Business Media · 2023 10.1007/s40747-023-01180-7
  16. Overview of temporal action detection based on deep learning Artificial Intelligence Review · Springer Science+Business Media · 2024 10.1007/s10462-023-10650-w
  17. Cross-dimensional feature attention aggregation network for cloud and snow recognition of high satellite images Neural Computing and Applications · Springer Science+Business Media · 2024 10.1007/s00521-024-09477-5
  18. DCS-YOLOv8: An Improved Steel Surface Defect Detection Algorithm Based on YOLOv8 2024 10.1145/3647649.3647656
  19. Surface defect detection of strip steel based on GT-CutMix augmentation algorithm and improved DSSD model Measurement Science and Technology · IOP Publishing · 2024 10.1088/1361-6501/ad5b7c
  20. The transmission line foreign body detection algorithm based on weighted spatial attention Frontiers in Neurorobotics · Frontiers Media · 2024 10.3389/fnbot.2024.1424158