## 3 Methods
### Terrain Recognition and Stability Analysis
#### 3.3.1 LA-MobileNet Network  
The overall structure of the LA-MobileNet is shown in Figure 6. First, cascaded convolutional layers are used for feature extraction, then its output is input to the global pooling layer to obtain the spatial geometric features of the image, and finally the predicted category is obtained through the classifier. The CA [33] is introduced into the Bneck structure, and global average pooling is performed from the horizontal and vertical spatial directions to obtain direction-awareness and position-awareness information. An auxiliary loss function is used in the middle layer of the network to alleviate the problem of vanishing gradients and improve the generalization ability of the neural network. The SE [34] attention mechanism in the MobileNetV3 model mainly focuses on internal channel information without considering the impact of position information. In contrast, the CA embeds position information into channel attention, which not only avoids introducing excessive calculations, but also enables the model to obtain richer information. The structure is shown in Figure 6. The CA module can avoid the loss of position information caused by global pooling-2D operations, focus on the width and height dimensions, respectively, and effectively utilize the spatial coordinate information of the input feature map. The output of the c-th channel with height h and width w is shown in Equations (13) and (14). Among them, in the horizontal pooling operation, each row of the attention matrix is summed to obtain a horizontal summary attention vector, as shown in Equation (13). In the vertical pooling operation, each column of the attention matrix is summed to obtain a vertical summary attention vector, as shown in Equation (14). Figure 5: Unilateral obstacle crossing. (**a**) Forward and backward, (**b**) unilateral obstacle crossing, where \(\alpha\) is the speed control signal, \(\beta\) is the balance control signal, \(\
u\) is the actual left and right wheel speed, \(\varphi\) and \(\omega\) are the actual pitch angle and angular velocity, \(\beta^{\prime}\) is the unilateral balance control signal, and \(\omega^{\prime}\) is the actual roll angle. \[Z_{c}^{h}(h)=\frac{1}{W}\sum_{0\leq i\leq W}x_{c}(h,i) \tag{13}\] \[Z_{c}^{w}(w)=\frac{1}{H}\sum_{0\leq j\leq H}x_{c}(j,w) \tag{14}\]  
where \(x_{c}(h,i)\) represents the input of the c-th channel in the horizontal direction; \(x_{c}(j,w)\) represents the input of the c-th channel in the vertical direction; \(H\) and \(W\) represent the height and width of the input feature map, respectively. Coordinate attention first splices the feature maps obtained in the previous stage in the spatial dimension, uses \(1\times 1\) convolution to compress the channels, and uses the ReLu function to perform nonlinear activation of spatial information in the vertical and horizontal directions. The feature map is then divided into horizontal tensors and vertical tensors. Then, \(1\times 1\) convolution is used to increase the channel dimension so that the number of channels is consistent with the input feature map. Finally, the Sigmod function is used for nonlinear activation and weighted fusion. The final output result is shown in Equation (15). \[y_{c}(i,j)=x_{c}(i,j)\times g_{c}^{h}(i)\times g_{c}^{w}(j) \tag{15}\]  
Among them, \(y_{c}(i,j)\) is the output of the \(c\)-th channel; \(x_{c}(i,j)\) is the input feature map; \(g_{c}^{h}(i)\) is the attention weight in the horizontal direction; \(g_{c}^{w}(j)\) is the attention weight in the vertical direction. The backbone network we use is MobileNetV3-large, which has a deep network structure and is prone to the problem of vanishing gradients. Inspired by the literature [35], we choose to add an auxiliary classifier on the feature layer of \(32\times 32\) size. In order to obtain more hierarchical features, a Bneck module is added to the classifier for feature extraction, and then a classifier composed of Dropout, ReLU and Linear layers is used for classification.