Mask R-CNN and Centroid Tracking Algorithm to Process UAV Based Thermal-RGB Video for Drylot Cattle Heat Stress Monitoring
Abstract
:1. Introduction
- Develop an algorithm to analyze UAV-based thermal and RGB video streams in real-time for identifying and tracking individual cows and quantifying body surface temperature as an indicator of heat stress.
- Evaluate the developed approach in commercial drylot cattle operations to provide actionable real-time insights on cattle heat stress.
2. Materials and Methods
2.1. Study Site
2.2. Data Collection
2.3. Cattle Tracking and Body Surface Temperature Monitoring
2.3.1. Cow Detection through Instance Segmentation
2.3.2. Tracking
Algorithm 1: Centroid Tracking Algorithm | ||||
1 | Initialize nextObjectID ← 0, objects ← {}, disappeared ← {} | |||
2 | def update(rects): | |||
3 | if rects is empty then | |||
4 | for objectID in disappeared.keys() do | |||
5 | disappeared[objectID] ← disappeared[objectID] + 1 | |||
6 | if disappeared[objectID] > maxDisappeared then | |||
7 | deregister(objectID) | |||
8 | end if | |||
9 | end for | |||
10 | return objects | |||
11 | end if | |||
12 | inputCentroids ← [] | |||
13 | for rect in rects do | |||
14 | centroid ← computeCentroid(rect) | |||
15 | inputCentroids.append(centroid) | |||
16 | end for | |||
17 | if objects is empty then | |||
18 | for centroid in inputCentroids do | |||
19 | register(centroid) | |||
20 | end for | |||
21 | else | |||
22 | objectIDs ← objects.keys(), objectCentroids ← objects.values() | |||
23 | D ← computeDistanceMatrix(objectCentroids, inputCentroids) | |||
24 | rows,cols ← linearAssignment(D) | |||
25 | unmatchedRows ← range(D.shape[0]), unmatchedCols ← range(D.shape[1]) | |||
26 | for (row, col) in zip(rows, cols) do | |||
27 | if D[row, col] > maxDistance then | |||
28 | unmatchedRows.add(row), unmatchedCols.add(col) | |||
29 | else | |||
30 | objectID ← objectIDs[row], objects[objectID] ← inputCentroids[col] | |||
31 | disappeared[objectID] ← 0 | |||
32 | unmatchedRows.remove(row), unmatchedCols.remove(col) | |||
33 | end if | |||
34 | end for | |||
35 | for row in unmatchedRows do | |||
36 | disappeared[objectID] ← disappeared[objectID] + 1 | |||
37 | if disappeared[objectID] > maxDisappeared then | |||
38 | deregister(objectID) | |||
39 | end if | |||
40 | end for | |||
41 | for col in unmatchedCols do | |||
42 | register(inputCentroids[col]) | |||
43 | end for | |||
44 | end if | |||
45 | return objects |
2.3.3. Body Surface Temperature and Stress Assessment
Algorithm 2: Thermal Image Distortion Correction | |||
Require: Distorted image Id | |||
Ensure: Undistorted image Iu | |||
1 | Camera matrix K and distortion coefficients d | ||
2 | |||
5 | |||
6 | Knew, ROI = cv2.getOptimalNewCameraMatrix(K, d, (w, h), 1, (w, h)) | ||
7 | Iu = cv2.undistort(Id, K, d, None, Knew) | ||
8 | Crop Iu using ROI | ||
9 | if necessary then | ||
10 | Resizing Id and Iu |
2.4. Thermal Video for Real-Time Stress Monitoring
3. Results and Discussion
3.1. Segmentation, Counting, and Localization
3.2. Heat Stress Assessment
3.3. Real Timeliness of Stress Monitoring
3.4. Limitations and Generalizability
4. Conclusions
- The mask RCNN model combined with the centroid tracking algorithm can accurately localize and track individual cows in real-time, avoiding duplicate counts.
- The algorithm’s detection accuracy varies between input imaging modalities, with 89% and 64% accuracy in detecting individual cows from respective RGB and thermal imagery feed.
- Real timeliness of stress evaluation using thermal imagery feed showed promising results with 72.4% (spring 2023) and 81.7% (summer 2024) accuracy in spring 2023 and summer 2024. Similarly, algorithm was able to extract the BST of individual cows with a mean absolute difference of 2.1 °C (spring 2023) and 3.3 °C (summer 2024) from ground truth and quantify heat stress.
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Appendix A
16 March | 26 July | |||||
---|---|---|---|---|---|---|
Min. | Mean | Max. | Min | Mean | Max | |
Air Temperature (°C) | −3.4 | 4.4 | 13.2 | 8.2 | 18.7 | 28.9 |
Relative Humidity (%) | 30.4 | 62.3 | 92.9 | 14.2 | 48.1 | 84.3 |
Solar Radiation (MJ/m2) | 17.6 | 26.5 | ||||
Precipitation (mm) | 0 | 0 | ||||
Wind Speed (m/s) | 1.4 | 1.8 | ||||
Wind Gust (m/s) | 9.3 | 4.2 |
References
- Russell Knight. 30 August 2023. Available online: https://www.ers.usda.gov/topics/animal-products/cattle-beef/sector-at-a-glance/ (accessed on 13 September 2024).
- Gardine, S.E.; Warner, J.M.; Bondurant, R.G.; Hilscher, F.H.; Rasby, R.J.; Klopfenstein, T.J.; Watson, A.K.; Jenkins, K.H. Performance of cows and summer-born calves and economics in semi-confined and confined beef systems. Appl. Anim. Sci. 2019, 35, 521–529. [Google Scholar] [CrossRef]
- Belhadj Slimen, I.; Najar, T.; Ghram, A.; Abdrrabba, M. Heat stress effects on livestock: Molecular, cellular and metabolic aspects, a review. J. Anim. Physiol. Anim. Nutr. 2016, 100, 401–412. [Google Scholar] [CrossRef]
- Idris, M.; Uddin, J.; Sullivan, M.; McNeill, D.M.; Phillips, C.J.C. Non-Invasive Physiological Indicators of Heat Stress in Cattle. Animals 2021, 11, 71. [Google Scholar] [CrossRef] [PubMed]
- Kim, N.Y.; Moon, S.H.; Kim, S.J.; Kim, E.K.; Oh, M.; Tang, Y.; Jang, S.Y. Summer season temperature-humidity index threshold for infrared thermography in Hanwoo (Bos taurus coreanae) heifers. Asian-Australas. J. Anim. Sci. 2020, 33, 1691–1698. [Google Scholar] [CrossRef] [PubMed]
- Dikmen, S.; Hansen, P.J. Is the temperature-humidity index the best indicator of heat stress in lactating dairy cows in a subtropical environment? J. Dairy Sci. 2009, 92, 109–116. [Google Scholar] [CrossRef] [PubMed]
- Lemal, P.; May, K.; König, S.; Schroyen, M.; Gengler, N. Invited review: From heat stress to disease—Immune response and candidate genes involved in cattle thermotolerance. J. Dairy Sci. 2023, 106, 4471–4488. [Google Scholar] [CrossRef]
- Gonzalez-Rivas, P.A.; Chauhan, S.S.; Ha, M.; Fegan, N.; Dunshea, F.R.; Warner, R.D. Effects of heat stress on animal physiology, metabolism, and meat quality: A review. Meat Sci. 2020, 162, 108025. [Google Scholar] [CrossRef]
- Mufford, J.T.; Reudink, M.W.; Rakobowchuk, M.; Carlyle, C.N.; Church, J.S. Using unmanned aerial vehicles to record behavioral and physiological indicators of heat stress in cattle on feedlot and pasture. Can. J. Anim. Sci. 2022, 102, 1–8. [Google Scholar] [CrossRef]
- Fuentes, S.; Gonzalez Viejo, C.; Tongson, E.; Dunshea, F.R. The livestock farming digital transformation: Implementation of new and emerging technologies using artificial intelligence. Anim. Health Res. Rev. 2022, 23, 59–71. [Google Scholar] [CrossRef]
- Bohmanova, J.; Misztal, I.; Cole, J.B. Temperature-Humidity Indices as Indicators of Milk Production Losses due to Heat Stress. J. Dairy Sci. 2007, 90, 1947–1956. [Google Scholar] [CrossRef]
- Mufford, J.; Church, J.S.; Reudink, M.; Rakobowchuk, M.; Bell, C.; Rasmussen, S. PSI-8 Comparison of heat stress behaviour between different Canadian Bos taurus cattle breeds using unmanned aerial vehicles. J. Anim. Sci. 2019, 97 (Suppl. S3), 287. [Google Scholar] [CrossRef]
- Abdulai, G.; Sama, M.; Jackson, J. A preliminary study of the physiological and behavioral response of beef cattle to unmanned aerial vehicles (UAVs). Appl. Anim. Behav. Sci. 2021, 241, 105355. [Google Scholar] [CrossRef]
- Benalaya, N.; Adjih, C.; Amdouni, I.; Laouiti, A.; Saidane, L. UAV Search Path Planning For Livestock Monitoring. In Proceedings of the 2022 IEEE 11th IFIP International Conference on Performance Evaluation and Modeling in Wireless and Wired Networks (PEMWN), Rome, Italy, 8–10 November 2022; pp. 1–6. [Google Scholar] [CrossRef]
- Saliev, D.; Dimitrov, K.; Mladenov, G.; Valkovski, T. Study of the cattle population with the help of remote digital photography and videography. In Proceedings of the 2022 8th International Conference on Energy Efficiency and Agricultural Engineering (EE&AE), Ruse, Bulgaria, 30 June–2 July 2022; pp. 1–4. [Google Scholar] [CrossRef]
- Andrew, W.; Greatwood, C.; Burghardt, T. Visual Localisation and Individual Identification of Holstein Friesian Cattle via Deep Learning. In Proceedings of the 2017 IEEE International Conference on Computer Vision Workshops (ICCVW), Venice, Italy, 22–29 October 2017; pp. 2850–2859. [Google Scholar] [CrossRef]
- Xu, B.; Wang, W.; Falzon, G.; Kwan, P.; Guo, L.; Chen, G.; Tait, A.; Schneider, D. Automated cattle counting using Mask R-CNN in quadcopter vision system. Comput. Electron. Agric. 2020, 171, 105300. [Google Scholar] [CrossRef]
- Barbedo, J.G.A.; Koenigkan, L.V.; Santos, P.M.; Ribeiro, A.R.B. Counting Cattle in UAV Images—Dealing with Clustered Animals and Animal/Background Contrast Changes. Sensors 2020, 20, 2126. [Google Scholar] [CrossRef] [PubMed]
- Bhambri, P.; Rani, S.; Balas, V.E.; Elngar, A.A. Integration of AI-Based Manufacturing and Industrial Engineering Systems with the Internet of Things; CRC Press: Boca Raton, FL, USA, 2023. [Google Scholar] [CrossRef]
- Luo, W.; Zhang, G.; Yuan, Q.; Zhao, Y.; Chen, H.; Zhou, J.; Meng, Z.; Wang, F.; Li, L.; Liu, J.; et al. High-precision tracking and positioning for monitoring Holstein cattle. PLoS ONE 2024, 19, e0302277. [Google Scholar] [CrossRef]
- Myat Noe, S.; Zin, T.T.; Tin, P.; Kobayashi, I. Comparing State-of-the-Art Deep Learning Algorithms for the Automated Detection and Tracking of Black Cattle. Sensors 2023, 23, 532. [Google Scholar] [CrossRef]
- Mg, W.H.E.; Tin, P.; Aikawa, M.; Kobayashi, I.; Horii, Y.; Honkawa, K.; Zin, T.T. Customized Tracking Algorithm for Robust Cattle Detection and Tracking in Occlusion Environments. Sensors 2024, 24, 1181. [Google Scholar] [CrossRef]
- Luo, W.; Zhang, Z.; Fu, P.; Wei, G.; Wang, D.; Li, X.; Shao, Q.; He, Y.; Wang, H.; Zhao, Z.; et al. Intelligent Grazing UAV Based on Airborne Depth Reasoning. Remote Sens. 2022, 14, 4188. [Google Scholar] [CrossRef]
- He, K.; Gkioxari, G.; Dollar, P.; Girshick, R. Mask R-CNN. In Proceedings of the 2017 IEEE International Conference on Computer Vision (ICCV), Venice, Italy, 22–29 October 2017; pp. 2980–2988. [Google Scholar] [CrossRef]
- Xiao, J.; Liu, G.; Wang, K.; Si, Y. Cow Identification in Free-Stall Barns Based on an Improved Mask R-CNN and an SVM. Comput. J. Electron. Agric. 2022, 194, 106738. [Google Scholar] [CrossRef]
- Qiao, Y.; Truman, M.; Sukkarieh, S. Cattle Segmentation and Contour Extraction Based on Mask R-CNN for Precision Livestock Farming. Comput. J. Electron. Agric. 2019, 165, 104958. [Google Scholar] [CrossRef]
- Peng, D.; Chen, S.; Li, G.; Chen, J.; Wang, J.; Gu, X. Infrared thermography measured body surface temperature and its relationship with rectal temperature in dairy cows under different temperature-humidity indexes. Int. J. Biometeorol. 2019, 63, 327–336. [Google Scholar] [CrossRef] [PubMed]
- Salles, M.S.V.; da Silva, S.C.; Salles, F.A.; Roma, L.C.; El Faro, L.; Bustos Mac Lean, P.A.; Lins de Oliveira, C.E.; Martello, L.S. Mapping the body surface temperature of cattle by infrared thermography. J. Therm. Biol. 2016, 62, 63–69. [Google Scholar] [CrossRef] [PubMed]
- Styan, G.P.H. Hadamard products and multivariate statistical analysis. Linear Algebra Its Appl. 1973, 6, 217–240. [Google Scholar] [CrossRef]
- OpenCV: Camera Calibration. (n.d.). Available online: https://docs.opencv.org/4.x/dc/dbb/tutorial_py_calibration.html (accessed on 29 August 2024).
- s-du. IRMapper; GitHub Repository. Available online: https://github.com/s-du/IRMapper (accessed on 29 August 2024).
- Armstrong, J.; Janni, K. Heat Stress in Dairy Cattle. Available online: https://extension.umn.edu/dairy-milking-cows/heat-stress-dairy-cattle (accessed on 13 September 2024).
- Feng, L.; Song, K.; Wang, J.; Yan, Y. Exploring the potential of Siamese network for RGBT object tracking. J. Vis. Commun. Image Represent. 2023, 95, 103882. [Google Scholar] [CrossRef]
- Koch, G.; Zemel, R.; Salakhutdinov, R. Siamese Neural Networks for One-Shot Image Recognition. In Proceedings of the 32nd International Conference on Machine Learning, Lille, France, 6–11 July 2015. [Google Scholar]
- Cui, Y.; Guo, D.; Shao, Y.; Wang, Z.; Shen, C.; Zhang, L.; Chen, S. Joint Classification and Regression for Visual Tracking with Fully Convolutional Siamese Networks. Int. J. Comput. Vis. 2022, 130, 550–566. [Google Scholar] [CrossRef]
- Chandrakanth, V.; Murthy, V.S.N.; Channappayya, S.S. Siamese Cross-Domain Tracker Design for Seamless Tracking of Targets in RGB and Thermal Videos. IEEE Trans. Artif. Intell. 2023, 4, 161–172. [Google Scholar] [CrossRef]
- Zhang, C.; Xiao, D.; Yang, Q.; Wen, Z.; Lv, L. Review: Application of Infrared Thermography in Livestock Monitoring. Trans. ASABE 2020, 63, 389–399. [Google Scholar] [CrossRef]
- Han, X.; Thomasson, J.A.; Swaminathan, V.; Wang, T.; Siegfried, J.; Raman, R.; Rajan, N.; Neely, H. Field-Based Calibration of Unmanned Aerial Vehicle Thermal Infrared Imagery with Temperature-Controlled References. Sensors 2020, 20, 7098. [Google Scholar] [CrossRef]
- Zhang, K.; Jiao, L.; Zhao, X.; Dong, D. An instantaneous approach for determining the infrared emissivity of swine surface and the influencing factors. J. Therm. Biol. 2016, 57, 78–83. [Google Scholar] [CrossRef]
- Aragon, B.; Johansen, K.; Parkes, S.; Malbeteau, Y.; Al-Mashharawi, S.; Al-Amoudi, T.; Andrade, C.F.; Turner, D.; Lucieer, A.; McCabe, M.F. A Calibration Procedure for Field and UAV-Based Uncooled Thermal Infrared Instruments. Sensors 2020, 20, 3316. [Google Scholar] [CrossRef]
- Adams, A.E.; Olea-Popelka, F.J.; Roman-Muniz, I.N. Using temperature-sensing reticular boluses to aid in the detection of production diseases in dairy cows. J. Dairy Sci. 2013, 96, 1549–1555. [Google Scholar] [CrossRef] [PubMed]
- Bewley, J.M.; Einstein, M.E.; Grott, M.W.; Schutz, M.M. Comparison of Reticular and Rectal Core Body Temperatures in Lactating Dairy Cows. J. Dairy Sci. 2008, 91, 4661–4672. [Google Scholar] [CrossRef] [PubMed]
- Zhang, X.; Ye, P.; Peng, S.; Liu, J.; Xiao, G. DSiamMFT: An RGB-T fusion tracking method via dynamic Siamese networks using multi-layer feature fusion. Signal Process. Image Commun. 2020, 84, 115756. [Google Scholar] [CrossRef]
- Kendall, P.E.; Webster, J.R. Season and physiological status affects the circadian body temperature rhythm of dairy cows. Livest. Sci. 2009, 125, 155–160. [Google Scholar] [CrossRef]
RGB | Thermal | |||
---|---|---|---|---|
Cow | Not Cow | Cow | Not Cow | |
Cow | 292 | 60 | 163 | 54 |
Not Cow | 9 | - | 129 | - |
Metric | Precision | Recall | F1 Score |
---|---|---|---|
RGB | 0.97 | 0.83 | 0.89 |
Thermal | 0.56 | 0.75 | 0.64 |
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
Dadallage, K.M.; Amogi, B.R.; Khot, L.R.; Leal Yepes, F.A. Mask R-CNN and Centroid Tracking Algorithm to Process UAV Based Thermal-RGB Video for Drylot Cattle Heat Stress Monitoring. Drones 2024, 8, 491. https://doi.org/10.3390/drones8090491
Dadallage KM, Amogi BR, Khot LR, Leal Yepes FA. Mask R-CNN and Centroid Tracking Algorithm to Process UAV Based Thermal-RGB Video for Drylot Cattle Heat Stress Monitoring. Drones. 2024; 8(9):491. https://doi.org/10.3390/drones8090491
Chicago/Turabian StyleDadallage, Keshawa M., Basavaraj R. Amogi, Lav R. Khot, and Francisco A. Leal Yepes. 2024. "Mask R-CNN and Centroid Tracking Algorithm to Process UAV Based Thermal-RGB Video for Drylot Cattle Heat Stress Monitoring" Drones 8, no. 9: 491. https://doi.org/10.3390/drones8090491
APA StyleDadallage, K. M., Amogi, B. R., Khot, L. R., & Leal Yepes, F. A. (2024). Mask R-CNN and Centroid Tracking Algorithm to Process UAV Based Thermal-RGB Video for Drylot Cattle Heat Stress Monitoring. Drones, 8(9), 491. https://doi.org/10.3390/drones8090491