The activity level of group-housed pigs can reflect their daily behavioral patterns and health conditions. Currently, most pig farms mainly rely on manual daily patrols to monitor the activities of group-housed pigs, which is labor-intensive and inaccurate. In this paper, we propose a computer vision-based method for the automatic monitoring and alerting of group-housed pigs activity anomaly. We established a pig segmentation model based on an improved Mask R-CNN incorporating the CBAM attention mechanism and CIoU loss function for segmenting pigs from video frames. The CBAM attention mechanism enables the model to focus more effectively on target regions, while CIoU loss function guides precise learning of object boundaries, outperforming the traditional IoU loss. Grounded on the segmentation results, we invocated a frame difference method to quantify the activity level of group-housed pigs. Subsequently, we adopted the K-means clustering algorithm to explore the daily behaviors of these pigs. Furthermore, we constructed a SARIMA model using historical data to proactively forecast potential shifts in activity levels. The experimental results demonstrated that the accuracy and recall rate of the pig instance segmentation model were 98.7% and 97.9%, respectively. The SARIMA model performed well in predicting activity levels of group-housed pigs with differing health status. For the pig herds under healthy status, the Mean Absolute Error (MAE) and Root Mean Square Error (RMSE) were 6.01 and 7.67 respectively, while for the pig herds under unhealthy status, the MAE and RMSE were 6.41 and 9.30 respectively. We proposed an effectively method to monitor daily behavioral patterns and anomalies of group-housed pigs, providing valuable references for pig farm management.
Read full abstract