Acessibilidade / Reportar erro

IoT-based measurement system for classifying cow behavior from tri-axial accelerometer

Sistema de medição baseado em IoT para classificar o comportamento de vacas através de acelerômetro tri-axial

ABSTRACT:

A cow behavior monitoring system based on the Internet of Things (IoT) has been designed and implemented using tri-axial accelerometer, MSP430 microcontroller, wireless radio frequency (RF) module, and a laptop. The implemented system measured cow movement behavior and transmitted acceleration data to the laptop through the wireless RF module. Results were displayed on the laptop in a 2D graph, through which behavior patterns of cows were predicted. The measured data from the system were analyzed using the Multi-Back Propagation-Adaptive Boosting algorithm to determine the specific behavioral state of cows. The developed system can be used to increase classification performance of cow behavior by detecting acceleration data. Accuracy exceeded 90% for all the classified behavior categories, and the specificity of normal walking reached 96.98%. The sensitivity was good for all behavior patterns except standing up and lying down, with a maximum of 87.23% for standing. Overall, the IoT-based measurement system provides accurate and remote measurement of cow behavior, and the ensemble classification algorithm can effectively recognize various behavior patterns in dairy cows. Future research will improve the classification algorithm parameters and increase the number of enrolled cows. Once the functionality and reliability of the system have been confirmed on a large scale, commercialization may become possible.

Key words:
internet of things; tri-axial accelerometer; multi-BP-ada Boost algorithm; cow behavior classification

RESUMO:

Um sistema de monitoramento de comportamento de vacas baseado na Internet das Coisas (IoT) foi projetado e implementado através do uso de acelerômetro tri-axial, Microcontrolador MSP430, módulo de rádio, frequência sem fio (RF), e um portátil. O sistema implementado mediu o comportamento do movimento da vaca e transmitiu dados de aceleração ao portátil através do módulo RF sem fio. Os resultados foram exibidos no portátil em um gráfico 2D, através do qual os padrões de comportamento das vacas foram previstos. Os dados medidos do sistema foram analisados usando o Multi-retropropagação-Adaptativa algoritmo de Boosting para determinar o estado comportamental específico das vacas. O sistema desenvolvido pode ser usado para aumentar a classificação de desempenho de vaca comportamento através da detecção de aceleração de dados. A precisão excedeu 90% de todas as categorias de classificação de comportamento e a especificidade do andar normal atingiu 96.98%. A sensibilidade foi boa para todos os padrões de comportamento, exceto em pé e deitada, com um máximo de 87.23% para ficar de pé. No geral, o sistema baseado em IoT fornece medição precisa e remota do comportamento da vaca, e o algoritmo de conjunto de classificação pode efetivamente reconhecer vários padrões de comportamento em vacas leiteiras. Pesquisas futuras irão melhorar os parâmetros do algoritmo de classificação e aumentar a quantidade de vacas matriculadas. Uma vez que a funcionalidade e confiabilidade do sistema foram confirmadas em larga escala, a comercialização pode se tornar possível.

Palavras-chave:
internet das coisas; acelerômetro tri-axial; multi-retropropagação-adaptativa algoritmo de boosting; omportamento de classificação de vaca

INTRODUCTION:

Dairy cow farming faces various challenges. Severe economic pressure has led to the rise and development of heavily industrialized farming. Although, dairy industry can supply large quantities of dairy produce at low prices, industrial farming practices face increased scrutiny regarding cow welfare and health aspects (THOMPSON et al., 2017THOMPSON, A. J. et al. Technical note: Mining data from on-farm electronic equipment to identify the time dairy cows spend away from the pen. Journal of Dairy Science, v.5100, p.3975-3982, 2017. Available from: <Available from: https://doi.org/10.3168/jds.2016-11713 >. Accessed: Feb. 6, 2018. doi: 10.3168/jds.2016-11713.
https://doi.org/10.3168/jds.2016-11713...
). Behavior is an indicator of the well-being and health of dairy cows (BORCHERS et al., 2016BORCHERS, M. R. et al. A validation of technologies monitoring dairy cow feeding, ruminating, and lying behaviors. Journal of Dairy Science, v.999, p.7458-7466, 2016. Available from: <Available from: https://doi.org/10.3168/jds.2015-10843 >. Accessed: Nov. 3, 2017. doi:10.3168/jds.2015-10843.
https://doi.org/10.3168/jds.2015-10843...
). Cows exhibit different behavior when health problems or physiological conditions (e.g., estrus) develop (MATTACHINI et al., 2013MATTACHINI, G.et al. Methodology for quantifying the behavioral activity of dairy cows in freestall barns. Journal of Animal Science, v.10, p.4899-4907, 2013. Available from: <Available from: https://doi.org/10.2527/jas.2012-5554 >. Accessed: Nov. 14, 2017. doi: 10.2527/jas.2012-5554.
https://doi.org/10.2527/jas.2012-5554...
). For instance, comparing with non-lamed cows, lamed cows spend more time lying and less time standing, perform fewer aggressive interactions and are less active. Cows in estrus have rapid increases in time spent normal walking, active walking, and also have changes in milk production performance. Moreover, the frequency of standing up and lying down is highly correlated to cow behavior intensity (PEREIRA et al., 2018PEREIRA, G. M. et al. Technical note: Validation of an ear-tag accelerometer sensor to determine rumination, eating, and activity behaviors of grazing dairy cattle. Journal of Dairy Science, v.101, p.2492-2495, 2018. Available from: <Available from: https://doi.org/10.3168/jds.2016-12534 >. Accessed: Jun. 24, 2018. doi: 10.3168/jds.2016-12534.
https://doi.org/10.3168/jds.2016-12534...
). Detection of changes in cow behavior is an important means of providing alerts to execute specific management tasks (e.g., lameness discrimination, estrus detection, artificial insemination, and pregnancy testing) (WEIGELE et al., 2018WEIGELE H. C. et al. Moderate lameness leads to marked behavioral changes in dairy cows. Journal of Dairy Science, v.3101, p.2370-2382, 2018. Available from: <Available from: https://doi.org/10.3168/jds.2017-13120 >. Accessed: May. 6, 2018. doi: 10.3168/jds.2017-13120.
https://doi.org/10.3168/jds.2017-13120...
).Cow behavior assessment is mainly performed through experienced observers, but intensive and sustainable detection proves difficult, especially in large herds, due to time constraint and lack of manpower (NIELSEN et al., 2018NIELSEN, P. P. et al. Technical note: Validation and comparison of 2 commercially available activity loggers. Journal of Dairy Science, v.6101, p.5449-5453, 2018. Available from: <Available from: https://doi.org/10.3168/jds.2017-13784 >. Accessed: Jun. 2, 2018. doi: 10.3168/jds.2017-13784.
https://doi.org/10.3168/jds.2017-13784...
). Properly designed and deployed sensor systems should possess the capacity to reduce manpower needs and overall costs while improving cow welfare and increasing productivity (ADAMCZYK et al., 2017ADAMCZYK, K. et al. The application of cluster analysis methods in assessment of daily physical activity of dairy cows milked in the Voluntary Milking System. Computers and Electronics in Agriculture, v.141, p.65-72, 2017. Available from: <Available from: https://doi.org/10.1016/j.compag.2017.07.007 >. Accessed: May, 6, 2018. doi: 10.1016/j.compag.2017.07.007.
https://doi.org/10.1016/j.compag.2017.07...
). Some automatic systems that are based on radio frequency identification or Bluetooth technology have been applied for detecting cow behavior (RAYAS-AMOR et al., 2017RAYAS-AMOR, A. A. et al. Triaxial accelerometers for recording grazing and ruminating time in dairy cows: An alternative to visual observations. Journal of Veterinary Behavior-Clinical Applications and Research, v.20, p.102-108, 2017. Available from: <Available from: https://doi.org/10.1016/j.jveb.2017.04.003 >. Accessed: Jun. 3, 2018. doi: 10.1016/j.jveb.2017.04.003.
https://doi.org/10.1016/j.jveb.2017.04.0...
). However, these systems usually collect measurement data at fixed locations, resulting in poor real-time performance (THORUP et al., 2015THORUP, V. M. et al. Lameness detection via leg-mounted accelerometers on dairy cows on four commercial farms. Animal An International Journal of Animal Bioscience, v.9, p.1704, 2015. Available from: <Available from: https://doi.org/10.1017/S1751731115000890 >. Accessed: Feb. 6, 2017. doi: 10.1017/S1751731115000890.
https://doi.org/10.1017/S175173111500089...
). An accurate and real-time system is essential in monitoring behavior patterns to appropriately evaluate cow health and welfare.

Recent advances in sensor technology offer electronic devices that allow high sensitivity and provide new scenarios for recording cow activities (MAINA, 2017MAINA, C. W. IoT at the Grassroots - Exploring the Use of Sensors for Livestock Monitoring. Ist-Africa, 2017. Available from: <Available from: https://doi.org/ 10.23919/ISTAFRICA.2017.8102356 >.Accessed: Nov. 28, 2017. doi: 10.23919/ISTAFRICA.2017.8102356.
https://doi.org/ 10.23919/ISTAFRICA.2017...
). Given their advantages of small size, light weight, and low power consumption, accelerometers can be easily mounted on animals without affecting their behavior (MARTIN TALAVERA et al., 2017MARTIN, TALAVERA J. et al. Review of IoT applications in agro-industrial and environmental fields. Computers and Electronics in Agriculture, v.142, p.283-297, 2017. Available from: <Available from: https://doi.org/10.1016/j.compag.2017.09.015 >. Accessed: May, 15, 2018. doi: 10.1016/j.compag.2017.09.015.
https://doi.org/10.1016/j.compag.2017.09...
). In addition, tri-axial accelerometers provide a noninvasive and objective method of measuring cow behavior under farm conditions. MARTISKAINEN et al. (2009MARTISKAINEN, P. et al. Cow behaviour pattern recognition using a three-dimensional accelerometer and support vector machines. Applied Animal Behaviour Science, v.119, p.32-38, 2009. Available from: <Available from: https://doi.org/10.1016/j.applanim.2009.03.005 >. Accessed: Nov. 11, 2017. doi: 10.1016/j.applanim.2009.03.005.
https://doi.org/10.1016/j.applanim.2009....
) developed a method for recognizing several behavioral patterns in dairy cows using a 3D accelerometer and a multiclass support vector machine. ARCIDIACONO et al. (2017ARCIDIACONO, C. et al. A threshold-based algorithm for the development of inertial sensor-based systems to perform real-time cow step counting in free-stall barns. Biosystems Engineering, v.153, p.99-109, 2017. Available from: <Available from: https://doi.org/10.1016/j.biosystemseng.2016.11.003 >. Accessed: May, 11, 2018. doi: 10.1016/j.biosystemseng.2016.11.003.
https://doi.org/10.1016/j.biosystemseng....
) proposed an approach that allows computation of an acceleration threshold to classify the feeding and standing activities of dairy cows in a free-stall barn.

The Internet of Things (IoT) is one of the most important technological advances in the last decade (BENAISSA et al., 2017BENAISSA, S. et al. Internet of animals: characterisation of LoRa sub-GHz off-body wireless channel in dairy barns. Electronics Letters, v.1853, p.1281-1283, 2017. Available from: <Available from: https://doi.org/10.1049/el.2017.1344 >, Accessed: May, 3, 2018. doi: 10.1049/el.2017.1344.
https://doi.org/10.1049/el.2017.1344...
). IoT enables sensing and/or remote control of objects across an existing network infrastructure, creating opportunities for a more direct integration of the physical world into computer-based systems (MEMON et al., 2016MEMON, M. et al. Internet of Things (IoT) enabled smart animal farm. International Conference on Computing for Sustainable Global Development, 2016. Available from: <Available from: https://www.researchgate.net/publication/311223405 >. Accessed: Oct. 21, 2017.
https://www.researchgate.net/publication...
). Recently, the IoT has been shown to feature potential benefits in dairy cattle farming, providing a way to extend our perception of cow behavior and our ability to modify traditional management (NODA et al., 2017NODA, A. et al.. Behavior analysis of a small animal using IoT sensor system. International Conference on Intelligent Informatics and Biomedical Sciences, p.9-10, 2017. Available from: <Available from: https://doi.org/10.1109/ICIIBMS.2017.8279686 >. Accessed: Jun. 6, 2018. doi: 10.1109/ICIIBMS.2017.8279686.
https://doi.org/10.1109/ICIIBMS.2017.827...
). In this context, IoT systems in the form of wireless sensor networks have been applied in animal tracking and livestock environment monitoring and other fields. IPEMA et al. (2008)IPEMA et al. The effects of automated milking and feeding on the production and behaviour of dairy cows. Japanese Journal of Applied Physics, v.30, p.627-632, 2008. Available from: < Available from: http://edepot.wur.nl/317697#page=15 >, Accessed: Nov. 12, 2017.
http://edepot.wur.nl/317697#page=15...
utilized a 433 MHz wireless sensor network to measure the pH of the stomach of dairy cows. NADIMI (2009NADIMI E. S. et al. Observer Kalman filter identification and multiple-model adaptive estimation technique for classifying animal behaviour using wireless sensor networks, Computers and Electronics in Agriculture, v.68, p.9-17, 2009. Available from: <Available from: https://doi.org/10.1016/j.compag.2009.03.006 >. Accessed: Nov. 2, 2017. doi: 10.1016/j.compag.2009.03.006.
https://doi.org/10.1016/j.compag.2009.03...
) validated the performance of a 2.4 GHz Zigbee-based wireless sensor network to measure the head movements of a herd of dairy cows. NADIMI et al. (2012)NADIMI, E. S. et al. Monitoring and classifying animal behavior using ZigBee-based mobile ad hoc wireless sensor networks and artificial neural networks. Computers and Electronics in Agriculture, v.82, p.44-54, 2012. Available from: <Available from: https://doi.org/10.1016/j.compag.2011.12.008 >. Accessed: Nov. 13, 2016. doi: 10.1016/j.compag.2011.12.008.
https://doi.org/10.1016/j.compag.2011.12...
designed a 2.4 GHz Zigbee-based mobile ad hoc wireless sensor network for monitoring the head movements of sheep.

However, no research investigated the capacity of IoT to classify cow behavior. Therefore, this study aimed to develop a complete design and specific property of a wireless measurement system for (1) continuous monitoring of the behavioral data of cows and (2) classifying cow behavior into six categories (e.g., standing, lying, normal walking, active walking, standing up, and lying down).

MATERIALS AND METHODS:

IoT-based measurement system

The IoT-based measurement system mainly comprises twelve leg tags, a wireless transceiver, and a laptop (Figure 1). The leg tags (Figure 2a) were outfitted with a tri-axial accelerometer (ADXL345, Analog Devices Inc., USA), a microprocessor (MSP430F149IMP, Texas Instruments Inc., USA), a radio frequency (RF) module (CC1101, Texas Instruments Inc., USA), and two 3.7 V lithium ion batteries (18650-2800, Delipow Ltd., China) attached as the power supply. The leg tags measured 89 mm × 60 mm × 38 mm and weighed approximately 300 g (Figure 2b). Leg tags were used to collect the tri-axial accelerometer data of cows and transmit data to the wireless transceiver. The leg tag was placed in a water-resistant plastic box to satisfy the water-proofing demands and protect it from elements and mechanical damage. Adjustable elastic straps provided a proper fit to the dimensions of the cow hind leg below the knee joint. The leg tag was positioned to ensure that the x-axis lay in the direction of vertical acceleration; the y-axis and z-axis lay parallel (forward movement) and perpendicular to the cow (Figure 2c), respectively. As the leg tag should be attached to the right hind leg of the cows, one of our objectives was to minimize its size and reduce its energy consumption as much as possible (these two goals are not entirely separate) to nullify animal discomfort and the effect of the device’s mass on measurement. The leg tag was fixed on the right hind leg of a cow, allowing for easy collection of cow motion data while preventing the cow from pressing the equipment when lying down. This placement will not hinder the cow from feeding unlike when the device is attached to the neck.

Figure 1
Behavior data acquisition and processing flow of the developed IoT-based measurement system.

Figure 2
Circuit design and coordinate system of the leg tag.

For the present project, the leg tag of interest is the accelerometer (ADXL345). ADXL345 is a typical representative of its device class; other accelerometers can be used instead with predictably similar results. The device measures acceleration along three orthogonal axes (x, y, z), which are discretized into 210 levels (per axis) in four settable ranges: 2g, 4g, 8g, and 16g. For our experiments, the range of accelerometer was set to 4g (i.e., from −4g to +4g), yielding a high resolution (3.9 mg/Least Significant Bit) that allows for measurements of less than 1.0° change in tilt angle and thus meeting the requirements for precise acquisition of the acceleration data produced by cows. A sampling frequency of 1 Hz was used for acceleration data acquisition. The digital output data were formatted as complements of 16-bit twos to facilitate data processing and made accessible through SPI (3-wire or 4-wire) or I2C digital interface.

The RF module is a low-cost sub-1 GHz transceiver designed for very-low-power wireless applications. The RF module provides extensive hardware support for packet handling, data buffering, burst transmissions, clear channel assessment, link quality indication, and wake-on radio. The main operating parameters and the 64-byte transmit/receive FIFOs of the RF module can be controlled via a serial peripheral interface (SPI) interface. In IoT-based measurement systems, the RF module was used with a microcontroller and a few additional passive components.

The wireless transceiver measured 75 mm × 48 mm × 30 mm, weighed 180 g, and was powered by an AC-DC adapter. The transceiver can communicate with leg tags at 433 MHz radio bands and send cow acceleration data to the laptop through wireless transmission. Wireless transceiver was fixed to a 2.5 m high stake within the area of the barn for high communication reliability and low packet loss rate. To improve the efficiency of network communication, a polling wireless protocol was developed (Figure 3). The communication process includes the following steps:

Figure 3
State transition of communication. State 0: The leg tag powers up; State 1: The leg tag collects acceleration data; State 2: The convergent node poll sends its address frame to the leg tag; State 3: The leg tag receives the address from the convergent node; State 4: The leg tag compares with the address frame of the convergent node; State 5: The leg tag enters the low-power mode; State 6: The leg tag sends data packet to the wireless transceiver; State 7: The leg tag enters the low-power mode, and the host address loop changes once; the address features the same flag bit to determine whether the leg tag and the convergent node address are the same (Address = 1 means the same address, Address=0 means different address).

1) Each leg tag is assigned a unique address. At the beginning of the trial, each leg tag is initialized after power up.

2) First, the wireless transceiver issues the request information to the first leg tag containing information, such as leg tag address, sequence number of the performed cycle, and time stamps. Wireless transceiver compares the address with the leg tag because the prerequisite for establishing data communication is the matching of address.

3) Suitable delay should be used to grant the master node an access period that is sufficient to perform all necessary operations on its slave nodes. Thus, after a fixed delay and address matching, the compared leg tag is considered the addressable leg tag, and the packet is transmitted to the wireless transceiver through the RF module. The wireless transceiver accesses the next leg tag and compares the address. Conversely, the previous leg tag maintains a low-power mode.

4) After successful transmission of the packet, the compared leg tag enters a low-power mode, and the wireless transceiver address changes automatically into that of the next accessed leg tag. Once the last leg tag is queried, the wireless transceiver restarts from the first one, implementing a polling cycle.

The format of the data packet sent to the wireless transceiver by the leg tag begins with a start flag (4 bytes) and ends with a cyclic redundancy check (CRC) field (2 bytes), whereas the other fields include a synchronization field (2 bytes), a packet-length field (1 byte), a source address field (1 byte), and a data field (11 bytes). The leading code is an interactive 1 and 0 sequence that was used for bit synchronization and ready to transmit data. The CRC ensures correct data transmission. The synchronization word was used to align data in transmission and determine their validity. Length of data was set to 11 bytes and expressed by the x, y, and z axes. The sensor address is the node address for sending cow data. The rate of packet transmission was 38.4 kbps.

The laptop was configured to enable users to perform post-processing of the acceleration data acquired by the leg tag. The main modules installed in the laptop include the data storage, data processing, and data display modules. The data storage module was used primarily for storage of tri-axial accelerometer data from the leg tag. Using the proposed classification algorithm, the data processing module was utilized to classify the acceleration data stored in the database into specific behavior. The data display module was used to show basic cow information, basic hardware information, and cow behavior attribute. To store the acquired information, MySQL (based on SQL client/ server mode), which is an open source relational database system most suited for small repositories, was used as the backend database.

The data processing module selects the training behavior according to user needs and interactively trains a Multi-Back Propagation (BP)-Adaptive Boosting (Ada Boost) algorithm classifier that recognizes the states of dairy cows and more specific behavior. This module can dynamically train an activity classifier using predefined behavior data and then apply this trained classification model to test the accelerometer data to automatically classify activities.

When new tri-axial accelerometer data were uploaded, the corresponding predefined behavior were extracted and introduced into the trained classifier, which automatically classified the new data. Classification results were stored in a database and displayed via the data display module for user verification. In the process, the backend program was compiled in the Jet Brains Php Storm 10.0.3 development environment using the PHP language as bottom CI framework.

The data display module (Figure 4) was developed to display the basic information of dairy cows and described them using simple data, including cow_information (e.g., id, age, weight, and sex), sensor_information (e.g., id, status, and sensor_id), and cow_tri-axial acceleration (e.g., x-axis, y-axis, z-axis, and time). In the process, the frontend program was compiled in the Web Storm 11.0.3 development environment using Java script language as the bottom React framework.

Figure 4
Data display interface of the laptop.

The laptop adopts the browser/server architecture, which features better real-time performance than the client/server architecture. Cow information was stored in the user server, resulting in high information security and stability. Users can view the cow conditions at any time and place, thus indicating the timeliness of the study. When the laptop requires an upgrade, only the pages and background programs on the server need to be updated, and upgrade on the user’s laptop system or any other changes will not affect the normal software operations.

Transmission performance analysis.

Packet loss occurs when one or more packets of data travelling across a laptop network fail to reach their destination. Packet loss is caused by errors in data transmission and was measured as a percentage of packets lost with respect to the packets sent.

In the trial, a series of communication tests with two leg tags was carried out to measure packet loss rate at a certain distance. The leg tag distances were set to 1, 15, 30, 45, 60, 75, and 90 m. Each leg tag followed a sequence of instructions to gather acceleration information and to transmit data packets to the wireless transceiver.

Animals and facility.

The trial was carried out on August 17-20, 2017 in a cow farm of Sansege Nanyang (Henan Province, China) to investigate the system performance over 3 days for 4 h per day. The barn held more than 700 Holstein cows. Cows were housed in a free-stall environment with the dimensions 150 m x 28 m, which included a feeding passage, two rows of self-locking head locks, and two rows of head-to-head stalls bedded with sand. The width of feeding passage and individual free stall is 5 m and 1.4 m respectively, and each side of the feeding passage is provided with a feed bunk with a width of 0.35 m. The barn flooring is solid concrete with automatic scrapers (Figure 5). This study selected 12 cows (parity = 3 ± 0.00, days in milk = 50.79 ± 7.80 d, milk yield = 30.15 ± 2.76 kg/d, weight = 635.26 ± 32.94 kg, mean ± S.D.), which showed no signs of severe lameness or other diseases that may affect their behavioral repertoire. To facilitate data acquisition and management, leg tags (ID1, ID2, ID3, ID12) with identification numbers were associated with cows.

Figure 5
Plan of the studied area in the barn.

A top-view panoramic image of the area of interest with a resolution of 1920×1080 pixels was obtained by the system. The video-recording system provided panoramic and rectified top-view images of the barn to obtain real dimensions of cows and cow behavior. Four video cameras were synchronized with the laptop clock, which was also synchronized with the clock timers of the leg tag. Finally, results acquired by the system were compared with those obtained from visual analyses of cow behavior from panoramic images.

Observations were recorded in a database. For each observation, the start and end times of the behavior and identification of the cow were recorded. Consequently, observation data were programmatically combined with acceleration data. The times of video recording lasted throughout the full 4 h from 10:00 AM to 2:00 PM to monitor each cow involved in all activities (standing, lying, normal walking, active walking, standing up, and lying down). The video was downloaded onto the laptop, and visual analyses were performed by 3 skilled operators to avoid a risk for bias and assure accuracy of the recorded behavior.

Observations were made according to the definitions of 6 different behavior categories (Table 1). Active and inactive behavior can be specifically classified according to the movement of cow’s legs. Active behaviors mean that cow has significant and continuous leg movements, such as lying down, standing up, normal walking and active walking. Inactive behaviors indicated that cow has little or no movement of legs accordingly, including lying and standing. Acceleration and digital video data were simultaneously recorded in the database, regardless of whether the cow was already performing the behavior or had only just begun. Subsequently, accelerometer measurements were programmatically integrated with the video data.

Table 1
Descriptions of the registered behavior.

Classification algorithms

The Ada Boost (Adaptive Boosting) algorithm was applied in cow behavior recognition in this study. Ada Boost was developed by Freund and Schapire (1996). The advantages of Ada Boost included low memory and computational requirements. Ada Boost is a classifier ensemble algorithm composed of a finite number of weak learners. A weak learner (e.g., single-level decision tree or simple neural networks) is a simple, fast, and easy to implement classifier whose classification accuracy may be only slightly better than a random guess (GABER et al., 2016GABER, T. et al. Biometric cattle identification approach based on Weber’s Local Descriptor and AdaBoost classifier. Computers and Electronics in Agriculture,v.122, p.55-66, 2016. Available from: <Available from: https://doi.org/10.1016/j.compag.2015.12.022 >,Accessed: Nov. 24, 2017. doi: 10.1016/j.compag.2015.12.022.
https://doi.org/10.1016/j.compag.2015.12...
). The main idea of an Ada Boost classifier is to individually train weak learners and combine their decisions to make a final one. Thus, the powerful pattern classification capacity of Ada Boost algorithm is formed through iteratively combining the performances of weak learners to build a strong classifier whose performance is better than any of the individual weak classifiers (MATHANKER et al., 2011MATHANKER S. K., WECKLER P. R., et al. AdaBoost classifiers for pecan defect classification. Computers and Electronics in Agriculture, v.177, p.60-68, 2011. Available from: <Available from: https://doi.org/ 10.23919/ISTAFRICA.2017.8102356 >. Accessed: Nov. 28, 2017. doi: 10.23919/ISTAFRICA.2017.8102356
https://doi.org/ 10.23919/ISTAFRICA.2017...
).

The selected Ada Boost algorithm was programmed by combining a multi-class BP (Back Propagation) neural network with the algorithm of Stage wise Additive Modeling using Multi-class Exponential loss function algorithm to construct a strong classifier, which is hereafter called the Multi-BP-Ada Boost algorithm. In the Ada Boost algorithm, the BP neural network serves as the weak learner for predicting sample output through iterative training. The Multi-BP-Ada Boost algorithm was also optimized in terms of the number of iterations. To maximize classification accuracy, 30 training runs were performed to optimize the number of iterations. Algorithm 1 summarizes the steps of Multi-BP-Ada Boost algorithm.

Algorithm 1. multi-BP-ada boost algorithm.

Input: The training set T=p1,q1,,pN,qN where pipi P R3represents the three-axis acceleration data, refers to the matching behavior class, P expresses the training set containing 6 types of cow behavior activities, and N denotes the total number of samples in the training set.

Output: The Ada Boost classifier G(p).

1) Initialize the parameters of the Multi-BP-Ada Boost algorithm, the number of iterations (L), and the weight () of each training sample, where ωli is formally expressed as . ω1i=1N,i=1,L,N

2)for m=1 to L do.

3)Train the training set samples to obtain the BP weak classifier as follows: Glp:PK=1,2,L,6, where K is the set of classification results, and the value range of K from 1 to 6, representing standing, lying, normal walking, active walking, standing up, and lying down respectively.

4)Compute the error rate of classifier in each iteration as follows: errl=i=1Nωli×IGlpiqi. I indicates that when the condition in parentheses is satisfied, the assignment is 1; otherwise, the assignment is 0.

5) Compute the coefficient of as follows: al=12log1-errlerrl+logK-1.

6) Update the weights of training samples to be used in the next iteration (l+1) as follows: ωi+1,i=ωlii=1Nωliexp-alqiGlpiexp-alqiGlpi, .

7) end.

8) Output the final classifier as follows, Gp=signl=1LalGlp. Sign is applied to take the integer portion of l=1LalGlp and use that as the result of behavior recognition defined in set K.

Data analysis

The classification results were presented in the form of a confusion matrix that lists the number of cases that have been correctly identified as positive (the modeled behavior) and negative (other behavior). Negative samples that were misclassified as positive, and vice versa, were called false positives and false negatives, respectively. The performance of the algorithm was evaluated based on four indicator parameters, namely, accuracy, specificity, sensitivity, precision, and bootstrapped statistics (mean ± (S.D.)). Indicators (accuracy, specificity, sensitivity, and precision) are defined as follows:

Accuracy=TP+TNTP+TN+FN+FP×100%(1)

Specificity=TNTN+FP×100%(2)

Sensitivity=TPTP+FN×100%(3)

Precision=TPTP+FP×100%(4)

where TP is the number of instances where the behavioral state of interest was correctly classified after validation by the videos. The FN is the number of instances where the behavioral state of interest was visually observed but was incorrectly classified as other behavior. The FP is the number of instances where the behavioral state of interest was incorrectly classified but not observed. The TN is the number of instances where the behavioral state of interest was correctly classified but not observed.

RESULTS:

Figure 6 shows the current used by the circuit during measurement and transmission cycle with two consecutive resistance measurements. From the perspective of power consumption (current drain), the different components of the leg tag can be treated additively. Therefore, the combined drain is the sum of contributions from these modules.

Figure 6
Current consumption during one measurement and transmission cycle.

Power on (1), resistance measurement (2), acceleration measurement (3), carrier sense (4), transmission (5), and power off (6). (A) indicates the end of acceleration measurement. Most of the current consumption between (A) and (4) is related to initialization of the transmission circuit. Resistance measurement (2) consists of open- and short-circuit calibration followed by measurements of the two electrode pairs, that is, four consecutive measurements.

CPU: Normally, when the program is idle and awaiting an event, the current drain by the CPU approximates 1.5 mA. The current may increase (up to approximately 3 mA) when the CPU is engaged in computation (spinning in a tight loop).

Accelerometer: When dormant, the sensor drains no current. When operating at full capacity, the accelerometer drains approximately 6 mA. Acceleration measurement consumes very little power and shows no significant contribution to current measurement.

RF transceiver: When switched off, the module drains no current. When the receiver is switched on (listening for an incoming packet), the RF transceiver drains approximately 26 mA. Figure 6 shows that the transmission of the RF transceiver was one of the main power-consuming action.

The probe was powered by two series-connected 18650 lithium batteries with a capacity of approximately 2800×2 mA h. In this study, cow behavior was successfully identified using a measurement interval of 1 s, which corresponds to roughly 60 days of use. The practical lifetime should be slightly shorter due to the non-zero (but still very small) sleep current and battery self-discharge, but the device will sustain the entire data acquisition period of the cow without needing battery replacement, operating wirelessly under zero maintenance.

Packet loss resulted from intermittent communication due to poor connectivity with the transceiver, presence of obstacles as an interferer, and general unreliability in the communication channels. As shown in Figure 7, in the 45 m transmission distance, packet loss rate was lower than 2%; when the distance reached beyond 60 m, the packet loss rate increased rapidly, and the environment exhibited signal interference in the larger shielding and communication link transmission of the transition zone; signal instability led to the increase in packet loss rate. During node data transmission in the distance of 90 m, packet loss rate measured no more than 5% and can meet the needs of the system.

Figure 7
Results of communication packet loss rate test.

Table 2 presents the composition of behavior observations stored in the database. Owing to accidental network delay and data packet loss, several observations were removed in the training phase.

Table 2
Composition of behavior observations.

After omitting the missing values, data samples were obtained using a time window of 5 s (equivalent to five data samples). Observations shorter than 5 s were not applied in the training and performance evaluation of the modeling process. This action dramatically decreased the number of lying-down and standing-up observations. Data samples were randomly divided into training and testing data. A total of 70% of the data (9140 sets) were selected as the training data set, and the remaining 30% (3917 sets) was used as the test data set.

Table 3 illustrates the confusion matrix of the Multi-BP-Ada Boost classification algorithm. As shown in Table 3, 833 standing, 829 lying, 485 normal walking, 472 active walking, 263 standing up, and 224 lying down behavior were correctly classified. Standing and lying behavior were classified correctly to a high degree but with misclassifications of other behaviors. Normal walking was mainly misclassified as either standing, lying, or active walking (21.27% of the cases). Active walking was misclassified most often (18.11% of the cases) as standing or normal walking. Standing up and lying down were mostly confused with each other (13.42% and 12.57% of the cases, respectively).

Table 3
Confusion matrix obtained for classification of dairy cow behavior with the Multi-BP-Ada Boost classification algorithm.

The overall performance of the Multi-BP-Ada Boost classification algorithm model was reasonable (Table 4).The accuracy exceeded 90% for all the classified behavior categories. The specificity of normal walking reached 96.98%, indicating that samples were more easily misclassified as normal walking than the other five classes. Sensitivity was good for all behavior patterns except standing up and lying down, with a maximum of 87.23% for standing. The best precision was achieved for standing, lying, and normal walking. The precision for active walking classifications was slightly lower but substantially better than those for standing up and lying down.

Table 4
Statistical performance (mean ± S.D.) of the Multi-BP-Ada Boost algorithm for all behavior ategories.

DISCUSSION:

The automatic detection of changes in cow behavior can be applied as the input to warning systems which alert the farmer when some health problem (e.g., lameness) or a particular physiological status (e.g., estrus). Several studies have carried out to recognize cow behavior by developing systems in the field of precision livestock farming. However, many of these systems are suited to distinguish only one or two behavior patterns or activity states (BORCHERS et al., 2016BORCHERS, M. R. et al. A validation of technologies monitoring dairy cow feeding, ruminating, and lying behaviors. Journal of Dairy Science, v.999, p.7458-7466, 2016. Available from: <Available from: https://doi.org/10.3168/jds.2015-10843 >. Accessed: Nov. 3, 2017. doi:10.3168/jds.2015-10843.
https://doi.org/10.3168/jds.2015-10843...
; NADIMI et al., 2009NADIMI E. S. et al. Observer Kalman filter identification and multiple-model adaptive estimation technique for classifying animal behaviour using wireless sensor networks, Computers and Electronics in Agriculture, v.68, p.9-17, 2009. Available from: <Available from: https://doi.org/10.1016/j.compag.2009.03.006 >. Accessed: Nov. 2, 2017. doi: 10.1016/j.compag.2009.03.006.
https://doi.org/10.1016/j.compag.2009.03...
).

In this research, the implementation of an IoT-based measurement system to objectively monitor and classify six categories of behavior by measuring both active and inactive activities can provide a useful aid to assess cow health and welfare. The leg tag equipped with a tri-axial accelerometer and a RF module supply a non-invasive, objective measure method for cow behavior. Compared with the measurement system using Bluetooth technology (RAYAS-AMOR et al., 2017RAYAS-AMOR, A. A. et al. Triaxial accelerometers for recording grazing and ruminating time in dairy cows: An alternative to visual observations. Journal of Veterinary Behavior-Clinical Applications and Research, v.20, p.102-108, 2017. Available from: <Available from: https://doi.org/10.1016/j.jveb.2017.04.003 >. Accessed: Jun. 3, 2018. doi: 10.1016/j.jveb.2017.04.003.
https://doi.org/10.1016/j.jveb.2017.04.0...
), the developed system has the advantage of real-time movement data acquisition. Moreover, the system working at 433 MHz has stronger diffraction ability, receiver sensitivity and lower power consumption (Figure 6), comparing with some 2.4 GHz detection system (NADIMI et al., 2012NADIMI, E. S. et al. Monitoring and classifying animal behavior using ZigBee-based mobile ad hoc wireless sensor networks and artificial neural networks. Computers and Electronics in Agriculture, v.82, p.44-54, 2012. Available from: <Available from: https://doi.org/10.1016/j.compag.2011.12.008 >. Accessed: Nov. 13, 2016. doi: 10.1016/j.compag.2011.12.008.
https://doi.org/10.1016/j.compag.2011.12...
). Meanwhile, wireless communication architecture of the system with expansion capacity allows each wireless transceiver to communicate with up to 255 leg tags. Large-scale applications can be realized by deploying multiple wireless transceivers in the future. However, sampling delay of the system will inevitably rise with the increase of the number of leg tags. At present, the proposed system has only realized activity data collection and behavior classification, and continues to establish the quantitative relationship between the changes in the duration of various behavior patterns and different diseases. More cows need to be enrolled and long-term test is required. The next step in the development of this system is to test large scale deployment. Once the functionality and reliability has been confirmed on a larger scale through continuous improvement of system, commercialization is possible.

In this study, we developed a Multi-BP-Ada Boost classification algorithm to distinguish behaviors in the proposed system. Accuracy and specificity measures were excellent for all classes of behavior, as well as for the overall classification performance. The statistical performance of Multi-BP-Ada Boost algorithm addressed in Table 4, was obviously higher than the previous studies (MARTISKAINEN et al., 2009MARTISKAINEN, P. et al. Cow behaviour pattern recognition using a three-dimensional accelerometer and support vector machines. Applied Animal Behaviour Science, v.119, p.32-38, 2009. Available from: <Available from: https://doi.org/10.1016/j.applanim.2009.03.005 >. Accessed: Nov. 11, 2017. doi: 10.1016/j.applanim.2009.03.005.
https://doi.org/10.1016/j.applanim.2009....
) in both sensitivity and precision values for standing, lying, standing up, and lying down. The sensitivity and precision of classifying the four behaviors increased by an average of 19.30 and 31.51 percentage points, respectively. Acceleration data of a leg-mounted sensor are purer and more intuitive to demonstrate cow activities than those of a neck-mounted sensor, which may be the most likely reason for this result. Moreover, compared with SVM, the mixed classification method can strengthen the identification ability. However, there were more misclassifications of standing up as lying down than vice versa, and since there were also less samples of the two behaviors in our data, it lowered the distinguishing performance considerably compared to other well predicted behavior patterns. In addition, standing up and lying down have significant similarity in data characteristics, which directly lead to the confusion in behavior identification. Using an IoT-based measurement system, we are able to discriminate more types of behavior than the monitoring system reported by ARCIDIACONO et al (2017ARCIDIACONO, C. et al. A threshold-based algorithm for the development of inertial sensor-based systems to perform real-time cow step counting in free-stall barns. Biosystems Engineering, v.153, p.99-109, 2017. Available from: <Available from: https://doi.org/10.1016/j.biosystemseng.2016.11.003 >. Accessed: May, 11, 2018. doi: 10.1016/j.biosystemseng.2016.11.003.
https://doi.org/10.1016/j.biosystemseng....
). Meanwhile, verifying of standing (87.23% sensitivity, 83.38% precision) and lying (86.26%, 86.17%) in our system compares well to the figures for their decision-tree algorithm. Further trials and analysis are necessary to reliably differentiate the repertoire of behaviors.

CONCLUSION:

In this study, an IoT-based measurement system for monitoring cow behavior was successfully designed and implemented. The system-specific software versions were suitable and exhibited high performance for behavior classification. The key advantage of the system is its assembly using low-cost components, which were fixed to the legs of the cows. The deployment of twelve leg tags and a wireless transceiver ensured network connectivity, and the master-slave polling wireless protocol resulted in high communication reliability. The Multi-BP-Ada Boost algorithm provided reliable estimates of cow behavior. Results of the study showed that the system is a viable solution to behavior recognition in dairy cows.

ACKNOWLEDGEMENTS

The authors would like to thank the Sansege farm for providing the conditions for carrying out the trial and allowing the installation of equipment.

REFERENCES

  • 0
    CR-2018-0627.R2
  • BIOETHICS AND BIOSSECURITY COMMITTEE APPROVAL

    All animals were kept in a pathogen-free environment and fed naturally. The procedures for care and use of animals were approved by the Ethics Committee of the Henan University of Science and Technology, Luoyang, China. All experimental procedures were conducted in conformity with institutional guidelines for the care and use of laboratory animals in Henan University of Science and Technology, and conformed to the National Institutes of Health Guide for Care and Use of Laboratory Animals (NIH Pub. No. 85-23, revised 1996).

Publication Dates

  • Publication in this collection
    13 June 2019
  • Date of issue
    2019

History

  • Received
    05 Aug 2018
  • Accepted
    26 Mar 2019
  • Reviewed
    24 Apr 2019
Universidade Federal de Santa Maria Universidade Federal de Santa Maria, Centro de Ciências Rurais , 97105-900 Santa Maria RS Brazil , Tel.: +55 55 3220-8698 , Fax: +55 55 3220-8695 - Santa Maria - RS - Brazil
E-mail: cienciarural@mail.ufsm.br