Papers
Topics
Authors
Recent
Search
2000 character limit reached

PigDetect: Integrated Pig Monitoring System

Updated 7 July 2026
  • PigDetect is an integrated computer-vision system for pig monitoring that combines detection, segmentation, tracking, and behavior inference.
  • The system utilizes modular workflows including zero-shot detection, transformer-based segmentation, and advanced tracking to handle occlusions and maintain identity.
  • It offers practical solutions for continuous monitoring and precision welfare assessment through scalable deployment and robust behavioral analytics.

PigDetect denotes an integrated computer-vision capability for pig monitoring in which systems "find all pigs in overhead videos", "track each pig with stable identity despite occlusions", "extract robust visual representations", and "map temporal sequences of features to individual behaviors" (Yang et al., 15 Sep 2025). In closely related formulations, the same problem is cast as "Segmentation, Tracking, Action recognition, and Re-identification (STAR)" for group-housed pigs (Tangirala et al., 2021), or as automated video classification of "aggressive and non-aggressive behaviors" to support stress monitoring, animal welfare, and farm decision making (Souza et al., 2024). This suggests a broader usage in which PigDetect is not a single algorithm but a systems layer spanning detection, segmentation, tracking, identity preservation, and downstream behavioral inference.

1. Scope and system decomposition

A canonical PigDetect workflow is modular. One recent implementation specifies six core modules: Video decoding, Zero-shot object detection, Motion-aware segmentation & tracking, Automated cropping & preprocessing, Feature extraction, and Behavior classification (Yang et al., 15 Sep 2025). In that pipeline, OpenCV decodes frames with a configurable stride; OWLv2 is used for zero-shot pig localization; SAMURAI provides motion-aware segmentation and tracking; cropped pig images are resized to 224×224224 \times 224; DINOv2 yields a 1024-dimensional embedding per frame; and either an MLP or a BiLSTM predicts behavior (Yang et al., 15 Sep 2025).

A more integrated formulation is STAR, which jointly optimizes segmentation, tracking, action recognition, and re-identification through a transformer architecture with shared instance embeddings (Tangirala et al., 2021). At the other end of the design spectrum, task-specific systems isolate only one behavior, as in video-based aggression classification with STAM, TimeSformer, ViViT, ResNet3D2, Resnet(2+1)D, and CnnLstm (Souza et al., 2024). The architectural divergence is substantial, but the problem decomposition is stable: detection localizes pigs, segmentation delineates them, tracking preserves identity, and temporal models convert trajectories or embeddings into semantic outputs.

The practical motivation is equally stable across papers. Automated analysis is described as reducing "susceptible errors and time consumption" in human behavioral observation and as contributing to "precision pig farming and welfare assessment through automated, objective, and continuous analysis" (Souza et al., 2024, Yang et al., 15 Sep 2025). For that reason, PigDetect is best understood as infrastructure for continuous monitoring rather than as a narrowly defined detector.

2. Detection and segmentation substrates

Zero-shot detection is a prominent entry point. In the Edinburgh Pig pipeline, OWLv2 is queried with "pig" at confidence 0.5; at IoU =0.5= 0.5, the reported metrics are [email protected]: 89.28%, Precision: 80.19%, Recall: 88.05%, F1: 83.94%, Average IoU: 0.747, Missed detection rate: 11.95%, False positive rate: 19.81%, and Mean Absolute Error for pig counting per frame: 1.53 pigs (Yang et al., 15 Sep 2025). The same study also notes that on the Edinburgh overhead videos, YOLOv12 under-detected pigs (only 3 of 8 in an example), whereas OWLv2 detected all 8 pigs plus 2 heavily occluded pigs in an adjacent pen, indicating that detector ranking is strongly viewpoint-dependent (Yang et al., 15 Sep 2025).

Segmentation-first approaches target the information loss inherent in boxes. "Panoptic Instance Segmentation on Pigs" reports a specially created dataset with 1000 hand-labeled images and "detection rates of around 95% (F1 Score) despite disturbances such as occlusions and dirty lenses" (Brünger et al., 2020). At 640×512640 \times 512, the same work reports Jaccard/IoU ≈0.973\approx 0.973 for binary segmentation and panoptic-quality values around 0.792–0.797 with F1 ≈0.948\approx 0.948–$0.951$ for combined segmentation (Brünger et al., 2020). The contribution is not only pixel-accurate masks but also geometric surrogates such as ellipse area and orientation, which support downstream estimation of size, weight, and posture.

Extreme occlusion motivates center-based formulations. In farrowing pens, BSO appears in 95.4% of images, PMO in 92.3%, at least one partial occlusion in 98.7%, and complete occlusion of some piglets in 19.1%; under those conditions, CClusnet-Inseg reports mAP 84.1 and outperforms the other instance segmentation baselines compared in that study (Huang et al., 2022). Its central idea is to predict object centers and center-offset vectors, cluster center votes with DBSCAN, and recover instance masks from those clusters rather than from box proposals.

These results support a stable pattern. Box detectors remain attractive for throughput and simplicity, but segmentation-centric PigDetect variants are preferred when crowding, body deformation, or downstream morphology matter.

3. Identity preservation and tracking architectures

Tracking quality is usually summarized with identity-aware metrics such as MOTA and IDF1: MOTA=1−∑t(FNt+FPt+IDSWt)∑tGTt,IDF1=2⋅IDTP2⋅IDTP+IDFP+IDFN.\text{MOTA} = 1 - \frac{\sum_t (FN_t + FP_t + IDSW_t)}{\sum_t GT_t}, \qquad \text{IDF1} = \frac{2 \cdot \text{IDTP}}{2 \cdot \text{IDTP} + \text{IDFP} + \text{IDFN}}. PigDetect systems differ mainly in what representation is propagated: boxes, masks, keypoints, or learned embeddings.

On the Edinburgh dataset, SAMURAI-based segmentation tracking reports Average MOTA: 86.68%, Average IDF1: 93.33%, Average identity switches: 0.44 per sequence, and Average tracklet length: 600 frames (Yang et al., 15 Sep 2025). A stronger long-duration FM-centered workflow based on Grounding-DINO and Grounded-SAM2, evaluated on a 132-minute video, reports mean region similarity (J) of 0.83, contour accuracy (F) of 0.92, J&F of 0.87, MOTA of 0.99, MOTP of 90.7%, and no identity switches on 132 uniformly sampled ground-truth frames (Bi et al., 3 Apr 2026). In both cases, the decisive change relative to box-only MOT is that segmentation masks and mask-derived centroids provide more stable support through partial occlusion.

Large pens require explicit cross-camera handover. In a three-camera grow-finish setup with 16–17 pigs per pen, YOLO plus DeepSORT yields single-camera MOTA 65.0% and MOTP 54.3%, while the homography-based handover stage reaches Camera Handover Accuracy of 74.0%, with a marked day-night asymmetry (92.4% versus 46.3%) (Shirke et al., 2021). This establishes that PigDetect is not intrinsically monocular; in oblong pens, overlapping views and inter-view geometry are a practical necessity.

Comparative benchmarking reinforces the same conclusion. On a 10-minute pig tracking dataset, "overall, MOT approaches outperform traditional MAT tools, even for long-term tracking scenarios" (Bibinbe et al., 15 Sep 2025). ByteTrack reports IDF1 0.79 and MOTA 0.73, DeepSORT IDF1 0.74 and MOTA 0.72, whereas idTracker and several DeepLabCut configurations are substantially weaker on identity metrics (Bibinbe et al., 15 Sep 2025). The implication is not that animal-specific tools are obsolete, but that PigDetect increasingly inherits its association logic from the contemporary MOT literature.

4. Behavior inference and semantic understanding

Behavior inference is the stage at which PigDetect moves from geometry to semantics. In aggression analysis, the target is binary clip classification. "Pig aggression classification using CNN, Transformers and Recurrent Networks" compares STAM, TimeSformer, and ViViT, as well as ResNet3D2, Resnet(2+1)D, and CnnLstm, and evaluates accuracy, precision, and recall; the TimerSformer technique showed the best results in video classification, with median accuracy of 0.729 (Souza et al., 2024). The significance is methodological: video transformers are not merely imported architectures but explicit alternatives to 3D convolutions and recurrent heads in pig-behavior recognition.

At finer behavioral granularity, the Edinburgh modular pipeline selects 9 behaviors from an original set of 17 and uses frozen DINOv2 embeddings with lightweight classifiers (Yang et al., 15 Sep 2025). The reported results are 92.9% test accuracy for the MLP and 94.2% for the BiLSTM, with Weighted F1: 0.932 and 0.944, respectively; relative to Bergamini et al. (2021), the BiLSTM result is described as a 21.2 percentage point improvement (Yang et al., 15 Sep 2025). This architecture is notable because nearly all heavy lifting is delegated to pretrained visual backbones; the task-specific head is small.

Transformer-based joint formulations push the integration further. In Pigtrace, starformer is described as "the first end-to-end multiple-object livestock monitoring framework that learns instance-level embeddings for grouped pigs through the use of transformer architecture" (Tangirala et al., 2021). On Pigtrace, starformer reports mAP(0.5:0.95) ≈0.690\approx 0.690 for segmentation, cMOTSA 0.778 for tracking by masks, AUC ≈0.985\approx 0.985 for binary active/inactive classification, and CMC Rank-1 0.771 for re-identification (Tangirala et al., 2021). Here, PigDetect becomes a single shared-embedding model rather than a pipeline of isolated components.

Multimodal LLMs occupy a different point in the design space. In piglet activity understanding, "while current multimodal LLMs require improvement in semantic correspondence and time perception, they have initially demonstrated visual perception capabilities for animal activity recognition" (Wu et al., 2024). GPT-4o shows the strongest overall performance in that benchmark, especially on close-up clips, but the study explicitly identifies semantic correspondence and temporal estimation as unresolved weaknesses (Wu et al., 2024). A plausible implication is that MLLMs are currently more credible as semantic interfaces or annotation assistants than as standalone PigDetect cores.

5. Edge deployment and systems compression

Foundation-model pipelines set the current accuracy ceiling, but they are often too large for continuous deployment in barns. A distilled SAM 3 and DINOv3 pipeline addresses this constraint directly (Yang et al., 29 Apr 2026). The 446M-parameter SAM 3 perception encoder is compressed into a 40.66M-parameter student; on the Edinburgh Pig dataset, the student reaches 92.29% MOTA and 96.15% IDF1 against the teacher, with a 7.77-fold reduction in system-level parameters and a 3.01-fold reduction in peak VRAM (19.52GB -> 6.49GB) (Yang et al., 29 Apr 2026). The same pipeline reports 97.34% top-1 accuracy and 91.67% macro-F1 on nine-class pig behaviour classification and is described as fitting inside an NVIDIA Jetson Orin NX 16GB envelope with 4.9GB of headroom (Yang et al., 29 Apr 2026).

A complementary strategy is to use the foundation model only offline. "SAM3-Assisted Training of Lightweight YOLO Models for Precision Pig Farming" treats SAM 3 as an auto-annotator and trains YOLOv8 detectors from pseudo-labels (Faria et al., 25 May 2026). The headline result is that YOLOv8m achieves a mean Average Precision (mAP) of 79.4% without human intervention, with approximately 200× lower inference latency than the teacher; in low-occlusion scenarios, the pipeline reaches AP50>99%AP_{50} > 99\% (Faria et al., 25 May 2026). This is a different notion of edge adaptation: not distilling the tracker itself, but converting a slow teacher into a deployable detector through zero-annotation supervision.

Pipeline Compression or supervision strategy Reported outcome
Distilled SAM 3 + DINOv3 + BiLSTM 446M backbone compressed to 40.66M student 92.29% MOTA, 96.15% IDF1, 97.34% top-1, 6.49GB peak VRAM
SAM3-assisted YOLOv8m Zero-shot pseudo-labels from SAM 3 mAP 79.4, =0.5= 0.50 in low-occlusion scenarios, ~200× lower latency

Long before foundation-model distillation, edge constraints already shaped PigDetect design. A real-time counting system using keypoints, tracking, and spatial-aware temporal response filtering reports 82.6 fps on GTX 1080Ti, 3.19 fps on Jetson Nano, and 0.625 fps on RK3399, demonstrating that lightweight edge deployment is feasible when the task is simplified to counting rather than full identity-preserving tracking (Chen et al., 2020).

6. Identity-centric and biometric variants

A narrower interpretation of PigDetect emphasizes persistent identity rather than pen-wide tracking. One such line uses auricular vein pattern recognition as a noninvasive biometric (Nsengiyumvaa et al., 2 Oct 2025). In that study, 800 ear images from 20 mixed-breed pigs are processed through a multistage pipeline that enhances veins, extracts structural and spatial features, and classifies the resulting signatures with conventional machine learning. The reported best model is an SVM with 98.12% precision, and the full process completes in an average of 8.3 seconds (Nsengiyumvaa et al., 2 Oct 2025). The imaging protocol is constrained—smartphone capture plus simple back lighting—but the modality is attractive precisely because it does not rely on persistent visual differences in whole-body appearance.

Face-centered variants address the front end of visual biometrics. LAD-RCNN is introduced as a light-weight angle detection and region-based convolutional network for livestock face detection and normalization (Sun et al., 2022). It detects face location and rotation angle in one stage, reaches 72.74 FPS on a GeForce RTX 2080 Ti, reports AP more than 95%, and achieves a rotation-angle deviation less than 0.036 (i.e. 6.48°) on the test datasets used in that paper (Sun et al., 2022). Although the evaluation there is not pig-specific, the technical point is general: PigDetect can be construed as a face-detection-and-normalization module upstream of individual identification.

These biometric systems are complementary to pen-level tracking rather than replacements for it. Whole-pen MOT is optimized for continuity under occlusion and crowding; biometric capture is optimized for high-confidence individual verification under controlled acquisition. A practical PigDetect stack can therefore combine both, using tracking for routine monitoring and biometric acquisition for identity registration or correction.

7. Validation requirements, failure modes, and open problems

The strongest empirical lesson is that zero-shot performance is conditional rather than universal. One modular pipeline explicitly states that even "zero-shot" models must be validated per species / setup (Yang et al., 15 Sep 2025). The same work also notes a hard dependency on initialization quality: the pipeline requires a good start frame, because poor first-frame detection propagates into tracking and cropping failures (Yang et al., 15 Sep 2025). These are not implementation details but structural constraints of prompt-based and memory-based vision systems.

Nighttime and occlusion remain the dominant degradations. In the FM-centered segmentation-and-tracking workflow, Grounding-DINO achieves a true positive rate of 85.20% during daytime but only 57.53% at night (Bi et al., 3 Apr 2026). In pseudo-label transfer from SAM 3 to YOLO, the hardest farrowing group reports mAP = 56.7 and =0.5= 0.51, far below the low-occlusion groups (Faria et al., 25 May 2026). These results are consistent with the explicit occlusion statistics reported for piglets in farrowing pens, where partial occlusion is nearly ubiquitous (Huang et al., 2022).

Long-term identity drift also remains unresolved. The comparative tracking study finds that F1 scores decrease over time for all methods, with accumulated misses and identity switches degrading long-sequence reliability (Bibinbe et al., 15 Sep 2025). That benchmark also shows that contemporary MOT methods outperform traditional MAT tools, but it does not eliminate the need for post hoc identity repair, track smoothing, or cross-session re-identification (Bibinbe et al., 15 Sep 2025). The edge-deployable foundation-model pipeline therefore proposes—but does not yet validate—an embedding-pool re-identification mechanism for long-horizon identity correction and longitudinal visual analytics (Yang et al., 29 Apr 2026).

At the semantic layer, multimodal LLMs add descriptive flexibility but not yet dependable ethological precision. The piglet-activity benchmark concludes that semantic correspondence and time perception still require improvement (Wu et al., 2024). Taken together, these findings point toward a convergent architecture for PigDetect: foundation-model priors for open-world perception, lightweight task-specific logic for tracking and quality control, and explicit validation under species-, viewpoint-, and illumination-specific constraints.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to PigDetect.