A modular open-source computer vision pipeline enables individual-level behavior analysis of group-housed pigs
Abstract Animal behavior analysis is central to understanding welfare, health, and productivity in livestock, yet manual observation is time-consuming, subjective, and difficult to scale. We present a modular pipeline that integrates open-source, state-of-the-art computer vision models to automate individual-level behavior analysis in group-housing environments. The pipeline does not introduce a new learning algorithm or training paradigm; instead, it combines existing zero-shot object detection, motion-aware segmentation and tracking, and vision-transformer feature extraction into a reproducible end-to-end workflow that isolates each animal from its background before behavior is recognized. This individual-level, background-independent design directly targets the poor cross-environment generalization that limits group-level approaches, and it addresses challenges such as occlusion and crowding in indoor pig monitoring. We validated the system on the Edinburgh Pig Behavior Video Dataset across detection, tracking, and behavior-classification tasks. A temporal model achieved 94.2% overall accuracy on nine behaviors, a 21.2 percentage-point improvement over the previous benchmark, while tracking reached 93.3% identity preservation (IDF1) and detection reached 89.3% average precision. The same pipeline, unchanged in structure, transfers across species and tasks: companion studies report 97.6% accuracy for calf play behavior and 98.3% for dairy-cow posture. By releasing an open-source, end-to-end implementation, this work provides a reproducible and scalable tool for automated, objective, and continuous behavior monitoring in precision livestock farming and welfare assessment.
Authors
- Jennifer Sun (ORCID: https://orcid.org/0000-0002-1836-2785)
- Puchun Niu (ORCID: https://orcid.org/0000-0001-6858-1284)
- Sébastien Franceschini (ORCID: https://orcid.org/0000-0001-6298-5149)
- Meike van Leerdam
- Haiyu Yang
- Miel Hostens
- Enhong Liu
- Sumit Sharma
Publication Details
- Journal
- Scientific Reports
- Published
- 2026-08-24
- DOI
- https://doi.org/10.1038/s41598-026-67803-4
- Primary Topic
- Animal Behavior and Welfare Studies
- Type
- article
- Field-Weighted Citation Impact
- 0.00