# Lightweight Domestic Pig Behavior Detection Based on YOLOv8
## 1 Introduction  
Pork serves as the primary source of animal protein in China, and its quality is intricately linked to the nation's health. Therefore, it is essential to evaluate the behavior of the domestic pig to guarantee the quality and safety of pork. Artificial farming, a complex and enduring agricultural method, poses significant obstacles because of its labor-intensive and insufficiently mechanized characteristics [1]. Consequently, developing a model for recognizing domestic pig behavior is very significant. The advent of target detection algorithms enables the rectification of these deficiencies, with current techniques classified into traditional and deep learning-based categories. Conventional target detection algorithms predominantly depend on manually crafted features and traditional machine learning methods, utilizing sliding windows or region segmentation to scan the image and then employing manually extracted features to define the target's appearance. Such algorithms exhibit restricted generalization capability, and the sliding window approach results in computational inefficiency [2]. Deep learning algorithms for target detection fall into two categories: two-stage and one-stage [3]. Two-stage algorithms, such as R-CNN [4], Fast R-CNN [5], and Faster R-CNN [6], employ region proposal methods to identify candidate regions. These zones are utilized for classification and bounding-box regression, resulting in high accuracy but reduced speed. Single-stage algorithms (e.g., YOLO [7] and SSD [8]) immediately anticipatetarget categories and locations from the image, omitting the region recommendation phase, which enhances speed and is conducive to real-time applications. The second method of deep learning for domestic pig behavior recognition has attracted considerable interest from researchers in recent years. The multi-type pig behavior recognition method has been a prominent research area in pig behavior identification, owing to its improved adaptability and proficiency in accurately recognizing various common pig actions and behaviors [9]. [PERSON] et al. [10] proposed an instance classification method inspired by the image grid concept in YOLO, transforming image instance segmentation into a classification problem. [PERSON] [11] introduced a method for identifying pig behavior by leveraging the animal's gestures and temporal characteristics. This approach integrated the OpenPose algorithm with YOLOv5s to detect and estimate the pig's gestures, analyzing 20 main body regions. The twenty essential components of the pig's anatomy are examined, and the skeleton is removed to identify three behaviors: standing, walking, and lying. [PERSON] et al. [12] created a system for behavior recognition and tracking of group-reared pigs with the YOLOv5s depth model in conjunction with the enhanced DeepSort algorithm. Utilizing the outcomes of the YOLOv5s model classification, the enhanced DeepSort algorithm was employed to facilitate behavior identification throughout the tracking process, thereby alleviating the issue of frequent identity number fluctuations resulting from the overlapping and obscuring of pigs. [PERSON] et al. [13] employed YOLOv5 to isolate individual pigs from herd photos, integrated it with the DeepLab v3+ semantic segmentation technique to delineate pig outlines, and identified standing, prone, side-lying, and exploratory behaviors utilizing a deep separable convolutional network. [PERSON] et al. [14] employed the enhanced YOLOX to identify pig postural behaviors and implemented a streamlined copy-paste and label-smoothing technique to effectively address the category imbalance issue resulting from a scarcity of sitting examples in the dataset. Modern behavior recognition methods using deep learning have improved in accuracy, but they often use complex models that are heavy and require a lot of resources, making it difficult to use them in real-time on smaller swine farms [15].