Individual Detection and Tracking of Group Housed Pigs in Their Home Pen Using Computer Vision - van der Zande, Lisette. E.; Guzhva, Oleksiy; Rodenburg, T. Bas (Frontiers in Animal Science, 2021)
Modern welfare definitions not only require that the Five Freedoms are met, but animals should also be able to adapt to changes (i.e. resilience) and reach a state that the animals experience as positive. Measuring resilience is challenging since relatively subtle changes in animal behavior need to be observed 24/7. Changes in individual activity showed potential in previous studies to reflect resilience. A computer vision (CV) based tracking algorithm for pigs could potentially measure individual activity, which will be more objective and less time consuming than human observations. The aim of this study was to investigate the potential of state-of-the-art CV algorithms for pig detection and tracking for individual activity monitoring in pigs. This study used a tracking-by-detection method, where pigs were first detected using You Only Look Once v3 (YOLOv3) and in the next step detections were connected using the Simple Online Real-time Tracking (SORT) algorithm. Two videos, of seven hours each, recorded in a barren and enriched environment were used to test the tracking. Three detection models were proposed using different annotation datasets: a young model where annotated pigs were younger than in the test video, an older model where annotated pigs were older than the test video, and a combined model where annotations from younger and older pigs were combined. The combined detection model performed best with a mean average precision (mAP) of over 99.9% in the enriched environment and 99.7% in the barren environment. Intersection over Union (IOU) exceeded 85% in both environments, indicating a good accuracy of the detection algorithm. The tracking algorithm performed better in the enriched environment compared to the barren environment. When false positive tracks where removed (i.e. tracks not associated with a pig), individual pigs were tracked on average for 22.3 minutes in the barren environment and 57.8 minutes in the enriched environment. Thus, based on tracking-by-detection algorithm using YOLOv3 and SORT, pigs can be tracked automatically in different environments, but manual corrections may be needed to keep track of the individual throughout the video. The individual activity measured with proposed algorithm could be used as an estimate to measure resilience.