Evaluation of the Efficiency of Machine Learning Algorithms for Identification of Cattle Behavior Using Accelerometer and Gyroscope Data
Abstract
:1. Introduction
2. Materials and Methods
2.1. Experimental Setup and Means of the Investigation
2.2. Data Collection and Data Analysis
2.3. Classification Methodology
2.3.1. Data Collection and Preparation
- data collection from the sensors
- data storage in the database
- data extraction (from a database to a CSV file suitable for further classification)
- data cleaning consisting of removing rows with only zeros, duplicate rows, and ping rows (rows with zero data, used for pinging from the sensors to the server)
- data transformation, consisting of two subprocesses—resampling the data and finding and removing the outliers in the resampled data.
2.3.2. Feature Engineering and Selection
2.3.3. Model Training
- x and y are feature vectors of size n
- is a free parameter trading off the influence of higher-order and lower-order items in the polynomial
- d is the degree.
3. Results and Discussion
3.1. Data Resampling
- A high imbalance exists between the three classes for both sensors which can affect negatively the performance and results. While options for artificial handling of the imbalance exist, they are not entirely applicable in the current state of the dataset
- The accelerometer provided more sample groups for the classes “Standing and Ruminating” and “Laying and Ruminating”, compared to the gyroscope
- The number of sample groups for the class “Standing and Eating” is approximately equal for the two sensors.
3.2. Outlier Detection
3.3. Class Distribution and Class Borders
3.4. Model Training and Result Metrics
4. Conclusions and Future Work
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- The World Counts. Available online: https://www.theworldcounts.com/challenges/consumption/foods-and-beverages/world-consumption-of-meat (accessed on 1 November 2023).
- da Silva Santos, A.; de Medeiros, V.W.C.; Gonçalves, G.E. Monitoring and classification of cattle behavior: A survey. Smart Agric. Technol. 2023, 3, 100091. [Google Scholar] [CrossRef]
- Rodriguez-Baena, D.S.; Gomez-Vela, F.A.; García-Torres, M.; Divina, F.; Barranco, C.D.; Daz-Diaz, N.; Jimenez, M.; Montalvo, G. Identifying livestock behavior patterns based on accelerometer dataset. J. Comput. Sci. 2020, 41, 101076. [Google Scholar] [CrossRef]
- Robert, B.; White, B.J.; Renter, D.G.; Larson, R.L. Evaluation of three-dimensional accelerometers to monitor and classify behavior patterns in cattle. Comput. Electron. Agric. 2009, 67, 80–84. [Google Scholar] [CrossRef]
- Bernabucci, U.; Bifani, S.; Buggiotti, L.; Vitali, A.; Lacetera, N.; Nardone, A. The efects of heat stress in Italian Holstein dairy cattle. J. Dairy Sci. 2014, 97, 471–486. [Google Scholar] [CrossRef] [PubMed]
- Riaboff, L.; Aubin, S.; Bédère, N.; Couvreur, S.; Madouasse, A.; Goumand, E.; Chauvin, A.; Plantier, G. Evaluation of pre-processing methods for the prediction of cattle behaviour from accelerometer data. Comput. Electron. Agric. 2019, 165, 104961. [Google Scholar] [CrossRef]
- Becciolini, V.; Ponzetta, M. Inferring behaviour of grazing livestock: Opportunities from GPS telemetry and activity sensors applied to animal husbandry. In Proceedings of the 17th International Scientific Conference Engineering for Rural Development, Jelgava, Latvia, 23–25 May 2018; pp. 192–198. [Google Scholar]
- Berckmans, D. Precision livestock farming technologies for welfare management in intensive livestock systems. Rev. Sci. Tech. 2014, 33, 189–196. [Google Scholar] [CrossRef] [PubMed]
- EFSA Panel on Animal Health and Animal Welfare (AHAW); Nielsen, S.S.; Alvarez, J.; Bicout, D.J.; Calistri, P.; Canali, E.; Drewe, J.A.; Garin-Bastuji, B.; Rojas, J.L.G.; Schmidt, C.G.; et al. Welfare of dairy cows. EFSA J. 2023, 21, e07993. [Google Scholar] [PubMed]
- Defra. Code of Recommendations for the Welfare of Livestock: Cattle; Defra Publications: London, UK, 2003. [Google Scholar]
- Grant, R.J.; Dann, H.M. Biological Importance of Rumination and Its Use On-Farm. Cornell Nutrition Conference, Cornell University, 2015. Available online: https://hdl.handle.net/1813/41226 (accessed on 1 November 2023).
- Paudyal, S. Using rumination time to manage health and reproduction in dairy cattle: A review. Vet. Q. 2021, 41, 292–300. [Google Scholar] [CrossRef] [PubMed]
- Wadhwani, K.N.; Thakkar, N.K.; Islam, M.M.; Lunagariya, P.M.; Patel, J.H. Rumination Assessment: A Managemental Tool for Dairy Cattle. Indian J. Anim. Prod. Manag. 2023, 37, 88–101. [Google Scholar] [CrossRef]
- Beauchemin, K.A. Invited review: Current perspectives on eating and rumination activity in dairy cows. J. Dairy Sci. 2018, 101, 4762–4784. [Google Scholar] [CrossRef]
- Leiber, F.; Moser, F.N.; Ammer, S.; Probst, J.K.; Baki, C.; Spengler Neff, A.; Bieber, A. Relationships between dairy cows’ chewing behavior with forage quality, progress of lactation and efficiency estimates under zero-concentrate feeding systems. Agriculture 2022, 12, 1570. [Google Scholar] [CrossRef]
- Byskov, M.V.; Nadeau, E.; Johansson BE, O.; Nørgaard, P. Variations in automatically recorded rumination time as explained by variations in intake of dietary fractions and milk production, and between-cow variation. J. Dairy Sci. 2015, 98, 3926–3937. [Google Scholar] [CrossRef] [PubMed]
- Siivonen, J.; Taponen, S.; Hovinen, M.; Pastell, M.; Lensink, B.J.; Pyörälä, S.; Hänninen, L. Impact of acute clinical mastitis on cow behaviour. Appl. Anim. Behav. Sci. 2011, 132, 101–106. [Google Scholar] [CrossRef]
- Soriani, N.; Trevisi, E.; Calamari, L. Relationships between rumination time, metabolic conditions, and health status in dairy cows during the transition period. J. Anim. Sci. 2012, 90, 4544–4554. [Google Scholar] [CrossRef] [PubMed]
- Beaver, A.; Proudfoot, K.L.; von Keyserlingk, M.A. Symposium review: Considerations for the future of dairy cattle housing: An animal welfare perspective. J. Dairy Sci. 2020, 103, 5746–5758. [Google Scholar] [CrossRef]
- Varlyakov, I.; Slavov, T.; Grigorova, N. Ethological evaluation of a building for free housing of dairy cows. II. Behavioural activities in the winter. Agric. Sci. Technol. 2010, 2, 14–21. [Google Scholar]
- Varlyakov, I.; Penev, T.; Mitev, J.; Miteva, T.; Uzunova, K.; Gergovska, Z. Effect of lameness on the behaviour of dairy cows under intensive production systems. Bulg. J. Agric. Sci. 2012, 18, 126–133. [Google Scholar]
- Norring, M.; Valros, A. The effect of lying motivation on cow behaviour. Appl. Anim. Behav. Sci. 2016, 176, 1–5. [Google Scholar] [CrossRef]
- Rushen, J.; Chapinal, N.; de Passilé, A.M. Automated monitoring of behavioural-based animal welfare indicators. Anim. Welf. 2012, 21, 339–350. [Google Scholar] [CrossRef]
- Sammad, A.; Wang, Y.J.; Umer, S.; Lirong, H.; Khan, I.; Khan, A.; Ahmad, B.; Wang, Y. Nutritional Physiology and Biochemistry of Dairy Cattle under the Influence of Heat Stress: Consequences and Opportunities. Animals 2020, 10, 793. [Google Scholar] [CrossRef]
- Carabaño, M.J.; Ramón, M.; Menéndez-Buxadera, A.; Molina, A.; Díaz, C. Selecting for heat tolerance. Anim. Front. 2019, 9, 62–68. [Google Scholar] [CrossRef] [PubMed]
- Smith, D.; Little, B.; Greenwood, P.I.; Valencia, P.; Rahman, A.; Ingham, A.; Bishop-Hurley, G.; Shahriar, S.; Hellicar, A. A study of sensor derived features in cattle behaviour classification models. In Proceedings of the 2015 IEEE SENSORS, Busan, Republic of Korea, 1–4 November 2015; pp. 1–4. [Google Scholar]
- Bouten, C.V.C.; Koekkoek, K.T.M.; Verduin, M.; Kodde, R.; Janssen, J.D. A triaxial accelerometer and portable data processing unit for the assessment of daily physical activity. IEEE Trans. Biomed. Eng. 1997, 44, 136–147. [Google Scholar] [CrossRef] [PubMed]
- Mathie, M.J. Monitoring and Interpreting Human Movement Patterns Using a Triaxial Accelerometer. Ph.D. Thesis, UNSW Sydney, Sydney, Australia, 2003. [Google Scholar]
- Karantonis, D.M.; Narayanan, M.R.; Mathie, M.; Lovell, N.H.; Celler, B.G. Implementation of a real-time human movement classifier using a triaxial accelerometer for ambulatory monitoring. IEEE Trans. Inf. Technol. Biomed. 2006, 10, 156–167. [Google Scholar] [CrossRef] [PubMed]
- Fida, B.; Bernabucci, I.; Bibbo, D.; Conforto, S.; Schmid, M. Pre-processing effect on the accuracy of event-based activity segmentation and classification through inertial sensors. Sensors 2015, 15, 23095–23109. [Google Scholar] [CrossRef] [PubMed]
- Barwick, J.; Lamb, D.W.; Dobos, R.; Welch, M.; Trotter, M. Categorising sheep activity using a tri-axial accelerometer. Comput. Electron. Agric. 2018, 145, 289–297. [Google Scholar] [CrossRef]
- Martiskainen, P.; Järvinen, M.; Skön, J.-P.; Tiirikainen, J.; Kolehmainen, M.; Mononen, J. Cow behaviour pattern recognition using a three-dimensional accelerometer and support vector machines. Appl. Anim. Behav. Sci. 2009, 119, 32–38. [Google Scholar] [CrossRef]
- Rajapriya, R.; Rajeswari, K.; Thiruvengadam, S.J. Deep learning and machine learning techniques to improve hand movement classification in myoelectric control system. Biocybern. Biomed. Eng. 2021, 41, 554–571. [Google Scholar]
- Evstatiev, B.I.; Valov, N.P.; Kadirova, S.Y.; Nenov, T.R. Implementation of a Prototype IoT-Based System for Monitoring the Health, Behavior and Stress of Cows. In Proceedings of the 2022 IEEE 9th Electronics System-Integration Technology Conference (ESTC), Sibiu, Romania, 13–16 September 2022; pp. 77–81. [Google Scholar] [CrossRef]
- Van Rossum, G.; Drake, F.L., Jr. Python Reference Manual; Centrum voor Wiskunde en Informatica: Amsterdam, The Netherlands, 1995. [Google Scholar]
- Pedregosa, F.; Varoquaux, G.; Gramfort, A.; Michel, V.; Thirion, B.; Grisel, O.; Blondel, M.; Prettenhofer, P.; Weiss, R.; Dubourg, V.; et al. Scikit-learn: Machine Learning in Python. J. Mach. Learn. Res. 2011, 12, 2825–2830. [Google Scholar]
- McKinney, W. Data structures for statistical computing in python. In Proceedings of the 9th Python in Science Conference, Austin, TX, USA, 28 June–3 July 2010; Volume 445. [Google Scholar]
- Harris, C.R.; Millman, K.J.; van der Walt, S.J.; Gommers, R.; Virtanen, P.; Cournapeau, D.; Wieser, E.; Taylor, J.; Berg, S.; Smith, N.J.; et al. Array programming with NumPy. Nature 2020, 585, 357–362. [Google Scholar] [CrossRef]
- Smith, D.; Rahman, A.; Bishop-Hurley, G.J.; Hills, J.; Shahriar, S.; Henry, D.; Rawnsley, R. Behavior classification of cows fitted with motion collars: Decomposing multi-class classification into a set of binary problems. Comput. Electron. Agric. 2016, 131, 40–50. [Google Scholar] [CrossRef]
- Benaissa, S.; Tuyttens, F.A.; Plets, D.; Cattrysse, H.; Martens, L.; Vandaele, L.; Joseph, W.; Sonck, B. Classification of ingestive-related cow behaviours using RumiWatch halter and neck-mounted accelerometers. Appl. Anim. Behav. Sci. 2019, 211, 9–16. [Google Scholar] [CrossRef]
- Valova, I.; Mladenova, T. An Information System for Livestock and Pasture Surveillance. In Proceedings of the 13th National Conference with International Participation, ELECTRONICA, Sofia, Bulgaria, 19–20 May 2022; pp. 1–4. [Google Scholar] [CrossRef]
- Ben-Gal, I. Outlier Detection. In Data Mining and Knowledge Discovery Handbook; Springer: Berlin/Heidelberg, Germany, 2006; pp. 131–146. [Google Scholar] [CrossRef]
- Singh, K.; Upadhyaya, S. Outlier Detection: Applications and Techniques. Int. J. Comput. Sci. Issues 2012, 9, 307–323. Available online: https://www.proquest.com/openview/08b675f647e808f41d65e964df5b52f4/1?pq-origsite=gscholar&cbl=55228 (accessed on 1 November 2023).
- Liu, F.T.; Ting, K.M.; Zhou, Z.-H. Isolation Forest. In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining, Pisa, Italy, 15–19 December 2008; pp. 413–422. [Google Scholar] [CrossRef]
- Zhao, Y.; Nasrullah, Z.; Li, Z. PyOD: A Python Toolbox for Scalable Outlier Detection. J. Mach. Learn. Res. 2019, 20, 1–7. [Google Scholar]
- Brownlee, J. Ensemble Learning Algorithms with Python: Make Better Predictions with Bagging, Boosting, and Stacking; Machine Learning Mastery: Vermont, Australia, 2021. [Google Scholar]
- Kuhn, M.; Johnson, K. Applied Predictive Modeling; Springer: Berlin/Heidelberg, Germany, 2013; Volume 26. [Google Scholar]
- Witten, D.; James, G. An Introduction to Statistical Learning with Applications in R; Springer Publication: Berlin/Heidelberg, Germany, 2013. [Google Scholar]
- Berrar, D. Bayes’ theorem and naive Bayes classifier. Encycl. Bioinform. Comput. Biol. ABC Bioinform. 2018, 403, 412. [Google Scholar]
- Valverde-Albacete, F.J.; Peláez-Moreno, C. 100% classification accuracy considered harmful: The normalized information transfer factor explains the accuracy paradox. PLoS ONE 2014, 9, e84217. [Google Scholar]
Behavior | Description | Photo | Database ID (Label) |
---|---|---|---|
Standing and eating | The cow is standing and actively eating grass or hay, which is characterized by frequent head movements. | 3 | |
Standing and ruminating | The cow is standing and ruminating, which is characterized by frequent bites, without vertical changes in the head position. | 1 | |
Laying and ruminating | The animal is ruminating while laying. | 5 |
Algorithm | Parameters |
---|---|
Random Forest Ensemble | Features per Split = 6 (Equation (4)), Depth = 10, Number of Trees = 1000 |
Decision Tree | Criterion = Entropy |
Support Vector Machines | Kernel = Polynomial, C Parameter = 10, Gamma = 0.1, Degree = 5, Class Weight = Balanced |
Naïve Bayes | Multinomial NB, alpha = 1 |
Class | Accelerometer | Gyroscope | ||||
---|---|---|---|---|---|---|
1s | 3s | 5s | 1s | 3s | 5s | |
Standing and Eating | 7675 | 2675 | 1617 | 6824 | 2484 | 1553 |
Standing and Ruminating | 3837 | 1304 | 782 | 970 | 368 | 246 |
Laying and Ruminating | 5376 | 1855 | 1132 | 805 | 319 | 212 |
Authors | ML Algorithms | Sensor | Placement | Target | Data Binning | Total # of Feature | Accuracy |
---|---|---|---|---|---|---|---|
[4] | Decision Trees | accelerometers | Right rear limb | Laying, standing, walking | 3, 5, 10s | 7 | Lying—98%, walking—67.8% |
[6] | Decision Trees | accelerometer | collar | Grazing, walking, laying, standing | 3s, 5s, 10s, 20s and 30s | 61 | 20s and 30s—95% |
[32] | Support Vector Machines | accelerometer | collar | Standing, laying, ruminating, feeding, normal walking, lame walking, laying down, standing up | 10s | 9 | Standing = 87% Laying = 84% Ruminating = 92% Feeding = 96% normal walking = 99% lame walking = 98% laying down = 100% standing up = 100% |
[33] | Deep Neural Network, Artificial Neural Network, Linear Discriminant Analysis, Support Vector Machines, KNN, Decision Trees, Naïve Bayes | EMG sensors on people | limbs | Human body movements | 5s | N/A | DNN—82% ANN—82% LDA—84% SVM—82% KNN—76% DT—75% NB—69% |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Mladenova, T.; Valova, I.; Evstatiev, B.; Valov, N.; Varlyakov, I.; Markov, T.; Stoycheva, S.; Mondeshka, L.; Markov, N. Evaluation of the Efficiency of Machine Learning Algorithms for Identification of Cattle Behavior Using Accelerometer and Gyroscope Data. AgriEngineering 2024, 6, 2179-2197. https://doi.org/10.3390/agriengineering6030128
Mladenova T, Valova I, Evstatiev B, Valov N, Varlyakov I, Markov T, Stoycheva S, Mondeshka L, Markov N. Evaluation of the Efficiency of Machine Learning Algorithms for Identification of Cattle Behavior Using Accelerometer and Gyroscope Data. AgriEngineering. 2024; 6(3):2179-2197. https://doi.org/10.3390/agriengineering6030128
Chicago/Turabian StyleMladenova, Tsvetelina, Irena Valova, Boris Evstatiev, Nikolay Valov, Ivan Varlyakov, Tsvetan Markov, Svetoslava Stoycheva, Lora Mondeshka, and Nikolay Markov. 2024. "Evaluation of the Efficiency of Machine Learning Algorithms for Identification of Cattle Behavior Using Accelerometer and Gyroscope Data" AgriEngineering 6, no. 3: 2179-2197. https://doi.org/10.3390/agriengineering6030128
APA StyleMladenova, T., Valova, I., Evstatiev, B., Valov, N., Varlyakov, I., Markov, T., Stoycheva, S., Mondeshka, L., & Markov, N. (2024). Evaluation of the Efficiency of Machine Learning Algorithms for Identification of Cattle Behavior Using Accelerometer and Gyroscope Data. AgriEngineering, 6(3), 2179-2197. https://doi.org/10.3390/agriengineering6030128