PhyDaC - Stress Detection from Physiological Data in Cattle: Challenges in IoT Franci Suni-Lopez1 , Angela Mayhua-Quispe2 , Nelly Condori-Fernandez3,4 and Elisban Flores Quenaya5 1 Universidad de Lima, Avenida Javier Prado Este N.°4600 Lima-Perú 2 Universidad La Salle, Arequipa, Peru 3 CITIC, Universidade da Coruña, Spain 4 Vrije Universiteit Amsterdam, De Boelelaan 1105, 1081 HV Amsterdam, The Netherlands 5 Universidad Católica San Pablo, Arequipa, Peru Abstract Stress in cattle is one of the main factors that generate economic losses in the livestock sector (e.g., reduction in the quality of milk or meat). In this field, heat stress has been considered as one of the main types of stress that negatively affects cattle. In addition, thanks to the arising of the Internet of Things in Animal Health, some researchers have proposed systems and models for the detection of this type of stress in an automated way, collecting and using data from meteorological variables (e.g., temperature, humidity), heart rate and others. However, the proposed models are mainly focused on heat stress detection that uses threshold-based estimation to determine the presence of stress; but, the level of stress experienced by cows can vary depending on their breed, or their ability to adapt to the environment where they are located. Therefore, in this project we propose an IoT platform for automatic detection of stress in cattle based on physiological signals; which is divided into three parts: i) implement a sensing device to collect physiological data, ii) a new method for automatic detection of stress based on physiological signals, and iii) an intuitive visualizer for monitoring cattle in individually way. The future research project, named PhyDac, is going to be carried out for two years with the participation of farmers from Peruvian regions (Arequipa, Cusco). Keywords cattle, stress detection, physiological data, IoT platform 1. Introduction In recent years, animal welfare has become more relevant due to its impact on farm animals (such as cattle), with the aim of reaching stable and competitive levels in the medium and long term [1]. Within the indicators of animal welfare, the presence or absence of stress represents a potential indicator because stressors generate homeostatic, physiological, and behavioral responses out of the ordinary, affecting the health of the animal [2]. Also, stress negatively affects the profitability and economic viability of livestock activity. For example, climatic factors RCIS 2022 Workshops and Research Projects Track, May 17–20, 2022, Barcelona, Spain $ fsuni@ulima.edu.pe (F. Suni-Lopez); amayhua@ulasalle.edu.pe (A. Mayhua-Quispe); n.condori.fernandez@udc.es (N. Condori-Fernandez); elisban.flores@ucsp.edu.pe (E. F. Quenaya) © 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings http://ceur-ws.org ISSN 1613-0073 CEUR Workshop Proceedings (CEUR-WS.org) such as temperature can produce a variability of 10% in milk production 1 . This climatic factor can raise heat stress, generating a decrease in feed consumption in cattle and therefore the quantity and quality of milk produced by cows are affected as a consequence of the reduction in protein concentration and milk fat. Additionally, heat stress can cause hormonal changes, which reduce reproductive rates due to inhibition of ovulation and estrus behavior. In order to monitor cattle, there are indicators that are collected and analyzed by experts to determine the stress level in the animal and making-decisions to reduce or control it; however, these tests and control require investing time due to the large number of animals that are kept on farms or production fields [3]. Due to the growth of a new area known as the Internet of Things in Animal Health (IoTAH), some works have been proposed to detect stress (e.g., [4], [5], [6]); however, the proposed models are mainly focused on heat stress detection for that they use threshold-based discrimination (i.e., when the signal exceeds a predetermined value, it is considered as stress) to determine the presence of stress; but, the level of stress experienced by cows can vary depending on their breed, or their ability to adapt to the environment in which they find themselves. For this reason, in this project, we propose to build a robust and non-obtrusive stress detector in cattle, by using only the animal’s physiological signals. To achieve this goal, we plan to integrate a last version of our real-time stress detector, that was evaluated and improved along the KUSISQA project2 , into an IoT architecture. It will allow provide useful information (about each individual of cattle) to farmers and cooperatives for making correct decisions. The paper is organized as follows. Section 2 discusses related works on stress recognition in animals, and Section 3 presents our methodology to implement the PhyDaC project. Challenges are discussed in Section 4. Finally, we conclude the paper in Section 5. 2. Related works 2.1. Stress in animals Stress in animals is an automatic response of their body to adverse environmental conditions that produce physiological and metabolic changes [7]. These changes are harmful to the health of the animal, also can affect the quality of milk, meat quality, or the reproduction process in the case of cows [8, 9, 10]. According to the review carried out by Sanmiguel Plazas et al. [7], there are two types of indicators that are analyzed to determine if the animal has stress or not. Among the main non-invasive indicators we have ethological patterns (analyzes changes in the normal behavior of the animal, based on a designed evaluation protocol), fear tests (such as the "arena test" or analysis of tonic immobility, where an expert acts as an observer to assess the state of the animal) and physiological parameters (such as body temperature that is measured using an infrared thermometer, the rectal temperature measured with a digital thermometer, respiratory rate by counting chest movements over the course of a minute, cortisol levels in saliva, urine, feces or hair). On the other hand, invasive indicators require manipulation of the animal that can generate discomfort or pain and therefore generate stress in the collection of 1 Information extracted from https://www.fawec.org/es/documentos-tecnicos-vacuno/10-efecto-del-estres-por- calor-en-la-produccion-de-las-vacas-de-leche-una-vision-practica 2 KUSISQA project website: http://kusisqa.unsa.edu.pe/ samples or during handling, within these we can mention the measurement of blood parameters (which requires blood sampling by venipuncture), humoral immune response (requires blood serum), or telemetry (requiring surgical implantation of a telemetry transmitter). After analyzing the types of existing indicators to measure stress in animals, we can indicate that the main limitation is the expert time-consuming either for the application of protocols and/or sample collection, because all animals need to be tested individually. In addition, the stress detection is not in real-time due to the waiting time to obtain the result. In our proposal, we propose the development of a prototype that allows the collection of physiological data in real-time, then they can be processed to detect the level of stress in the animal in a shorter time. 2.2. Automatic stress detection in cattle According to the literature, heat stress is one of the main types of stress that affects negatively the cattle. As consequence, during the last years, some researchers have proposed systems and models for the detection of this type of stress in an automated way, collecting and mainly using data from meteorological variables such as temperature, humidity, among others. For instance, Kitpitak and Hantrakul [4] proposed a real-time system to measure the heat stress level in dairy cows in Thailand using the temperature-humidity index (THI), their platform used humidity and temperature sensors and is based on a Raspberry Pi 3B to calculate the THI value that was used to determine the heat stress level. Similarly, Choquehuanca-Zevallos and Mayhua-Lopez [5] applied data from meteorological variables to detect heat stress in dairy cattle using an IoT platform based on Raspberry Pi 3B, this platform detects stress from a modified version of the THI calculation, which considers two additional variables in the equation (air velocity and solar radiation intensity). One of the main limitations of these research works is they only use data from meteorological variables to detect the stress level. However, not all cows experience the same level of stress because it can vary depending on their breeds or tolerance to the environment in which they are found. On the other hand, in the field of IoTAH some investigations have included physiological signals of the animal as part of their input data, with the aim of monitoring and maintaining the health of each animal. Among these works, we can mention the work of Sousa et al. [11] that proposes a model based on neural networks with the purpose of predicting the rectal temperature (RT) of the cow and determining the heat stress level based on the known thresholds of the RT for each level; this work considered three types of data as input: environmental variables (wet bulb temperature (WBT) and dry bulb temperature (DBT)) and a physiological signal (skin surface temperature (IRT) on the frontal part). The work proposed by Reddy and Nandini [6] was focused on the detection of heat stress and the early estrus detection in Indian cattle, the authors used five physiological data: respiration rate, pulse rate, sweat rate, skin temperature and rectal temperature; using the calculated THI values as ground-truth for the validation of the stress detector. In a similar way, Davison et al. [12] used THI-based thresholds to evaluate their stress detector that is based on the estimation of respiration movements (i.e., respiration rate) from 3-axis accelerometer data collected by a neck-mounted collar. In contrast to the proposals before mentioned, this project explores a new method of moni- toring physiological stress that uses only physiological signals: skin temperature (SKT), pho- toplethysmography (PPG) and galvanic skin response (GSR). In addition, the processing of Figure 1: An overview of PhydaC: An IoT-based stress detection approach in cattle biological samples (e.g., saliva, urine, etc.) is considered for the evaluation and validation of our stress detector. 3. Methodology PhyDaC aims to investigate whether physiological data commonly exploited in human stress detection, such as GSR and SKT, might be considered as relevant assets in the development of a new stress detection method in cattle. Figure 1 shows an overview of the main IoT components and their corresponding interactions. We plan to follow an incremental and iterative approach for delivering the main outcomes of PhyDaC: (i) a prototype of a sensing device to collect physiological data, (ii) an automatic stress detector, and (iii) a visualizer for monitoring the stress levels of Peruvian cows. In addition, in order to facilitate the data collection, storing, processing, and visualization of stress in cattle, PhyDaC is based on an IoT architecture, which is organized into four layers: sensing, data processing and storing, engine and presentation. These layers are briefly explained in the following subsections. 3.1. Sensing layer The first layer of the proposal is focused on the configuration of a sensing device per each cow to collect physiological data. This device is composed of an Arduino Uno, three physiological sensors (GSR, PPG and SKT) and a wireless sensor for sending data to a local server. Furthermore, this layer includes some tests to find a suitable location in the cow body that facilities the acquisition of physiological data. 3.2. Data layer The second layer of our proposal includes the collection of physiological signals, which are sent and stored in a local server for their processing in the engine layer. The communication with the server is based on the LoRa network specification, where the wireless module of the Arduino will transmit the acquired data. Moreover, the local server applies defined protocols to generate a dataset for future experiments and investigations in this topic. Also in this layer, we include the collection of biological samples of the cow (saliva) to be later analyzed in the laboratory and indicate the stress level in the cattle, this output allows validate the stress detector results. 3.3. Engine layer This layer is related to the core of our proposal. We plan to apply and integrate the second version of our stress detector, which was improved and evaluated using low-cost sensors as part of the KUSISQA project, into the IoTAH context. As the physiological signals can be affected by noise, we apply filtering and normalization algorithms implemented by Suni-Lopez et al. [13]). It is also important to remark that due to the lack of datasets, main resource for machine- learning based classifiers, we decided to use the same statistical change detection algorithm, which is based on the ADaptive WINdowing (ADWIN) method [13]. This approach computes the mean for each split of a sequence of signals and analyzes the statistically significant difference between two consecutive splits. When a statistically significant difference is detected, ADWIN drops the data backward, after it repeats the splitting procedure until no significant differences are found in the sequence. To provide a trustworthy stress detection process, as show in Figure 1, we plan to validate the detected stress episodes with a biological stress detection process; where the collected biological samples are processed by a cortisol test to determine the presence of stress. 3.4. Presentation layer The final part of our proposal is showing in real-time the physiological signals of each cow and their corresponding stress level through a visualizer. In this case, final users (e.g., farmers or cooperatives) could visualize the stress information not only by each cow but also on group of cows (multiple points). This last kind of visualization could become challenging when the number of cows increase (population) and other variables (e.g., location, cow breed, gender, age) could be interesting to be considered. For addressing the challenge of perceptual scalability, we plan to select and apply some of the existing dimensionality reduction methods (e.g., [14]). 4. Challenges The IoT has been successfully adopted in many application fields. Currently, however, the IoTAH itself lacks standards and specific technologies for recognizing animal emotions. In the following, we listed some of the challenges that are going to be affronted along the project: 1. Sensing physiological data in natural environments: The application of IoT in smart farming is challenging due to the environmental conditions (e.g., ambient temperature, high altitude, raining, rugged topography) in which the smart sensing devices are used by animals (e.g., cattle). Despite their increase adoption in different segments (e.g., green buildings, automotive industry, healthcare), as far as we know, in the market exists sensing devices for monitoring only movements of cows (e.g., Cattle Traxx). Therefore, considering the relevance of physiological data in automatic stress detection, one of the expected deliverables from the project is to build a non-obtrusive, compact and durable prototype of sensing device that allows us to collect physiological data of cows in natural environments. 2. Network and communication: an IoT platform combines different sensors and devices to collect, store, and process data depending on the problem domain. The network architecture and communication protocols are challenging in smart farming due to most farms are located in rural areas, where they do not have access to internet connection or it is low-speed. Government help is necessary to improve the internet access in these areas to have the opportunity of sharing and knowing the stress levels in cows of different regions and figure out patterns of this behavior that can be related to regions, seasons, breeds, among others. In this project, we plan to configure a local network and define protocols to generate a data repository, and start collecting historic data for this field. 3. Stress detection model: As we described in Section 2, the physiological signals used by the researchers are: respiration, PPG, and SKT. On the other hand, GSR is the most used signal to detect stress in humans. But there is not yet any evidence on detecting stress in animals using this signal. Although, there are some studies on collecting other type of data using sensors (i.e., location); for our purpose it is not clear how the sensing device should be used by the cow. For example, some works put the sensors in the feet of the animal, and others consider the neck or chest. Therefore part of our interdisciplinary research in PhyDaC is to determine the most suitable place to allocate the sensing device. It will allow us to reduce the risk of collecting noisy or corrupt data. 4. Validation: Some works based on meteorological variables for determining heat stress in animals have been proposed and commonly validated using the THI thresholds proposed by Eigenberg et al. [15]. However, these thresholds are related to the environmental conditions and not to the actual heat stress experienced by each cow. Researchers assume that cattle could experience a certain level of stress when certain THI thresholds are reached (e.g., THI value between 74 and 79 is an alert level of heat stress or 𝑇 𝐻𝐼 > 84 represents an emergency level), which is not necessarily true for all cows. There is a direct relationship between the concentration level of cortisol — which can be found in saliva, hair, blood, and faeces — and stress in cows [16]. In this project, we plan to validate our stress detector by assessing cortisol levels in saliva because salivary cortisol concentrations reflect short-term (i.e., around twenty minutes after a stressful situation) hypothalamic-pituitary-adrenal activity [16]. In addition, this sampling is considered minimally invasive, so it does not have a strong impact on the stress level of the cow. 5. Conclusions In this paper, we have presented PhyDaC, a future project that will combine research on affective computing and the emerging field named IoTAH. PhyDaC proposes an IoT platform to detect and monitor individual stress in cattle from physiological data. This solution will provide useful information to farmers and cooperatives in real-time. Besides, it will contribute to improving the process of production in the livestock industry. A list of challenges that are going to be affronted along the two-years research project were also listed. We believe the results of PhyDaC will provide the following achievements: i) implement a sensing device to collect physiological data, ii) a new method for automatic detection of stress based on physiological signals, and iii) an intuitive visualizer for monitoring cattle individually. Therefore, PhyDaC can have a significant impact on the industry and the IoTAH field. Acknowledgments The research of Nelly Condori-Fernandez has been carried out as part of CITIC, as Research Center accredited by Galician University System, which is funded by "Consellería de Cultura, Educación e Universidade from Xunta de Galicia. References [1] M. M. Odeón, S. A. Romera, Estrés en ganado: causas y consecuencias, Rev. vet. 28 (2017) 69. [2] V. R. Boroski, S. M. Martino Quartara, M. M. Prieto Laport, Caracterización de vacas lecheras a través de indicadores de bienestar animal y su relación con prácticas de manejo, infraestructura y medio ambiente en predios lecheros del Uruguay, Ph.D. thesis, Facultad de Veterinaria. Universidad de la República (Uruguay), 2008. [3] D. Smith, S. Lyle, A. Berry, N. Manning, M. Zaki, A. Neely, Internet of animal health things (IoAHT) opportunities and challenges, 2015. [4] N. Kitpitak, K. Hantrakul, Automatic Thermal Stress Level Measurement System in Dairy Cows, in: 2021 Joint International Conference on Digital Arts, Media and Technology with ECTI Northern Section Conference on Electrical, Electronics, Computer and Telecom- munication Engineering, IEEE, 2021, pp. 180–184. [5] J. J. Choquehuanca-Zevallos, E. Mayhua-Lopez, A Low-Cost IoT Platform for Heat Stress Monitoring in Dairy Cattle, in: 2021 IEEE 6th International Conference on Computer and Communication Systems (ICCCS), IEEE, 2021, pp. 982–986. [6] S. S. Reddy, C. Nandini, Early Detection of Estrus and Heat stress using IoAHT and Ana- lytics in Indian Cattle to overcome Repeat-Breading-Syndrome, in: 2019 1st International Conference on Advanced Technologies in Intelligent Control, Environment, Computing & Communication Engineering (ICATIECE), IEEE, 2019, pp. 220–224. [7] R. A. Sanmiguel Plazas, F. A. Plazas Hernández, D. Y. Trujillo Piso, M. d. R. Pérez Rubio, L. M. Peñuela Sierra, D. Alice, Requerimientos para la medición de indicadores de estrés invasivos y no invasivos en producción animal, Revista de Investigaciones Veterinarias Del Perú. 29 (2018) 15–30. [8] M. T. Gorczyca, K. G. Gebremedhin, Ranking of environmental heat stressors for dairy cows using machine learning algorithms, Comput. Electron. Agric. 168 (2020) 105–124. [9] D. Temple, F. Bargo, E. Mainau, I. Ipharraguerre, X. Manteca, Efecto del estrés por calor en la producción de las vacas de leche: una visión práctica, Technical Report, FAWEC, 2015. [10] A. Summer, I. Lora, P. Formaggioni, F. Gottardo, Impact of heat stress on milk and meat production, Animal Frontiers 9 (2019) 39–46. [11] R. V. d. Sousa, A. V. d. S. Rodrigues, M. G. d. Abreu, R. A. Tabile, L. S. Martello, Predictive model based on artificial neural network for assessing beef cattle thermal stress using weather and physiological variables, Comput. Electron. Agric. 144 (2018) 37–43. [12] C. Davison, C. Michie, A. Hamilton, C. Tachtatzis, I. Andonovic, M. Gilroy, Detecting Heat Stress in Dairy Cattle Using Neck-Mounted Activity Collars, Agriculture 10 (2020) 210. [13] F. Suni Lopez, N. Condori-Fernandez, A. Catala, Towards real-time automatic stress detec- tion for office workplaces, in: Information Management and Big Data, Communications in computer and information science, Springer International Publishing, Cham, 2019, pp. 273–288. [14] T. Fujiwara, Shilpika, N. Sakamoto, J. Nonaka, K. Yamamoto, K.-L. Ma, A visual analytics framework for reviewing multivariate time-series data with dimensionality reduction, IEEE Transactions on Visualization and Computer Graphics 27 (2021) 1601–1611. doi:10.1109/ TVCG.2020.3028889. [15] R. Eigenberg, T. Brown-Brandl, J. Nienaber, G. Hahn, Dynamic Response Indicators of Heat Stress in Shaded and Non-shaded Feedlot Cattle, Part 2: Predictive Relationships, Biosystems Engineering 91 (2005) 111–118. [16] L. J. Jerram, S. Van Winden, R. C. Fowkes, Minimally Invasive Markers of Stress and Production Parameters in Dairy Cows before and after the Installation of a Voluntary Milking System, Animals 10 (2020) 589.