Background: As farms move towards more and more automation, there is a need to obtain this more quickly, accurately and contactlessly. Infrared thermography (IRT) provides an option that calls for more exploration through surface temperature measurements. It is, however, complicated by environmental and physiological variability.

Methods: In this study, we tested whether multivariable models using IRT regions and environmental features could predict sheep rectal temperature in animals. Models were compared using grouped cross-validation, with independent animal hold-out evaluation and agreement analyses. We compared linear, ridge, random-forest and gradient-boosting models.

Result: The random forest model performed best among the regressors tested, with RMSE ~0.38°C. Bland-Altman, clinical agreement (±0.5±1.0°C) calibration and environmental analyses supported the reliability of this study. The results were also worse in sunlight than in the shade. Calibration analysis indicated mild regression toward the mean. We conclude that infrared thermography combined with environmental information can approximate rectal temperature under farm conditions. The performance depends on acquisition conditions and needs to be adequately calibrated with more data. This method works as extra support for monitoring and fever screening.

The temperature of an animal is very important for physiological and clinical studies. As farms move towards more and more automation, there is a need to obtain this more quickly, accurately and contactlessly. This is important in precision animal health monitoring. Infrared thermography (IRT) provides surface temperature measurements. This could potentially provide a clue about the core temperature of the animal.
       
Core body temperature is an important and quick gateway to understanding the physiological status and health. Rectal thermometry is the most accurate and main method. However, it is invasive, labour intensive and difficult to perform continuously and for many animals. These limitations create a need for rapid and contactless approaches that can support temperature monitoring in precision livestock systems.
       
Infrared thermography (IRT) measures the infrared radiation emitted from the animal’s surface. It provides the peripheral temperature and at vascularised and relatively exposed body regions, this may be useful. Because the temperatures here may be affected by blood flow and heat exchange and can therefore provide useful information. But this will be affected by ambient temperature, solar radiation, posture, coat characteristics, emissivity and the spec anatomical region. Therefore, the use of IRT requires validation and calibration of the environmental conditions. This could supplement the rectal temperature, which currently is the reference standard for assessing core temperature in sheep (Peng et al., 2019). IRT can only capture surface temperature patterns, but this may be useful for finding some correlation with the underlying physiological state (Lahiri et al., 2012). This is dependent on several factors like ambient conditions, sunlight exposure, animal posture, coat characteristics and image acquisition variability. In animals, the presence of thick skin and wool/ fur further complicates the readings. Due to all this, the accuracy of infrared thermography could be reduced.
       
Many field thermography studies use limited validation methods, such as random splitting. This sometimes causes data leakage because the same animal may be used for both the training and testing sets (Joeres et al., 2025). Such designs may overrepresent the performance (Stewart et al., 2005). Animal-level validation is therefore essential. In the real world, it is also important to pay attention to agreement, calibration and clinically meaningful error bounds (Bland and Altman, 1986)  And many studies are limited by this (Luzi et al., 2013; McManus et al., 2016; Weschenfelder et al., 2013). This is especially important for veterinary use, where the subjects cannot be asked to cooperate in measurement making or other procedures. Additionally, as artificial intelligence driven precision livestock farming becomes more common (Hamadani, 2024; Hamadani et al., 2022), there is a need for more non invasive procedures.
       
In animals, IRT has been explored in livestock for applications in disease detection, welfare monitoring and thermal physiology (McCafferty, 2007; Stewart et al., 2005; Tattersall, 2016). However, its reliability is limited. There is still a need for studies on variability, emissivity settings, camera calibration, imaging protocols and region-of-interest selection. This would be important for reproducibility (Luzi et al., 2013). Therefore, the objectives of this study were to evaluate the ability of infrared thermography-to predict rectal temperature in sheep under farm conditions and to compare regression approaches for the prediction. In addition, we assessed the prediction agreement, calibration and the influence of sunlight on model performance. We hypothesised that thermal features from multiple anatomical regions along with information about the ambient environmental would improve prediction of rectal temperature.
The study was conducted at the Mountain Research Centre for Sheep and Goat, SKUAST-Kashmir, Shuhama, during February 2026. The study included 175 unique Corriedale animals. There were 130 adult sheep with 155 records and 45 lambs with 46 records; 140 animals were included in the training pool and 35 independent animals for the hold-out set. The animals were maintained under semi-intensive housing conditions. A total of 201 observations were obtained, with repeated observations occurring for some animals.
       
The thermal imager had an infrared resolution of 256 x 192 pixels and a noise-equivalent temperature difference (NETD) of ≤50 mK (0.05°C) at 25°C. The temperature measurement resolution was 0.1°C. The emissivity was set to 0.98. Images were acquired from approximately frontal and lateral approx. 20 cm, Limbs approx. 30 cm and muzzle at approx 10 cm, with the camera positioned at approximately 90° relative to the animal. The camera was allowed to equilibrate to the environmental conditions before image acquisition. Rectal temperature measurement and thermal imaging were performed simultaneously using standard procedure. The rectal temperature was originally recorded in °F and subsequently converted to °C for analysis.    
       
Environmental information available for analysis included ambient temperature, time of day and illumination condition (sunlight/shade). The data was preprocessed appropriately and missing data were handled using median imputation to avoid bias. The temperature was obtained in Fahrenheit and was converted to Celsius from the thermal camera. The Region of Interest included frontal face, lateral face, muzzle, limb (°C); ambient (°C); sun = 1 / shade = 0.  We also used derived features to build models. Biological and environmental interaction terms were also assessed. Original features comprised raw ROI temperatures (frontal face, lateral face, muzzle, limb), ambient temperature, lighting condition, animal identifier and rectal temperature recorded in Fahrenheit, with optional cohort labels when datasets were merged.
       
Engineered features included region-ambient temperature differences, head temperature summaries (mean and maximum), frontal-lateral facial temperature difference, hour of day, a binary sunlight indicator and interaction terms between sunlight and selected thermal gradients. All analyses were performed in Python 3 using pandas, numpy, scikit-learn, statsmodels, scipy, matplotlib and seaborn (Python Software Foundation, 2023).
 
Model development
 
Four regression models were evaluated. In addition, an extended Ridge model included sex (where available), cohort (sheep vs lamb) and two interaction terms: sunlight x (muzzle “ ambient) and sunlight x (limb “ ambient), in addition to the baseline engineered predictors. For linear models, the relationship between predictors and rectal temperature was specified as: 
 
 
Where,
Ti = Temperature for observation i.
Xij = j-th predictor, β0 is the intercept, βj are regression coefficients
εi = Error term.
       
Linear mixed-effects models were fitted using the MixedLM implementation in statsmodels to understand repeated measurements within animals. A random intercept for each animal was included to model within-subject correlation. The following were evaluated:
• Model A included muzzle temperature and ambient temperature as fixed effects, with animal ID as a random intercept.
• Model B included head mean temperature and ambient temperature as fixed effects, also with animal ID as a random intercept.
       
Models were estimated using restricted maximum likelihood (REML) or ML with multiple optimizer initializations.
 
 
 
Where,
b_i ~ N(0, σ_b2) = Animal-level random intercept.
εij ~ N(0, σ2) = Residual error.

Ridge regression
 
Ridge regression estimates coefficients by minimizing the penalized least squares objective:
 
 
 
Where,
α = 12 controls the strength of L2 regularization.
       
All predictors were median-imputed and standardized prior to model fitting.
       
To account for within-animal dependence, uncertainty in coefficients was quantified using cluster bootstrap resampling at the animal level, yielding empirical 95% confidence intervals.
 
Tree-based models
 
Nonlinear relationships were modelled using ensemble tree-based methods:
 
 
Where,
f(·) = Either a random forest or a gradient boosting regressor.
       
The random forest consisted of 400 trees with a maximum depth of 5, while the gradient boosting model used 180 estimators with a learning rate of 0.06. Feature importance for the random forest was computed using mean decrease in impurity (MDI), interpreted as a descriptive measure of variable contribution rather than causality.
 
Validation strategy
 
Approximately 20% of animals were reserved as a hold-out set. Grouped 5-fold cross-validation for training. Out-of-fold (OOF) predictions were generated for unbiased performance estimation. The final model was refitted on the full training data and evaluated on the hold-out set.
The merged adult sheep-lamb cohort comprised 163 observations from 140 animals in the training pool and 38 observations from 35 independent hold-out animals (Table 1). Rectal temperature ranged from 37.67 to 40.61°C. There was a small subset of febrile observations above 39.5°C. Across candidate models, the random forest achieved the lowest mean cross-validated error (Table 2). The performance gap between random forest and Ridge showed that while nonlinear effects contribute to prediction, some signal can be captured by linear combinations of thermal and environmental features.

Table 1: Study design and cohort characteristics.



Table 2: Grouped cross-validated performance of regression models (training pool).


       
On the independent hold-out set, bias remained small, the details of which are given in Table 3. Clinical agreement between predicted and rectal temperature is given in Table 4. Calibration analysis showed slopes of 0.899 in the training pool and 0.914 in the hold-out set, indicating mild regression toward the mean (Table 5). These results indicate that the model provides unbiased estimates on average; however, the spread of differences suggests that individual-level substitution for rectal thermometry remains limited. 

Table 3: Bland-Altman agreement between predicted and rectal temperature.



Table 4: Clinical agreement between predicted and rectal temperature.



Table 5: Calibration of model predictions (actual vs predicted rectal temperature).


       
Slightly greater variability of surface temperature was noted at higher temperatures (Fig 1). There was a mild regression toward the mean. Specifically, higher temperatures tended to be slightly underestimated, while lower temperatures were slightly overestimated. Our findings are endorsed by other scientific reports (Liu et al., 2023). Calibration analysis confirmed deviance from the ideal identity relationship. So, although the predictions are reasonably accurate overall, calibration adjustment would be required before clinical deployment or substitution for rectal measurements.

Fig 1: Bland-altman plot for agreement between predicted and rectal temperature (Hold-out Set).


       
Environmental conditions had a clear impact on performance. Models showed lower error in shade (RMSE ≈ 0.36°C) compared to sunlight (RMSE ≈ 0.45°C) (Table 6). These findings emphasize the importance of accounting for environmental conditions in both model design and practical deployment and suggest that shaded measurements may be more reliable. The influence of environmental on peripheral measurements is consistent with infrared thermography-derived temperatures studied in Murrah bulls (Ahirwar et al., 2019). Changes in barn microclimate and airflow also change the rectal and peripheral surface temperatures in heifers as per one study (Rajawat et al., 2026).
       
This is also consistent with the findings of other scientists. Solar radiation and environmental heat load disrupt the relationship between surface and core temperature (McManus et al., 2016; Weschenfelder et al., 2013). Simplified deployment-oriented models demonstrated a trade-off between practicality and accuracy. A sparse Ridge model using only muzzle and ambient temperature resulted in higher error (RMSE ≈ 0.41°C) compared to the full engineered feature set (≈ 0.38°C). Although performance decreased, the gap was modest, indicating that reduced-sensor configurations may still be viable for field deployment where simplicity and cost are important considerations.
 
Mixed-effects models
 
In the mixed-effects model incorporating head mean temperature and ambient temperature (Model B), ambient temperature showed a statistically significant positive association with rectal temperature (p = 0.021).
       
In the other model, including muzzle temperature and ambient temperature (Model A), neither predictor demonstrated a statistically significant association with rectal temperature. Taken together, these findings support the use of IRT as a supplementary approach for temperature monitoring rather than as a replacement for rectal thermometry (Hashimoto, 2026). The models achieved moderate predictive accuracy with minimal bias and reasonable clinical agreement. Similar reported ranges for infrared thermography-based were reported by multiple authors (McCafferty, 2007; Tattersall, 2016). The feature importance from random regression is given in Table 7. Limb temperature was the most important predictor, followed by face-derived thermal contrasts. This indicates that peripheral and facial heat signatures carry the strongest association with rectal temperature. The prominence of limb temperature may reflect the peripheral tissues are sensitive to changes in blood flow and environmental heat exchange (Bakony et al., 2023). The value of peripheral temperature appears to be due to the thermal relationship with rectal temperature and the surrounding environment.

Improving robustness under sunlight and enhancing calibration remain a challenge. Solar radiation directly increases the temperature of exposed body surfaces and changes the thermal gradient between the animal and its surroundings. Consequently, surface temperatures measured under direct sunlight may have more environmental influence. The higher error observed under sunlight suggests that the image acquisition conditions must be taken into consideration before interpretation (Cross et al., 2024). Larger datasets will be important for refining model stability and extending applicability across diverse farm conditions (Hussein et al., 2025). Additionally, the dataset needs to be diversified to improve the predictions by the inclusion of more febrile cases.
       
Overall, the findings indicate that infrared thermography combined with environmental information can provide useful inferences regarding temperature in sheep. However, the method can be a supplementary tool rather than a replacement for rectal thermometry. Further validation will be necessary to establish the robustness and practical applicability of the approach. This should include more of diverse dataset, febrile animals, seasons, environments and environmental measurements.
It is concluded that infrared thermography combined with environmental information can approximate rectal temperature under farm conditions. The acquisition conditions as well as the environmental effects of the measurements and needs to be adequately calibrated with more data. It could potentially supplement animal screening in precision livestock farming, but more research, data and calibration are needed. 
The present study was supported by Anusandhan National Research Foundation (ANRF) GoI’s Prime Ministers Early Career Research Grant.
 
Disclaimers
 
The views and conclusions expressed in this article are solely those of the authors and do not necessarily represent the views of their affiliated institutions or the funding agency. The authors are responsible for the accuracy and completeness of the information provided and accept responsibility for the content of this manuscript.
 
Ethical approval
 
Not applicable.
 
Informed consent
 
Not applicable.
 
Consent to participate and publish
 
Not applicable.
The authors declare that there are no conflicts of interest regarding the publication of this article. No funding or sponsorship influenced the design of the study, data collection, analysis and decision to publish, or preparation of the manuscript.

  1. Ahirwar, M.K., Kataktalware, M.A., Prasad, K., Reen, J.K., Barman, D., Pal, R.P., Deginal, R.S., Kumar, N.A. and Gupta, D. (2019). Digital infrared thermography as a tool to assess the effect of season, age and housing on seminal traits in Murrah bulls. Indian Journal of Animal Research. 53(10): 1389-1396. doi: 10.18805/ijar.B-3669.

  2. Bakony, M., Kovács, L., Kézér, L. F. and Jurkovich, V. (2023). The use of body surface temperatures in assessing thermal status of hutch-reared dairy calves in shaded and unshaded conditions. Frontiers in Veterinary Science. 10. https:// doi.org/10.3389/fvets.2023.1162708.

  3. Bland, J.M. and Altman, D.G. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. The Lancet. 327(8476): 307-310. https://doi.org/10.1016/ S0140-6736(86)90837-8.

  4. Cross, J.L., Choma, M.A. and Onofrey, J.A. (2024). Bias in medical AI: Implications for clinical decision-making. PLOS Digital Health. 3(11): e0000651. https://doi.org/10.1371/journal. pdig.0000651.

  5. Hamadani, A. (2024). Artificial intelligence on farms: Sheep breed classification using computer vision. Indian Journal of Animal Production and Management. 40(4): 260-268. https://doi.org/10.48165/ijapm.2024.40.4.8.

  6. Hamadani, A., Ganai, N.A., Alam, S., Mudasir, S., Raja, T.A., Hussain, I. and Ahmad, H.A. (2022). Artificial intelligence techniques for the prediction of body weights in sheep. Indian Journal of Animal Research. 58(5): 884-889. doi: 10.18805/IJAR.B-4831.

  7. Hashimoto, Y. (2026). A comprehensive review of non-invasive core body temperature measurement techniques. Sensors. 26(3): 972. https://doi.org/10.3390/s26030972.

  8. Hussein, J.B., Workneh, T.S., Kassim, A., Ntsowe, K., Melesse, S.F. and El-Mesery, H.S. (2025). A review on the impact of big data analytics in transforming agricultural practices, food processing and preservation strategies. Applied Food Research. 5(2): 101234. https://doi.org/10.1016/ j.afres.2025.101234.

  9. Joeres, R., Blumenthal, D.B. and Kalinina, O.V. (2025). Data splitting to avoid information leakage with DataSAIL. Nature Communications. 16: 3337. https://doi.org/10.1038/s41 467-025-58606-8.

  10. Lahiri, B.B., Bagavathiappan, S., Jayakumar, T. and Philip, J. (2012). Medical applications of infrared thermography: A review. Infrared Physics and Technology. 55(4): 221-235. https:// doi.org/10.1016/j.infrared.2012.03.007.

  11. Liu, C., Zhao, C., Wang, Y. and Wang, H. (2023). Machine-learning- based calibration of temperature sensors. Sensors. 23(17): 7347. https://doi.org/10.3390/s23177347.

  12. Luzi, F., Mitchell, M., Nanni Costa, L. and Redaelli, V. (2013). Thermography: Current status and advances in livestock animals and in veterinary medicine. Fondazione Iniziative Zooprofilattiche e Zootecniche.

  13. McCafferty, D.J. (2007). The value of infrared thermography for research on mammals: Previous applications and future directions. Mammal Review. 37: 207-223. https://doi.org/ 10.1111/j.1365-2907.2007.00111.x.

  14. McManus, C., Tanure, C.B., Peripolli, V., Seixas, L., Fischer, V., Gabbi, A.M., Menegassi, S.R.O., Stumpf, M.T., Kolling, G.J., Dias, E. and Costa Jr., J.B.G. (2016). Infrared thermography in animal production: An overview. Computers and Electronics in Agriculture. 123: 10-16. https://doi.org/10.1016/j.com pag.2016.01.027.

  15. Peng, D., Chen, S., Li, G., Chen, J., Wang, J. and Gu, X. (2019). Infrared thermography measured body surface temperature and its relationship with rectal temperature in dairy cows under different temperature-humidity indexes. International Journal of Biometeorology. 63(3): 327-336. https://doi. org/10.1007/s00484-018-01666-x.

  16. Python Software Foundation. (2023). Python: A dynamic, open source programming language. https://www.python.org/

  17. Rajawat, N., Dang, A.K., Kumari, B., Anil and Ashutosh. (2026). High-speed air flow alleviates circadian heat load and stabilizes peripheral thermoregulation in heifers. Indian Journal of Animal Research. 60(5): 781-788. doi: 10.18805/IJAR.B-5773.

  18. Stewart, M., Webster, J.R., Schaefer, A.L., Cook, N.J. and Scott, S.L. (2005). Infrared thermography as a non-invasive tool to study animal welfare. Animal Welfare. 14: 319- 325.

  19. Tattersall, G.J. (2016). Infrared thermography: A non-invasive window into thermal physiology. Comparative Biochemistry and Physiology Part A. 202: 78-98. https://doi.org/10.1016/ j.cbpa.2016.02.022.

  20. Weschenfelder, A.V., Saucier, L., Maldague, X., Rocha, L.M., Schaefer, A.L. and Faucitano, L. (2013). Use of infrared ocular thermography to assess physiological conditions of pigs prior to slaughter and predict pork quality variation. Meat Science. 95: 616-620. https://doi.org/10.1016/j.meatsci. 2013.05.032.

Background: As farms move towards more and more automation, there is a need to obtain this more quickly, accurately and contactlessly. Infrared thermography (IRT) provides an option that calls for more exploration through surface temperature measurements. It is, however, complicated by environmental and physiological variability.

Methods: In this study, we tested whether multivariable models using IRT regions and environmental features could predict sheep rectal temperature in animals. Models were compared using grouped cross-validation, with independent animal hold-out evaluation and agreement analyses. We compared linear, ridge, random-forest and gradient-boosting models.

Result: The random forest model performed best among the regressors tested, with RMSE ~0.38°C. Bland-Altman, clinical agreement (±0.5±1.0°C) calibration and environmental analyses supported the reliability of this study. The results were also worse in sunlight than in the shade. Calibration analysis indicated mild regression toward the mean. We conclude that infrared thermography combined with environmental information can approximate rectal temperature under farm conditions. The performance depends on acquisition conditions and needs to be adequately calibrated with more data. This method works as extra support for monitoring and fever screening.

The temperature of an animal is very important for physiological and clinical studies. As farms move towards more and more automation, there is a need to obtain this more quickly, accurately and contactlessly. This is important in precision animal health monitoring. Infrared thermography (IRT) provides surface temperature measurements. This could potentially provide a clue about the core temperature of the animal.
       
Core body temperature is an important and quick gateway to understanding the physiological status and health. Rectal thermometry is the most accurate and main method. However, it is invasive, labour intensive and difficult to perform continuously and for many animals. These limitations create a need for rapid and contactless approaches that can support temperature monitoring in precision livestock systems.
       
Infrared thermography (IRT) measures the infrared radiation emitted from the animal’s surface. It provides the peripheral temperature and at vascularised and relatively exposed body regions, this may be useful. Because the temperatures here may be affected by blood flow and heat exchange and can therefore provide useful information. But this will be affected by ambient temperature, solar radiation, posture, coat characteristics, emissivity and the spec anatomical region. Therefore, the use of IRT requires validation and calibration of the environmental conditions. This could supplement the rectal temperature, which currently is the reference standard for assessing core temperature in sheep (Peng et al., 2019). IRT can only capture surface temperature patterns, but this may be useful for finding some correlation with the underlying physiological state (Lahiri et al., 2012). This is dependent on several factors like ambient conditions, sunlight exposure, animal posture, coat characteristics and image acquisition variability. In animals, the presence of thick skin and wool/ fur further complicates the readings. Due to all this, the accuracy of infrared thermography could be reduced.
       
Many field thermography studies use limited validation methods, such as random splitting. This sometimes causes data leakage because the same animal may be used for both the training and testing sets (Joeres et al., 2025). Such designs may overrepresent the performance (Stewart et al., 2005). Animal-level validation is therefore essential. In the real world, it is also important to pay attention to agreement, calibration and clinically meaningful error bounds (Bland and Altman, 1986)  And many studies are limited by this (Luzi et al., 2013; McManus et al., 2016; Weschenfelder et al., 2013). This is especially important for veterinary use, where the subjects cannot be asked to cooperate in measurement making or other procedures. Additionally, as artificial intelligence driven precision livestock farming becomes more common (Hamadani, 2024; Hamadani et al., 2022), there is a need for more non invasive procedures.
       
In animals, IRT has been explored in livestock for applications in disease detection, welfare monitoring and thermal physiology (McCafferty, 2007; Stewart et al., 2005; Tattersall, 2016). However, its reliability is limited. There is still a need for studies on variability, emissivity settings, camera calibration, imaging protocols and region-of-interest selection. This would be important for reproducibility (Luzi et al., 2013). Therefore, the objectives of this study were to evaluate the ability of infrared thermography-to predict rectal temperature in sheep under farm conditions and to compare regression approaches for the prediction. In addition, we assessed the prediction agreement, calibration and the influence of sunlight on model performance. We hypothesised that thermal features from multiple anatomical regions along with information about the ambient environmental would improve prediction of rectal temperature.
The study was conducted at the Mountain Research Centre for Sheep and Goat, SKUAST-Kashmir, Shuhama, during February 2026. The study included 175 unique Corriedale animals. There were 130 adult sheep with 155 records and 45 lambs with 46 records; 140 animals were included in the training pool and 35 independent animals for the hold-out set. The animals were maintained under semi-intensive housing conditions. A total of 201 observations were obtained, with repeated observations occurring for some animals.
       
The thermal imager had an infrared resolution of 256 x 192 pixels and a noise-equivalent temperature difference (NETD) of ≤50 mK (0.05°C) at 25°C. The temperature measurement resolution was 0.1°C. The emissivity was set to 0.98. Images were acquired from approximately frontal and lateral approx. 20 cm, Limbs approx. 30 cm and muzzle at approx 10 cm, with the camera positioned at approximately 90° relative to the animal. The camera was allowed to equilibrate to the environmental conditions before image acquisition. Rectal temperature measurement and thermal imaging were performed simultaneously using standard procedure. The rectal temperature was originally recorded in °F and subsequently converted to °C for analysis.    
       
Environmental information available for analysis included ambient temperature, time of day and illumination condition (sunlight/shade). The data was preprocessed appropriately and missing data were handled using median imputation to avoid bias. The temperature was obtained in Fahrenheit and was converted to Celsius from the thermal camera. The Region of Interest included frontal face, lateral face, muzzle, limb (°C); ambient (°C); sun = 1 / shade = 0.  We also used derived features to build models. Biological and environmental interaction terms were also assessed. Original features comprised raw ROI temperatures (frontal face, lateral face, muzzle, limb), ambient temperature, lighting condition, animal identifier and rectal temperature recorded in Fahrenheit, with optional cohort labels when datasets were merged.
       
Engineered features included region-ambient temperature differences, head temperature summaries (mean and maximum), frontal-lateral facial temperature difference, hour of day, a binary sunlight indicator and interaction terms between sunlight and selected thermal gradients. All analyses were performed in Python 3 using pandas, numpy, scikit-learn, statsmodels, scipy, matplotlib and seaborn (Python Software Foundation, 2023).
 
Model development
 
Four regression models were evaluated. In addition, an extended Ridge model included sex (where available), cohort (sheep vs lamb) and two interaction terms: sunlight x (muzzle “ ambient) and sunlight x (limb “ ambient), in addition to the baseline engineered predictors. For linear models, the relationship between predictors and rectal temperature was specified as: 
 
 
Where,
Ti = Temperature for observation i.
Xij = j-th predictor, β0 is the intercept, βj are regression coefficients
εi = Error term.
       
Linear mixed-effects models were fitted using the MixedLM implementation in statsmodels to understand repeated measurements within animals. A random intercept for each animal was included to model within-subject correlation. The following were evaluated:
• Model A included muzzle temperature and ambient temperature as fixed effects, with animal ID as a random intercept.
• Model B included head mean temperature and ambient temperature as fixed effects, also with animal ID as a random intercept.
       
Models were estimated using restricted maximum likelihood (REML) or ML with multiple optimizer initializations.
 
 
 
Where,
b_i ~ N(0, σ_b2) = Animal-level random intercept.
εij ~ N(0, σ2) = Residual error.

Ridge regression
 
Ridge regression estimates coefficients by minimizing the penalized least squares objective:
 
 
 
Where,
α = 12 controls the strength of L2 regularization.
       
All predictors were median-imputed and standardized prior to model fitting.
       
To account for within-animal dependence, uncertainty in coefficients was quantified using cluster bootstrap resampling at the animal level, yielding empirical 95% confidence intervals.
 
Tree-based models
 
Nonlinear relationships were modelled using ensemble tree-based methods:
 
 
Where,
f(·) = Either a random forest or a gradient boosting regressor.
       
The random forest consisted of 400 trees with a maximum depth of 5, while the gradient boosting model used 180 estimators with a learning rate of 0.06. Feature importance for the random forest was computed using mean decrease in impurity (MDI), interpreted as a descriptive measure of variable contribution rather than causality.
 
Validation strategy
 
Approximately 20% of animals were reserved as a hold-out set. Grouped 5-fold cross-validation for training. Out-of-fold (OOF) predictions were generated for unbiased performance estimation. The final model was refitted on the full training data and evaluated on the hold-out set.
The merged adult sheep-lamb cohort comprised 163 observations from 140 animals in the training pool and 38 observations from 35 independent hold-out animals (Table 1). Rectal temperature ranged from 37.67 to 40.61°C. There was a small subset of febrile observations above 39.5°C. Across candidate models, the random forest achieved the lowest mean cross-validated error (Table 2). The performance gap between random forest and Ridge showed that while nonlinear effects contribute to prediction, some signal can be captured by linear combinations of thermal and environmental features.

Table 1: Study design and cohort characteristics.



Table 2: Grouped cross-validated performance of regression models (training pool).


       
On the independent hold-out set, bias remained small, the details of which are given in Table 3. Clinical agreement between predicted and rectal temperature is given in Table 4. Calibration analysis showed slopes of 0.899 in the training pool and 0.914 in the hold-out set, indicating mild regression toward the mean (Table 5). These results indicate that the model provides unbiased estimates on average; however, the spread of differences suggests that individual-level substitution for rectal thermometry remains limited. 

Table 3: Bland-Altman agreement between predicted and rectal temperature.



Table 4: Clinical agreement between predicted and rectal temperature.



Table 5: Calibration of model predictions (actual vs predicted rectal temperature).


       
Slightly greater variability of surface temperature was noted at higher temperatures (Fig 1). There was a mild regression toward the mean. Specifically, higher temperatures tended to be slightly underestimated, while lower temperatures were slightly overestimated. Our findings are endorsed by other scientific reports (Liu et al., 2023). Calibration analysis confirmed deviance from the ideal identity relationship. So, although the predictions are reasonably accurate overall, calibration adjustment would be required before clinical deployment or substitution for rectal measurements.

Fig 1: Bland-altman plot for agreement between predicted and rectal temperature (Hold-out Set).


       
Environmental conditions had a clear impact on performance. Models showed lower error in shade (RMSE ≈ 0.36°C) compared to sunlight (RMSE ≈ 0.45°C) (Table 6). These findings emphasize the importance of accounting for environmental conditions in both model design and practical deployment and suggest that shaded measurements may be more reliable. The influence of environmental on peripheral measurements is consistent with infrared thermography-derived temperatures studied in Murrah bulls (Ahirwar et al., 2019). Changes in barn microclimate and airflow also change the rectal and peripheral surface temperatures in heifers as per one study (Rajawat et al., 2026).
       
This is also consistent with the findings of other scientists. Solar radiation and environmental heat load disrupt the relationship between surface and core temperature (McManus et al., 2016; Weschenfelder et al., 2013). Simplified deployment-oriented models demonstrated a trade-off between practicality and accuracy. A sparse Ridge model using only muzzle and ambient temperature resulted in higher error (RMSE ≈ 0.41°C) compared to the full engineered feature set (≈ 0.38°C). Although performance decreased, the gap was modest, indicating that reduced-sensor configurations may still be viable for field deployment where simplicity and cost are important considerations.
 
Mixed-effects models
 
In the mixed-effects model incorporating head mean temperature and ambient temperature (Model B), ambient temperature showed a statistically significant positive association with rectal temperature (p = 0.021).
       
In the other model, including muzzle temperature and ambient temperature (Model A), neither predictor demonstrated a statistically significant association with rectal temperature. Taken together, these findings support the use of IRT as a supplementary approach for temperature monitoring rather than as a replacement for rectal thermometry (Hashimoto, 2026). The models achieved moderate predictive accuracy with minimal bias and reasonable clinical agreement. Similar reported ranges for infrared thermography-based were reported by multiple authors (McCafferty, 2007; Tattersall, 2016). The feature importance from random regression is given in Table 7. Limb temperature was the most important predictor, followed by face-derived thermal contrasts. This indicates that peripheral and facial heat signatures carry the strongest association with rectal temperature. The prominence of limb temperature may reflect the peripheral tissues are sensitive to changes in blood flow and environmental heat exchange (Bakony et al., 2023). The value of peripheral temperature appears to be due to the thermal relationship with rectal temperature and the surrounding environment.

Improving robustness under sunlight and enhancing calibration remain a challenge. Solar radiation directly increases the temperature of exposed body surfaces and changes the thermal gradient between the animal and its surroundings. Consequently, surface temperatures measured under direct sunlight may have more environmental influence. The higher error observed under sunlight suggests that the image acquisition conditions must be taken into consideration before interpretation (Cross et al., 2024). Larger datasets will be important for refining model stability and extending applicability across diverse farm conditions (Hussein et al., 2025). Additionally, the dataset needs to be diversified to improve the predictions by the inclusion of more febrile cases.
       
Overall, the findings indicate that infrared thermography combined with environmental information can provide useful inferences regarding temperature in sheep. However, the method can be a supplementary tool rather than a replacement for rectal thermometry. Further validation will be necessary to establish the robustness and practical applicability of the approach. This should include more of diverse dataset, febrile animals, seasons, environments and environmental measurements.
It is concluded that infrared thermography combined with environmental information can approximate rectal temperature under farm conditions. The acquisition conditions as well as the environmental effects of the measurements and needs to be adequately calibrated with more data. It could potentially supplement animal screening in precision livestock farming, but more research, data and calibration are needed. 
The present study was supported by Anusandhan National Research Foundation (ANRF) GoI’s Prime Ministers Early Career Research Grant.
 
Disclaimers
 
The views and conclusions expressed in this article are solely those of the authors and do not necessarily represent the views of their affiliated institutions or the funding agency. The authors are responsible for the accuracy and completeness of the information provided and accept responsibility for the content of this manuscript.
 
Ethical approval
 
Not applicable.
 
Informed consent
 
Not applicable.
 
Consent to participate and publish
 
Not applicable.
The authors declare that there are no conflicts of interest regarding the publication of this article. No funding or sponsorship influenced the design of the study, data collection, analysis and decision to publish, or preparation of the manuscript.

  1. Ahirwar, M.K., Kataktalware, M.A., Prasad, K., Reen, J.K., Barman, D., Pal, R.P., Deginal, R.S., Kumar, N.A. and Gupta, D. (2019). Digital infrared thermography as a tool to assess the effect of season, age and housing on seminal traits in Murrah bulls. Indian Journal of Animal Research. 53(10): 1389-1396. doi: 10.18805/ijar.B-3669.

  2. Bakony, M., Kovács, L., Kézér, L. F. and Jurkovich, V. (2023). The use of body surface temperatures in assessing thermal status of hutch-reared dairy calves in shaded and unshaded conditions. Frontiers in Veterinary Science. 10. https:// doi.org/10.3389/fvets.2023.1162708.

  3. Bland, J.M. and Altman, D.G. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. The Lancet. 327(8476): 307-310. https://doi.org/10.1016/ S0140-6736(86)90837-8.

  4. Cross, J.L., Choma, M.A. and Onofrey, J.A. (2024). Bias in medical AI: Implications for clinical decision-making. PLOS Digital Health. 3(11): e0000651. https://doi.org/10.1371/journal. pdig.0000651.

  5. Hamadani, A. (2024). Artificial intelligence on farms: Sheep breed classification using computer vision. Indian Journal of Animal Production and Management. 40(4): 260-268. https://doi.org/10.48165/ijapm.2024.40.4.8.

  6. Hamadani, A., Ganai, N.A., Alam, S., Mudasir, S., Raja, T.A., Hussain, I. and Ahmad, H.A. (2022). Artificial intelligence techniques for the prediction of body weights in sheep. Indian Journal of Animal Research. 58(5): 884-889. doi: 10.18805/IJAR.B-4831.

  7. Hashimoto, Y. (2026). A comprehensive review of non-invasive core body temperature measurement techniques. Sensors. 26(3): 972. https://doi.org/10.3390/s26030972.

  8. Hussein, J.B., Workneh, T.S., Kassim, A., Ntsowe, K., Melesse, S.F. and El-Mesery, H.S. (2025). A review on the impact of big data analytics in transforming agricultural practices, food processing and preservation strategies. Applied Food Research. 5(2): 101234. https://doi.org/10.1016/ j.afres.2025.101234.

  9. Joeres, R., Blumenthal, D.B. and Kalinina, O.V. (2025). Data splitting to avoid information leakage with DataSAIL. Nature Communications. 16: 3337. https://doi.org/10.1038/s41 467-025-58606-8.

  10. Lahiri, B.B., Bagavathiappan, S., Jayakumar, T. and Philip, J. (2012). Medical applications of infrared thermography: A review. Infrared Physics and Technology. 55(4): 221-235. https:// doi.org/10.1016/j.infrared.2012.03.007.

  11. Liu, C., Zhao, C., Wang, Y. and Wang, H. (2023). Machine-learning- based calibration of temperature sensors. Sensors. 23(17): 7347. https://doi.org/10.3390/s23177347.

  12. Luzi, F., Mitchell, M., Nanni Costa, L. and Redaelli, V. (2013). Thermography: Current status and advances in livestock animals and in veterinary medicine. Fondazione Iniziative Zooprofilattiche e Zootecniche.

  13. McCafferty, D.J. (2007). The value of infrared thermography for research on mammals: Previous applications and future directions. Mammal Review. 37: 207-223. https://doi.org/ 10.1111/j.1365-2907.2007.00111.x.

  14. McManus, C., Tanure, C.B., Peripolli, V., Seixas, L., Fischer, V., Gabbi, A.M., Menegassi, S.R.O., Stumpf, M.T., Kolling, G.J., Dias, E. and Costa Jr., J.B.G. (2016). Infrared thermography in animal production: An overview. Computers and Electronics in Agriculture. 123: 10-16. https://doi.org/10.1016/j.com pag.2016.01.027.

  15. Peng, D., Chen, S., Li, G., Chen, J., Wang, J. and Gu, X. (2019). Infrared thermography measured body surface temperature and its relationship with rectal temperature in dairy cows under different temperature-humidity indexes. International Journal of Biometeorology. 63(3): 327-336. https://doi. org/10.1007/s00484-018-01666-x.

  16. Python Software Foundation. (2023). Python: A dynamic, open source programming language. https://www.python.org/

  17. Rajawat, N., Dang, A.K., Kumari, B., Anil and Ashutosh. (2026). High-speed air flow alleviates circadian heat load and stabilizes peripheral thermoregulation in heifers. Indian Journal of Animal Research. 60(5): 781-788. doi: 10.18805/IJAR.B-5773.

  18. Stewart, M., Webster, J.R., Schaefer, A.L., Cook, N.J. and Scott, S.L. (2005). Infrared thermography as a non-invasive tool to study animal welfare. Animal Welfare. 14: 319- 325.

  19. Tattersall, G.J. (2016). Infrared thermography: A non-invasive window into thermal physiology. Comparative Biochemistry and Physiology Part A. 202: 78-98. https://doi.org/10.1016/ j.cbpa.2016.02.022.

  20. Weschenfelder, A.V., Saucier, L., Maldague, X., Rocha, L.M., Schaefer, A.L. and Faucitano, L. (2013). Use of infrared ocular thermography to assess physiological conditions of pigs prior to slaughter and predict pork quality variation. Meat Science. 95: 616-620. https://doi.org/10.1016/j.meatsci. 2013.05.032.
In this Article
Published In
Indian Journal of Animal Research

Editorial Board

View all (0)