Tracking a single pig through the chaos of a crowded pen has long defeated even the best computer vision systems. Commercial pigs are genetically standardised to the point of near-identical appearance, they grow rapidly over weeks, and they accumulate and shed dirt that constantly rewrites their coat texture. A new study published in Smart Agricultural Technology now reports a re-identification framework that kept track of 12 unmarked, visually uniform pigs across an 18-day evaluation period, achieving a mean daily recognition accuracy of 88.0% without any physical tags — up from just 54.6% for a conventional sequential day-to-day tracking baseline.
The work, led by Gytis Bernotas and colleagues, tackles a practical bottleneck in precision livestock farming. Continuous, automated monitoring of individual animals can reveal long-term patterns in feeding, space use, social interaction and health that group-level data cannot capture, because small deviations from an individual’s normal behaviour may signal welfare or health problems. Yet most existing long-term vision systems depend on ear tags, RFID anchors or painted marks to correct identity errors — information that commercial grow-finish farms rarely have, since market pigs are typically managed as untagged batches.
The researchers built their system on an extended version of a large-scale longitudinal pig-tracking dataset comprising 162 visually similar, group-housed commercial pigs. Ground-truth identity was established using a clever trick: RFID ear tags fitted with UV-only visible patterns that are invisible to standard colour cameras, so the images show pigs that look genuinely unmarked while the true identities remain verifiable. Groups of 150 pigs were used for training, while two unseen groups totalling 12 pigs — recorded daily over 18 days, 190 days after the last training capture — served as the open-set evaluation cohort.
Because pigs spend much of the day lying down, and recumbent postures from a top-down camera badly distort the visible body shape, the team first filtered the data to keep only standing animals. A fine-tuned YOLOv8x classifier achieved 98.4% accuracy and an F1 score of 0.982 on a held-out posture test set, and up to 250 standing images per pig per day were retained. The evaluation clips themselves were also expanded, raising the unfiltered image counts to 115,422 for one group and 106,382 for the other, compared with 14,179 and 18,300 in the original dataset.
At the heart of the method is a ResNet50 network trained with deep metric learning, producing 128-dimensional identity embeddings. Training combined an ArcFace angular-margin loss — chosen because near-identical pigs demand maximal angular separation between individuals — with a lightly weighted triplet loss whose anchor and positive images were deliberately drawn from different imaging days, forcing the network to learn features that persist over time rather than day-specific cues like transient dirt. Crucially, the framework is open-set: instead of a fixed classifier over known animals, new individuals can be enrolled automatically without retraining, a necessity on real farms where populations constantly change.
The most distinctive innovation is a dynamic multi-anchor voting algorithm that counters embedding drift. Each day, the day’s embeddings are clustered and the resulting centroids are matched not just to the previous day but against a rolling bank of trusted historical anchors from the last five high-confidence days, using Hungarian assignment with cosine distance. An identity is confirmed only when at least two historical anchors agree, and a self-healing fallback re-matches everything to the most recent trusted anchor when systemic uncertainty strikes. In ablations, expanding the bank from a one-day baseline (54.6%) to three days lifted accuracy to 69.4%, and a five-day bank stabilised performance at 88.0% with a standard deviation of just 6.9 points across days; larger banks of seven or ten days brought no meaningful further gain.
Input format mattered enormously. Instance segmentation masks, which isolate the pig pixel-by-pixel, gave the most stable tracking at 88.0%. Oriented bounding boxes, which fit the animal’s body axis tightly, reached 82.8% at lower computational cost, making them a practical compromise for on-farm edge hardware. Axis-aligned bounding boxes, which drag in background and neighbouring animals, collapsed to 51.4%. The team also introduced a synthetic dirt augmentation pipeline, generated with OpenSimplex noise and fractional Brownian motion, that darkens the animal’s natural texture with random dirt patches during training. Removing it devastated the tightly cropped formats — accuracy fell to 56.5% for segmentation and 46.1% for oriented boxes — showing that without this invariance training, networks latch onto transient soiling as a false identity cue.
An unsupervised enrolment step clusters the embeddings with k-means to establish identities without labels, exceeding 95% accuracy at low retention rates for the segmentation and oriented-box formats. Adapted GradCAM visualisations showed the model attending to consistent body regions — shoulders, rear and head — for the same pig across days, suggesting reliance on stable morphological traits rather than temporary artefacts, though the authors caution that such attention maps cannot pinpoint the underlying features. Enabling a self-supervised continual learning stage, which fine-tunes the network daily on high-confidence pseudo-labelled samples, nudged accuracy to 90.5%; the authors note this modest 2.5-point gain carries a risk of reinforcing confident but wrong assignments, so the zero-shot configuration remains the more robust default.
The authors are careful about scope. The data came from a controlled research facility, only two evaluation groups were tested over 18 days, and key parameters were tuned on the same groups on which performance is reported, making this a feasibility result that should be confirmed on truly unseen cohorts. Inter-farm, inter-breed and inter-camera robustness remain unexplored, imaging was conducted in daylight rather than under the infrared lighting common in commercial barns, and the cluster count for enrolment was supplied manually rather than estimated. No directly comparable benchmark exists, since published pig re-identification datasets rely on tagged or marked animals.
Even with those caveats, the demonstration that biometric identification of visually uniform livestock is feasible without physical markers is significant. Tagless re-identification removes the labour burden, welfare concerns and data loss associated with ear tags, and lays the groundwork for continuous longitudinal monitoring of individual growth, behaviour and health on commercial farms — provided future work extends the approach to more postures, other farms and deployable short-term tracking integration.
Subject of Research: Computer vision re-identification of untagged, group-housed pigs over long-term monitoring
Article Title: Long-term tracking of individual pigs through re-identification
Article References: Bernotas, G., Hansen, M. F., Smith, M. L., Jack, M., Baxter, E. M., & D’Eath, R. B. (2026). Long-term tracking of individual pigs through re-identification. Smart Agricultural Technology, 15, Article 102661. https://doi.org/10.1016/j.atech.2026.102661
Image Credits: AI Generated
DOI: 10.1016/j.atech.2026.102661
Keywords: precision livestock farming, pig re-identification, computer vision, deep metric learning, animal welfare, multi-anchor voting, open-set recognition, RFID-free tracking, synthetic dirt augmentation, instance segmentation, continual learning, livestock monitoring
News Source: Alan Morgan. (October 29, 2026). AI Learns to Recognise Untagged Pigs Day After Day on the Farm. Scienmag.



