Skip to main content
Journal of Food Science and Technology logoLink to Journal of Food Science and Technology
. 2014 Apr 10;52(5):3065–3071. doi: 10.1007/s13197-014-1350-6

Egg volume prediction using machine vision technique based on pappus theorem and artificial neural network

Mahmoud Soltani 1,, Mahmoud Omid 2, Reza Alimardani 2
PMCID: PMC4397291  PMID: 25892810

Abstract

Egg size is one of the important properties of egg that is judged by customers. Accordingly, in egg sorting and grading, the size of eggs must be considered. In this research, a new method of egg volume prediction was proposed without need to measure weight of egg. An accurate and efficient image processing algorithm was designed and implemented for computing major and minor diameters of eggs. Two methods of egg size modeling were developed. In the first method, a mathematical model was proposed based on Pappus theorem. In second method, Artificial Neural Network (ANN) technique was used to estimate egg volume. The determined egg volume by these methods was compared statistically with actual values. For mathematical modeling, the R2, Mean absolute error and maximum absolute error values were obtained as 0.99, 0.59 cm3 and 1.69 cm3, respectively. To determine the best ANN, R2test and RMSEtest were used as selection criteria. The best ANN topology was 2-28-1 which had the R2test and RMSEtest of 0.992 and 0.66, respectively. After system calibration, the proposed models were evaluated. The results which indicated the mathematical modeling yielded more satisfying results. So this technique was selected for egg size determination.

Keywords: Egg, Machine vision system, Volume prediction, Math modeling, Artificial Neural network modeling

Introduction

Poultry egg is widely produced in the world. In 2011, about 65 million tons poultry egg was produced indicated the importance of this nutrient food material (Anon 2012). This large amount of egg production needs the appropriate systems for performing of different post processing and measurements such as grading and sorting.

Appearance and size are the main key quality attributes evaluated by consumers and are critical in the acceptance of egg. So these characteristics must be considered in sorting treatment. Previous researchers demonstrated that egg weight is a sufficient attribute for predicting other shell egg properties such as hatchability. Wilson (1991) proposed that sorting eggs by weight prior to incubation, might be advantageous to improve pullet uniformity and efficiency. Based on studies carried out by Narushin (2005), egg geometrical properties (volume and surface area) have important roles in the poultry industry and in biological studies, as they can be used in research on population and ecological morphology, chick weight prediction, shell quality inspection and egg interior parameters.

In egg weight determination, Asadi and Raoufat (2010) developed a machine vision (MV) system in combination with an artificial neural network (ANN) technique. The MV system was composed of a CCD camera, a capture video, a lightning system and a mirror. From each sample two images were captured and processed. The needed features were calculated for each image and fed to a multilayer perceptron (MLP) network with different training algorithms. They obtained the correlation coefficient between estimated and measured egg weight as 0.96 with maximum absolute error of 2.3 g. Javadikia et al. (2011) predicted egg weight with image processing (IP) and ANFIS model. They measured the width and length of egg by real time IP, designed an ANFIS model and extracted the best relation between IP outputs and the weight of eggs. They obtained the R value and Mean Absolute Error (MAE) for actual and predicted weight of eggs as 0.9942 and 0.3285 g, respectively. Other studies have been conducted in egg weight prediction (Narushin 2005; Asadi et al. 2012; Rashidi and Gholami 2011). Machine vision technique has been utilized for other agricultural materials. Du and Sun (2006) developed an automatic method for ham surface area and volume estimation using IP method. Omid et al. (2010a) applied IP technique for estimating volume and mass of citrus fruits. Also the IP method has been used for watermelon volume (Koc 2007), orange volume and surface area (Khojastehnazhand et al. 2009) and saffron crocus corm mass (Hassan-Beygi et al. 2010).

Jin et al. (2011) indicated that egg weight loss is one of the parameters that are greatly influenced according to the temperature and period of storage. Egg weight loss occurs as a result of moisture and CO2 losses through the shell pores. So prediction of egg weight using image processing is not appropriate operation because the accuracy of egg weighing system based on MV technique is function of storage time and temperature. But egg volume is an invariable parameter and can be used as a size index.

ANNs are widely used in food engineering. ANNs construct a suitable relationship between input data and the target responses without any need for a theoretical model with which to work (Hua et al. 2011). ANNs can be applied in almost every aspect of food processing, from raw material assessing (Wang et al. 2008a; Pan et al. 2009), thermal processing (Houessou et al. 2008; Hernandez 2009; Omid et al. 2011), fermentation (Wang et al. 2008b), enzymatic hydrolysis, antioxidant activity and anthocyanin content (Taghadomi-saberi et al. 2013), ultra-filtrating (Sun et al. 2004) and drying (Poonnoy et al. 2007; Omid et al. 2009) to composition detecting (Afkhami et al. 2009; Torrecilla et al. 2008), quality-assessing (Dutta et al. 2003; Sobel and Ballantine 2008; Pan et al. 2011) and safety-evaluating (Gupta et al. 2004; Panagou et al. 2007).

This study aims to design and develop a new method of egg volume prediction based on a MV system. For calibration of developed system, mathematical approximation and ANN technique were used. A statistical comparison was performed between these methods and the best model was selected for egg volume prediction.

Material and methods

Mathematical approximation

In mathematical modeling of egg, the Pappus’s second centroid theorem was used (Thomas et al. 2006). The second theorem states that the volume of a solid of revolution generated by rotating a plane figure about an external axis is equal to the product of the plane area and the distance traveled by its geometric centroid based on Eq. 1 (Thomas et al. 2006).

V=A×d 1

where V is the volume of solid, A is plane area and d is the traveled length of plane’s centroid.

In egg volume approximation, it is assumed that the volume of an egg is performed by rotation of two half planes obtained from dividing of projected area into two sections in line of longitudinal axis (Fig. 1). If each half plane rotates 180° about major diameter of egg (longitudinal axis), the whole egg will be generated.

Fig. 1.

Fig. 1

A plot of half part of egg for mathematical modeling

So the volume of an egg can be obtained by following equation:

V=i=12Vi 2
Vi=π×Ri×Ai 3

where V is the volume of whole egg, Vi is the volume of solid substance generated by revolution of half plane, Ri is the radius of traveling line and Ai is the area of half plane

Artificial neural network (ANN) modeling

Among ANN architectures, MLP networks are commonly used for classification and function approximation in agri-food products especially for sorting, grading and quality predictions (Omid et al. 2009; Omid et al. 2010b; Mollazade et al. 2012). The structure of MLP is composed of an input layer, one or more hidden layer (s), and an output layer.

The MLPs are usually trained by error backpropagation algorithm. Error minimization can be obtained by a number of procedures including gradient descent (GD), Levenberg-Marquardt (LM), and conjugate gradient (CG) (Omid et al. 2009; Omid et al. 2010b). Here, LM algorithm is used for error minimization, as this algorithm was designed to approach second-order training speed without having to compute the Hessian matrix (Omid et al. 2010b). The egg’s major and minor diameters were selected as input parameters whereas the ANN output was the volume of egg.

The topology of ANN (number of hidden layers and neurons) has an important role in accuracy and computational burdens of networks. The complexity of the problem indicates the number of hidden layers and neurons (Mollazade et al. 2012). In this study, one hidden layer with variable neuron number (2 to 50 neurons) was used for developing the MLP network. MATLAB software, version 2012b (8.0.0.873) was used for the design and testing of ANN models (MathWorks 2012).

Statistical analysis

To evaluate the performance of ANNs and determine the best model, Root Mean Square Error (RMSE), Mean Absolute Error (MAE) of the difference between the experimental and calculated values and coefficient of determination (R2) were used for tested models. Eq. 4, Eq. 5 and Eq. 6 represents the RMSE, MAE and R2 equations, respectively.

RMSE=i=1nPiOi2n 4
MAE=i=1nPiOin 5
R2=1i=1nPiOi2i=1nPiO¯2 6

where Pi is the network (predicted) output from observation i, Oi is the experimental output from sample i, Ō is the average value of experimental output, and n is the number of samples.

Machine vision system

To determine the volume of egg samples, a machine vision (MV) system was designed and developed. The MV system consisted of a CCD camera (PROLINE UK, Model 565 s), a USB capture card (USB 2.0 Video Capture Device, pin Avid, Germany), a lighting source with 10 super high bright LEDs (2 V, 40 mW) and a personal computer (PC). To simplify the segmentation of egg pictures from captured images easy, a black sheet was used as background. The camera was mounted about 40 cm above the background and perpendicular to it. Figure 2 shows the developed MV system. The procedure of system design consists of three subsections: image acquisition, image processing and computation of main diameters of eggs. In acquisition step, an image was captured from each sample in RGB color space and saved in MATLAB software. In image processing operation, the unwanted parts of images were cropped and the modified image was converted from RGB space to binary format.

Fig. 2.

Fig. 2

Designed machine vision system for egg mass prediction

Undesirable stains and holes in images (due to dirt, breakage and cracks) affected the pixel numbering and caused a high error in size determination. In order to eliminate these areas, the imfill function was used for this purpose. The algorithm of this function operates based on morphological reconstruction on binary images (Omid et al. 2013). To separate eggs from background, the segmentation was carried out on the images using automatic thresholding. In this method, the program finds the best threshold for each image separately. Finally, using the regionprops function, the dimensional properties of egg pictures were extracted. These properties included major and minor diameters of whole egg (in pixel unit), centroid and area of each half part. After design of MV system, experiments were carried out for its calibration and accuracy performance evaluation.

Sample preparation

The 125 intact egg samples were randomly collected on a laying day from Agricultural Community and Animal Husbandry of Iranians Modern Farms (Varamin unit) located in Tehran province and were transferred to the Instrumentation Laboratory, Department of Agricultural Machinery Engineering, Faculty of Engineering and Technology, University of Tehran, Karaj, Iran. Samples were divided into two groups: 80 % for system calibration (100 egg samples) and 20 % (25 egg samples) for evaluation purpose. The actual value of egg’s main diameters and mass were measured using a digital caliper (accuracy; 0.01 mm) and a digital balance (accuracy; 0.01 g), respectively. The volume of eggs was determined using mass of samples by Eq. 7:

Va=mρ 7

where Va is the actual volume of egg (cm3), m is the mass of egg (g) and ρ is the density of egg (g/cm3). The density of fresh egg assumed 1.035 g/cm3 (Stadelman and Cotterill 1995).

Results and discussion

The egg samples prepared for system calibration and evaluation had the mean value of 58.12 cm3 for volume, 57.12 and 43.95 mm, with standard deviation of 4.5 cm3, 1.95 and 1.29 mm for volume, major and minor diameters, respectively.

The predicted volume of eggs from mathematical model in calibration mode was compared with actual ones (Fig. 3). The R2, MAE and maximum absolute error values were 0.99, 0.59 and 1.69 cm3, respectively. The obtained results are better than results of Asadi et al. (2012). They used multiple linear regression (MLR) in egg mass prediction and obtained the best model with R2 of 0.968 and maximum error of 5 g, respectively. So the proposed model is more efficient than MLR obtained by Asadi et al. (2012).

Fig. 3.

Fig. 3

Predicted volume obtained by mathematical model vs. measured volume in calibration mode

To develop the ANNs, the calibration data was divided into 3 groups: 70 % for training, 15 % for cross validation and the remaining for test purposes. To determine the best structure of ANN, the R2 and RMSE values of test data were obtained. The networks with 2 and 3 neurons in the hidden layer had the lowest performance and so they were eliminated.

Results of ANN modeling with different number of neurons in the hidden layer are presented in Figs. 4 and 5. Among the designed networks, the best model with 2-28-1 topology had the highest value of R2Test (Fig. 4) and an acceptable value of RMSETest (Fig. 5), i.e., a network with two inputs (egg’s major and minor diameters), one hidden layer (with 28 neurons), and one output (volume of egg) (shown in Fig. 6). The R2test and RMSEtest, of the best network were 0.992 and 0.66 cm3, respectively. The obtained results are better than results of Asadi and Raoufat (2010). They obtained the correlation coefficient and maximum absolute error as 0.922 and 2.3 g for the best algorithm.

Fig. 4.

Fig. 4

The obtained R2 test values for different ANNs

Fig. 5.

Fig. 5

The RMSEtest value of ANN models with different number of neurons in the hidden layer

Fig. 6.

Fig. 6

The structure of the best ANN structure for egg volume prediction

In order to evaluate the performance of developed models, the volume of evaluation specimens was predicted using mathematical and ANN models. Figure 7 shows the predicted volume by these methods versus the actual volume. Table 1 represents the statistical results of evaluation.

Fig. 7.

Fig. 7

Result of machine vision evaluation

Table 1.

Result of statistical analysis of proposed models for egg volume (cm3) prediction

Method of prediction R2 STDEV of absolute difference Mean absolute difference Maximum absolute difference
ANN modeling 0.990 0.426 0.89 2.06
Math modeling 0.993 0.393 1.41 1.96

Conclusion

In this study, a simple machine vision system was developed for egg volume estimation. The mathematical and ANN models were developed and validated. Results of model validation confirmed the good performance of two methods. After calibration of system, another experiment was performed. Evaluation results demonstrated the superiority of the mathematical modeling. Both methods were quite general and may be readily applied for volume computation of other ellipsoidal agricultural products such as citrus fruits, limes, peaches, onions, melons, kiwifruits, pomegranates, pears, etc.

Acknowledgments

The authors would like to acknowledge their gratitude to the Center of Research & Development of ETKA Organization for its financial support in this research. The authors would also like to thank Department of Agricultural Machinery Engineering, Faculty of Agricultural Engineering and Technology, University of Tehran for his contributions towards this study.

References

  1. Afkhami A, Abbasi-Tarighat M, Khanmohammadi H. Simultaneous determination of Co2+, Ni2+, Cu2+ and Zn2+ ions in foodstuffs and vegetables with a new Schiff base using artificial neural networks. Talanta. 2009;77:995–1001. doi: 10.1016/j.talanta.2008.07.065. [DOI] [PubMed] [Google Scholar]
  2. Anon (2012) Food and Agricultural commodities production. http://faostat.fao.org/site/339/default.aspx. Accessed 3 Sept 2013.
  3. Asadi V, Raoufat MH. Egg weight estimation by machine vision and neural network techniques (a case study fresh egg) Int J Nat Eng Sci. 2010;4:1–4. [Google Scholar]
  4. Asadi V, Raoufat MH, Nassiri SM. Fresh egg mass estimation using machine vision technique. Int Agrophys. 2012;26:229–234. doi: 10.2478/v10247-012-0034-6. [DOI] [Google Scholar]
  5. Du CJ, Sun DW. Estimating the surface area and volume of ellipsoidal ham using computer vision. J Food Eng. 2006;73:260–268. doi: 10.1016/j.jfoodeng.2005.01.029. [DOI] [Google Scholar]
  6. Dutta R, Kashwan KR, Bhuyan M, Hines EL, Gardner JW. Electronic nose based tea quality standardization. Neural Netw. 2003;16:847–853. doi: 10.1016/S0893-6080(03)00092-3. [DOI] [PubMed] [Google Scholar]
  7. Gupta MJ, Irudayaraj J, Debroy C. Spectroscopic quantification of bacteria using artificial neural networks. J Food Protect. 2004;67:2550–2554. doi: 10.4315/0362-028x-67.11.2550. [DOI] [PubMed] [Google Scholar]
  8. Hassan-Beygi SR, Ghanbarian D, Farahmand M. Prediction of saffron crocus corm mass by geometrical attributes. Sci Hortic. 2010;124:109–115. doi: 10.1016/j.scienta.2009.12.006. [DOI] [Google Scholar]
  9. Hernandez JA. Optimum operating conditions for heat and mass transfer in foodstuffs drying by means of neural network inverse. Food Control. 2009;20:435–438. doi: 10.1016/j.foodcont.2008.07.005. [DOI] [Google Scholar]
  10. Houessou JK, Goujot D, Heyd B, Camel V. Modeling the formation of some polycyclic aromatic hydrocarbons during the roasting of Arabica coffee samples. J Agric Food Chem. 2008;56:3648–3656. doi: 10.1021/jf073233j. [DOI] [PubMed] [Google Scholar]
  11. Hua C, Huili1 S, Xiangxi Y, Xin C (2011) Artificial Neural Network in Food Processing. 30th Chinese Control Conference, 2687–2692, 22–24 July 2011, Yantai, China.
  12. Javadikia P, Dehrouyeh MH, Naderloo L, Rabbani H, Lorestani AN. Measuring the weight of egg with image processing and ANFIS model. Lect Notes Comput Sci. 2011;7076:407–416. doi: 10.1007/978-3-642-27172-4_50. [DOI] [Google Scholar]
  13. Jin YH, Lee KT, Lee WI, Han YK. Effect of storage temperature and time on the quality of eggs from laying hens at peak production. Asian Austral J Anim. 2011;24:279–284. doi: 10.5713/ajas.2011.10210. [DOI] [Google Scholar]
  14. Khojastehnazhand M, Omid M, Tabatabaeefar A. Determination of orange volume and surface area using image processing technique. Int Agrophys. 2009;23:237–24. [Google Scholar]
  15. Koc AB. Determination of watermelon volume using ellipsoid approximation and image processing. Postharvest Biol Tec. 2007;45:366–371. doi: 10.1016/j.postharvbio.2007.03.010. [DOI] [Google Scholar]
  16. MathWorks . Matlab User’s guide. USA: The MathWorks Inc; 2012. [Google Scholar]
  17. Mollazade K, Omid M, Arefi E. Comparing data mining classifiers for grading raisins based on visual features. Comput Electron Agr. 2012;84:124–131. doi: 10.1016/j.compag.2012.03.004. [DOI] [Google Scholar]
  18. Narushin VG. Production, modeling, and education egg geometry calculation using the measurements of length and breadth. Poult Sci. 2005;84:482–484. doi: 10.1093/ps/84.3.482. [DOI] [PubMed] [Google Scholar]
  19. Omid M, Baharlooei A, Ahmadi H. Modeling drying kinetics of pistachio nuts with multilayer feed-forward neural network. Dry Technol. 2009;27:1069–1077. doi: 10.1080/07373930903218602. [DOI] [Google Scholar]
  20. Omid M, Khojastehnazhand M, Tabatabaeefar A. Estimating volume and mass of citrus fruits by image processing technique. J Food Eng. 2010;100:315–321. doi: 10.1016/j.jfoodeng.2010.04.015. [DOI] [Google Scholar]
  21. Omid M, Mahmoudi A, Omid MH. Development of pistachio sorting system using PCA assisted artificial neural networks of impact acoustics. Expert Syst Appl. 2010;37:7205–7212. doi: 10.1016/j.eswa.2010.04.008. [DOI] [Google Scholar]
  22. Omid M, Akram A, Golmohammadi A. Modeling thermal conductivity of Iranian flat bread using artificial neural networks. Int J Food Prop. 2011;14:708–720. doi: 10.1080/10942910903374098. [DOI] [Google Scholar]
  23. Omid M, Soltani M, Dehrouyeh MH, Mohtasebi SS, Ahmadi H. An expert egg grading system based on machine vision and artificial intelligence techniques. J Food Eng. 2013;118:70–77. doi: 10.1016/j.jfoodeng.2013.03.019. [DOI] [Google Scholar]
  24. Pan PM, Li JP, Lv GL, Yang H, Zhu SM, Lou JZ. Prediction of shelled shrimp weight by machine vision. J Zhejiang Univ Sci B. 2009;10:589–594. doi: 10.1631/jzus.B0820364. [DOI] [PMC free article] [PubMed] [Google Scholar]
  25. Pan LQ, Zhan G, Tu K, Tu S, Liu P. Eggshell crack detection based on computer vision and acoustic response by means of back-propagation artificial neural network. Eur Food Res Technol. 2011;233:457–463. doi: 10.1007/s00217-011-1530-9. [DOI] [Google Scholar]
  26. Panagou EZ, Tassou CC, Saravanos EK, Nychas GJ. Application of neural networks to simulate the growth profile of lactic acid bacteria in green olive fermentation. J Food Protect. 2007;70:1909–1916. doi: 10.4315/0362-028x-70.8.1909. [DOI] [PubMed] [Google Scholar]
  27. Poonnoy P, Tansakul A, Chinnan M. Artificial neural network modeling for temperature and moisture content prediction in tomato slices undergoing microwave-vacuum drying. J Food Sci. 2007;72:42–47. doi: 10.1111/j.1750-3841.2006.00220.x. [DOI] [PubMed] [Google Scholar]
  28. Rashidi M, Gholami M. Prediction of egg mass based on geometrical attributes. Agric Biol J N Am. 2011;4:638–644. doi: 10.5251/abjna.2011.2.4.638.644. [DOI] [Google Scholar]
  29. Sobel RM, Ballantine DS. 2D bitmapping approach for identification and quantitation of common base flavor adulterants using surface acoustic wave arrays and artificial neural network data analysis. Anal Chim Acta. 2008;608:79–85. doi: 10.1016/j.aca.2007.12.007. [DOI] [PubMed] [Google Scholar]
  30. Stadelman WJ, Cotterill OJ. Egg science and technology. 4. New York: Food Product Press; 1995. [Google Scholar]
  31. Sun WG, Zhou JW, Shi QD, Da K (2004) Reconstructing concentrations of ternary solution based on artificial neural network. 3rd International Symposium on Instrumentation Science and Technology, 51–57, 18–22 August 2004, Held in Xi’an, China
  32. Taghadomi-saberi S, Omid M, Emam-Djomeh Z, Ahmadi H. Estimation of sweet cherry antioxidant activity and anthocyanin content during ripening by artificial neural network assisted image processing technique. Int J Food Sci Tech. 2013;48:735–741. doi: 10.1111/ijfs.12021. [DOI] [PubMed] [Google Scholar]
  33. Thomas BG, Hass J, Weir MD. Thomas’ calculus including second-order differential equations. New York: Pearson Addison- Wesley; 2006. [Google Scholar]
  34. Torrecilla JS, Cámara M, Fernández V, Piera G, Caceres JO. Solving the spectroscopy interference effects of beta-carotene and lycopene by neural networks. J Agr Food Chem. 2008;56:6261–6266. doi: 10.1021/jf8005239. [DOI] [PubMed] [Google Scholar]
  35. Wang LZ, Yang B, Wang R, Dua XQ. Extraction of pepsin-soluble collagen from grass carp (Ctenopharyngodon idella) skin using an artificial neural network. Food Chem. 2008;111:683–686. doi: 10.1016/j.foodchem.2008.04.037. [DOI] [Google Scholar]
  36. Wang Y, Yang W, Winter P, Walker L. Walk-through weighing of pigs using machine vision and an artificial neural network. Biosyst Eng. 2008;100:117–125. doi: 10.1016/j.biosystemseng.2007.08.008. [DOI] [Google Scholar]
  37. Wilson HR. Interrelationship of egg size, chick size, posthatching growth and hatchability. World Poult Sci J. 1991;47:5–20. doi: 10.1079/WPS19910002. [DOI] [Google Scholar]

Articles from Journal of Food Science and Technology are provided here courtesy of Springer

RESOURCES