Agricultural engineers and animal scientists have developed a non-contact weight-estimation network that determines piglet body mass from standard overhead video footage by pairing two-dimensional visual contours with explicit anatomical scale measurements. The automated vision system, designated GCAF-Net, addresses a fundamental operational bottleneck in precision swine husbandry: while continuous tracking of early growth trajectories provides critical warnings regarding neonatal health risks and feed efficiency, traditional monitoring has long relied on manual catching and physical crate weighing. Such physical handling repeatedly triggers severe vocalization, elevated heart rates, acute physiological stress responses, and potential limb trauma during vulnerable pre-weaning stages. While specialized three-dimensional sensing apparatuses, such as depth sensors and point-cloud scanners, have previously attempted to automate mass measurement in livestock enclosures, their practical commercial deployment in farrowing facilities remains severely constrained by high sensor acquisition costs, fragile mobile gantries, and frequent optical degradation caused by ubiquitous environmental dust, water vapor, and variable illumination.
To overcome these persistent hardware constraints without surrendering structural physical scale, the researchers designed an analytical pipeline that extracts interpretable geometric dimensions from standard two-dimensional surveillance cameras and integrates them directly into a neural regression architecture. Traditional two-dimensional visual weight models often falter because planar silhouettes cannot directly record third-dimensional volumetric depth, such as animal body height and torso thickness. Consequently, minor posture shifts, lateral resting, or torso curvature distort projected dorsal boundaries and introduce substantial regression bias. Rather than attempting to reconstruct full three-dimensional volumetric meshes or relying strictly on uncalibrated silhouette pixels, GCAF-Net extracts a compact set of four explicit image-plane geometric priors from segmented frames—specifically projected mask area, head-to-tail body length, transverse shoulder width, and transverse hip width—and processes them alongside deep convolutional feature maps through an asymmetric cross-attention mechanism.
The experimental dataset supporting the framework was established across ten months of continuous monitoring at a commercial facility affiliated with the Chongqing Academy of Animal Science under approved institutional animal ethics protocols. The research team mounted an industrial Hikvision network camera equipped with a fixed orthographic lens approximately 2.3 meters directly above each pen floor, providing an unobstructed perpendicular viewing angle covering the total floor space of single farrowing pens at a constant recording rate of twenty-five frames per second. Data collection monitored forty-two Rongchang piglets, a native Chinese breed, housed across seven separate farrowing pens during critical early development milestones at birth, day three, day seven, and day fourteen of life. To obtain reliable reference truth while minimizing experimental stress, professional animal caretakers weighed individual piglets during scheduled routine health inspections, allowing researchers to link video sequences recorded within one to two hours of weighing events with verifiable ground-truth scale readings.
From an initial candidate repository of 9,358 surveillance frames matched to ground-truth weights through ear-tag records and pen identifiers, the authors instituted a rigorous multi-stage automated filtering sequence to ensure that only quality-controlled frames entered the analytical stream. The front end deployed an instance segmentation model, YOLO11l-Seg, to isolate target piglets from challenging farrowing environments characterized by floor contamination, structural pen rails, and varying ambient lighting. Because standard tight bounding boxes frequently truncate peripheral anatomical boundaries, the pipeline implemented an expanded-cropping procedure that moderately enlarged candidate bounding boxes before final silhouette isolation, safeguarding the integrity of vulnerable peripheral features such as snouts, ear margins, and tails without fabricating occluded structures. Segmented individual piglets retained authentic surface RGB values while all exterior pen backgrounds were replaced with neutral gray fills, establishing standardized visual inputs across varying pen floor conditions.
To guarantee that extracted geometric indicators reflected true somatic proportions rather than transient physical bending, cropped single-piglet crops were evaluated by a secondary keypoint localization architecture, YOLO11m-Pose. This auxiliary network located six distinct anatomical landmarks: the rostral head tip, the base of the tail, the left and right shoulder margins, and the left and right hip boundaries. The inspection system enforced an exacting keypoint confidence threshold of ninety-five percent, instantly rejecting any frame where visual obscurity or occlusion degraded keypoint detection certainty. Surviving images then underwent formal body-axis straightness quantification, wherein an imaginary dorsal midline was established between the localized head and tail coordinates, and the two-dimensional perpendicular Euclidean offsets of the calculated shoulder and hip midpoint centers relative to this axis were computed and normalized against the total trunk length.
Systematic validation experiments demonstrated that tuning the permissible body-axis deviation threshold established a direct operational trade-off between retained sample volume and visual measurement noise. Extremely conservative deviation limits unnecessarily discarded straight, measurable piglets and diminished available training diversity, whereas excessively permissive thresholds allowed curved or laterally reclining individuals to contaminate downstream regressions with distorted planar proportions. Empirical threshold sweeps identified a normalized deviation boundary of 0.10 as optimal, yielding 5,362 validated frames across 125 independent weighing events for model construction. When applied across candidate inputs, this geometric constraint effectively pruned irregular poses, yielding a standardized sample distribution where training, validation, and testing partitions were stratified by pen weight groups in an approximate 8:1:1 ratio, strictly preventing frames from the same individual weighing event from crossing evaluation boundaries.
Following sample validation, the four-dimensional structural prior set, termed Geom-4, was assembled directly in pixel dimensions without relying on external camera calibration matrices. Longitudinal body length was calculated as the direct Euclidean distance between head and tail coordinates, while shoulder and hip widths captured transverse anterior and posterior proportions from their corresponding bilateral keypoints. Extensive probing experiments comparing twelve candidate geometric indicators—including convex hull boundaries, boundary perimeters, bounding-box aspect ratios, and shape solidity—revealed that while overall projected mask area shared significant redundant correlation with perimeter and convex hull area, local transverse widths and longitudinal length exhibited low linear recoverability from standard convolutional feature maps. Because these anatomical distances correlated strongly with real mass variations but could not be derived trivially by the visual backbone alone, they provided complementary structural scale intelligence.
The core GCAF-Net regression engine processes inputs through two distinct branches, leveraging a ResNet50 backbone to encode visual contour representations while transforming z-score standardized geometric measurements into linear token embeddings enriched with learnable identity vectors. Crucially, the system departs from conventional late-stage vector concatenation: inside an intermediate cross-attention fusion block inserted at the third convolutional stage of the ResNet50 backbone, self-attended geometry tokens act as query matrices that selectively attend to flattened spatial image tokens serving as key and value pairs. This structural query formulation permits the explicit scale measurements to extract contextual contour semantics and local edge features from mid-level convolutional maps, producing updated fusion tokens that are subsequently combined with global average-pooled image features and raw geometric descriptors before final evaluation within a multi-layer perceptron regression head.
When evaluated on the independent test split of 544 validated frames, the full GCAF-Net configuration delivered exceptional predictive accuracy, recording a mean absolute error of 0.243 kilograms, a root mean squared error of 0.358 kilograms, a mean squared error of 0.129 square kilograms, and a coefficient of determination of 0.933. Ablation comparisons against alternative paradigms confirmed the superiority of this cross-modal design: a baseline regressor using only the explicit Geom-4 parameters achieved a coefficient of determination of 0.883 and a mean absolute error of 0.311 kilograms, while an image-only ResNet50 achieved an almost identical coefficient of determination of 0.884 and a mean absolute error of 0.331 kilograms. Merging both representations through naive vector concatenation improved the coefficient of determination to 0.910 and lowered the mean absolute error to 0.282 kilograms, yet intermediate cross-attention yielded an additional 25.8 percent reduction in mean squared error over direct concatenation.
Comparative benchmarking against alternative spatial modulation and attention mechanisms further supported the design of the cross-attention block. When evaluated on identical ResNet50 features and geometric priors, self-attention, Squeeze-and-Excitation blocks, and Convolutional Block Attention Modules produced inferior test-set determination coefficients ranging between 0.908 and 0.919, as these internal mechanisms primarily rescale intra-channel or intra-spatial weights rather than mediating cross-modal dependencies. Feature-wise Linear Modulation achieved competitive performance with an R2 of 0.926 and an MAE of 0.255 kilograms, but cross-attention remained superior across all metrics while operating at a rapid regression throughput of 1,298 frames per second on an NVIDIA RTX 4090 GPU. Testing the entire cascaded surveillance framework from uncurated multi-piglet surveillance video demonstrated an end-to-end processing latency of 62.59 milliseconds per raw surveillance frame, translating to an operational throughput of approximately 16 frames per second.
Segmented performance evaluations across stratified body mass ranges revealed that predictive deviations were lowest among newborn animals weighing between zero and one kilogram, where mean absolute error was restricted to 0.058 kilograms, and between one and two kilograms, where mean absolute error reached 0.181 kilograms. Prediction scatter widened moderately across intermediate weights between two and five kilograms, peaking at an absolute error of 0.505 kilograms in the four to five kilogram bracket before contracting back to 0.230 kilograms among piglets weighing five to six kilograms. Analysis of model residuals confirmed that explicit geometric priors performed directional corrections on visual backbone errors, systematically elevating predictions when the image branch underestimated mass and reducing predictions when image features overestimated mass, demonstrating that numerical priors effectively compensated for spatial scale ambiguities inherent in planar masks.
To rigorously verify biological generalizability beyond the primary weight-group validation split, the authors executed a five-fold cross-validation protocol organized strictly by independent animal identity, ensuring that all video recordings of any given piglet across its entire growth trajectory were confined to a single fold. Under this strict individual-holdout partition, the image-only model exhibited substantial degradation, yielding an average mean absolute error of 0.437 kilograms and an R2 of 0.783 across folds. In sharp contrast, GCAF-Net maintained robust cross-individual stability, registering an average mean absolute error of 0.257 ± 0.053 kilograms, a root mean squared error of 0.401 ± 0.088 kilograms, and an R2 of 0.907 ± 0.040, demonstrating that explicit anatomical priors insulate the model against visual overfitting to specific animal markings.
Despite its proven efficacy, the authors explicitly outlined critical technical constraints governing the operational deployment of the current GCAF-Net framework. First, because the Geom-4 features represent uncalibrated pixel distances rather than metric dimensions, the learned regression mappings remain tied to the specific 2.3-meter camera mounting height and perpendicular viewing geometry used during training, meaning changes in lens focal length or installation altitude will necessitate camera recalibration or physical scale normalization. Furthermore, the reliance on high-confidence instance masks and straight posture alignment prunes curved or heavily occluded individuals, restricting reported precision metrics specifically to frames surviving quality control. To translate this static single-frame innovation into uninterrupted commercial farm automation, future research must incorporate temporal tracking algorithms that aggregate predictions across rolling video windows, develop posture-dewarping mechanisms, and expand validation across diverse pig breeds and varied commercial rearing environments.
Subject of Research: Non-contact piglet body weight estimation using overhead RGB imagery and explicit geometric feature fusion
Article Title: Non-contact weight estimation of piglets using RGB images and explicit geometric priors via cross-attention fusion
Article References: Zhong, X., Jiang, X., Liu, Q., Chen, H., Chai, J., Luo, Z., & Xu, S. (2026). Non-contact weight estimation of piglets using RGB images and explicit geometric priors via cross-attention fusion. Smart Agricultural Technology, 15, Article 102691. https://doi.org/10.1016/j.atech.2026.102691
Image Credits: AI Generated
DOI: 10.1016/j.atech.2026.102691
Keywords: GCAF-Net, piglet weight estimation, precision livestock farming, cross-attention fusion, YOLO11l-Seg, YOLO11m-Pose, ResNet50, Rongchang piglets, computer vision in agriculture, body-axis straightness, non-contact phenotyping, farrowing pen monitoring, instance segmentation, keypoint detection, explicit geometric priors, smart pig farming
News Source: Alan Morgan. (November 13, 2026). Top-View Camera Network Estimates Piglet Weight Using Cross-Attention and Geometric Priors. Scienmag.



