Recognizing attack behavior of herd pigs using improved YOLOX
-
Graphical Abstract
-
Abstract
Image data was collected at the Pig Breeding Base in Fenxi County, Linfen City, Shanxi Province in July 2020. Nine 5-month-old fattening pigs were selected to raise in a closed pig house. Hikvision DS-2CD3345D-I model camera was used in a downward tilt angle of 60 degrees to collect data under incandescent light. This angle was utilized to obtain the rich behavioral features of pigs, in order to avoid large-scale occlusion, compared with the head-up and overhead views. In the process of data collection, the daily behavior videos of pigs were first repeatedly observed, and 185 video clips of pigs with aggressive behavior were extracted; Inter frame difference method was used to extract the key frames from these video clips. Slow pig movement and long rest time were removed as well. An improved YOLOX model was proposed to identify the typical attack behaviors of herd pigs, such as impact, ear biting, and tail biting. The high accuracy and effectiveness were achieved to reduce pig stacking and adhesion in complex pen environments. Firstly, a Normalization based Attention Module (NAM) was added to obtain the global information about the YOLOX neck; Secondly, the loss function IoU Loss in the YOLOX was replaced with the GIoU to improve the recognition accuracy; Finally, the real-time performance of the model was realized to enhance feature extraction and detection efficiency. Feature pyramid structure SPP was lightweight to SPPF. The experiment showed that the integrated NAM modules, GIoU Loss replacing, and SPPF feature pyramid structures in the original backbone network improved the average accuracy of the model by 2.50, 2.12, and 0.98 percentage points, respectively. The model with SPP feature pyramid structure reduced the parameter by 0.1 MB and improved the accuracy by 0.98 percentage points, indicating the minimum impact of the model parameter after the integrated NAM module. The average accuracy of the improved model increased from 90.77% to 97.57%, with an increase of 6.80 percentage points; The parameter quantity decreased from the highest 34.7 to 34.5 MB with a decrease of 0.2 MB. In addition, there was the continuous attack behavior of pigs in the low credibility of single-frame images. Two optimization indicators (proportion of attack activities (PAA) and proportion of attack behavior (PAB))were introduced to further confirm whether the attack behavior occurred. When the PAA and PAB thresholds were 0.2 and 0.4, respectively, the recognition accuracy (Accuracy) reached 98.55%. Video segments with frequent attacks were selected to verify the effectiveness of the optimization. Usually, PAA and PAB posed a significant impact on the recognition of pig aggressive behavior; If the threshold set was too small, it was easy to misjudge frames without attack behavior as having occurred; If the threshold set was too large, the frame without the attack was assumed as the occurrence. The experimental results show that the improved YOLOX model was achieved in the high-precision recognition of pig attack behavior by the integrated PAA and PAB. The finding can provide effective reference and technical support for the intelligent monitoring of herd health pigs.
-
-