Abstract
With the rise of smart agriculture and the expansion of pig farming, pig aggressive behavior recognition is crucial for maintaining herd health and improving farming efficiency. The differences in background and light variation in different barns can lead to the missed detection and false detection of pig aggressive behaviors. Therefore, we propose a deep learning-based pig aggressive behavior recognition model, in order to improve the adaptability of the model in complex pig environments. This model, combined with MobileNetV2 and Autoformer, can effectively extract local detail features of pig aggression and temporal correlation information of video frame sequences. Both Convolutional Block Attention Module (CBAM) and Advanced Filtering Feature Fusion Pyramid Network (HS-FPN) are integrated into the lightweight convolutional network MobileNetV2, which can more accurately capture key visual features of pig aggression and enhance the ability to detect small targets. We extract temporal correlation information between consecutive frames by the improved Autoformer. The Gate Attention Unit (GAU) is embedded into the Autoformer encoder in order to focus on important features of pig aggression while reducing computational latency. Experimental validation was implemented on public datasets, and the results showed that the classification recall, precision, accuracy, and F1-score of the model proposed in this paper reach 98.08%, 94.44%, 96.23%, and 96.23%, and the parameter quantity is optimized to 10.41 M. Compared with MobileNetV2-LSTM and MobileNetV2-GRU, the accuracy has been improved by 3.5% and 3.0%, respectively. Therefore, this model achieves a balance between recognition accuracy and computational complexity and is more suitable for automatic pig aggression recognition in practical farming scenarios, providing data support for scientific feeding and management strategies in pig farming.