Each Animal as Its Own Control: RFID Identity for Rare-Disease Detection in Groups

Sick animals in a farm pen are rare. Sometimes one bird in a hundred is infected. A classifier trained to separate "sick" from "healthy" across the whole group therefore sees almost no positive examples. It drifts toward calling everything healthy, and the standard fixes are reweighting, resampling or synthesizing minority cases. This proposal argues that the imbalance comes from asking the wrong question. If every animal keeps a reliable identity for weeks, the question changes from "does this animal look like a sick animal?" to "has this animal stopped behaving like itself?" The second question needs no sick training examples at all. Each individual supplies its own healthy reference, and illness shows up as a departure from that reference.

Radio-frequency identification (RFID) is what makes this practical. Small tags are read by antennas without line of sight, so they supply identity that cameras alone lose whenever animals huddle, rest or occlude each other. We propose a system that combines two sources. Sparse RFID reads at feeders and drinkers re-anchor camera-based tracks to the correct animal. Each animal's continuous movement record then feeds a per-individual change detector. The central empirical question is quantitative: how much identity accuracy does rare-disease detection actually need, and does it beat a population-level classifier with the usual imbalance remedies?

Core Claim

Persistent individual identity turns a severely imbalanced between-animal classification problem into a within-animal change-detection problem. In that form, prevalence no longer controls how many training positives exist. Identity errors also hurt this approach in a specific, asymmetric way that can be predicted. Write $x_i(t)$ for a behavioral feature of animal $i$ in time window $t$, such as distance travelled, rate of body-area change or time at the feeder. Write $\mu_i, \sigma_i$ for that animal's own mean and spread over a healthy baseline period. The detection score is then

$$z_i(t) = \frac{x_i(t) - \mu_i}{\sigma_i}.$$

An alarm fires when $z_i(t)$ stays below a threshold for several consecutive windows.

Now suppose a fraction $\varepsilon$ of the windows attributed to a sick animal actually belong to a healthy pen-mate, because the tracker swapped identities. The expected post-onset shift that the detector sees then shrinks from $\Delta$ to roughly

$$\mathbb{E}[\text{observed shift}] \approx (1-\varepsilon)\,\Delta.$$

This follows directly from averaging a mixture of sick and healthy windows. The swapped-in healthy windows also widen $\sigma_i$. Healthy animals, in contrast, are contaminated by sick windows only at a rate near $\varepsilon p$, where $p$ is prevalence, so at low prevalence their false-alarm rate barely moves. Identity errors therefore cost sensitivity, which is the clinically scarce quantity, and leave specificity almost unchanged. This is the same lopsided sensitivity-specificity failure that imbalance produces in medical classifiers. For example, Classification of Heart Sound Recordings Using Convolution Neural Network trains a CNN on PhysioNet heart sounds and reports 88.2% specificity against only 70.8% sensitivity.

The effect sizes to be detected are known. Deep learning from videography as a tool for measuring E. coli infection in poultry used markerless pose estimation on a balanced 20-versus-20 flock. Infected birds travelled 24% less distance, showed a 23% lower rate of body-area change and spent 41% less time near food. That study motivates ours. It shows that the behavioral signal exists, but it never tested the signal at realistic prevalence or kept identity beyond a short controlled recording.

Research Program

The system has three parts.

The first part keeps animal identity correct over weeks. Overhead cameras run a two-stage multi-object tracker: short tracklets are linked into long tracks. The design follows Automated Monitoring of Ear Biting in Pigs by Tracking Individuals and Events, which used oriented boxes from the Segment Anything Model and linear assignment to cut identity switches from 52 to 7 and raise IDF1 to 89.35% on three short pen videos. We reuse this tracker as the visual backbone. We do not accept its residual errors, because 7 switches in under 4,000 frames compounds to thousands of switches over a multi-week study.

UHF RFID leg bands are read by antennas at feeders and drinkers, and each read is a hard identity anchor. When an RFID read coincides with exactly one visual track in the antenna zone, that whole tracklet chain is relabeled. Between anchors, identity is carried forward by the visual tracker. Where tracklets are ambiguous, identity is filled in as a probability over candidate animals, never a hard guess.

We deliberately do not rely on continuous radio-plus-vision matching. Online People Tracking and Identification with RFID and Kinect matched RFID phase-derived velocity (23 cm/s error) to skeleton tracks and reached 100% identification for one or two people. Accuracy fell to 80% for six people, and the method breaks down for stationary subjects and for subjects with identical radial velocity. Broilers rest for most of the day in dense groups, so velocity matching would fail exactly where identity matters. Checkpoint anchoring borrows instead from gated designs like AutonoMouse and High-Throughput Automated Olfactory Phenotyping of Group-Housed Mice. Those systems resolve identity at a single-occupancy port, but we drop the requirement that the animal be isolated.

The second part is the detector. For each animal we compute window-level features from the first part's identity-resolved tracks and from RFID visit logs, then score them with the self-referenced statistic above. We also test a learned variant: a small sequence model trained only on healthy animals to forecast each animal's next-window features from its own history and the pen-wide average. The forecast error serves as the anomaly score. Including the pen average lets the model separate individual decline from shared shifts, such as a cold night that slows the whole flock. Because training uses no sick examples, the imbalance never enters the loss.

The third part is an identity-tolerance analysis. Across a range of injected swap rates $\varepsilon$ and subsampled prevalences $p$, we measure how sensitivity at a fixed false-alarm budget degrades, and we compare the result with the $(1-\varepsilon)$ dilution prediction. The aim is a practical decision rule, in the spirit of From Theory to Decision Rule. That paper studied pseudo-labels from vision-language models on medical images and found a crossover number of expert labels beyond which the noisy labels hurt. It also noted that its rule was not built for heavy class skew, where averaged AUC hides failures on the rare class. Our analog treats identity error as a structured label noise and asks below what $\varepsilon$ vision-only tracks suffice and above which RFID anchoring is needed. We report this in prevalence-aware metrics, not macro-AUC.

Baselines

The naive reference point is a population-level classifier trained with ordinary cross-entropy on window features from vision-only tracks, with each window labeled by its animal's infection status. At 2% prevalence we expect it to approach the trivial "all healthy" solution. It sets the floor and shows how large the imbalance problem is in this setting.

The strongest existing competitor on this question is the same population classifier given every standard imbalance remedy. These are class-weighted cross-entropy, focal loss, minority oversampling and a hybrid cross-entropy-plus-hinge objective of the kind CURENet used against multi-label imbalance in health records. This competitor also receives the RFID-anchored tracks, so it has the same identity quality as our method and differs only in how it frames detection. Every method sees identical pens, the same days and the same feature extractor. Each gets the same hyperparameter search budget, with folds split by pen so that no animal appears in both training and test. Positives are scarce, so the population classifier is trained on positives from other pens through leave-one-pen-out cross-validation.

For a reported number, no result was found on Lacuna for any method detecting infection in a low-prevalence flock or herd. The closest figures are the balanced-cohort effect sizes above and the 70.8% sensitivity at 88.2% specificity from the heart-sound CNN, which come from a different modality. We will not treat either as a target. Our method beats this competitor if it reaches higher sensitivity at a matched budget of one false alarm per 100 animals per day, with a 95% confidence interval over pens that excludes zero difference, and earlier median time-to-detection after inoculation.

A third baseline isolates the key ingredient: the identical self-referenced detector run on vision-only tracks with no RFID anchoring. If it matches the full system, identity anchoring is not what helps. A fourth baseline, described below, uses RFID feeder logs alone.

Why not just…?

Why not just threshold each animal's RFID feeder visits and skip the cameras? This is the most serious threat, and we treat it as a central baseline rather than a straw man. Infected birds cut feeder time by 41%, the largest of the three reported effects, and per-animal visit logs come almost free from the antennas. If a per-animal feeder-time z-score matches the full system, the honest conclusion is that the cheapest system is enough, and that result alone would support the core claim about self-reference. The full system can win in two places. One is early-stage illness, which we expect to appear first in locomotion and body-area dynamics, the effects that need cameras. The other is birds that keep eating while becoming less active. Time-to-detection and per-feature ablations will decide this.

Why not just use vision-only tracking with per-track baselines? A per-animal baseline needs days of correctly attributed data. The pig tracker's 7 switches in roughly 3,900 frames scale to frequent splices over weeks. SideCow-VSS reports that even a segmenter at 97.32% mIoU cannot separate cows in contact. The swap-rate sweep and the vision-only ablation measure this cost directly, so the argument rests on our own numbers, not only on cited ones.

Why not just read visual tags instead of RFID? ReadMyCow reached 96.1% accuracy on printed ear tags but 54.6% on handwritten ones. It also failed on soiled or pinned tags and needed a frame-skipping module to run in real time on edge hardware. Small, dusty, densely packed birds are a harder case for visual tags than cattle in a milking parlor. Visual leg-band IDs could still serve as a cheaper anchor in place of RFID, and the identity-tolerance curve tells us what read accuracy any anchor must reach.

Why not just fix the imbalance with resampling, focal loss or synthetic sick animals? These methods still learn "sick" from a handful of sick individuals pooled across animals with very different baseline activity. Pooling stretches the healthy distribution so wide that a 24% drop in one bird disappears inside normal variation between birds. The tuned population baseline above tests this directly. If it wins, the claim that identity relieves imbalance fails.

Proposed Experiments

The retrospective test uses RFID-anchored long records of the AutonoMouse type: more than 1.35 million trials from 67 mice with graded olfactory-bulb lesions. We will request access to these data. Using the reported pre-lesion and post-lesion periods, and subsampling lesioned animals to prevalences from 20% down to 2%, we compare self-referenced and population detection of lesion-induced performance decline with identity guaranteed to be perfect. This gives the upper bound on the benefit of reframing.

The prospective test is a poultry challenge study modeled on Scheidwasser et al., run at realistic prevalence. Pens of about 80 broilers are fitted with UHF leg bands, feeder and drinker antennas, and overhead cameras. In each pen, two to four birds are inoculated with pathogenic E. coli, and the rest receive sham doses. Ground truth comes from serum amyloid A levels, lesion scores and bacterial counts, as in the original study. The primary metrics are sensitivity at a fixed false-alarm budget, area under the precision-recall curve and hours from inoculation to alarm. Identity quality is reported as IDF1, switches per hour and the fraction of animal-hours correctly attributed.

The decisive checks are three. First, the self-referenced detector must beat the tuned population classifier at prevalence of 5% or below, with the margin growing as prevalence falls. Second, sensitivity must degrade with injected swap rate roughly as the $(1-\varepsilon)$ dilution predicts, and specificity must stay nearly flat. Third, the full system must beat feeder-RFID-only detection on time-to-detection. If it does not, we report the cheaper system as the practical answer.