Journal Article2025Cited by 1

CattleNet-XAI: An explainable CNN framework for efficient cattle weight estimation

Md Junayed Hossain, Jannatul Ferdaus, Ashraful Islam, M Ashraful Amin

Plos one

Public Library of Science San Francisco, CA USA, Vol. 20, Issue 11, pp. e0336434, ISBN: 1932-6203

  • Zero Hunger — Relevance: 64%

Abstract

Accurate estimation of cattle weight is essential for effective farm management, health assessment, and productivity optimization. Traditional manual methods for weight estimation, however, are labor-intensive, time-consuming, and prone to inaccuracies. Recent advances in computer vision have facilitated the automation of weight prediction from image data. However, traditional regression models, such as Random Forest and Linear Regression, face challenges in capturing the complex, nonlinear relationships within image data, leading to less accurate predictions. To address these issues, we introduce CattleNet-XAI, a framework designed for both efficiency and explainability, which utilizes a custom Convolutional Neural Network (CNN). For the CNN-based approach, we incorporated advanced image preprocessing techniques, including normalization and histogram equalization, to enhance the input data quality. We compared its performance with other CNN models, the pretrained EfficientNetB3 model, and traditional machine learning methods like Random Forest and Linear Regression. For the traditional methods, we first leveraged the YOLOv5 algorithm for precise feature extraction from the cattle images. All the models were trained and evaluated on a dataset of cattle images and associated weight data, with performance measured by Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE). Our results show that one variation of our custom CNN (3Conv3Dense) model significantly surpasses other conventional models, achieving a low MAE of 18.02 kg and an RMSE of 19.85 kg, which demonstrates superior accuracy. We also present LIME visualization and error case analysis to provide insights into the decision-making process of the model. This study emphasizes the capability of deep learning, especially CNN, in automating and enhancing the precision of livestock weight estimation, offering a modern and effective approach to cattle management.

Keywords

  • convolutional neural networks
  • histogram equalization
  • Explainable AI

CCDS Authors

Ashraful Islam, PhD
Ashraful Islam

Ashraful Islam, PhD

  • Center Director, CCDS
  • Director, HCI Wing

Assistant Professor

Department of Computer Science and Engineering

Independent University, Bangladesh (IUB)

Published at

CHI, UIST, UbiComp, IJCNN, ICIP, HCII, ICDMW, BLP, IEEE Internet of Things Journal, JMIR, JMIR Human Factors, JMIR Formative Research, IEEE Access, Smart Agricultural Technology, Diabetes Research and Clinical Practice, PLOS ONE

Research Interests

Human-Computer Interaction, AI for Social Good, AI for Public Health, AI for Impact

Prof. M Ashraful Amin, PhD
M Ashraful Amin, PhD

Prof. M Ashraful Amin, PhD

  • Founder Director, CCDS
  • Director, AI/ML, HCI & DS Wings

Professor

+1 more affiliation

Department of Information Sciences and Technology

George Mason University, USA

Published at

ACL, CHI, UbiComp, ECAI, WACV, PAKDD, IJCNN, ICPR, ICIP, HCII, CLEF, BLP, Scientific Reports, JMIR, IEEE Access, Smart Agricultural Technology, Frontiers in Computational Neuroscience, Diabetes Research and Clinical Practice, PLOS ONE

Research Interests

Machine Learning, Cognitive & Vision Science, Cybernetics, Surveillance & Security, ICT in Education, Health, & Agriculture, Human-Computer Interaction, Internet of Things, Robotics

References

  1. 1.Christian Janiesch, Patrick Zschech, Kai Heinrich. (2021). Machine learning and deep learning. Electronic Markets, 31(3), 685–695[10.1007/s12525-021-00475-2]
  2. 2.Steven J. Rigatti. (2017). Random Forest. Journal of Insurance Medicine, 47(1), 31–39[10.17849/insm-47-01-31-39.1]
  3. 3.Dalwinder Singh, Birmohan Singh. (2019). Investigating the impact of data normalization on classification performance. Applied Soft Computing, 97, 105524[10.1016/j.asoc.2019.105524]
  4. 4.Dastan Maulud, Adnan M. Abdulazeez. (2020). A Review on Linear Regression Comprehensive in Machine Learning. Journal of Applied Science and Technology Trends, 1(2), 140–147[10.38094/jastt1457]
  5. 5.Richard Szeliski. (2022). Computer Vision. Texts in computer science[10.1007/978-3-030-34372-9]
  6. 6.Rahul Chauhan, Kamal Kumar Ghanshala, R.C Joshi. (2018). Convolutional Neural Network (CNN) for Image Detection and Recognition. 2018 First International Conference on Secure Cyber Computing and Communication (ICSCCC), 278–282[10.1109/icsccc.2018.8703316]
  7. 7.Utkarsh Mahadeo Khaire, R. Dhanalakshmi. (2019). Stability of feature selection algorithm: A review. Journal of King Saud University - Computer and Information Sciences, 34(4), 1060–1073[10.1016/j.jksuci.2019.06.012]
  8. 8.Mohammad Mustafa Taye. (2023). Theoretical Understanding of Convolutional Neural Network: Concepts, Architectures, Applications, Future Directions. Computation, 11(3), 52[10.3390/computation11030052]
  9. 9.Lei Huang, Jie Qin, Yi Zhou, Fan Zhu, Li Liu, Ling Shao. (2023). Normalization Techniques in Training DNNs: Methodology, Analysis and Application. IEEE Transactions on Pattern Analysis and Machine Intelligence, 45(8), 10173–10196[10.1109/tpami.2023.3250241]
  10. 10.Muhammad Rehman Zafar, Naimul Khan. (2021). Deterministic Local Interpretable Model-Agnostic Explanations for Stable Explainability. Machine Learning and Knowledge Extraction, 3(3), 525–541[10.3390/make3030027]
  11. 11.Abdul Waheed, Muskan Goyal, Deepak Gupta, Ashish Khanna, Aboul Ella Hassanien, Hari Mohan Pandey. (2020). An optimized dense convolutional neural network model for disease recognition and classification in corn leaf. Computers and Electronics in Agriculture, 175, 105456[10.1016/j.compag.2020.105456]
  12. 12.Afia Zafar, Muhammad Aamir, Nazri Mohd Nawi, Ali Arshad, Saman Riaz, Abdulrahman Alruban, Ashit Kumar Dutta, Sultan Almotairi. (2022). A Comparison of Pooling Methods for Convolutional Neural Networks. Applied Sciences, 12(17), 8643[10.3390/app12178643]
  13. 13.Brett Koonce. (2021). EfficientNet. Apress eBooks, 109–123[10.1007/978-1-4842-6168-2_10]
  14. 14.Hyelynn Jeon, Sejong Oh. (2020). Hybrid-Recursive Feature Elimination for Efficient Feature Selection. Applied Sciences, 10(9), 3211[10.3390/app10093211]
  15. 15.Goran Pavlov, Alberto Maydeu-Olivares, Dexin Shi. (2020). Using the Standardized Root Mean Squared Residual (SRMR) to Assess Exact Fit in Structural Equation Models. Educational and Psychological Measurement, 81(1), 110–130[10.1177/0013164420926231]
  16. 16.Md Shoaib Ahmed, Tanjim Taharat Aurpa, Md. Abul Kalam Azad. (2021). Fish Disease Detection Using Image Based Machine Learning Technique in Aquaculture. Journal of King Saud University - Computer and Information Sciences, 34(8), 5170–5182[10.1016/j.jksuci.2021.05.003]
  17. 17.Rajendran Nirthika, Siyamalan Manivannan, Amirthalingam Ramanan, Ruixuan Wang. (2022). Pooling in convolutional neural networks for medical image analysis: a survey and an empirical study. Neural Computing and Applications, 34(7), 5321–5347[10.1007/s00521-022-06953-8]
  18. 18.Eliana Vivas, Héctor Allende-Cid, Rodrigo Salas. (2020). A Systematic Review of Statistical and Machine Learning Methods for Electrical Power Forecasting with Reported MAPE Score. Entropy, 22(12), 1412[10.3390/e22121412]
  19. 19.X. Song, E.A.M. Bokkers, P.P.J. van der Tol, P.W.G. Groot Koerkamp, S. van Mourik. (2018). Automated body weight prediction of dairy cows using 3-dimensional vision. Journal of Dairy Science, 101(5), 4448–4459[10.3168/jds.2017-13094]
  20. 20.Wilhelm Burger, Mark J. Burge. (2022). Digital Image Processing. Texts in computer science[10.1007/978-3-031-05744-1]
  21. 21.Montaser Abdelsattar, Mohamed A. Ismeil, Karim Menoufi, Ahmed AbdelMoety, Ahmed Emad-Eldeen. (2025). Evaluating Machine Learning and Deep Learning models for predicting Wind Turbine power output from environmental factors. PLoS ONE, 20(1), e0317619[10.1371/journal.pone.0317619]
  22. 22.Huang Jin Jie, Putra Wanda. (2020). RunPool: A Dynamic Pooling Layer for Convolution Neural Network. International Journal of Computational Intelligence Systems, 13(1), 66[10.2991/ijcis.d.200120.002]
  23. 23.Montaser Abdelsattar, Mohamed A. Ismeil, Mohamed M. A. Azim Zayed, Ahmed Abdelmoety, Ahmed Emad-Eldeen. (2024). Assessing Machine Learning Approaches for Photovoltaic Energy Prediction in Sustainable Energy Systems. IEEE Access, 12, 107599–107615[10.1109/access.2024.3437191]
  24. 24.Kesang Wangchuk, Jigme Wangdi, Mindu Mindu. (2017). Comparison and reliability of techniques to estimate live cattle body weight. Journal of Applied Animal Research, 46(1), 349–352[10.1080/09712119.2017.1302876]
  25. 25.Zhong Qu, Le-yuan Gao, Sheng-ye Wang, Hao-nan Yin, Tu-ming Yi. (2022). An improved YOLOv5 method for large objects detection with multi-scale feature cross-layer fusion network. Image and Vision Computing, 125, 104518[10.1016/j.imavis.2022.104518]
  26. 26.Santanu Roy, Kanika Bhalla, Rachit Patel. (2023). Mathematical analysis of histogram equalization techniques for medical image enhancement: a tutorial from the perspective of data loss. Multimedia Tools and Applications, 83(5), 14363–14392[10.1007/s11042-023-15799-8]
  27. 27.Sohaib Asif, Xiaolong Zheng, Yusen Zhu. (2024). An optimized fusion of deep learning models for kidney stone detection from CT images. Journal of King Saud University - Computer and Information Sciences, 36(7), 102130[10.1016/j.jksuci.2024.102130]
  28. 28.Alexey Ruchay, Vitaly Kober, Konstantin Dorofeev, Vladimir Kolpakov, Alexey Gladkov, Hao Guo. (2022). Live Weight Prediction of Cattle Based on Deep Regression of RGB-D Images. Agriculture, 12(11), 1794[10.3390/agriculture12111794]
  29. 29.Alexey Ruchay, Vitaly Kober, Konstantin Dorofeev, Vladimir Kolpakov, Kinispay Dzhulamanov, Vsevolod Kalschikov, Hao Guo. (2022). Comparative analysis of machine learning algorithms for predicting live weight of Hereford cows. Computers and Electronics in Agriculture, 195, 106837[10.1016/j.compag.2022.106837]
  30. 30.Yu Sun, Jinsong Zhou, David Thompson, Tianchen Yuan, Dao Gong, Taiwen You. (2020). Design, analysis and experimental validation of high static and low dynamic stiffness mounts based on target force curves. International Journal of Non-Linear Mechanics, 126, 103559[10.1016/j.ijnonlinmec.2020.103559]
  31. 31.Sèyi Fridaïus Ulrich Vanvanhossou, Luc Hippolyte Dossa, Sven König. (2021). Sustainable Management of Animal Genetic Resources to Improve Low-Input Livestock Production: Insights into Local Beninese Cattle Populations. Sustainability, 13(17), 9874[10.3390/su13179874]
  32. 32.Ye Bi, Leticia M. Campos, Jin Wang, Haipeng Yu, Mark D. Hanigan, Gota Morota. (2023). Depth video data-enabled predictions of longitudinal dairy cow body weight using thresholding and Mask R-CNN algorithms. Smart Agricultural Technology, 6, 100352[10.1016/j.atech.2023.100352]
  33. 33.Beibei Xu, Yifan Mao, Wensheng Wang, Guipeng Chen. (2024). Intelligent weight prediction of cows based on semantic segmentation and back propagation neural network. Frontiers in Artificial Intelligence, 7, 1299169[10.3389/frai.2024.1299169]
  34. 34.Ali William Canaza-Cayo, Roxana Churata-Huacani, Cihan Çakmakçı, Francisco Halley Rodríguez-Huanca, Júlio Sílvio de Sousa Bueno Filho, Tales Jesus Fernandes, Yhan Carlos Rojas De La Cruz. (2024). Use of machine learning approaches for body weight prediction in Peruvian Corriedale Sheep. Smart Agricultural Technology, 7, 100419[10.1016/j.atech.2024.100419]
  35. 35.Apurba Kumar Datta, Mohammed Ziaul Haider, Sumon Kumar Ghosh. (2018). Economic analysis of dairy farming in Bangladesh. Tropical Animal Health and Production, 51(1), 55–64[10.1007/s11250-018-1659-7]
  36. 36.Roel Dohmen, Cagatay Catal, Qingzhi Liu. (2021). Image-based body mass prediction of heifers using deep neural networks. Biosystems Engineering, 204, 283–293[10.1016/j.biosystemseng.2021.02.001]
  37. 37.Mikel Gjergji, Vanessa de Moraes Weber, Luiz Otavio Campos Silva, Rodrigo da Costa Gomes, Thiago Luis Alves Campos de Araujo, Hemerson Pistori, Marco Alvarez. (2020). Deep Learning Techniques for Beef Cattle Body Weight Prediction. , 1–8[10.1109/ijcnn48605.2020.9207624]
  38. 38.Roman Vershynin. (2020). Memory Capacity of Neural Networks with Threshold and Rectified Linear Unit Activations. SIAM Journal on Mathematics of Data Science, 2(4), 1004–1033[10.1137/20m1314884]
  39. 39.Ernest Jeczmionek, Piotr A. Kowalski. (2021). Flattening Layer Pruning in Convolutional Neural Networks. Symmetry, 13(7), 1147[10.3390/sym13071147]
  40. 40.Zongwei Li, Zongwei Li, Jia Song, Kai Qiao, Chenghai Li, Yanhui Zhang, Zhenyu Li, Zhenyu Li. (2022). Research on efficient feature extraction: Improving YOLOv5 backbone for facial expression detection in live streaming scenes. Frontiers in Computational Neuroscience, 16, 980063[10.3389/fncom.2022.980063]
  41. 41.Oleksandr Bezsonov, Oleh Lebediev, Valentyn Lebediev, Yuriy Megel, Dmytro Prochukhan, Oleg Rudenko. (2021). Breed recognition and estimation of live weight of cattle based on methods of machine learning and computer vision. Eastern-European Journal of Enterprise Technologies, 6(9 (114)), 64–74[10.15587/1729-4061.2021.247648]
  42. 42.Gaganpreet Thapar, Tapas Kumar Biswas, Bharat Bhushan, Syamal Naskar, Amit Kumar, Premanshu Dandapat, Jaydip Rokhade. (2023). Accurate estimation of body weight of pigs through smartphone image measurement app. Smart Agricultural Technology, 4, 100194[10.1016/j.atech.2023.100194]
  43. 43.Luis Alvaro Montoya-Santiyanes, Alfonso Juventino Chay-Canul, Enrique Camacho-Pérez, Omar Rodríguez-Abreo. (2022). A novel model for estimating the body weight of Pelibuey sheep through Gray Wolf Optimizer algorithm. Journal of Applied Animal Research, 50(1), 635–642[10.1080/09712119.2022.2123812]
  44. 44.A N Ruchay, V I Kolpakov, V V Kalschikov, K M Dzhulamanov, K A Dorofeev. (2021). Predicting the body weight of Hereford cows using machine learning. IOP Conference Series Earth and Environmental Science, 624(1), 012056[10.1088/1755-1315/624/1/012056]
  45. 45.Habtamu Ayalew, Genzeb Tamru, Desalegn Abebe. (2018). Beef Cattle Fattening Practices and Marketing Systems in Gondar Town, Amhara, Ethiopia. Journal of Veterinary Science & Technology, 09(05)[10.4172/2157-7579.1000555]
  46. 46.Chang Gwon Dang, Seung Soo Lee, Mahboob Alam, Sang Min Lee, Mi Na Park, Ha-Seung Seong, Min Ki Baek, Van Thuan Pham, Jae Gu Lee, Seungkyu Han. (2023). A Korean Cattle Weight Prediction Approach Using 3D Segmentation-Based Feature Extraction and Regression Machine Learning from Incomplete 3D Shapes Acquired from Real Farm Environments. Agriculture, 13(12), 2266[10.3390/agriculture13122266]
  47. 47.Leibin Lan, Lei Shen, Huaxia Wang, Yudong Yao, Peng Zheng, Axiu Mao. (2024). Estimation of cattle weight from composite image/height/length data with spatial and channel attention convolution network (SCA-ConvNet). Signal Image and Video Processing, 18(10), 7349–7358[10.1007/s11760-024-03398-5]
  48. 48.L.O. Nafiu, T. Saili, M. Abadi, R. Badaruddin, F.A. Auza. (2024). Portrait of body weight of swamp buffalo based on weighing and using a rondo measuring tape in South Konawe district. , 75–82[10.1201/9781003468943-13]
  49. 49.Mobasshir Bhuiya Shagor, Md. Zahidul Haque Alvi, Khandaker Tabin Hasan. (2022). CID: Cow Images Dataset for Regression and Classification. , 450–455[10.1145/3542954.3543018]

Cited By

  1. 1.Aabu Yousuf Raj, Md. Rakibul Hasan, Abdur Rahman Arafat, S.M. Sadman Rahman, Md. Roman Bin Jalal, Jannatun Noor. (2026). A computer vision driven ecosystem for cattle monitoring: Multi-disease classification with severity grading, multi-view individual identification, and weight estimation. Computers and Electronics in Agriculture, 252, 112050[10.1016/j.compag.2026.112050]