Download PDF

From Detection to Dominance: A Graph Learning Approach to Pig Behavior Analysis

Publication date: 2026-08-26

Author:

Parmiggiani, Andrea
Norton, Tomas

Keywords:

S007421N#56230548

Abstract:

Automated phenotyping of social behaviour in group-housed pigs promises scalable, objective welfare and management indicators, but it is constrained by three coupled difficulties: (i) perception in crowded pens (occlusion, overlap, motion blur, weak head-tail cues from overhead views, and visually similar individuals), (ii) the untrimmed nature of long recordings in which multiple behaviours overlap in time and space, and (iii) the need to infer individual roles for decision making or downstream social-structure analysis. This dissertation develops and validates an end-to-end computer-vision framework that converts overhead video into interaction-level measurements and longitudinal social phenotypes, emphasizing robustness under different housing conditions. The thesis is organized as a chain of inference: video → detection/localization → identity-preserving tracking → spatiotemporal interaction proposal generation → interaction classification with role attribution → derivation of social phenotypes, including dominance structure. Each stage is treated as necessary: errors early in the chain can silently distort downstream welfare metrics, so methods are designed to reduce error propagation and to handle ambiguity explicitly. Detection and localization. Accurate localization under rotation and crowding is addressed through an oriented bounding-box formulation for pig detection. Instead of axis-aligned boxes, pigs are parameterized by geometric attributes (centre, length, width, orientation) and detected as rotated boxes, improving localization in densely populated scenes with arbitrary orientations and lens distortion. A lightweight detector (≈1.7M parameters) is trained and evaluated on a multi-pen dataset (3123 images from 27 pens for training/validation; additional video clips from three novel environments for testing). The detector attains high precision (AP@0.5: 96.54 on the test environments), and a fast sequential, temporally informed non-maximum suppression method further improves video performance (AP@0.5 to 97.41), demonstrating that orientation and temporal consistency can be exploited to reduce duplicate and inconsistent detections. Tracking under detector error. The dissertation then addresses long-horizon tracking in group housing, where detector outputs contain both missed detections and false positives. A robust tracking algorithm is proposed that integrates deep-learning-based detection with graph convolutional networks. Detections across multiple frames are represented as a graph, where nodes correspond to candidate detections and edges link detections that do not co-occur in the same frame; the graph convolutional network learns to associate detections into consistent trajectories and to suppress detector-induced errors. The resulting method supports long recordings (>10 minutes) and operates at practical speed (≈22 fps), targeting the operational requirement of behavioural monitoring beyond short clips. Spatiotemporal proposal generation in untrimmed video. A major challenge for behaviour analysis is that multiple behaviour categories can occur concurrently, overlap in both time and space, and occupy a small fraction of long recordings. To address this, a trigger-based approach for spatiotemporal behavioural proposal generation is developed for five key behaviour types: fighting, tail biting, feeder displacement, feeder visiting, and drinker visiting. The proposal generator is designed to achieve full coverage of true events while reducing redundant background segments; in the reported evaluation it achieves 100% recall while substantially reducing unnecessary proposals. The approach combines evolutionary parameter optimization with posture recognition, keypoint detection, and spatial constraints to remain effective in densely populated environments. To support reproducible evaluation and downstream research, this work is accompanied by the construction of a benchmark dataset, PigInteraction, providing annotated interaction samples for modelling and comparison. Role-aware interaction recognition. The dissertation advances interaction recognition by modelling dyadic events as role-specific dynamics. Traditional image-analysis pipelines and convolutional recurrent networks often struggle to represent the structured, pairwise, and role-dependent nature of 6 interactions such as fighting, feeder displacement, and tail biting. The thesis proposes a graph-based neural model that encodes spatial and temporal relationships among key body landmarks of interacting pig pairs, complemented by engineered kinematic features that capture motions expressed over different durations segments. On validation, the model achieves strong behaviour recognition performance (average F1 ≈94%) and demonstrates the ability to discern the role of each individual in one-to-one interactions (average role F1 ≈90%). Automated dominance phenotyping. Finally, the thesis demonstrates how the preceding components enable automated dominance phenotyping. Dominance hierarchies typically form rapidly after mixing, but quantifying social structure over long recordings is labour-intensive. A multi-stage deep-learning pipeline (detection, tracking, pose estimation, behaviour classification) is benchmarked against manual annotation in a pen during the first 27 hours post-mixing. Dyadic agonistic events extracted by both assessments are converted into dominance endpoints using two established inference frameworks: Glicko-2 (with uncertainty dynamics via rating deviation) and the I&SI method. The resulting final dominance rankings show strong agreement between manual and automated assessments (Kendall's τ = 0.93, p ≈ 2×10⁻4). These results indicate that, when interaction extraction is sufficiently reliable, automated pipelines can recover core hierarchy structure and interpretable group dynamics from long video, making dominance analysis feasible at a scale that is impractical for manual scoring. The framework developed in this dissertation advances precision livestock farming and computational ethology by providing methods that operate under realistic visual constraints (crowding, occlusion, untrimmed recordings) and by linking perception outputs to interpretable social phenotypes. It also clarifies practical limitations: visual ambiguity and severe occlusion constrain role attribution and must be handled explicitly to avoid biasing social-structure estimates. Future directions include integrating additional sensing modalities, and strengthening statistical links between automated phenotypes and intervention outcomes in controlled experiments.