Skip to main content

A non-invasive method to determine core temperature for cats and dogs using surface temperatures based on machine learning

Abstract

Background

Rectal temperature (RT) is an important index of core temperature, which has guiding significance for the diagnosis and treatment of pet diseases.

Objectives

Development and evaluation of an alternative method based on machine learning to determine the core temperatures of cats and dogs using surface temperatures.

Animals

200 cats and 200 dogs treated between March 2022 and May 2022.

Methods

A group of cats and dogs were included in this study. The core temperatures and surface body temperatures were measured. Multiple machine learning methods were trained using a cross-validation approach and evaluated in one retrospective testing set and one prospective testing set.

Results

The machine learning models could achieve promising performance in predicting the core temperatures of cats and dogs using surface temperatures. The root mean square errors (RMSE) were 0.25 and 0.15 for cats and dogs in the retrospective testing set, and 0.15 and 0.14 in the prospective testing set.

Conclusion

The machine learning model could accurately predict core temperatures for companion animals of cats and dogs using easily obtained body surface temperatures.

Peer Review reports

Background

Pet ownership is common in modern society, with cats and dogs being the most commonly owned pets [1]. According to a recent report, more than 88 million European households (38% of all households) had at least one pet in 2021 [2]. Some studies suggested that human-companion animal ownership or interactions may help improve the overall quality of life, including physical, social, and mental health [3,4,5]. However, the increasing prevalence of animal diseases has elevated the risk and has a detrimental impact on animal welfare [6]. Moreover, Zoonosis such as dengue fever, hepatitis E, toxoplasmosis, etc., make the companion animal has the potential for human pathogenicity [7]. Therefore, attention needs to be paid to the health status of animals for prompt diagnosis and treatment.

The change of the body temperature of an animal is closely related to the diagnosis and treatment of diseases [8]. Clinically, rectal temperature (RT) is an important index of core temperature, which has guiding significance for the diagnosis and treatment of pet diseases [9, 10]. However, this invasive approach is not tolerated in all cats and dogs [11]. In addition, due to the influence of intestinal air, feces, and lumps, RT measured by this method is slightly lower and often lags behind the temperature changes. For these reasons, alternative methods such as infrared ear thermometer, axillary temperature record, and infrared thermogram were used to estimate the rectal temperature [11, 12]. However, these alternatives were found inaccurate in predicting RT [12,13,14,15], which are difficult to meet clinical needs. Therefore, it is necessary to find a simple, fast, and accurate method of determining pet core temperatures.

Recent years witnessed significant advances in artificial intelligence (AI) with groundbreaking successful applications in a range of domains [16]. Machine learning (ML) is a branch of AI, consisting of various mathematical methodologies to conduct tasks like classifications, regressions, dimensionality reductions, and density estimations [17]. In a typical machine learning process, predictive models were trained based on the available datasets to obtain generalization, namely the capability to accurately process unseen or future datasets [18]. There were abundant reports using machine learning in human medicine [17]. More recently, machine learning was found in zoology. Especially, there were emerging studies applying machine learning to animal health. Renard et al. developed an algorithm to predict the short-term and medium-term survival rates of cats with acute and chronic kidney diseases [19]. Banzato et al. used a convolutional neural network (CNN) to identify common radiological findings from chest X-rays in cats [20]. Vehkaoja et al. proposed a machine learning algorithm for dog behavior recognition and classification [21]. We noticed that there was literature investigating approaches to determine core temperatures in the human body [22] and economical animals like rabbits and piglets [23, 24]. However, the usefulness of machine learning models to predict core temperatures of companion animals like cats and dogs are unclear.

Therefore, in this study, we proposed an alternative method based on machine learning to replace direct measuring RT for cats and dogs. We systematically developed and evaluated a core temperature predictive model using the measurements of surface temperatures of body areas. The machine learning based model was developed and evaluated in a retrospective dataset and a prospective dataset, respectively. The results showed that the model could achieve satisfying accuracies in predicting core temperatures of cats and dogs using measurements of the nasal, ear, oral cavity, abdomen, axillary, perianal, core, and room temperatures.

Methods

Data collection

In this study, we conducted both retrospective and prospective studies. As illustrated in Fig. 1, we first retrospectively collected data from four clinics that are part of Xinwang Animal Hospital. The inclusion criteria were companion cats and dogs that were admitted to the Xinwang Animal Hospital and tolerated to body temperature measurements. All temperature measurements were made with the consent of the owners. Initially, 400 subjects were included containing 200 cats and 200 dogs cared between March 2022 and May 2022. Subjects who were not companion animals, could not complete temperature measurement, refused to participate in the study or had an abnormal temperature were excluded. Finally, 369 subjects (180 cats, 189 dogs) exhibiting normal core temperature were used to develop models and initial testing. Later, we further prospectively collected data (30 cats, 30 dogs) between May 2022 and June 2022.

Fig. 1
figure 1

Flowchart of data collection, model development and evaluation in the retrospective and prospective studies. MAE: mean absolute error, MSE: mean square error, MAPE: mean absolute percentage error, RMSE: root mean squared error

Data acquirement

We invited four experienced clinicians to form the data team. We explained the study and protocol to the team first before training them with the use of the temperature measuring guns and data recordings. The team was qualified by correctly performing the data acquirements and strictly following the protocol. After practice, the data team was asked to collect data for this study. The RT was measured as the core temperature using a mercury thermometer (Triangle bar type, KeFu, China) and the thermometer was lubricated before use and inserted into the rectum for at least 2 cm and against the rectal wall until a stable peak was reached. To eliminate bias, the anal temperature was measured five times and averaged as the ground truth. Surfaces temperatures were measured using infrared thermometers (KF-HW-011, KeFu, China). In order to identify the best model, we systematically measured temperatures of several body parts including nasal, ears (medial skin of left ear, left ear canal, medial skin of right ear, right ear canal), oral cavity, abdomen (left breast, right breast, central abdomen, lower left abdomen, lower right abdomen), axillary (anterior of left axillary, posterior of left axillary, anterior of right axillary, posterior of right axillary), and perianal, as shown in Fig. 2. The ear temperature was averaged by the temperatures of the four ear areas. The mouth temperature was averaged by the five measurements of oral cavity. The abdomen temperature was the average of the temperatures of the five abdomen areas. The axillary temperature was the average of the temperatures of the four areas. The perianal temperature was the average of the temperatures of five measurements of perianal skin. In result, we obtained six averaged surface temperatures and one room temperature as inputs to machine learning for the core temperature prediction. Both retrospective and prospective studies were conducted at the same clinics and followed the same protocol.

Fig. 2
figure 2

Temperature measurements of surface temperatures, including (a) nasal, (b) ear, (c) oral cavity, (d) abdomen, (e) axillary, and (f) perianal skin. The first and third columns were cats, and the second and forth columns were dogs

Machine learning model

In this study, we developed machine learning models for cats and dogs independently, namely dataset of one animal was used to train and evaluate the corresponding model for the animal. In the retrospective study, we first randomly divided the dataset into one train-validation set (80%) and one testing set (20%). To investigate which machine learning model works best in this considered task, we systematically implemented six machine learning models covering commonly used algorithms in studies, including typical linear models, regressors, and regressors based on techniques of boosting and trees. As listed in Table 1, the models were gradient boosting regressor (GBR), support vector regressor (SVR), least absolute shrinkage and selection operator (LASSO), adaptive boosting regressor (ABR), and random forest regressor (RFR). Additionally, we also implemented a multilayer perceptron (MLP) model. In optimizing model performance, we utilized grid search to systematically explore hyperparameter values within manually predefined ranges. Grid search using a selected evaluation metric to assess the performance of machine learning model for each combination within a defined grid. In this instance, a custom loss function, incorporating MAE, MSE, and R2 score with distinct weights, is manually defined for comprehensive model evaluation.

Table 1 Machine learning models and hyperparameter settings

We used the 4-fold cross-validation approach in the training-validation process, in which models were trained using three folds (60%) and validated using each of the four folds (20%) iteratively. We select the best-performing model according to the averaged performance in the four cross-validation iterations. The selected model was finally evaluated on the independent testing set. To evaluate the generalization of the selected models, we tested the models in the prospectively collected datasets.

The machine learning models were developed in the programming language Python (3.9.7) using a conventional desktop computer with a central processing unit of Intel Core i5 (4 cores, 2 GHz) and 16 GB of main memory. Opensource libraries of numPy (1.21.2) and Pandas (1.4.1) were utilized for data handling. Scikit-learn (1.0.2) and Keras (2.7.0) were used for implementations of machine learning models and MLP respectively. Matplotlib (3.5.1) was used for visualization.

Statistical analysis

The performance of the core temperature prediction was evaluated using metrics of mean absolute error (MAE), mean square error (MSE), root mean squared error (RMSE), mean absolute percent error (MAPE). We used RMSE as the main metric. Mathematically, for the ground truth temperature \({t}_{i}\) and its prediction \({\widehat{t}}_{i}\), the metrics were defined as:

$$MAE= \frac{1}{n}\sum _{i=1}^{n}\left|({t}_{i }-{\widehat{t}}_{i})\right|$$
$$MSE= \frac{1}{n}\sum _{i=1}^{n}{\left({t}_{i}- {\widehat{t}}_{i}\right)}^{2}$$
$$MAPE= \frac{100\%}{n}\sum _{i=1}^{n}\left|\frac{{\widehat{t}}_{i}-{t}_{i}}{{t}_{i}}\right|$$
$$RMSE={\left[\frac{1}{n}\sum _{i=1}^{n}{\left({t}_{i}- {\widehat{t}}_{i}\right)}^{2}\right]}^{\frac{1}{2}}$$

Results

Subjects characteristics

In the retrospective study, we initially collected 200 subjects for cats and dogs. After data cleaning, the resulting datasets included 180 cats and 189 dogs. In the prospective study, we collected data for 30 cats and 30 dogs. We summarized the subject characteristics including numbers and average temperatures for cats (Table 2) and dogs (Table 3), respectively.

Table 2 Characteristics of cats
Table 3 Characteristics of dogs

Performance of machine learning

In this study, we used the cross-validation approach to train and evaluated multiple machine learning methods in both respective and prospective studies. We first reported the performance obtained in the cross-validation of the retrospective study. As shown in Table 4, ABR and SVR obtained relatively optimal performance with RMSE of 0.21 and 0.21 for cats and dogs, respectively. Therefore, we selected ABR as the chosen model for cats and SVR for dogs. We evaluated the performance of the chosen models first in the retrospective testing set and later in the prospective testing set. The final results were summarized in Table 5. We found that the models could accurately predict the core temperatures for both cats and dogs with satisfying performance. The values of RMSE for cats in respective and prospective studies were 0.25 and 0.15, respectively. The values of RMSE for dogs in respective and prospective studies were 0.15 and 0.14, respectively. In Fig. 3, we illustrated the histograms of prediction errors in both studies. As shown, most predictions fall around zero with small deviations, indicating good accuracies. In order to evaluate the model’s performance across different cohorts, we also counted the number of cats and dogs that had an absolute error (AE) less than the corresponding SD in each cohort. In the retrospective cohort, 21 cats and 27 dogs exhibited AE below the retrospective SD. Similarly, in the prospective cohort, 17 cats and 22 dogs demonstrated AE below the prospective SD. These numbers also show good accuracies. We calculated quantiles of the RMSE for cats and dogs to further evaluate the models’ predictive performance. The RMSE quantiles for retrospective cats were found to be [0.03, 0.06, 0.11] for the 25th, 50th, and 75th percentiles of the lowest absolute errors, respectively. Similarly, for retrospective dogs, the RMSE quantiles were [0.03, 0.07, 0.08]. In the prospective cohort, the RMSE quantiles for cats were [0.03, 0.06, 0.10], and for dogs, the RMSE quantiles were [0.02, 0.04, 0.07]. The results show the models have good performance at different levels of prediction accuracy.

Table 4 Performance of models in the cross-validation
Table 5 Performance of the selected models in the retrospective and prospective testing sets
Fig. 3
figure 3

Histograms of prediction errors for the selected models in retrospective and prospective studies. The first row were cats in retrospective (a) and prospective (b) studies, and the second row were dogs in retrospective (c) and prospective (d) studies

Discussion

As the closest companion animals to human beings, the diseases of cats and dogs have a great impact on human physical and mental health [5]. As an important index of core body temperature, the RT has important guiding significance in the diagnosis and treatment of pet diseases. However, traditional RT measurement methods have some disadvantages, such as poor tolerance, the influence of intestinal contents, and lag, making it difficult to measure the core temperature of animals quickly and accurately. This study proposed an alternative and simple method to predict core temperatures for companion animals, based on body surface temperatures using machine learning. The results demonstrated the accuracies were encouraging.

In the existing literature, one study developed models to predict RT, skin-surface temperatures, and hair-coat surface temperatures for livestock like piglets using lamps as supplementary heats [24]. In another study, rectal temperatures of rabbits were predicted using measurements obtained with advanced infrared cameras [23]. There were also reports for human infants, among them, Lyra et al. combined deep learning-based algorithms and camera modalities to real-time monitor the temperature of neonates [25]; Yaeger et al. developed a natural language processing algorithm to identify febrile infants [26]; Asano et al. applied a semantic segmentation method to thermal images, which makes it possible to monitor the temperature distribution over the whole body of infants [27]. Different to those approaches in predicting core temperatures, our method focused on companion animals using convenient operations and equipment. Moreover, we systematically investigated a broad range of machine learning models and considered more body surface parts.

Our results suggested that the proposed method demonstrated several advantages in determining the core temperatures of human-companion animals. First, by measuring the surface temperatures, our non-invasive, contactless approach was friendly to shy animals than the traditional method of invasively measuring anal temperatures. Professional clinicians, as well as animal owners, could easily master the simple measuring techniques in no time without the need for complicated training. Moreover, our method used widely available and affordable temperature measuring guns, making it possible for rapid adoption. Therefore, our approach had promise in assisting diagnosis in animal clinics and daily animal health monitoring in households. Altogether, the present study added new evidence to the line of studies using machine learning to predict core temperatures of animals, meanwhile providing valuable implications for the prediction of the core temperatures of human infants.

This study also had limitations. First, this study is a single-center study with limited resources. In the future, a larger-scale of multicenter study could strengthen the dataset. Second, we only included cats and dogs in this study, other human-companion animals were not studied. The potential usefulness and generalization capability were unknown and worth further investigations in other human-companion animals. Third, due to limited data, we did not include the age, sex, breed, feeding situation, health status, hair condition of animals, and other factors like humidity, day-night timing of measurements, and seasons. Future work could consider these potential influential variables. Four, as an initial study, we measured the temperatures of several body parts. To facilitate the adoption of the proposed method, we need to reach a balance of convenience and acceptable accuracy. Namely, future investigations should identify the optimal combination with the least measurements of body parts for easier uses in practice. Last but not least, the present work was only a primitive model. It’s worth implementing this model as a working system to further evaluate the model and cumulate incoming data for model retrains.

Conclusions

In this study, we proposed a machine learning method to accurately predict the core temperatures of cats and dogs using measurements of other surface body parts. We conducted a retrospective study using the first dataset to identify and develop the best-performing model. Subsequently, a prospective study was conducted using the second dataset to validate the selected model’s performance on new, unseen data and to gain insights into long-term trends. We implemented several machine learning models and trained using cross-validation.

Data availability

The data used in this study is available from the corresponding author on reasonable request.

Abbreviations

RT:

Rectal Temperature

AI:

Artificial Intelligence

ML:

Machine Learning

MLP:

Multilayer Perceptron

GBR:

Gradient Boosting Regressor

SVR:

Support Vector Regressor

LASSO:

Least Absolute Shrinkage and Selection Operator

ABR:

Adaptive Boosting Regressor

RFR:

Random Forest Regressor

MAE:

Mean Absolute Error

MSE:

Mean Square Error

MAPE:

Mean Absolute Percent Error

RMSE:

Root Mean Squared Error

AE:

Absolute Error

References

  1. Chomel BB. Diseases transmitted by Less Common House pets. Microbiol Spectr. 2015;3(6).

  2. The European Pet Food Industry. Annual Report 2021.

  3. Friedmann E, Son H. The human-companion animal bond: how humans benefit. Vet Clin North Am Small Anim Pract. 2009;39(2):293–326.

    Article  PubMed  Google Scholar 

  4. Smith B. The ‘pet effect’--health related aspects of companion animal ownership. Aust Fam Physician. 2012;41(6):439–42.

    PubMed  Google Scholar 

  5. Overgaauw PAM, Vinke CM, Hagen M, Lipman LJA. A one health perspective on the human-companion animal relationship with emphasis on zoonotic aspects. Int J Environ Res Public Health. 2020;17(11).

  6. Day MJ. One health: the importance of companion animal vector-borne diseases. Parasit Vectors. 2011;4:49.

    Article  PubMed  PubMed Central  Google Scholar 

  7. Vonesch N, Binazzi A, Bonafede M, Melis P, Ruggieri A, Iavicoli S et al. Emerging zoonotic viral infections of occupational health importance. Pathog Dis. 2019;77(2).

  8. Miller JB. Hyperthermia and fever. Small animal critical care medicine. 2009:21–30.

  9. Greer RJ, Cohn LA, Dodam JR, Wagner-Mann CC, Mann F. Comparison of three methods of temperature measurement in hypothermic, euthermic, and hyperthermic dogs. J Am Vet Med Assoc. 2007;230(12):1841–8.

    Article  PubMed  Google Scholar 

  10. Southward ES, Mann F, Dodam J, Wagner-Mann CC. A comparison of auricular, rectal and pulmonary artery thermometry in dogs with anesthesia-induced hypothermia. J Veterinary Emerg Crit Care. 2006;16(3):172–5.

    Article  Google Scholar 

  11. Lamb V, McBrearty A. Comparison of rectal, tympanic membrane and axillary temperature measurement methods in dogs. Vet Rec. 2013;173(21):524.

    Article  CAS  PubMed  Google Scholar 

  12. Yanmaz LE, Dogan E, Okumus Z, Senocak MG, Yildirim F. Comparison of rectal, eye and ear temperatures in kangal breed dogs. Kafkas Univ Vet Fak Derg. 2015;21:615–7.

    Google Scholar 

  13. Konietschke U, Kruse BD, Muller R, Stockhaus C, Hartmann K, Wehner A. Comparison of auricular and rectal temperature measurement in normothermic, hypothermic, and hyperthermic dogs. Tierarztl Prax Ausg K Kleintiere Heimtiere. 2014;42(01):13–9.

    Article  CAS  PubMed  Google Scholar 

  14. Piccione G, Giannetto C, Fazio F, Giudice E. Accuracy of auricular temperature determination as body temperature index and its daily rhythmicity in healthy dog. Biol Rhythm Res. 2011;42(5):437–43.

    Article  Google Scholar 

  15. Sousa MG, Carareto R, Pereira-Junior VA, Aquino MC. Comparison between auricular and standard rectal thermometers for the measurement of body temperature in dogs. Can Veterinary J. 2011;52(4):403.

    Google Scholar 

  16. LeCun Y, Bengio Y, Hinton G. Deep learning. Nature. 2015;521(7553):436–44.

    Article  CAS  PubMed  Google Scholar 

  17. Beam AL, Kohane IS. Big Data and Machine Learning in Health Care. JAMA. 2018;319(13):1317–8.

    Article  PubMed  Google Scholar 

  18. Nasrabadi N. Pattern Recognition and Machine Learning. J Electron Imaging. 2007;16(4):049901.

    Article  Google Scholar 

  19. Renard J, Faucher MR, Combes A, Concordet D, Reynolds BS. Machine-learning algorithm as a prognostic tool in non-obstructive acute-on-chronic kidney disease in the cat. J Feline Med Surg. 2021;23(12):1140–8.

    Article  PubMed  Google Scholar 

  20. Banzato T, Wodzinski M, Tauceri F, Dona C, Scavazza F, Muller H, et al. An AI-Based algorithm for the Automatic classification of thoracic radiographs in cats. Front Vet Sci. 2021;8:731936.

    Article  PubMed  PubMed Central  Google Scholar 

  21. Vehkaoja A, Somppi S, Tornqvist H, Valldeoriola Cardo A, Kumpulainen P, Vaataja H, et al. Description of movement sensor dataset for dog behavior classification. Data Brief. 2022;40:107822.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  22. Morishima S, Xu Y, Urashima A, Toriyama T. Human body skin temperature prediction based on machine learning. Artif Life Rob. 2020;26(1):103–8.

    Article  Google Scholar 

  23. Yuan H, Liu C, Wang H, Wang L, Sun F. Optimization and comparison of models for core temperature prediction of mother rabbits using infrared thermography. Infrared Phys Technol. 2022;120:103987.

    Article  CAS  Google Scholar 

  24. Gorczyca MT, Milan HFM, Maia ASC, Gebremedhin KG. Machine learning algorithms to predict core, skin, and hair-coat temperatures of piglets. Comput Electron Agric. 2018;151:286–94.

    Article  Google Scholar 

  25. Lyra S, Rixen J, Heimann K, Karthik S, Joseph J, Jayaraman K, et al. Camera fusion for real-time temperature monitoring of neonates using deep learning. Med Biol Eng Comput. 2022;60(6):1787–800.

    Article  PubMed  PubMed Central  Google Scholar 

  26. Yaeger JP, Lu J, Jones J, Ertefaie A, Fiscella K, Gildea D. Derivation of a natural language processing algorithm to identify febrile infants. J Hosp Med. 2022;17(1):11–8.

    Article  PubMed  Google Scholar 

  27. Asano H, Hirakawa E, Hayashi H, Hamada K, Asayama Y, Oohashi M, et al. A method for improving semantic segmentation using thermographic images in infants. BMC Med Imaging. 2022;22(1):1.

    Article  PubMed  PubMed Central  Google Scholar 

Download references

Acknowledgements

We appreciated our assistant veterinarians for their valuable support in the data collection of this study.

Funding

This study is supported by Key Research and Development Project of the Ministry of Science and Technology of the People’s Republic of China (2020YFF0305104), Key Research and Development Project of Science & Technology Department of Sichuan Province (2020YFS0324), National Natural Science Foundation of China (82272077).

Author information

Authors and Affiliations

Authors

Contributions

The design of the experiment was done by Song Su, Jiayu Huang and Yong Tang; methodology, Song Su, Jiayu Huang, Zimu Zhao and Yong Tang; data collection and analysis, Zimu Zhao, Xujia Li, Yan Zhuang, Fan li, Weijia Wang, Qing Wang; writing of the manuscript, Zimu Zhao, Xujia Li and Yong Tang. All authors have read and approved the manuscript.

Corresponding authors

Correspondence to Song Su, Jiayu Huang or Yong Tang.

Ethics declarations

Ethics approval and consent to participate

Ethical approval for this study was obtained from the Ethical Committee of the Affiliated Hospital of Southwest Medical University(sumu20220101). All temperature measurements were made with the consent of the owners. All methods were carried out in accordance with relevant guidelines and regulations. All methods are reported in accordance with ARRIVE guidelines for the reporting of animal experiments.

Consent for publication

Not applicable.

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated in a credit line to the data.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Zhao, Z., Li, X., Zhuang, Y. et al. A non-invasive method to determine core temperature for cats and dogs using surface temperatures based on machine learning. BMC Vet Res 20, 199 (2024). https://doi.org/10.1186/s12917-024-04063-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s12917-024-04063-2

Keywords