Traditional rectal temperature measurement in pigs induces stress in animals, imposes a heavy labor burden on staff, and increases the risk of cross-infection. This study proposes a non-invasive deep learning approach to predict porcine rectal temperature by combining infrared thermal images of thermal windows with environmental parameters. A multimodal dataset is constructed by synchronously collecting thermal images, environmental parameters, and actual rectal temperatures. Mask Region-based Convolutional Neural Network (Mask R-CNN), You Only Look Once version 8 small (YOLOv8s), and YOLOv11s are employed to automatically detect or segment thermal window regions, from which the maximum temperature of each region is extracted. To enhance model generalization under varying environmental conditions, a two-stage hybrid regression framework is established. In this framework, a Convolutional Neural Network (CNN) extracts spatial features from thermal images, a fully connected network (FCNN) encodes regional surface temperatures and environmental parameters, and a Transformer module captures cross-modal dependencies to generate a preliminary prediction. Subsequently, a Random Forest (RF) regressor is applied for residual correction and final output optimization. Comparative experiments on single-region, dual-region, and triple-region combinations demonstrate that the “eye + vulva” dual-region scheme yields the optimal performance, with a mean absolute error (MAE) of 0.1796 °C and a coefficient of determination (R2) of 0.8212. The prediction error of this scheme is reduced by 42.3% compared with the best-performing unimodal model. The proposed method provides a fast, accurate, and stress-free solution for porcine body temperature monitoring, thereby supporting the development of intelligent health management in livestock farming.
Xu et al. (Sun,) studied this question.