Industry-scale prediction of video-derived pig body weight using efficient convolutional neural networks and vision transformers
Ye Bi, Yuting Huang, Jianhua Xuan, Gota Morota
Abstract
Accurate pig body weight measurement is critical for pig growth, health, and marketing. Although there is a growing trend towards the use of computer vision approaches for pig body weight prediction, their validation with large-scale data collected in commercial environments is still limited. Therefore, the main objective of this study was to predict pig body weight collected at multiple timepoints from a commercial environment using efficient convolutional neural networks and efficient vision transformers. Top-view videos were collected from over 600 pigs at six time points over three months. Scale-based body weight records were simultaneously recorded by a digital weighing system. An automated video conversion pipeline and fine-tuned YOLOv8 were applied to preprocess the raw depth videos. Two families of lightweight deep neural networks, MobileNet and MobileViT, were initialised with the pre-trained weights from ImageNet and customised to predict pig body weight directly from depth images. Two cross-validation strategies were used: single time point random subsampling and time series forecasting with a sparse design considering limited budget scenarios. In single time point random subsampling, the best prediction mean absolute percentage error for each time point was 4.71%, 3.80%, 3.08%, 5.60%, 3.42%, and 3.77%, respectively. On average, the MobileViT-S model produced the best prediction mean absolute percentage error. In time series forecasting, although a sparse design resulted in some performance loss compared to the full design, the use of ViT models mitigated this degradation. These results suggest that efficient deep learning-based supervised learning models are a promising approach for predicting pig body weight from industry-scale depth video data. • We generated a pig body weight dataset for validation in commercial settings. • Lightweight CNN and ViT models successfully predicted pig body weight from videos. • Predictions remained accurate with sparse data showing promise for budget-friendly use.