An Automatic Movement Monitoring Method for Group-Housed Pigs

Animals (Basel). 2024 Oct 16;14(20):2985. doi: 10.3390/ani14202985.

Abstract

Continuous movement monitoring helps quickly identify pig abnormalities, enabling immediate action to enhance pig welfare. However, continuous and precise monitoring of daily pig movement on farms remains challenging. We present an approach to automatically and precisely monitor the movement of group-housed pigs. The instance segmentation model YOLOv8m-seg was applied to detect the presence of pigs. We then applied a spatial moment algorithm to quantitatively summarize each detected pig's contour as a corresponding center point. The agglomerative clustering (AC) algorithm was subsequently used to gather the pig center points of a single frame into one point representing the group-housed pigs' position, and the movement volume was obtained by calculating the displacements of the clustered group-housed pigs' center points of consecutive frames. We employed the method to monitor the movement of group-housed pigs from April to July 2023; more than 1500 h of top-down pig videos were recorded by a surveillance camera. The F1 scores of the trained YOLOv8m-seg model during training were greater than 90% across most confidence levels, and the model achieved an mAP50-95 of 0.96. The AC algorithm performs with an average extraction time of less than 1 millisecond; this method can run efficiently on commodity hardware.

Keywords: YOLOv8; agglomerative clustering; movement monitoring; pig; spatial moment.