# Application of Low-Altitude UAV Remote Sensing Image Object Detection Based on Improved YOLOv5
## 3 Materials and Methods
### Improved YOLOv5
#### 3.3.1 Addition of the SENet Network Structure  
Since the shape and appearance of grassland animals are different from the background color in the image, in order to improve the detection accuracy for grassland animal targets [41; 42; 43; 44], the SENet network is introduced [45], the structure of which is shown in Figure 3.  
Figure 2: The network structure of improved YOLOv5s.  
First, the \(F_{tr}\) step is a conversion operation. In fact, it is a standard convolution operation in the structure, and the input and output are defined as: \(F_{tr}:X\to U,X\in R^{H^{\prime}\times W^{\prime}\times C^{\prime}},U\in R^{H \times W\times C}\). The specific form of this \(F_{tr}\) is shown in Equation (1), where \(V_{c}\) represents the \(c\)-th convolution kernel, and \(X^{s}\) represents the \(s\)-th input.  
\[u_{c}=v_{c}*X=\sum_{s=1}^{c^{\prime}}v_{c}^{s}*X^{s} \tag{1}\]  
The \(U\) obtained by \(F_{tr}\) is the second three-dimensional matrix in the structure diagram, and \(u_{c}\) represents the \(c\)-th two-dimensional matrix in \(U\). What follows is the squeeze operation, the specific form of which is shown in Equation (2). In fact, squeeze converts the \(H\times W\times C\) input into \(1\times 1\times C\) a output.  
\[z_{c}=F_{sq}(u_{c})=\frac{1}{H\times W}\sum_{i=1}^{H}\sum_{j=1}^{W}u_{c}(i,j) \tag{2}\]  
Next is the excitation operation, the specific form of which is shown in Equation (3). The result obtained by squeeze, above, is \(z\). First, multiply \(W_{1}\) by \(z\). The dimension of \(W_{1}\) is \(\frac{C}{r}\times C\), and \(r\) is the scaling parameter. Its function is to reduce the number of channels, thereby reducing the amount of calculation required. In addition, because the dimension of \(z\) is \(1\times 1\times C\), the dimension of \(W_{1}z\) is \(1\times 1\times C/r\); then, through the ReLU layer, the dimension remains unchanged. Then multiply by \(W_{2}\); the dimension of \(W_{2}\) is \(C\times C/r\), so the output dimension is \(1\times 1\times C\), and finally through the sigmoid function, \(s\) is obtained.  
\[s=F_{ex}(z,W)=\sigma(g(z,W))=\sigma(W_{2}\delta(W_{1}z)) \tag{3}\]  
It can be seen from the above that the dimension of \(s\) is \(1\times 1\times C\), and \(s\) is used to describe the weight of the feature map \(C\) in \(U\). After obtaining s, it is possible to operate on the original \(U\). The specific form is as shown in Formula (4), where \(s_{c}\) represents the weight. Therefore, it is equivalent to multiplying each value in the \(u_{c}\) matrix by \(s_{c}\), which corresponds to \(F_{scale}\) in Figure 3.  
\[\widetilde{x}_{c}=F_{scale}(u_{c},s_{c})=s_{c}u_{c} \tag{4}\]  
The core idea of SENet is to learn the target feature weight through the loss function, and by improving the effective feature map weight. Train the network model by reducing the weight of the feature map that is invalid or has a small effect, so as to achieve better results. The SENet network structure requires a small amount of calculation, while at the same time effectively improving the expression ability of the network model and optimizing it. Therefore, the SENet network is embedded in the YOLOv5s model to improve the detection accuracy of the model, as shown in Figure 4.  
Figure 4: Optimized CSP1_X and CSP2_X module.  
Figure 3: Squeeze and excitation module structure (Copyright IEEE, 2022.).  
After adding the SENet module, the number of parameters of the model increased by about 3 percentage points, and the running speed was basically the same as that of the original network. Meanwhile, in order to reduce the number of parameters of the model, the weight parameter of the model channel was changed from 0.5 to 0.45 under the condition of ensuring the accuracy.