# Automatic Measurement of Inclination Angle of Utility Poles Using 2D Image and 3D Point Cloud
## 2 The Proposed Method
### Pole Segmentation Based on Improved Mask R-CNN
#### 2.2.2 Improvement of Mask R-CNN  
Mask R-CNN does not work well for pole skeleton segmentation. Therefore, we expanded the width of the bounding box generated by the mask. The expanded bounding box can contain more pole features, and as the ground truth of the model, it affects the convergence effect of the loss function of RPN and head network. In addition, an attention mechanism is added to the head network, which allows the network to focus on key confidence adaptively. The network structure of the improved Mask R-CNN is shown in Figure 2. This chapter will introduce it in detail in the following sections. Figure 1: Overall detection process. Figure 2: Network structure of the improved Mask R-CNN. The pole is mainly composed of the skeleton, the cross arm and its facilities, wires, and other parts, as shown in Figure 3a. The inclination angle of the pole mainly depends on the skeleton, so only the skeleton part needs to be segmented. The pole skeleton is labeled during training, and the skeleton mask is directly obtained during prediction, avoiding interference from cross arms and wires. Since Mask R-CNN uses the circumscribed rectangle of the mask as the target bounding box, and the pole skeleton is similar to the light pole, traffic sign pole, and other pole-like objects, this leads to the problem of high error rate in the recognition of the pole by Mask R-CNN. Cross arms and wires are also important features for identifying poles. In Figure 3b, we expand the width \(w_{0}\) and height \(h_{0}\) of the original bounding box, respectively, so that the network can extract more pole features and increase the accuracy of identification. As shown in Figure 3c, we observed that the more other features are covered with the larger angle \(\partial=\arctan\left(\frac{w_{0}}{h_{0}}\right)\) between the diagonal and the vertical line of the original bounding box, the smaller the size needs to be expanded in the original width direction. Therefore, the original width \(w_{0}\) is expanded to different values according to the angle \(\partial\). According to the statistical results of the angles \(\partial\) in the data set, it is found that most of the angles \(\partial\) are concentrated between 0-10\({}^{\circ}\); furthermore, the angle is divided into three intervals: 0-3\({}^{\circ}\), 3\({}^{\circ}\)-6\({}^{\circ}\), and greater than 6\({}^{\circ}\). The expanded bounding box can be described as  
\[w_{n}=\left\{ \begin{array}{ll}w_{0}+2\times(1.6-\partial\times 0.1)\times w_{0}&0 \leq\partial\ll 3^{\circ}\\ w_{0}+2\times(1.1-\partial\times 0.1)\times w_{0}&3^{\circ}<\partial\ll 6^{ \circ}\\ w_{0}&\partial>6^{\circ}\end{array} \right. \tag{2}\]  
where, \(w_{n}\) is the width of the newly generated bounding box and \(h_{n}\) is the height of the newly generated bounding box. Figure 4 shows the comparison of the original bounding box and the expanded bounding box, where the red line represents the original bounding box and the blue line represents the expanded bounding box. Figure 3: Expanding bounding box. (**a**) The structure of the pole; (**b**) Bounding box expansion; (**c**) Bounding box expanding to different values according to \(\partial\). In this case, the red line represents the original bounding box and the blue line represents the expanded bounding box. The left side is expanded by 0.51 \(w_{0}\) and the right side by 1.33 \(w_{0}\) in the width direction of the original bounding box. CBAM is a lightweight feed-forward neural network module that can be easily integrated into any convolutional neural network (CNN) architecture. By adaptively adjusting channel weight parameters and feature weight parameters, it can help the network learn to focus on key information to improve the accuracy of mask segmentation [31]. The segmentation accuracy of the pole mask has a great impact on the quality of the 3D point cloud, so the CBAM is referenced in the second stage of Mask R-CNN. As shown in Figure 5, CBAM is a combination of the Channel Attention Model and Spatial Attention Model.