# Wavelet-Enhanced YOLO for Intelligent Detection of Welding Defects in X-Ray Films
## 3 Materials and Methods
### WTConv Layer  
WTConv is a key innovation in this study, designed to address the need for extracting multi-frequency features, which is crucial in the task of weld defect detection. Traditional convolutional layers in neural networks focus on extracting spatial patterns at a single scale, which may not effectively capture the wide range of frequency components present in welding defects. On the other hand, WTConv enable the network to simultaneously process different frequency components of the input image, both high- and low-frequency, by leveraging the wavelet transform. The structure of the WTConv layer is illustrated in Figure 3.  
The wavelet transform is a mathematical tool that decomposes an image into different frequency bands. In contrast to Fourier transforms, wavelets have the ability to localize both in space and frequency, making them particularly effective at capturing localized features at different scales. The 2D continuous wavelet transform of an image \(I(x,y)\) is given by  
\[W_{a,b}=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}I(x,y)\psi_{a,b}(x,y)\, dx\,dy \tag{1}\]  
where \(\  
cracks are often sharp, high-frequency features, while defects like concave or porosity tend to appear as smoother, low-frequency structures. In the WT-YOLO model, the standard convolution operation is replaced with wavelet-based filters, which allows the network to perform localized frequency decomposition on the input feature maps. This operation is mathematically similar to regular convolution but uses wavelet functions as filters, enabling the network to capture features at multiple scales. The output of a WTConv operation can be expressed as  
\[I_{out}(x,y)=\sum_{i,j}I(x+i,y+j)\cdot\psi_{a,b}(i,j) \tag{2}\]  
where \(\psi_{a,b}(i,j)\) is the wavelet filter applied to the input image \(I(x,y)\), and the sum represents the convolution process. By using wavelets, WT-YOLO can efficiently extract both low-frequency global structures and high-frequency local details. The application of WTConv in the context of weld defect detection provides several advantages. Different types of weld defects, such as cracks, slag inclusion, or porosity, manifest at different frequencies in the image domain. WTConv enables the network to detect these defects by processing both high- and low-frequency components simultaneously. Additionally, wavelets' ability to localize features in both spatial and frequency domains improves WT-YOLO's ability to identify defects at various scales, from sharp edges to smooth regions. Figure 4 shows the application of WTConv on cracks. This multi-frequency feature extraction not only enhances the model's robustness in detecting a wide range of defects but also improves its generalization ability, allowing it to perform well across different types of defects and welding conditions. Figure 3: Structure of the WTConv layer. WT: Wavelet Transform. Low-Low: Contains low-frequency information in both horizontal and vertical directions, representing the overall structure and smooth regions of the image. Low-High: Contains low-frequency horizontal information and high-frequency vertical information, capturing vertical edges and textures in the image. High-Low: Contains high-frequency horizontal information and low-frequency vertical information, capturing horizontal edges and textures. High-High: Contains high-frequency information in both horizontal and vertical directions, capturing fine details and diagonal edges in the image. IWT: Inverse Wavelet Transform. YOLOv11n  
In this study, the traditional convolutional layers of YOLOv11n are replaced with WTConv layers at critical points in the network architecture. These layers are inserted in the early stages of the backbone to decompose feature maps into both high- and low-frequency components. As the network progresses, the integration of these multi-frequency features allows it to more effectively capture both fine-grained details (such as cracks) and large-scale structures (such as incomplete penetration).