## 3 The Proposed Method
### C2f_Dcn  
Deformable convolution is a type of convolution operation based on spatial deformations. It is commonly used in convolutional neural networks to handle images with spatial deformation characteristics [28]. Compared with traditional convolution operations, deformable convolution has stronger adaptability and better control over the receptive field. It can perceive and locate irregular shapes of objects more accurately. In deformable convolution, sampling positions are not confined to regular grid positions. Instead, an additional offset is introduced, allowing the convolution kernel to adaptively adjust based on the spatial variations of the input feature map. The output formula for deformable convolution is as follows:  
\[y(p_{0})=\sum_{p_{n}\in R}w(p_{n})\cdot x(p_{0}+p_{n}+\Delta p_{n}), \tag{1}\]  
Figure 3: Network structure diagram of DEW-YOLO.  
where \(\Delta p_{n}\) represents the offset, \(w(p_{n})\) denotes the weight of the convolutional kernel at position \(p_{n}\), and \(x(p_{0}+p_{n}+\Delta p_{n})\), and \(y(p_{0})\) represent the mapping relationship between the original image and the feature map obtained by convolution. The operation process of deformable convolution is illustrated in Figure 4.  
First, feature maps are extracted using traditional convolutional kernels, resulting in a feature response map. The obtained feature response map from the previous step is used as the input for the deformable convolution operation. A new convolutional layer is applied to it, generating a feature map with 2N channels, where N represents the size of the convolutional kernel. Each pair of channels represents a coordinate offset, which describes the displacement distance of the convolutional kernel at that position. These offsets can be continuously adjusted during training to adapt to different input images. Then, bilinear interpolation on the offset feature map is performed to upsample it to the same size as the input feature map, enabling the use of the offset feature map to adjust the position and size of the convolutional kernel later on. Finally, by combining the upsampled offset feature map with the original input feature, both are learned simultaneously through optimization of the backpropagation algorithm to obtain the ability to dynamically adjust the position size of the deformable convolutional kernel.  
To enhance the multi-scale feature extraction capability, the C2f module needs to integrate feature maps of different scales. Deformable convolution can learn nonlinear deformation fields, which facilitate better capturing of the correspondence between feature points across different scales. This is advantageous for extracting contextual information from multi-scale features. Deformable convolution can establish more complex correspondence relationships between feature points across different scales through deformable convolution kernels. This is more suitable for the C2f module to learn the transformations of feature points across scales compared with ordinary convolution.  
In deep networks, the deformation characteristics of objects are often more complex. Therefore, this paper improves the C2f structure in the YOLOv8 backbone network by replacing the ordinary convolution in the bottleneck structure of the C2f structure with deformable convolution. The improved C2f_DCN structure is illustrated in Figure 5.  
Figure 4: Structure diagram of deformable convolution.  
In the improved bottleneck structure, two layers of deformable convolution are introduced, allowing the model to freely sample the input feature map. This enables better learning of information related to the scale, background, and deformation of the target objects. After the convolutional layers, the output and input feature maps are fused to use residual connections. This allows the improved module to adaptively learn objects of different sizes and better understand the characteristics of different steel defects, thereby possessing stronger robustness and generalization ability.