# A Titanium Alloy Defect Detection Method Based on Optical-Acoustic Image Fusion
## 2 Principle  
### Optical Detection of Surface Defects  
A titanium alloy is a silver-gray metal with a shiny surface. Linear defects such as cracks and scratches occur on its surface during the forging and use of titanium alloys. In addition, these surface defects have obvious gray-level differences compared with the background, as well as significant differences in shape and texture.  
The optical testing process for surface defects on titanium alloys is shown in Figure 1. Specifically, the raw images captured by a charge-coupled device (CCD) industrial camera require image preprocessing [20, 21, 22, 23, 24], such as image rectification, image cropping, image gray-scale converting, image median filtering, image sharpening, and so on.  
In summary, image rectification can improve the distortion of image capture; image cropping can remove the unnecessary background in the raw pictures; image gray-scale converting can convert color images into grayscale images, which can reduce the computational load of image processing, and image median filtering can remove background noise and highlight the defect targets, as shown in Equation (1), and image sharpening can improve image quality, as shown in Equation (2).  
\[g(x,y)=med\{f(x-m,y-n),(m,n\in w)\} \tag{1}\]  
In this equation, \(g(x,y)\) is the gray value of the original optical image at position \((x,y)\) after median filtering, \(f(x-m,y-n)\) is the gray value of the original optical image at position \((x-m,y-n)\), and \(w\) is the two-dimensional filtering template.  
\[g(x,y)=f(x+1,y)+f(x-1,y)+f(x,y+1)+f(x,y-1)-4f(x,y) \tag{2}\]  
In this equation, \(g(x,y)\) is the gray value of the sharpened image at position \((x,y)\), \(f(x+1,y)\) is the gray value of the original image at position \((x+1,y)\), \(f(x-1,y)\) is the gray value of the raw image at position \((x-1,y)\), \(f(x,y+1)\) is the gray value of the raw image at position \((x,y+1)\), \(f(x,y-1)\) is the gray value of the raw image at position \((x,y-1)\), and \(f(x,y)\) is the gray value of the original image at position \((x,y)\).  
The preprocessed images are put into the lightweight and efficient Ti-YOLO model for defect detection. This model has been improved based on the original YOLOv10n model, with its structure shown in Figure 2. Ti-YOLO is mainly composed of the backbone network, the neck network, and the detection head. In addition, Ti-YOLO performs multiple convolution operations on the input images through the backbone network to extract the local features of the titanium alloy's surface defects. Moreover, in the neck network part, the module elements of the SlimNeck structure including VoVGSCSP and ghost convolution (GSConv) are used to effectively enhance the network's features fusion capability, which can  
Figure 1: Optical testing process.  
improve the detection of small defects. Finally, the lightweight LiteHead model is adopted in the detection head part, including depth-wise convolution (DWConv) and split-based convolution (SPConv). It can improve the performance of the model comprehensively while reducing the computational load.  
The module can output the detection image and the resulting document after defect testing, which includes the type of surface defects as well as the normalized position and length of each defect. In addition, the optical surface defect detection results of the titanium alloy are the foundation of the following image information fusion method.