Egg Weight Estimation Based on Image Processing using Mask R-CNN and XGBoost
Abstract
Manually measuring egg weight in the context of livestock and the food industry can pose various problems, including time and labor requirements, the risk of egg damage, consistency and accuracy, and limitations on production scale. To address these issues, an automated egg weight estimation system is essential. This study proposes integrating computer vision and machine learning into a unified workflow that combines segmentation, classification, and regression for practical weight estimation. The proposed pipeline employs Mask R-CNN for egg segmentation, Random Forest (RF) classifier for egg type classification based on color features, and XGBoost for regression using morphological, geometric, color features, and egg type as predictors. The dataset used is 720 images, consisting of 20 eggs (10 chicken and 10 duck), each photographed from 36 rotational angles, and was collected with Ground Truth (GT) weights obtained from a digital scale. Experimental findings show that the RF classifier achieved perfect accuracy (precision, recall, and F1-score = 1.00) in distinguishing chicken and duck eggs. The XGBoost regressor obtained a training performance of MAE = 1.07 g and R² = 0.68, and a validation performance of MAE = 0.23 g and R² = 0.80 under 10-fold grouped cross-validation. Although a Support Vector Regressor baseline reached higher training accuracy (MAE = 0.22 g, R² = 0.96), it failed to generalize on validation (R² < 0), highlighting XGBoost’s robustness. The feature importance analysis revealed that there are 4 (four) important features for building an estimation model, namely: Hu moments, eccentricity, elongation, and diagonal length, while color statistics played a complementary role. The novelty of this work lies in combining deep segmentation, color-based classification, and feature-driven regression into a unified framework specifically for egg weight estimation, showing its feasibility as a proof of concept and laying the foundation for future large-scale, calibrated, and externally validated deployment.
Keywords
Full Text:
PDFReferences
N. Yang, “Egg Production In China: Current Status And Outlook,” Front Agric Sci Eng, vol. 8, pp. 25–34, Aug. 2020, doi: 10.15302/J-FASE-2020363.
J. P. B. López Vargas, K. L. de Abreu, D. Duarte de Paula, D. H. Pinheiro Salvadeo, L. F. Arantes de Souza, and C. Bôa-Viagem Rabello, “Alternative Non-Destructive Approach for Estimating Morphometric Measurements of Chicken Eggs from Tomographic Images with Computer Vision,” Foods, vol. 13, no. 24, Dec. 2024, doi: 10.3390/foods13244039.
F. Akkoyun, A. Ozcelik, I. Arpaci, A. Erçetin, and S. Gucluer, “A Multi-Flow Production Line for Sorting of Eggs Using Image Processing,” Sensors, vol. 23, Jan. 2022, doi: 10.3390/s23010117.
X. Yang, R. B. Bist, S. Subedi, and L. Chai, “A Computer Vision-Based Automatic System for Egg Grading and Defect Detection,” Animals, vol. 13, no. 14, Jul. 2023, doi: 10.3390/ani13142354.
A. I. Khan and S. Al-Habsi, “Machine Learning in Computer Vision,” in Procedia Computer Science, Elsevier B.V., 2020, pp. 1444–1451. doi: 10.1016/j.procs.2020.03.355.
S. Jiang, G. Zhang, Z. Shen, P. Zhong, J. Tan, and J. Liu, “Pig Weight Estimation Method Based on a Framework Combining Mask R-CNN and Ensemble Regression Model,” Animals, vol. 14, no. 14, Jul. 2024, doi: 10.3390/ani14142122.
E. F. Guèye, “Trends and prospects of poultry value chains in Africa,” Journal of Agriculture, Science and Technology, vol. 23, no. 4, pp. 19–46, May 2024, doi: 10.4314/jagst.v23i4.2.
T. Ben Hassen, H. El Bilali, B. Daher, and S. Burkart, “Editorial: Sustainable and resilient food systems in times of crises,” Front Nutr, vol. 12, Feb. 2025, doi: 10.3389/fnut.2025.1564950.
A. Marzec et al., “Effect of Hens Age and Storage Time on Functional and Physiochemical Properties of Eggs,” Journal of Applied Poultry Research, vol. 28, pp. 290–300, 2019, doi: 10.3382/japr/pfy069.
T. Goto, H. Mori, S. Shiota, and S. Tomonaga, “Metabolomics approach reveals the effects of breed and feed on the composition of chicken eggs,” Metabolites, vol. 9, Oct. 2019, doi: 10.3390/metabo9100224.
X. H. Nguyen, H. T. Nguyen, and N. K. Morgan, “Dietary soluble non-starch polysaccharide level and xylanase supplementation influence performance, egg quality and nutrient utilization in laying hens fed wheat-based diets,” Animal Nutrition, vol. 7, pp. 512–520, Mar. 2021, doi: 10.1016/j.aninu.2020.05.012.
P. Priyadarshini G and S. Zahoor-Ul-Huq, “A Systematic Literature Review on CNN-Based Deep Learning Models for Plant Disease Detection and Classification to Enhance Agricultural Productivity,” 2025, pp. 1207–1218. doi: 10.2991/978-94-6463-718-2_100.
H. Ding, H. Hou, L. Wang, X. Cui, W. Yu, and D. I. Wilson, “Application of Convolutional Neural Networks and Recurrent Neural Networks in Food Safety,” Jan. 01, 2025, Multidisciplinary Digital Publishing Institute (MDPI). doi: 10.3390/foods14020247.
L. Benos, A. C. Tagarakis, G. Dolias, R. Berruto, D. Kateris, and D. Bochtis, “Machine learning in agriculture: A comprehensive updated review,” Jun. 01, 2021, MDPI AG. doi: 10.3390/s21113758.
W. Taparhudee, R. Jongjaraunsuk, S. Nimitkul, P. Suwannasing, and W. Mathurossuwan, “Optimizing Convolutional Neural Networks, XGBoost, and Hybrid CNN-XGBoost for Precise Red Tilapia (Oreochromis niloticus Linn.) Weight Estimation in River Cage Culture with Aerial Imagery,” AgriEngineering, vol. 6, no. 2, pp. 1235–1251, Jun. 2024, doi: 10.3390/agriengineering6020070.
A. Sharma, A. Jain, P. Gupta, and V. Chowdary, “Machine Learning Applications for Precision Agriculture: A Comprehensive Review,” 2021, Institute of Electrical and Electronics Engineers Inc. doi: 10.1109/ACCESS.2020.3048415.
Z. Unal, “Smart Farming Becomes even Smarter with Deep Learning - A Bibliographical Analysis,” IEEE Access, vol. 8, pp. 105587–105609, 2020, doi: 10.1109/ACCESS.2020.3000175.
K. He, G. Gkioxari, P. Dollár, and R. Girshick, “Mask R-CNN,” Mar. 2017, [Online]. Available: http://arxiv.org/abs/1703.06870
U. Afzaal, B. Bhattarai, Y. R. Pandeya, and J. Lee, “An instance segmentation model for strawberry diseases based on mask R-CNN,” Sensors, vol. 21, no. 19, Sep. 2021, doi: 10.3390/s21196565.
O. L. F. de Carvalho et al., “Instance Segmentation for Large, Multi-Channel Remote Sensing Imagery Using Mask-RCNN and a Mosaicking Approach,” Remote Sens (Basel), vol. 13, no. 1, pp. 1–24, Dec. 2020, doi: 10.3390/rs13010039.
R. W. Bello, A. S. A. Mohamed, and A. Z. Talib, “Contour Extraction of Individual Cattle from an Image Using Enhanced Mask R-CNN Instance Segmentation Method,” IEEE Access, vol. 9, pp. 56984–57000, Apr. 2021, doi: 10.1109/ACCESS.2021.3072636.
M. Frei and F. E. Kruis, “Image-Based Analysis of Dense Particle Mixtures via Mask R-CNN,” Eng, vol. 3, no. 1, pp. 78–98, Jan. 2022, doi: 10.3390/eng3010007.
C. Xu et al., “A Page Object Detection Method Based on Mask R-CNN,” IEEE Access, vol. 9, pp. 143448–143457, Oct. 2021, doi: 10.1109/ACCESS.2021.3121152.
Y. Shen, Z. Yan, Y. Yang, W. Tang, J. Sun, and Y. Zhang, “Application of UAV-Borne Visible-Infared Pushbroom Imaging Hyperspectral for Rice Yield Estimation Using Feature Selection Regression Methods,” Sustainability (Switzerland), vol. 16, no. 2, Jan. 2024, doi: 10.3390/su16020632.
X. Ji et al., “A Machine Learning-Based Method for Pig Weight Estimation and the PIGRGB-Weight Dataset,” Agriculture (Switzerland), vol. 15, no. 8, Apr. 2025, doi: 10.3390/agriculture15080814.
W. Anggraeni et al., “Prediction of Dengue Fever Outbreak Based on Climate and Demographic Variables Using Extreme Gradient Boosting and Rule-Based Classification,” in SeGAH 2021 - 2021 IEEE 9th International Conference on Serious Games and Applications for Health, Institute of Electrical and Electronics Engineers Inc., Aug. 2021. doi: 10.1109/SEGAH52098.2021.9551900.
P. Zhang et al., “Ensemble Learning for Oat Yield Prediction Using Multi-Growth Stage UAV Images,” Remote Sens (Basel), vol. 16, no. 23, Dec. 2024, doi: 10.3390/rs16234575.
J. Nakatumba-Nabende et al., “Using machine learning for image-based analysis of sweetpotato root sensory attributes,” Smart Agricultural Technology, vol. 5, Jul. 2023, doi: 10.1016/j.atech.2023.100291.
DOI: https://doi.org/10.47738/jads.v6i4.1004
Refbacks
- There are currently no refbacks.

Journal of Applied Data Sciences
| ISSN | : | 2723-6471 (Online) |
| Publisher | : | Bright Publisher |
| Website | : | http://bright-journal.org/JADS |
| : | taqwa@amikompurwokerto.ac.id (principal contact) | |
| support@bright-journal.org (technical issues) |
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0




.png)