## 3 Improved Algorithm Based on YOLOv5s
### Improvement Based on YOLOv5s and REPVGG Models  
The VGG network structure is one of the models used for target recognition that has the drawback of being prone to gradient disappearance and explosion issues. The ResNet network structure's residual branch addresses the issues of gradient disappearance and explosion, but it is simple to introduce the issue of model overfitting. Given that the original YOLOv5s employs the original convolution as its foundation, increasing the network depth by including additional convolutional layers is a more straightforward way to improve its ability to extract features. This approach will, however, result in the addition of an excessive number of network model parameters, which will increase the YOLOv5s algorithm's detection accuracy but slow down its detection speed. If we want to improve the detection speed while improving the detection accuracy of the algorithm, we need to replace the original network structure of YOLOv5s with the RepVGG lightweight network structure as the backbone network, i.e., replace the CBS module in the original YOLOv5s with the RepVGGBlock module [30]. RepVGG network is a simple and fast convolutional neural network. Since the RepVGG network structure has fewer convolutional layers and model parameters than the original convolutional network structure, this makes the network computationally faster than the original convolutional neural network. Although there are many other state-of-the-art lightweight network structures available, they still have some shortcomings compared to RepVGG. For example, Mobilenetv2 [31], DenseNet [32], and GhostNet [33], these models increase the computational effort of the model as well as the model size in improving the performance, making such lightweight network models more difficult to deploy to the endpoints. In contrast, the dataset of this paper requires models that are more easily deployed to mobile devices to facilitate the detection of animals, which is why the RepVGG model cannot be replaced. The RepVGG network uses different network architectures for training and network inference phases, with the training phase performing network performance improvement and the inference phase focusing on network speed [34]. RepVGG uses a multi-branch model in the training phase and converts it to a single-path model in the inference phase. In the training phase, the RepVGG network contains an Identity residual structure and 3 \(\times\) 3 convolutional kernels, and 1 \(\times\) 1 convolutional kernels. The 1 \(\times\) 1 convolutional branch is introduced in the Block of the VGG network, and then the residual branch is introduced to solve the problem of gradient explosion and gradient disappearance of the model and enhance the feature extraction ability of the algorithm [35]. In the inference stage, the convolutional and BN layers are firstly combined, and then the Conv1 \(\times\) 1 and residual branches in the network are transformed into Conv3 \(\times\) 3 with a plain structure by fusion. Figure 3 depicts the network topology for RepVGG training in panel a and the network structure for inference in panel b. The multi-branch structure in the training process is changed into Conv3 \(\times\) 3 by reparameterizing the RepVGG structure. The RepVGG network merges the convolutional and BN layers to improve the inference speed of the network by reducing the number of layers and reducing the memory occupation. The BN layer facilitates fast convergence to accelerate the network and effectively solve the gradient disappearance and gradient explosion problems. However, the BN layer occupies more memory and video memory in the forward inference of the network. Figure 4 depicts the structural reparameterization procedure.