Manuscript Offprint
arXiv:2610.32174Real-Time Localisation of Dorsal Anatomical Regions on Dairy Cows in Commercial Rotary Parlours from RGB-D
Abstract
Automated monitoring of dairy cows increasingly measures one part of the body, such as the rump for temperature or the back for posture, yet the region itself is usually placed by hand. Existing systems either score the cow as a whole or detect sparse keypoints, often in controlled walkways, and neither yields the named region masks that such measurements need on a crowded commercial rotary platform. We present a perception front end that finds the target cow, ten bony landmarks and four named dorsal regions (withers, back, rump and tailhead) in a single forward pass over a whole RGB-D frame from a commercial rotary parlour. Two encoders, one for colour and one for depth, are fused late and share one decoder with three heads. On an anatomical region dataset that we built on public rotary-parlour RGB-D images (538 annotated frames, cow-disjoint test set), the network reaches PCK@10 0.905 for landmarks and region IoU 0.70 to 0.91, and runs end to end in 26.4 ms per frame on a T4 GPU, against an 11 fps camera. Dense region supervision is what makes the landmarks accurate: removing the region head costs 0.15 PCK@10. Agreement between the two heads flags unreliable frames without labels. On our own rig at Western Australia's largest dairy farm, the model transfers with ten labelled frames (PCK@10 0.84), and its regions are carried through depth into a radiometric thermal camera, giving one repeatable temperature per region and cow.
1 Introduction
Precision dairy farming increasingly relies on automated, non-contact measurement of individual cows [Halachmi et al., 2019]. Many of these measurements concern one part of the body: rump and tail-head temperature around oestrus [Perez Marquez et al., 2019], hip width for body weight [Song et al., 2018], back posture for lameness [Viazzi et al., 2014; Van Hertem et al., 2014; Tun et al., 2024], and the rump and tail-head for body condition [Spoliansky et al., 2016]. Each study defines its region of interest by hand or with a task-specific crop. The region is therefore never measured, reused or validated in its own right, and a new measurement needs a new region-finding method.
A rotary milking parlour is a natural place to measure every cow twice a day: the platform carries each cow past a fixed sensor at a known point in the milking routine. It is also a hard scene for machine vision. The camera sees the cow in the stall together with two neighbours, through rails and cluster hoses, from an oblique view that changes between installations. Colour alone is unreliable on black-and-white coats, and depth alone loses fine landmarks. A front end for such a parlour has to find the right cow, localise anatomy on it and keep up with the platform, on hardware that can sit in the dairy.
Prior work on overhead RGB-D stops short of this. Duan et al. [2025] localise eight dorsal keypoints for lameness features; Ruchay et al. [2026a] regress a body condition score from the whole frame in real time (95 ms per frame) on the recording our dataset is built on; thermal studies place their regions by hand [Perez Marquez et al., 2019; Salles et al., 2016]. None outputs named anatomical regions as masks that a second sensor can reuse.
We address this gap with one multi-task network, illustrated in Figure 2. Its contributions are:
-
A whole-frame, multi-task RGB-D network (late fusion of two encoders, a shared feature pyramid decoder, and heads for the target-cow mask, ten landmarks with visibility, and four region masks) whose regions come with the depth behind every pixel, so any co-calibrated sensor can receive them.
-
An anatomical region dataset built on the colour and depth images of a public rotary-parlour recording [Ruchay et al., 2026b]: 538 landmark frames, 18 hand-drawn region outlines, 36 within-pass repeat pairs, reviewed target-cow masks and a depth-to-colour calibration.
-
A controlled study on cow-disjoint and session splits,
Corresponding author: hai.wang@murdoch.edu.au three seeds each: input modality and fusion, head ablations, four backbones including a backbone-specific recipe, and a label-free quality flag from the agreement between the two heads.
-
End-to-end timing on a T4 GPU at batch size one: 13.8 to 28.6 ms per frame, three to six times faster than the camera.
-
An industrial-scale proof of concept on our own rig at Peninsula Downs, Western Australia’s largest dairy farm: few-label transfer to a second RGB-D camera and projection of the regions into radiometric thermal images.
Learned landmarks and scores. Duan et al. [2025] train a keypoint network on overhead RGB-D images and derive back-curvature features for lameness. Their output is a set of points, not regions, and timing is not reported. Ruchay et al. [2026a] train a two-stream ResNet-18 on colour and depth from a commercial rotary to regress body condition at 95 ms per frame; their output is one score per frame. Animal pose estimation more broadly follows the heatmap formulation [Xiao et al., 2018; Mathis et al., 2018], which we adopt for the landmarks.
Regions for thermography. Infrared studies of dairy cows read temperatures from regions that an operator places on each image: the rump, withers and tail-head warm by 0.30 to 1.20 °C in the 48 h before ovulation [Perez Marquez et al., 2019], and flank temperature tracks the temperature-humidity index [Salles et al., 2016]. Placing regions by hand limits such studies to small herds and short trials.
RGB-D fusion and multi-task learning. Fusing depth through a separate encoder improves semantic segmentation over stacking it as an extra input channel [Hazirbas et al., 2016], and jointly learning dense tasks can help each task [Kendall et al., 2018; Prasad and Arashpour, 2025]. We test both ideas on a small, domain-specific dataset where labels are expensive.
3 Data and Annotation
Dataset. We build an anatomical region dataset on the colour and depth images of a public rotary-parlour recording [Ruchay

Figure 1. Landmarks K1 to K10 and the four rule regions on a test frame: withers (blue), back (orange), rump (green) and tail-head (yellow). The target cow is in the centre stall, between two neighbours.
et al., 2026b] (CC BY 4.0). In that recording, a Kinect v2 about 3 m above a commercial rotary records each cow from behind at an oblique angle as the platform carries it through the field of view. It holds 1,285 passes of 20 frames at about 11 fps from 1,025 cows over four sessions (three afternoons and one morning). Colour frames are ; depth frames are in millimetres and are not registered to colour. The recording provides only body condition scores, which we do not use; every landmark, region, mask and calibration in our dataset is our own annotation, described below. We excluded one duplicated pass. Below, the dataset refers to this anatomical region dataset, and the farm rig to our own recordings.
Landmarks and visibility. One annotator labelled the middle frame of 538 passes with ten landmarks (Figure 1): the front and rear of the withers (K1, K2), the tops of the shoulder blades (K3, K4), the hooks (K5, K6), the sacrum (K7), the pins (K8, K9) and the tail-head (K10), each with a visibility flag, plus a box around the target cow. Left and right follow the image side. A second frame of 36 passes was labelled again to measure the annotator's repeatability.
Rule regions. The four regions are defined from the landmarks: the withers is the quadrilateral K1, K4, K2, K3; the back is bounded by K3, K2, K4, K6, K7, K5; the rump by the hooks and pins (K5, K6, K9, K8); and the tail-head runs from the pin line to just beyond K10. When K1 is outside the image (4% to 99% of frames, depending on the session), it is placed 0.38 hook widths ahead of K2 along the spine. The regions are bounded by bony landmarks rather than the silhouette, so they avoid the steep body edges where thermal readings are least reliable. To check that the rules match anatomy, the annotator drew the four regions freehand on 18 test frames before placing any landmarks on them.
Target-cow masks and calibration. Reference masks of the target cow were produced with SAM 2.1 [Ravi et al., 2025] prompted by the box and the visible landmarks, and reviewed by eye; none needed editing. Depth was registered to colour with a pose solved by PnP [Lepetit et al., 2009] from 96 clicked point pairs on 12 frames, which reduced the median reprojection error from 27 px with the nominal Kinect parameters to about 7 px at full resolution.
Splits. Cows are split 70/10/20 into training, validation and test sets, with no cow in two sets, stratified by session and body condition: 406, 58 and 74 frames. A second, session split trains on the afternoons and tests on the morning session (141 frames), whose body condition distribution also differs (31% of passes at 4.0 or above, against about 1% in the afternoons).
Label audit. The task defines the target as the cow in the stall nearest the image centre. In 19 of the 538 frames, the labelled cow stands more than 300 px (about half a stall) from the image centre, in an adjacent stall or level with a second cow, so its labels follow a different cow from the one the task defines. We found these frames from the labels alone and removed them from both test sets, leaving 69 cow-split test frames (661 labelled landmarks) and 138 session-split test frames. The 12 such training and 2 validation frames were left in place. Retraining the headline model (ConvNeXt-T, Section 6.6) without them changes test PCK@10 from to over three seeds and every region IoU by less than 0.01, so the results reported below are, if anything, slightly conservative.
4 Method
Input. The network receives the whole colour frame, scaled by to and padded to , together with depth reprojected into it. The frame is never cropped around the labelled cow: finding the right cow is part of the task.
Encoders and fusion. Colour and depth each pass through their own ImageNet-pretrained encoder [Wightman, 2019]; the depth encoder takes one input channel. Their feature maps are summed level by level at strides 4 to 32 (late fusion). The alternative, early fusion, stacks depth as a fourth input channel of one encoder. A feature pyramid decoder [Lin et al., 2017] with 128 channels merges the levels to stride 4 ( cells).
Heads. Three light convolutional heads read the shared features. The cow head segments the target cow only, so the network must learn to reject the neighbours. The landmark head outputs one heatmap per landmark, trained against a Gaussian of cells [Xiao et al., 2018], and a visibility logit per landmark from globally pooled features; landmarks are decoded by the arg-max with quarter-cell refinement. The region head outputs four masks, trained on the rule regions built from the labelled landmarks.
Losses. The total loss is
where is the mean squared heatmap error over labelled landmarks, the binary cross-entropy of visibility, and and the sum of binary cross-entropy and Dice losses for the region and cow masks. The consistency term is the Dice loss between the region head and the regions rasterised from the predicted landmarks, applied from epoch 10. The weights were fixed before the experiments and are the same for every run; they were not tuned. Their purpose is to keep the terms on a comparable scale. A heatmap is almost entirely zero, so its mean squared error per cell settles at about , more than two orders of magnitude below the mask losses; the factor of 100 brings it to the same order as the cow and region terms (about 0.03 against 0.04 and 0.11 at the end of training for the late-fusion model). Visibility and consistency are auxiliary terms and are halved so that they do not compete with the three main tasks.
Label-free quality flag. At inference, the same comparison gives an agreement score per frame: the mean IoU between the region head's masks and the regions built by rule from the network's own landmarks. The two heads fail in different ways: a landmark error is usually a discrete jump of one heatmap peak (to a rail, the neighbouring cow or the opposite hook), which displaces a whole rule-built region, whereas the region head pools evidence over many pixels and degrades gradually at region boundaries. Because the heads share one encoder, failures with a common cause can still affect both, so low agreement marks a frame whose output should not be trusted, without any label, but high agreement does not guarantee a correct one.
Output and projection. Per frame, the network returns the cow mask, ten landmarks with visibility and four region masks. Because depth is registered to colour, every region pixel has a 3D position in the camera frame. A second camera with known pose and intrinsics receives the regions by projecting those points into its image. We use this in Section 6.7 to read region temperatures from a thermal camera.
Training. All models are trained for 60 epochs with AdamW [Loshchilov and Hutter, 2019] (learning rate , weight decay , batch 16), two warm-up epochs then cosine decay, and mixed precision. Augmentation applies horizontal flips with a left-right swap of paired landmarks, scaling by 0.9 to 1.1, rotation by up to , shifts of up to 30 px and brightness changes. The checkpoint is chosen on validation PCK@10 plus mean region IoU, evaluated every five epochs. ConvNeXt-T [Liu et al., 2022] was unstable under this shared recipe (three of six runs failed over two learning rates), so it uses its own recipe: encoder learning rate with per-stage decay 0.75, heads at , gradient clipping at a norm of 1.0, bf16 precision and ten warm-up epochs.

Figure 2. The proposed framework. A whole RGB-D frame from the parlour camera passes once through two encoders whose feature pyramids are summed (late fusion) and decoded to stride 4. Three heads give the target-cow mask, ten landmarks with visibility and four named region masks. The agreement between the region head and the regions built from the predicted landmarks serves as a label-free quality flag. The regions are lifted to 3D with the depth behind each pixel and projected into any co-calibrated sensor, here a radiometric thermal camera. (a) to (c) show a test frame from the dataset; (d) shows the temperatures inside each projected region on one farm-rig frame, coloured on the thermal scale, with the 95th percentile that serves as the region's temperature (pixels below 25 °C, rails and floor at the region edges, are not drawn).
5 Experimental Set-up
Metrics. Landmark accuracy is the percentage of correct keypoints within 5% and 10% of the labelled hook width (PCK@5, PCK@10; 10% is about 37 px at full resolution), and the median error in full-resolution pixels. Regions are scored by IoU against the rule regions built from the labels, and by the share of each predicted region that falls inside the hand-drawn outline. The cow mask is scored by IoU against the reviewed reference mask.
Protocol. Every learned result is the mean and standard deviation over three training seeds, selected on validation and reported on the 69 cow-disjoint test frames (661 labelled landmarks) unless stated. Input, fusion and head ablations use a ResNet-18 backbone [He et al., 2016]; the backbone study compares MobileNetV3-L [Howard et al., 2019], ResNet-18, PVTv2-b1 [Wang et al., 2022] and ConvNeXt-T under the same heads. Within-pass stability is measured without labels on all 20 frames of every pass.
Statistics. Correlations use Spearman’s , paired comparisons between regions of one cow use the Wilcoxon signed-rank test, and farm results use 4-fold cross-validation by pass.
Hardware and timing. Training uses an NVIDIA A100. Timing uses an NVIDIA T4 at batch size one in FP16, from a frame in host memory to decoded landmarks and masks: upload, GPU pre-processing (depth registration, resizing and normalisation), the network and decoding. Each configuration is warmed up and then timed over at least 500 frames with CUDA synchronisation; we report the median of three fresh sessions.
6 Results
6.1 Accuracy against the human
The full ResNet-18 model localises the landmarks at PCK@10 (median error 21.4 px at ), and the best backbone (Section 6.6) raises this to 0.905. Back and rump regions agree with the rule regions at IoU 0.87 to 0.91 for every RGB-D model, tail-head at 0.73 to 0.77 and withers at 0.67 to 0.70 (Tables 1 and 2).
The rule regions themselves match human anatomy: on the 17 outline frames that passed the label audit, a median of 93% (back) to 99% (rump and withers) of each rule region lies inside the annotator's freehand outline, and a median of 88% to 97% of each region predicted by the ResNet-18 network. They are narrower than the outlines by design, which suits sampling a temperature away from the body edge. Within a pass, the annotator's own repeat labels differ by 2.2% of hook width for the hook width itself, 4% to 5% for the shoulder width and hook-to-pin distance, and 12% for the distance from the rear of the withers (K2) to the sacrum. K2 and K10 are the landmarks that both the human and the network find hardest.
Figure 3 shows that the regions follow each cow’s own anatomy across coat colours, body sizes and body condition scores. Errors concentrate at the front of the cow and on cows standing at an angle in the stall (Figure 3d); the target cow itself is found in every cleaned test frame.
6.2 Inputs and fusion
Depth alone localises the landmarks better than colour alone (PCK@10 0.701 against 0.669): hooks, pins and the spine are shape, not colour. Feeding both into one encoder gains nothing
Table 1. Inputs, fusion and heads (ResNet-18 backbone; mean SD over three seeds; 69 cow-disjoint test frames unless stated). Region IoU is against the rule regions built from the labels; for the landmarks-only model, regions are built by rule from its predicted landmarks.
| Model | PCK@5 | PCK@10 | Median error (px) | IoU | ||||
|---|---|---|---|---|---|---|---|---|
| Withers | Back | Rump | Tail-head | Cow | ||||
| RGB only | 0.341 ± 0.012 | 0.669 ± 0.013 | 25.7 | 0.65 | 0.85 | 0.87 | 0.72 | 0.94 |
| Depth only | 0.362 ± 0.003 | 0.701 ± 0.018 | 24.4 | 0.65 | 0.88 | 0.89 | 0.73 | 0.95 |
| RGB-D, early fusion | 0.338 ± 0.022 | 0.687 ± 0.021 | 25.6 | 0.67 | 0.87 | 0.88 | 0.73 | 0.96 |
| RGB-D, late fusion (full model) | 0.421 ± 0.014 | 0.753 ± 0.007 | 21.4 | 0.68 | 0.88 | 0.90 | 0.75 | 0.96 |
| without consistency loss | 0.415 ± 0.015 | 0.745 ± 0.007 | 21.9 | 0.68 | 0.88 | 0.90 | 0.75 | 0.96 |
| without region head | 0.338 ± 0.036 | 0.600 ± 0.026 | 28.3 | 0.41 | 0.72 | 0.76 | 0.55 | 0.96 |
| without landmark head | - | - | - | 0.69 | 0.89 | 0.90 | 0.75 | 0.97 |
| session split (138 frames) | 0.425 ± 0.017 | 0.752 ± 0.014 | 22.7 | 0.63 | 0.88 | 0.90 | 0.75 | 0.97 |

Figure 3. Four test cows from the dataset, of different coat colour, size and body condition score (BCS 3 to 4.75), from three sessions (ConvNeXt-T). Top: input colour frames with each cow's BCS. Bottom: predicted regions and landmarks with the frame's median landmark error. (d) is a cow standing at an angle in the stall.
(0.687), because the colour-pretrained first layer has to absorb a modality it was not trained on. Separate encoders with late fusion gain 0.05 to 0.08 PCK@10 over every single-encoder variant and reduce the seed-to-seed spread (Table 1). Region IoU is nearly the same for all RGB-D variants, so the gain from late fusion lies in the landmarks.
6.3 Multi-task design and quality flag
Removing the region head lowers landmark PCK@10 from 0.753 to 0.600 and increases the median error from 21.4 to 28.3 px. With only 406 training frames, the dense region targets give every pixel of the dorsal surface a training signal that the sparse landmark heatmaps lack. The reverse does not hold: a regions-only model segments the regions as well as the full model, so the landmark head is not needed for the regions. Removing the consistency loss changes PCK@10 by about one standard deviation (0.745 against 0.753); the shared multi-task design, not the explicit consistency term, is what helps.
The agreement between the two heads is nevertheless useful at inference (Figure 4). Over the 69 test frames, it corre- lates with the median landmark error of the ResNet-18 model (Spearman , ). The 20% of frames with the lowest agreement have a mean PCK@10 of 0.55 and a median error of 30.0 px, against 0.80 and 20.8 px for the rest. Before the label audit, the flag also picked out three of the five frames whose labels followed a neighbouring cow.
6.4 The right cow
Against the reviewed reference masks, a depth-only cut of the stall cow reaches a mean IoU of 0.74, and SAM 2 prompted from depth 0.77: both merge touching neighbours. The network's cow head reaches 0.96 with ResNet-18 and 0.98 with ConvNeXt-T. Trained on whole frames, it learns which cow is the target from the stall layout rather than from a crop.
6.5 Sessions and stability
Trained on the three afternoon sessions and tested on the morning session, the full model reaches PCK@10 , the same as on the cow split, despite the different body condition mix (Table 1). Without labels, we compare the ResNet-18 model's shape descriptors (hook width, and ratios to it) from
Table 2. Backbones (RGB-D late fusion, all heads; three seeds; 69 test frames). Times are per frame on a T4 GPU at batch size 1 in FP16, median of three sessions; end to end includes upload, GPU pre-processing and decoding. The camera delivers a frame every 90 ms.
| Backbone | Params (M) | PCK@5 | PCK@10 | Median error (px) | IoU back / rump | IoU cow | Network (ms) | End to end (ms, fps) |
|---|---|---|---|---|---|---|---|---|
| MobileNetV3-L | 6.7 | 0.427 ± 0.002 | 0.750 ± 0.007 | 21.5 | 0.89 / 0.90 | 0.97 | 17.9 | 22.4 (45) |
| ResNet-18 | 23.1 | 0.421 ± 0.014 | 0.753 ± 0.007 | 21.4 | 0.88 / 0.90 | 0.96 | 10.7 | 13.8 (73) |
| PVTv2-b1 | 27.7 | 0.518 ± 0.004 | 0.843 ± 0.003 | 17.4 | 0.90 / 0.91 | 0.97 | 25.7 | 28.6 (35) |
| ConvNeXt-T, shared recipe | 56.4 | 0.458 ± 0.262 | 0.700 ± 0.330 | 33.1 | 0.88 / 0.90 | 0.97 | 23.5 | 26.4 (38) |
| ConvNeXt-T, own recipe | 56.4 | 0.645 ± 0.012 | 0.905 ± 0.008 | 13.3 | 0.91 / 0.91 | 0.98 | 23.5 | 26.4 (38) |

Figure 4. Label-free quality flag (ResNet-18, 69 test frames). Frames whose two heads disagree are the frames with large landmark errors; the shaded band is the lowest of agreement.
two frames about one second apart in 199 passes. They change by a median of (hook width) to (pin width). For four of the six descriptors the annotator also measured, the model is steadier than the annotator's repeat labels (for example, withers to sacrum against ); shoulder and pin widths are less stable than the human. Absolute widths converted to millimetres through the Kinect depth do not repeat for the same cow across dates (ICC 0.02 to 0.12 over 215 to 218 cows), so we use relative shape only.
6.6 Backbones and speed
Table 2 compares four backbones. With its own recipe, ConvNeXt-T is the most accurate (PCK@10 0.905 ± 0.008, median error 13.3 px) and converges on all three seeds; under the shared recipe it failed in three of six runs over two learning rates, collapsing or never converging. The gain therefore depends on optimisation as much as on capacity: on 406 training frames, a large pretrained encoder needs a lower, layer-wise learning rate and gradient clipping. PVTv2-b1 is the most accurate backbone under the shared recipe (0.843). MobileNetV3-L matches ResNet-18 (0.750 against 0.753) with 3.5 times fewer parameters but is not faster on a T4, whose throughput favours the dense convolutions of ResNet-18.
Moving depth registration from the CPU (62 ms per frame) to the GPU (2.5 to 2.9 ms) makes the network the main cost.

Figure 5. Per-landmark PCK@10 (test set: mean of three seeds; farm rig: 4-fold cross-validation). On the test set the rear of the withers (K2) is the hardest landmark for both backbones; on the farm rig's steeper view the same ConvNeXt-T backbone finds both withers landmarks more reliably.
End to end, a frame takes 13.8 ms with ResNet-18 (73 fps) and 26.4 ms with ConvNeXt-T (38 fps; 95th percentile 28.1 ms), against a camera frame interval of about 90 ms. GPU and CPU pre-processing give the same landmarks (median difference 0 px on ten test frames). Every backbone thus processes every frame with a margin of three to six times, which leaves room for tracking, a second camera or a smaller embedded GPU.
Figure 5 breaks accuracy down by landmark. Hooks and sacrum are the easiest. The front of the cow is the hardest on this dataset: the rear of the withers (K2) reaches PCK@10 0.66 even with ConvNeXt-T, and the withers region has the lowest IoU. We return to this in Section 6.7.
6.7 Farm proof of concept at Peninsula Downs
Rig and data. We recorded a 9-minute milking session on the commercial rotary parlour at Peninsula Downs, Western Australia's largest dairy farm, with a Basler Stereo mini RGB-D camera (colour and pixel-aligned depth, ) and a FLIR A70 radiometric thermal camera (, emissivity 0.95), both mounted above and behind the stalls in a view that is steeper and wider than the Kinect's. There was no calibration target and no shared clock: the clocks were aligned on a bracket knock seen by both cameras, and the thermal pose
(a) Before fine-tuning

(b) Fine-tuned on farm frames
(c) Regions in the thermal frame
(d) Temperatures in each region
Tail-head
outside the thermal view
Tail-head
outside the thermal view
Figure 6. Two farm passes held out from the model shown (ConvNeXt-T). (a) The model trained on the dataset, unchanged. (b) After fine-tuning on 39 farm frames; red crosses are the labels. (c) The fine-tuned regions lifted to 3D with the RGB-D depth and projected into the thermal frame of the same moment. (d) Temperatures inside each projected region, coloured on the thermal scale, with the 95th percentile marked. In these passes the tail-head lies outside the thermal camera's narrower field of view; a strictly overhead mount with matched fields of view will close this gap.
Table 3. Transfer to the farm rig (ConvNeXt-T; 52 labelled frames, 4-fold cross-validation by pass; errors in farm pixels). Every row except the last starts from the model trained on the dataset.
| Setting | Median | IoU | ||
|---|---|---|---|---|
| PCK@10 | error (px) | Back | Rump | |
| Zero-shot (no farm labels) | 0.545 | 16.7 | 0.55 | 0.41 |
| Fine-tuned, 10 frames | 0.839 | 9.1 | 0.86 | 0.86 |
| Fine-tuned, 20 frames | 0.905 | 8.0 | 0.87 | 0.88 |
| Fine-tuned, 39 frames | 0.913 | 7.6 | 0.88 | 0.89 |
| ImageNet start, 39 frames | 0.545 | 16.9 | 0.76 | 0.82 |
was solved from 101 clicked correspondences on ten frame pairs by PnP with a one-dimensional search over the focal length. The solution (focal length 681 px, a horizontal field of view against the lens's nominal ) reprojects with a median error of 3.5 px when each frame pair is held out, under 1 cm at the cow. We extracted 52 passes of 20 frames and labelled the frame with the rump centred in each pass. Farm frames are scaled using depth only, so that a cow's back appears the same size as in training (scale 0.637).
Transfer. Unchanged, the model trained on the dataset finds the stall cow on the new rig and places its landmarks at PCK@10 0.545, but its rump and tail-head regions are incomplete (Table 3, Figure 6). Fine-tuning on ten labelled farm frames raises PCK@10 to 0.839 and the back and rump IoU to 0.86; with 39 frames it reaches 0.913 (median error 7.6 px). Trained from ImageNet on the same 39 frames, the network reaches only 0.545, the level that the dataset-trained model achieves with no farm labels at all: training on the dataset is worth about 40 labelled farm frames here. On this steeper view the withers is no longer the weak point: the front and rear of the withers reach PCK@10 1.00 and 0.83 (Figure 5), which supports mounting the camera more directly overhead.
(a) One value per cow

(b) Through one pass
Figure 7. Region temperatures on the farm rig. (a) One 95th-percentile value per cow and region (box: quartiles; line: median). (b) The same value frame by frame through one pass; shaded frames are used.
One temperature per region and cow. For each frame we take the 95th percentile of the thermal pixels inside each projected region, using the fold model that did not see that pass, and then the median over frames 6 to 16 of the pass, keeping regions with at least 50 thermal pixels. Over 50 passes, this value changes by only 0.11 to 0.29 °C (SD) while the cow crosses the field of view, against 1.85 to 2.16 °C between cows (Figure 7). The regions differ systematically within the same cow: the rump is 1.9 °C warmer than the withers and 1.1 °C warmer than the back (Wilcoxon ), consistent with the regional differences that hand-placed studies report [Perez Marquez et al., 2019].
7 Discussion and Limitations
Fusion and multi-task design matter more than modality. Depth alone already beats colour, but the decisive choices are architectural: separate encoders, and a dense region task trained alongside the landmarks. Both are cheap at inference, since the region head adds one convolutional head to a shared decoder.
Real-time margin. The full pipeline runs at 35 to 73 fps on a 70 W inference GPU. The margin over an 11 fps camera matters on a rotary, where every cow passes once per milking and a missed frame cannot be recovered; it also leaves room for an embedded GPU in the parlour, which we have not yet measured.
Limitation: camera placement. The main limitation is the viewing geometry, not the network. On the dataset's oblique Kinect view, the withers is the weak point: K2 is the least repeatable human landmark, K1 is often outside the frame, and the low angle foreshortens the front of the cow; on our steeper farm view, the same landmarks are among the easiest. On the farm rig, the thermal camera is narrower than the colour camera, so only about 60% of rump pixels and 27% of tail-head pixels fall inside the thermal frame, and the tail-head is often missing (Figure 6). A strictly overhead mount with matched colour, depth and thermal fields of view removes both problems: it views the whole back without foreshortening and keeps every region inside every camera.
8 Conclusion
A single RGB-D network can find the target cow in a rotary parlour, localise ten dorsal landmarks and segment four named regions from the whole frame, faster than the camera delivers frames. Late fusion and a dense region head are the decisive design choices, and agreement between the heads flags unreliable frames without labels. Because each region carries its depth, a second sensor can receive it: on our own rig at a commercial dairy, ten labelled frames adapt the model, and the regions yield one repeatable temperature per region and cow. The next step is a strictly overhead rig with matched colour, depth and thermal fields of view, followed by multi-session farm recordings to test whether region temperatures carry physiological signal.
Acknowledgments
We thank Peninsula Downs and its staff for access to the parlour. This work was supported by the Australian Government’s Australia’s Economic Accelerator (AEA) Ignite Program under Grant No. IG250201257.
References
[Duan et al., 2025] Weijie Duan, Fei Wang, Honghui Li, Na Liu, and Xueliang Fu. Lameness detection in dairy cows from overhead view: high-precision keypoint localization and multi-feature fusion classification. Frontiers in Veterinary Science, 12:1675181, 2025.
[Halachmi et al., 2019] Ilan Halachmi, Marcella Guarino, Jeffrey Bewley, and Matti Pastell. Smart animal agriculture: Application of real-time sensors to improve animal well-being and production. Annual Review of Animal Biosciences, 7:403–425, 2019.
[Hazirbas et al., 2016] Caner Hazirbas, Lingni Ma, Csaba Domokos, and Daniel Cremers. FuseNet: Incorporating depth into semantic segmentation via fusion-based CNN architecture. In Proceedings of the Asian Conference on Computer Vision (ACCV), pages 213–228, 2016.
[He et al., 2016] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.
[Howard et al., 2019] Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, Quoc V. Le, and Hartwig Adam. Searching for MobileNetV3. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 1314–1324, 2019.
[Kendall et al., 2018] Alex Kendall, Yarin Gal, and Roberto Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 7482–7491, 2018.
[Lepetit et al., 2009] Vincent Lepetit, Francesc Moreno-Noguer, and Pascal Fua. EPnP: An accurate O(n) solution to the PnP problem. International Journal of Computer Vision, 81(2):155–166, 2009.
[Lin et al., 2017] Tsung-Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2117–2125, 2017.
[Liu et al., 2022] Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A ConvNet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 11976–11986, 2022.
[Loshchilov and Hutter, 2019] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In Proceedings of the International Conference on Learning Representations (ICLR), 2019.
[Mathis et al., 2018] Alexander Mathis, Pranav Mamidanna, Kevin M. Cury, Taiga Abe, Venkatesh N. Murthy, Mackenzie Weygandt Mathis, and Matthias Bethge. DeepLabCut: markerless pose estimation of user-defined body parts with deep learning. Nature Neuroscience, 21:1281–1289, 2018.
[Perez Marquez et al., 2019] H. J. Perez Marquez, D. J. Ambrose, A. L. Schaefer, N. J. Cook, and C. J. Bench. Infrared thermography and behavioral biometrics associated with estrus indicators and ovulation in estrus-synchronized dairy cows housed in tiestalls. Journal of Dairy Science, 102(5):4427–4440, 2019.
[Prasad and Arashpour, 2025] Vineet Prasad and Mehrdad Arashpour. Enhancing sorting efficiency in cluttered construction and demolition waste streams via boundary-guided grasp detection. Waste Management, 207:115123, 2025.
[Ravi et al., 2025] Nikhila Ravi, Valentin Gabeur, Yuan-Ting Hu, Ronghang Hu, Chaitanya Ryali, Tengyu Ma, Haitham Khedr, Roman Rädle, Chloe Rolland, Laura Gustafson, Eric Mintun, Junting Pan, Kalyan Vasudev Alwala, Nicolas Carion, Chao-Yuan Wu, Ross Girshick, Piotr Dollár, and Christoph Feichtenhofer. SAM 2: Segment anything in images and videos. In Proceedings of the International Conference on Learning Representations (ICLR), 2025.
[Ruchay et al., 2026a] Alexey Ruchay, Vladimir Kolpakov, Vitaly Ryazanov, Hao Guo, and Andrea Pezzuolo. Real-time automated body condition scoring of dairy cows in a commercial rotary milking parlor using RGB-D two-stream deep learning. Computers and Electronics in Agriculture, 254, 2026a.
[Ruchay et al., 2026b] Alexey Ruchay, Vladimir Kolpakov, and Alexandr Riazanov. RGB-D image dataset for automated body condition scoring of dairy cows in rotary milking parlors. Zenodo, doi:10.5281/zenodo.20290988, 2026b.
[Salles et al., 2016] Marcia Saladini Vieira Salles, Suelen Corrêa da Silva, Fernando André Salles, Luiz Carlos Roma, Lenira El Faro, Priscilla Ayleen Bustos Mac Lean, Celso Eduardo Lins de Oliveira, and Luciane Silva Martello. Mapping the body surface temperature of cattle by infrared thermography. Journal of Thermal Biology, 62:63–69, 2016.
[Song et al., 2018] X. Song, E. A. M. Bokkers, P. P. J. van der Tol, P. W. G. Groot Koerkamp, and S. van Mourik. Automated body weight prediction of dairy cows using 3-dimensional vision. Journal of Dairy Science, 101(5):4448–4459, 2018.
[Spoliansky et al., 2016] Roii Spoliansky, Yael Edan, Yisrael Parmet, and Ilan Halachmi. Development of automatic body condition scoring using a low-cost 3-dimensional Kinect camera. Journal of Dairy Science, 99(9):7714–7723, 2016.
[Tun et al., 2024] San Chain Tun, Tsubasa Onizuka, Pyke Tin, Masaru Aikawa, Ikuo Kobayashi, and Thi Thi Zin. Revolutionizing cow welfare monitoring: A novel top-view perspective with depth camera-based lameness classification. Journal of Imaging, 10(3):67, 2024.
[Van Hertem et al., 2014] Tom Van Hertem, Stefano Viazzi, Machteld Steensels, Ephraim Maltz, Aharon Antler, Victor Alchanatis, Andres A. Schlageter-Tello, Kees Lokhorst, Eduardo C. B. Romanini, Claudia Bahr, Daniel Berckmans, and Ilan Halachmi. Automatic lameness detection based on consecutive 3D-video recordings. Biosystems Engineering, 119:108–116, 2014.
[Viazzi et al., 2014] S. Viazzi, C. Bahr, T. Van Hertem, A. Schlageter-Tello, C. E. B. Romanini, I. Halachmi, C. Lokhorst, and D. Berckmans. Comparison of a three-dimensional and two-dimensional camera system for automated measurement of back posture in dairy cows. Computers and Electronics in Agriculture, 100:139–147, 2014.
[Wang et al., 2022] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. PVT v2: Improved baselines with Pyramid Vision Transformer. Computational Visual Media, 8(3):415–424, 2022.
[Wightman, 2019] Ross Wightman. PyTorch image models. GitHub repository, https://github.com/rwightman/pytorch-image-models, 2019.
[Xiao et al., 2018] Bin Xiao, Haiping Wu, and Yichen Wei. Simple baselines for human pose estimation and tracking. In Proceedings of the European Conference on Computer Vision (ECCV), pages 466–481, 2018.