# A Fitting Recognition Approach Combining Depth-Attention YOLOv5 and Prior Synthetic Dataset
## 4 Proposed Approach
### Prior Synthetic Dataset  
Prior synthetic datasets based on prior series data are promising for training deep learning models to recognize fittings on PTLs. We have achieved some findings in the previous studies [31; 52]. The YOLOX deep learning model is trained using a prior synthetic  
Figure 5: Schematic diagram of the collected data. (**a**) some of the fittings; (**b**) RGB image of the power tower; (**c**) depth map of the power tower. Figure 6: Diagram of the fitting recognition approach. dataset including 10,800 images of 720 \(\times\) 1280 pixels, and the trained model achieves 98.38% of mAP5090 on a test dataset containing 1200 real images. Figure 7 describes the major synthesis process for a prior synthetic dataset. First, the synthesis rules are formulated based on prior series data. Then, the synthesis rules, insulator models, and HDRI files are input into the Blender (Blender is a programmable modeling software for data synthesis platforms) to auto-synthesize images and annotations. Finally, the images and annotations are collated to generate the prior synthetic dataset. The synthesis rules are formulated based on prior series data collected on the PTLs by FPTLIR, so the prior synthesized dataset contains more features of the actual inspection images. The trained model could obtain better results using the prior synthesized dataset with less volume. The prior series data include a prior fitting series, a prior inspection-view series, a prior topography series, and a prior time series. The prior fitting series includes the type and location of the fitting; the prior inspection-view series includes the motion path of the robot viewpoint; the prior topographic series includes geographic information about the PTL corridor; the prior time series includes illumination and seasons with time as a variation. The synthesis rules mainly constrain the image background and the viewpoint-target position relationship. The image background is jointly influenced by the prior topography series and the prior time series, and the viewpoint-target position relationship is jointly influenced by the prior fitting series and the prior inspection-view series. Figure 4 illustrates the positional relationship between the viewpoint and the fitting. We fix the three-dimensional coordinates of the view at origin and move the fitting, and their movement rules in Blender are as follows. The four-order translation matrix of the fitting is:  
\[T_{xyz}= \begin{bmatrix}1&0&0&t_{x}\\ 0&1&0&t_{y}\\ 0&0&1&t_{z}\\ 0&0&0&1\end{bmatrix}  \tag{1}\]  
where \(t_{y}\) and \(t_{z}\) are related to the power tower structure. \(t_{x}\) is the distance between FPTLIR and the fittings on the X-axis of the global coordinate system. The four-order rotation matrix of fitting along the xyz axis, \(R_{x}\), \(R_{y}\), \(R_{z}\) are:  
\[R_{x}= \begin{bmatrix}1&0&0&0\\ 0&\cos\alpha&-\sin\alpha&0\\ 0&\sin\alpha&\cos\alpha&0\\ 0&0&0&1\end{bmatrix} ;R_{y}= \begin{bmatrix}\cos\beta&0&\sin\beta&0\\ 0&1&0&0\\ -\sin\beta&0&\cos\beta&0\\ 0&0&0&1\end{bmatrix} ;R_{z}= \begin{bmatrix}\cos\gamma&-\sin\gamma&0&0\\ \sin\gamma&\cos\gamma&0&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix}  \tag{2}\]  
Figure 7: The major synthesis process for prior synthetic datasets based on a prior series data. where \(\alpha\), \(\beta\), \(\gamma\) are the rotation angles of the fitting on the \(x_{i}\), \(y_{i}\), and \(z_{i}\) axes of the fitting coordinate system, respectively. To control the fitting within the output image, the rotation angles \(\theta_{x}\) and \(\theta_{z}\) of the viewpoint along the X and Z axes of the global coordinate system are:  
\[\left\{ \begin{array}{l}\theta_{z}=\arccos\frac{t_{z}^{2}+t_{y}\sqrt{t_{x}^{2}+ t_{y}^{2}}}{t_{x}^{2}+t_{y}^{2}+t_{z}^{2}}\\ \theta_{x}=\arctan\frac{\sqrt{t_{x}^{2}+t_{y}^{2}}}{t_{z}}(t_{x}\geq 0)\\ \theta_{x}=-\arctan\frac{\sqrt{t_{x}^{2}+t_{y}^{2}}}{t_{z}}(t_{x}<0)\end{array} \right. \tag{3}\]  
We could move the fitting in Blender by \(R_{x}\), \(R_{y}\), \(R_{z}\), and \(T_{xyz}\) and rotate the view by \(\theta_{x}\) and \(\theta_{z}\).