Research on Six-Axis Sensor-Based Step-Counting Algorithm for Grazing Sheep
Abstract
:1. Introduction
2. Materials and Methods
2.1. Experimental Site
2.2. Experimental Equipment and Data Acquisition
2.3. Technology Line
2.4. Data Processing
2.5. Peak and Valley Window Detection
2.6. Behavior Detection
2.6.1. Running Behavior Recognition
Algorithm 1: Running behavior step counting |
Peak: Peak data Valley: Valley data peak_i: Index of peak data in the original data run: Running behavior window. count: Running behavior steps. 1:tab1 = 0 2:tab2 = 0 3: while i < len(peak): 4: if peak[i] > 30: 5: tab1 = i 6: index1 = peak_i[i] 7: for j in range (i, len(peak)): 8: if peak[j] < 20 or peak[j] < 12: 9: Tab2 = j 10: index2 = peak_i[j] 11: For k in [I, j]: 12: if peak[k] − valley[k] < peak[k] − 20: 13: run = index2 − index1 14: count = (run/29) × 2.1 |
2.6.2. Leg-Shaking Behavior Recognition
Algorithm 2: Leg shaking behavior step counting |
Peak: Peak data Valley: Valley data xrad: x-axis angular velocity data Count1: Shaking leg behavior steps 1: while i < len(peak): 2: if peak[i] > 12: 3: index1 = i 4: for j in range (i, len(peak)): 5: if peak[j] < 12: 6: for k in [i, j]: 7: if peak[k] > 39: 8: break 9: else 10: if peaks[k] − Valley[k] < peaks[k] − 12: 11: index2 = j 12: if var(xrad[i: j]) > 10: 13: count1 = index2 − index1 |
3. Results
4. Discussion
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Trotter, M.; Falzon, G.; Dobos, R.C.; Lamb, D. Developing a Simple Accelerometer Based Grazing Sensor. In Proceedings of the 29th Biennial Conference of the Australian Society of Animal Production, Christchurch, New Zealand, 2–5 July 2012; Australian Society of Animal Production (ASAP): Roseworthy, Australia, 2012. [Google Scholar]
- Gu, F.; Khoshelham, K.; Shang, J.; Yu, F.; Wei, Z. Robust and Accurate Smartphone-Based Step Counting for Indoor Localization. IEEE Sens. J. 2017, 17, 3453–3460. [Google Scholar] [CrossRef]
- Kang, X.; Huang, B.; Qi, G. A Novel Walking Detection and Step Counting Algorithm Using Unconstrained Smartphones. Sensors 2018, 18, 297. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Brajdic, A.; Harle, R. Walk detection and step counting on unconstrained smartphones. In Proceedings of the 2013 ACM International Joint Conference on Pervasive and Ubiquitous Computing, Zurich, Switzerland, 8–12 September 2013. [Google Scholar]
- Jayalath, S.; Abhayasinghe, N. A gyroscopic data based pedometer algorithm. In Proceedings of the 2013 8th International Conference on Computer Science & Education, Colombo, Sri Lanka, 26–28 April 2013. [Google Scholar]
- Arcidiacono, C.; Porto, S.M.; Mancino, M.; Cascone, G. A threshold-based algorithm for the development of inertial sensor-based systems to perform re-al-time cow step counting in free-stall barns. Biosyst. Eng. 2017, 153, 99–109. [Google Scholar] [CrossRef]
- Alvarenga, F.A.P.; Borges, I.; Palkovič, L.; Rodina, J.; Oddy, V.H.; Dobos, R.C. Using a three-axis accelerometer to identify and classify sheep behaviour at pasture. Appl. Anim. Behav. Sci. 2016, 181, 91–99. [Google Scholar] [CrossRef]
- Giovanetti, V.; Decandia, M.; Molle, G.; Acciaro, M.; Mameli, M.; Cabiddu, A.; Cossu, R.; Serra, M.; Manca, C.; Rassu, S.; et al. Automatic classification system for grazing, ruminating and resting behaviour of dairy sheep using a tri-axial accelerometer. Livest. Sci. 2016, 196, 42–48. [Google Scholar] [CrossRef]
- Radeski, M.; Ilieski, V. Gait and posture discrimination in sheep using a tri-axial accelerometer. Animal 2017, 11, 1249–1257. [Google Scholar] [CrossRef] [PubMed]
- Barwick, J.; Lamb, D.; Dobos, R.; Schneider, D.; Welch, M.; Trotter, M. Predicting Lameness in Sheep Activity Using Tri-Axial Acceleration Signals. Animals 2018, 8, 12. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Barwick, J.; Lamb, D.W.; Dobos, R.; Welch, M.; Schneider, D.; Trotter, M. Identifying Sheep Activity from Tri-Axial Acceleration Signals Using a Moving Window Classification Model. Remote Sens. 2020, 12, 646. [Google Scholar] [CrossRef] [Green Version]
- Walton, E.; Casey, C.; Mitsch, J.; Vázquez-Diosdado, J.A.; Yan, J.; Dottorini, T.; Ellis, K.A.; Winterlich, A.; Kaler, J.; Emily, W.; et al. Evaluation of sampling frequency, window size and sensor position for classification of sheep behaviour. R. Soc. Open Sci. 2018, 5, 171442. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Jin, Z.; Guo, L.; Shu, H.; Qi, J.; Li, Y.; Xu, B.; Zhang, W.; Wang, K.; Wang, W. Behavior Classification and Analysis of Grazing Sheep on Pasture with Different Sward Surface Heights Using Machine Learning. Animals 2022, 12, 1744. [Google Scholar] [CrossRef] [PubMed]
- Alsaaod, M.; Niederhauser, J.; Beer, G.; Zehner, N.; Schuepbach-Regula, G.; Steiner, A. Development and validation of a novel pedometer algorithm to quantify extended characteristics of the locomotor behavior of dairy cows. J. Dairy Sci. 2015, 98, 6236–6242. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Jayalath, S.; Abhayasinghe, N.; Murray, I. A gyroscope based accurate pedometer algorithm. In Proceedings of the International Conference on Indoor Positioning and Indoor Navigation, Montbeliard, France, 28–31 October 2013. [Google Scholar]
- Chen, P. Dairy cow health monitoring system based on NB-IoT communication. In Proceedings of the 2019 International Conference on Electronic Engineering and Informatics (EEI), Nanjing, China, 8–10 November 2019. [Google Scholar]
- Chien, J.C.; Hirakawa, K.; Shieh, J.S.; Guo, H.W.; Hsieh, Y. An effective algorithm for dynamic pedometer calculation. In Proceedings of the 2015 International Conference on Intelligent Informatics and Biomedical Sciences (ICIIBMS), Okinawa, Japan, 28–30 November 2015. [Google Scholar]
- He, Z.; Liu, Z.; Jin, L.; Zhen, L.X.; Huang, J.C. Weightlessness feature—A novel feature for single tri-axial accelerometer based activity recognition. In Proceedings of the 2008 19th International Conference on Pattern Recognition, Tampa, FL, USA, 8–11 December 2008. [Google Scholar]
- 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]
- Schneider, R. Survey of Peaks/Valleys Identification in Time Series; Department of Informatics, University of Zurich: Zurich, Switzerland, 2011. [Google Scholar]
- Zhao, N. Full-featured pedometer design realized with 3-axis digital accelerometer. Analog. Dialogue 2010, 44, 1–5. [Google Scholar]
- Oner, M.; Pulcifer-Stump, J.A.; Seeling, P.; Kaya, T. Towards the run and walk activity classification through step detection-an android application. In Proceedings of the 2012 Annual International Conference of the IEEE Engineering in Medicine and Biology Society, San Diego, CA, USA, 28 August–1 September 2012. [Google Scholar]
- Cockram, M.S. A review of behavioural and physiological responses of sheep to stressors to identify potential behavioural signs of distress. Anim. Welf. 2004, 13, 283–291. [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]
Collection Date and Time | Data Format | Data Usage | |
---|---|---|---|
2 September 9:30–17:30 | Time (yyyy/m/d h:m:s.ms) + acc (m/s2) + gyro (rad/s) The data’s three-axis acceleration and triaxial angular velocity units result from converting the original data. | Model Building | / |
3 September 9:15–17:00 | / | Algorithm validation | |
5 September 8:15–17:25 | / | Algorithm validation | |
6 September 9:00–17:30 | / | Algorithm validation | |
7 September 9:00–17:00 | / | Algorithm validation | |
8 September 9:00–17:00 | Model Building | / | |
10 September 9:00–17:00 | Model Building | / | |
13 September 9:00–17:00 | Model Building | / | |
15 September 9:45–17:00 | Model Building | / | |
16 September 10:00–16:00 | Model Building | / |
K | Prediction Error | MSE | RMSE | MAE | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1.5 | −2 | −9 | −11 | −3 | −6 | −3 | −3 | −3 | 39.71 | 6.3 | 5.71 |
1.6 | −1 | −8 | −9 | −3 | −5 | −2 | −2 | −3 | 28.14 | 5.3 | 4.71 |
1.7 | 0 | −6 | −7 | −2 | −4 | −2 | −1 | −2 | 16.29 | 4.04 | 3.43 |
1.8 | 0 | −5 | −5 | −1 | −3 | −1 | 0 | −2 | 9.29 | 3.05 | 2.43 |
1.9 | 1 | −4 | −4 | 0 | −2 | −1 | 0 | −1 | 5.57 | 2.36 | 1.86 |
2 | 2 | −2 | −2 | 0 | −1 | 0 | 1 | 0 | 2 | 1.41 | 1.14 |
2.1 | 2 | −1 | 0 | 1 | 1 | 1 | 2 | 0 | 1.71 | 1.31 | 1.14 |
2.2 | 3 | 1 | 2 | 2 | 2 | 1 | 3 | 1 | 4.71 | 2.17 | 2.14 |
2.3 | 4 | 2 | 4 | 3 | 3 | 2 | 4 | 1 | 10.71 | 3.27 | 3.29 |
2.4 | 5 | 4 | 6 | 4 | 4 | 2 | 4 | 2 | 19 | 4.36 | 4.43 |
2.5 | 5 | 5 | 8 | 4 | 5 | 3 | 5 | 2 | 27.57 | 5.25 | 5.29 |
True value | Optimal | ||||||||||
15 | 38 | 54 | 19 | 25 | 16 | 29 | 24 | 1.71 | 1.31 | 1.14 |
K-Means | Mean | Var | Std | Kurt | Skew |
---|---|---|---|---|---|
0 | 0.865339 | 26.88633 | 4.680037 | 0.560563 | 0.558288 |
1 | 0.212394 | 7.833004 | 3.000012 | 3.21998 | −0.14211 |
2 | −0.30302 | 19.98162 | 2.094035 | 6.035494 | −2.18545 |
Accuracy | 0.621 | 0.862 | / | / | 0.724 |
Precision | 0.72 | 0.909 | / | / | 0.938 |
Recall | 0.818 | 0.909 | / | / | 0.682 |
Date | Sheep | True | Pre1 1 | Pre2 2 | RE1 3 (%) | RE2 4 (%) |
---|---|---|---|---|---|---|
3 September | Ram1 | 147 | 154 | 155 | 4.76 | 5.44 |
125 | 131 | 132 | 4.8 | 5.6 | ||
5 September | Ewe1 | 100 | 93 | 93 | 7 | 7 |
82 | 158 | 101 | 92.68 | 23.17 | ||
6 September | Ram 2 | 78 | 88 | 80 | 12.82 | 2.56 |
219 | 229 | 217 | 4.57 | 0.91 | ||
7 September | Ewe 2 | 243 | 238 | 238 | 2.06 | 2.06 |
187 | 165 | 193 | 11.76 | 3.21 |
Date | RT 1 | R1 2 | R2 3 | S 4 | SE 5 | RRE1 6 | RRE2 7 | SER 8 |
---|---|---|---|---|---|---|---|---|
3 September | 56 | 43 | 60 | 5 | 1 | 23.21 | 7.14 | 0.2 |
5 September | 9 | 8 | 9 | 25 | 2 | 11.11 | 0 | 0.08 |
6 September | 81 | 65 | 78 | 12 | 1 | 19.75 | 3.7 | 0.083333 |
7 September | 83 | 63 | 98 | 1 | 1 | 24.1 | 18.07 | 1 |
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. |
© 2023 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
Jiang, C.; Qi, J.; Hu, T.; Wang, X.; Bai, T.; Guo, L.; Yan, R. Research on Six-Axis Sensor-Based Step-Counting Algorithm for Grazing Sheep. Sensors 2023, 23, 5831. https://doi.org/10.3390/s23135831
Jiang C, Qi J, Hu T, Wang X, Bai T, Guo L, Yan R. Research on Six-Axis Sensor-Based Step-Counting Algorithm for Grazing Sheep. Sensors. 2023; 23(13):5831. https://doi.org/10.3390/s23135831
Chicago/Turabian StyleJiang, Chengxiang, Jingwei Qi, Tianci Hu, Xin Wang, Tao Bai, Leifeng Guo, and Ruirui Yan. 2023. "Research on Six-Axis Sensor-Based Step-Counting Algorithm for Grazing Sheep" Sensors 23, no. 13: 5831. https://doi.org/10.3390/s23135831
APA StyleJiang, C., Qi, J., Hu, T., Wang, X., Bai, T., Guo, L., & Yan, R. (2023). Research on Six-Axis Sensor-Based Step-Counting Algorithm for Grazing Sheep. Sensors, 23(13), 5831. https://doi.org/10.3390/s23135831