Development of Classification Method for Determining Chicken Egg Quality Using GLCM-CNN Method

Development of Classification Method for Determining Chicken Egg Quality Using GLCM-CNN Method

Pratomo Setiaji* Kusworo Adi Bayu Surarso

School of Postgraduate Studies, Diponegoro University Semarang, Semarang 50275, Indonesia

Department of Information System, Faculty of Engineering, Muria Kudus University, Kudus59327, Indonesia

Department of Physics, Faculty of Science and Mathematics, Diponegoro University, Semarang 50275, Indonesia

Department of Mathematics, Faculty of Science and Mathematics, Diponegoro University, Semarang 50275, Indonesia

Corresponding Author Email: 
pratomo.setiaji@umk.ac.id
Page: 
397-407
|
DOI: 
https://doi.org/10.18280/isi.290201
Received: 
10 July 2023
|
Revised: 
1 December 2023
|
Accepted: 
8 December 2023
|
Available online: 
25 April 2024
| Citation

© 2024 The authors. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

Eggs are widely consumed due to their high content of vitamin B12, choline and iron. External factors can be detected by observing the eggshell or taken into consideration. The nutrition in eggs is influenced by egg quality, which can be directly observed from the shell. If the shell is cracked, it can be inferred that the egg has poor quality because Salmonella bacteria are dangerous pathogens that can enter the egg. The current issue lies in the complexity and inefficiency of individually classifying eggs by workers, as it is a complicated, time-consuming, frustrating, and inefficient task. Therefore, it is important to separate them automatically. The selection of cracked and intact eggs in this research is an innovative approach to classification using a highly accurate machine learning method. The application of the GLCM-CNN method is an innovative strategy employed for selecting and classifying cracked eggs, as outlined in this research. VGG 19, one of the computational methods, is utilized as a comparative method alongside RESNET 50 and VGG 16. The GLCM-CNN algorithm in this research employed 1,000 images for each class, with a validation set of 20% for each class, resulting in an accuracy of 98%. The inefficient classification process and complexity of automated egg quality classification can be significantly addressed through the findings presented in this research.

Keywords: 

egg crack, classification, GLCM-CNN

1. Introduction

The consumption of eggs is one of the essential needs for every family due to the high nutritional value they possess. Eggs are a rich source of protein, vitamins, and important minerals, making them a valuable dietary component for humans [1].

The general classification of egg quality is divided into two main categories: external factors, observed from the shell's perspective, and internal factors. The eggshell is a primary consideration in visual observation as an initial assessment. Meanwhile, for internal factors, illumination can be used, or one can directly inspect and observe the contents. Some conditions on the eggshell that can be identified as defective eggs include cracks and dirt on the shell. Defects on the internal side of the egg are generally manifested by the presence of blood spots. The deterioration of egg quality is a result of defects and can pose a threat to health [2].

Health issues are crucial considerations in the automatic selection and separation of eggs based on their quality, alongside economic considerations [3]. The bacterium Salmonella is a dangerous pathogen that could pose a significant threat if it enters the egg. This can happen due to cracks or defects in the eggshell, providing a potential entry point for Salmonella bacteria [4]. The task of categorizing eggs has long been carried out by workers, and it is a complex and time-consuming process, often inefficient and frustrating for workers. Numerous studies have been conducted to automate the egg selection process with a focus on improving accuracy. One of the most popular methods is deep learning, where deep learning techniques are employed to classify eggs as either good or defective, ensuring the quality of egg classification [5].

Research related to egg cracks is using a novel method for detecting eggshell cracks based on machine learning. Many proposed methods aim to solve this problem and have gained popularity in the current era. The research conducted in this field aims to address the challenges associated with egg crack detection and classification [6] The method for detecting cracked eggs combines Gray-Level Co-occurrence Matrix (GLCM), wavelet transformation, and other techniques by incorporating Support Vector Machine (SVM) Into artificial neural networks, achieving an accuracy of 96.67% as a method for classifying cracked and intact eggs [7].

The utilization of acoustic signal method generated by rolling eggs on a plate to determine whether they are cracked or intact is performed [8]. Meanwhile, the method used is the F-ratio of acoustic signal frequency to evaluate the ability to distinguish cracked eggs from sound, resulting in an accuracy of 96.2% [9]. The learning method is constructed using SVM with an accuracy of 94.6%, utilizing One-versus-All, One-versus-One, and Directed Acyclic Graph classifiers [10].

In 2018, a detection model was implemented utilizing the support vector machine (SVM). Statistical parameter methods within SVM are employed to distinguish between cracked and intact eggs, achieving an accuracy of 93% [4]. Other researchers used the Faster Region-based Convolutional Neural Network method to detect damages on eggshells. The evaluation of the test data was conducted using mean average precision (mAP) [11]. The Fine-tuned VGG16 method involves the image acquisition process using candle lighting for training and testing the Convolutional Neural Network (CNN) model. The development of the classification block is employed as the model architecture based on the structure of the VGG 16 method. The achieved accuracy is 96.16% [2].

The method for detecting black spots on eggs based on the CNN model GoogLeNet achieved an accuracy of 95.38%. This method utilizes the Inception convolutional module within the GoogLeNet model to extract features related to black spots on eggs [12]. The modified CNN model was developed and trained on a dataset of egg images to classify the images into the categories of cracked and intact [13].

However, based on the literature review conducted by the author, encompassing an analysis of 70 articles, it is evident that the methods of data selection and collection employed have not been previously undertaken by researchers, previous research in the field of image processing-based methods has shown accuracies ranging from 93% to 96%. There is a need for further improvement in accuracy to approach the desired goal of 100%, which has not yet been achieved in studies using models such as VGG16 and others. Additionally, there is a lack of research discussing the classification of cracked and intact egg quality using images captured under natural daylight conditions with a specific distance.

Image processing has been widely employed by researchers in various fields, including Environmental Science [14], medical [15], agricultural [16, 17] and transportation [18] domains. Previous studies related to eggs have also utilized image processing techniques [19, 20]. The utilization of image processing is crucial as it enhances image quality, enables noise filtering, facilitates feature extraction, and allows for image and edge enhancement [21]. These options can be employed to extract and augment data effectively.

Compared to other studies, this research employs a GLCM-based image processing approach that has been popular and widely used in various domains, such as Recognition and Classification of Apple Leaf Diseases [22] , Plant Disease Classificationc [23], Leather Defect Detection and Classification [24], Apple Sorting [25], Potato Agricultural Product Defects [26], Tomato Leaf Diseases [27], enhancing chestnut quality [28], mango leaf variety classification [29], and Leaf Disease Detection [30].

Other studies utilizing image processing techniques involve RGB image conversion to grayscale, texture extraction, and backpropagation neural network classification. Features extracted using the Gray-Level Co-occurrence Matrix (GLCM) is utilized as the method, and a backpropagation artificial neural network serves as its classifier have demonstrated improved accuracy and effectiveness in image detection, achieving a 95% accuracy rate [31].

The aim of this research is to classify and select cracked and intact egg quality using machine learning with a high level of accuracy based on images captured at a specific distance under natural daylight conditions. The images are then extracted using GLCM. The next step involves developing a specific CNN model and training it on the previously extracted images to classify the egg images into the categories of cracked and intact. The performance of this model is then compared with VGG 19, VGG 16, and RESNET 50 models.

2. Literature Review

The use of acoustic signals was employed in 2015 with a detection rate result of 90%, as research related to egg quality involved placing eggs on a plate and rolling them to obtain images of cracked and intact eggs [8]. Wang et al. utilized the F-ratio frequency approach to assess the ability to differentiate cracked eggs based on sound, achieving an accuracy of 96.2% [9]. In 2017, Priyadumkol et al. [32] conducted research with similar results, both achieving an accuracy of 94%.

Research utilizing support vector machine (SVM) method to distinguish between cracked and intact eggs based on statistical characteristics was conducted [4]. The segmentation approach based on Laplacian of Gaussian evaluated crack properties on illuminated egg images [33]. Datta employed the Faster Region-based Convolutional Neural Network for faster processing and evaluated the test data using mean average precision [11]. Furthermore, further investigation by Nasiri employed the VGG16 Fine-tuned architecture approach, candle lighting for image acquisition, and training and testing of the CNN model [2]. Previous studies also involved hybrid models of sequential multiple image-based convolutional neural network-BiLSTM [3]. A modified CNN model was developed and trained on image regions to classify damaged and intact egg images [13].

This study proposes the development of a new method for classifying cracked and intact eggs using a hybrid GLCM-CNN approach, aiming to capture detailed texture features of eggs through the GLCM method.

2.1 GLCM

GLCM is a field in image processing where feature extraction plays a crucial role in reducing classification errors. [34]. The process of extracting texture information based on the matrix of dependencies and spatial gray levels uses the Gray Level Co-Occurrence Matrix (GLCM) method, where GLCM is one of the most commonly used second-order statistical tools [35].

Both coarse and fine textures can be easily captured in their structure by the Gray Level Co-Occurrence Matrix (GLCM) method. and is applicable to both monochrome and color images. It exhibits flexibility concerning image resolution. On the other hand, Convolutional Neural Networks (CNN) can perform automatic feature extraction, comprehend spatial contexts, share parameters, handle rotations and size variations, and possess transfer learning capabilities.

The texture properties in an image can be examined using GLCM by identifying the frequency of specific pixel value occurrences in pairs and their spatial relationships. The directions of GLCM include different degrees: 135°, 90°, 45°, and 0° [36]. Previous studies that utilized GLCM include automatic detection of COVID-19 from chest X-ray images [37], classification of computer graphics images [38], glaucoma classification [34], gray mold detection on strawberry leaves [39], and foreign object classification of rice [40]. All of these studies have employed GLCM, a prominent technique used by many researchers. The GLCM feature extraction method involves creating a matrix that represents the frequency of two pixels with specific intensities at a certain distance and orientation angle within the image. Gray-level features of an object that distinguish it from other objects are used for texture-based feature extraction. Contrast, correlation, energy, and homogeneity are among the extracted qualities.

2.1.1 Contrast

The contrast function is used to calculate the level of difference in image depths. The higher the gray-level contrast, the greater the contrast. Conversely, the lower the contrast, the smaller the difference in gray-level between two pixels. Contrast is defined by Eq. (1).

Contrast $=\sum_i \sum_j(i-j)^2 p(i, j)$       (1)

2.1.2 Correlation

Correlation indicates the extent to which a reference pixel is related to its neighbors across the image, Correlation is defined by Eq. (2).

Correlation $=\sum_i \sum_j \frac{i j P_d(i, j)-\mu_x \mu_y}{\sigma_x \sigma_y}$         (2)

2.1.3 Energy

The energy value characterizes the level of intensity distribution within an image, represented by Eq. (3).

Energy $=\sum_i \sum_i P^2(i, j)$         (3)

2.1.4 Homogeneity

The homogeneity feature calculates the level of uniformity in an image. A higher homogeneity value indicates an image with a more uniform grayscale level. Homogeneity is calculated using Eq. (4), which measures the similarity between two images based on their grayscale level. An image with a higher homogeneity score has a more similar grayscale level throughout.

Homogeneity $=\sum_i \sum_j \frac{P(i, j)}{1+|i-j|}$       (4)

2.2 Deep learning

A popular subset of machine learning in various artificial intelligence domains is deep learning. It leverages abstractions, hierarchical architectures, and high-level characteristics of the learning data. Deep learning, based on neural networks, possesses a unique capability to automatically extract and select optimal features [2]. Convolutional neural networks (CNNs) are the most well-known and commonly used group of deep learning algorithms, particularly in the recognition of various patterns, including object detection in digital images. In Figure 1, it illustrates the correlation between the convolutional neural network, deep learning, machine learning, and artificial intelligence [41].

Deep learning enables computational models with multiple layers of processing to discover data representations with varying levels of abstraction. The state of the art has been significantly enhanced by this technique across various domains, including object identification, speech recognition, and visual object recognition, among others. Deep learning unveils intricate structures within vast datasets through the utilization of the backpropagation technique. This method elucidates how the internal parameters of the machine, responsible for creating representations in each layer, should adjust in response to the representations in the layers above. Fields such as image processing, video processing, speech recognition, and audio processing have experienced notable advancements due to the implementation of deep convolutional networks [42].

2.3 Convolutional neural network (CNN)

Traditional machine learning algorithms are now being supplanted by the promising feature extraction technology known as CNN. Unlike conventional machine learning algorithms, which often struggle to extract the most powerful and effective features, CNN demonstrates a remarkable capacity for generalization [43]. Recent applications of CNN span various industries, including sidewalk crack detection [44], classification of normal, bacterial, and viral pneumonia [45], face recognition [46], and object recognition [41], significant advancements have been made in these domains, moving in different directions.

Figure 1. Deep learning

Figure 2. CNN's Architecture

Downsampling layers serve as feature extractors within CNNs, in addition to the convolutional layers, a feature not present in conventional neural networks. Neurons are only connected to a local part of neurons in the upper layers, known as the local receptive field. A given number of neurons make up each feature map, and all of the neurons' weights are shared by all of the neurons in that feature map. Reducing the interaction between the network's layers, lowering network parameters, and avoiding overfitting are the three main purposes of weight sharing.

Generally, During network training, convolution kernels' starting values are randomly generated, and the weights are continually evaluated and changed until appropriate weights are discovered. Downsampling is a special kind of convolution that's also called pooling. As a result, weight sharing, pooling, and local receptive field are CNN's three primary features.

CNN consists of a stack of layers, with at least one layer attached to each layer. As shown in Figure 2, there are three main layers that compose CNN: the output classification layer, the fully connected layer, and the convolutional layer.

Another significant hidden layer in CNN is the activation layer. It handles complex tasks more effectively. The incorporation of non-linear elements provides flexibility for tackling intricate issues in neural networks. The ReLU activation function is easier to train and yields better results. In addition to ReLU, the sigmoid activation function is also employed in this study. The equation in the ReLU function represents a piecewise linear function where the value produces the input directly if positive and returns zero if negative.

For classification across the entire network, a fully connected layer is employed, serving as the last layer of the CNN. A 1×1 convolution will be utilized if the preceding layer involves a fully connected layer. The use of global convolution hw, representing height (h) and width (w) in the previous convolutional layer, is applied when the fully connected layer acts as the preceding convolutional layer [47]. GLCM CNN is a hybrid method that involves detailed texture feature extraction, and the feature data obtained is processed using CNN to achieve classification.

The theoretical expectation of GLCM-CNN is that the model should excel in recognizing patterns within digital images better than either the GLCM or CNN models individually. This is because GLCM-CNN combines the advantages of both models. GLCM can extract crucial features from digital images, such as texture, patterns, and orientation. CNN, on the other hand, can learn relationships between these features to make predictions. Consequently, GLCM-CNN is expected to enhance the accuracy of digital image classification, as evidenced by the findings of this study where the accuracy improved to 98%.

2.4 Qualified eggs

High-quality and edible chicken eggs are eggs that have not undergone fortification, cooling, preservation, and hardening processes, and they possess good physical characteristics in terms of shape, smoothness, thickness, completeness, and cleanliness as shown in Table 1.

The consumption of cage color and egg weight is used to classify chicken eggs, with the cage color corresponding to the strain and the weight categorized as small (50 g), medium (50 g to 60 g), and large (> 60 g), respectively [48].

Table 1. Egg Quality Grade

No.

Eggshell Condition

Information

1

Shape

Normal

2

Smoothness

Smooth

3

Thickness

Thick

4

Completeness

Intact

5

Cleanliness

Clean

Figure 3(a) depicts an egg with cracked shell, while Figure 3(b) illustrates an egg with intact shell, representing the challenges associated with damaged or substandard eggs.

Figure 3. Egg types: (a) Cracked egg and (b) intact egg

3. Material and Method

High-resolution cameras were employed in this research as tools for image acquisition, ensuring that the images maintain a high quality. The computer used has the specification of an Intel (R) Core (TM) i7-10510U CPU @ 1.80GHz 2.30 GHz. Python is the programming language utilized for computation. It incorporates the 'os' package, allowing it to read various file types and directories. Additionally, numpy and TensorFlow are employed for matrix calculations. For the visualization of training and validation data, matplotlib.pyplot is used to create graphs and represent images.

The egg samples were obtained from local farms and were of varying sizes. They were divided into two classes: cracked eggs and intact eggs. Human experts were involved in determining the criteria for classifying the eggs as intact or cracked.

The research process, as shown in Figure 4, involved several stages. Data collection serves as the initial step, utilizing a digital camera as the tool to capture images distinguishing between cracked and intact eggs. The second step employs deep learning techniques, involving preprocessing followed by the training and testing processes.

Figure 4. Flow of the research process

3.1 Data collection

Figure 5. Egg imagery

In other studies, a digital camera was used to capture data of shrimps underwater [49, 50], In this research, the egg data was obtained from local chicken farms directly. The areas of cracked and intact eggs are captured entirely by a camera using the following method: a blue-colored plate is placed with an egg on it, and then a camera is positioned above the egg to capture the image. The process of capturing the images can be seen in Figure 5.

The egg images were captured using natural daylight under clear weather conditions to ensure clear image visibility. The collection of image data is based on the camera's distance from the object, which is 15 cm, while the camera's angle with the object is 90 degrees. The image data were categorized into two classes: cracked eggs and whole eggs, each consisting of 1000 images. This large dataset aims to enable the model to learn complex patterns, prevent overfitting, and enhance accuracy. After data collection, the next step involves preprocessing. Gray-scale images were required to extract texture features. RGB to HSV color space conversion was performed [51], followed by GLCM extraction to obtain texture feature values, including contrast, correlation, energy, and homogeneity. The next stages involved downsampling, data augmentation, and the utilization of deep learning methods.

3.2 Image pre-processing and data augmentation

In this paper, the GLCM variables employed include contrast to assess image quality and correlation to measure the extent to which pixel intensities in the image correlate with each other. The image size utilized as input for the CNN is 128×128. As for the CNN architecture, It consists of three convolutional layers with 32 filters in the first and second convolutions, while a 3×3 kernel with 64 filters constitutes the third convolution applied in this research. ReLU activation function is applied, the number of iterations (100 epochs) and batch size are set to 10, and the Adam optimization algorithm is used.

RGB follows an additive color model, displaying different colors when additional intensity is given to red (r), green (g), and blue (b) [52]. Collecting images is often a costly and challenging process; gathering a limited dataset of images presents its own set of challenges. To address this issue, image augmentation has been established as an effective and efficient strategy [53].

Downsampling is a technique used to generate low-resolution images to reduce the iteration time of image style transfer [54]. GLCM is a texture-based feature among various other texture-based feature extractions, standing out in its operation by solely utilizing pixels and identifying pixel combinations [35].

This stage involves introducing the CNN and performing object classification. Data augmentation is applied to generate additional data and enrich the variations of the previous data, which can be used by the CNN as new input parameters with different types. CNN takes RGB-formatted images as input, where the involvement of parameters is significant, it requires a sufficient amount of images and parameters to effectively learn the weights during training without overfitting. In some other research fields, the addition of new images may not be feasible due to the high cost of materials and time-consuming processes. Therefore, researchers create new images with the same labels but using different image processing techniques. Image transformations can be performed by adjusting the color intensity, adding noise, rotating, or resizing the images.

In the current study, the process involves resizing the original images from 1920×1080 pixels to 128×128 pixels. This change in size reduces computation time and maximizes results [55]. Additionally, the color is converted to grayscale, as shown in Figure 6. Augmentation techniques such as horizontal flipping, zooming, image rotation, width shift range, height shift range, and shear range are applied to the images as image processing methods to expand the training dataset.

In addition, during the training phase, pixel values normalization of the training images and resizing the original images are automatically performed by the written code.

Figure 6. Egg: (a) cracked and (b) intact

3.3 Training CNN model

After the dataset preparation process, the model training process is conducted. This process begins by creating a CNN model with a 3-layer convolution architecture. In each convolution process, the RELU activation function is used to transform negative values in the matrix [56]. This function sets a threshold from zero to infinity. Zero padding is applied for each convolution process, which means zero-valued pixels are added to each side of the input matrix. The resulting max-pooling outputs in the form of a multidimensional array are flattened into a vector. Since the output is a softmax categorization, the loss function used is sparse categorical cross-entropy. The training and validation accuracy on each epoch are also monitored by passing in the metrics argument [57].

3.4 Evaluation methods

The performance evaluation method used in this study is the Confusion Matrix, which is commonly employed to assess the performance of a classification model. The Confusion Matrix consists of four types of calculated results: True Positive (TP), False Positive (FP), True Negative (TN), and False Negative (FN). True Positive (TP) represents the number of data instances that are classified as positive class (or the desired label) and actually belong to the positive class. False Positive (FP) represents the number of data instances that are classified as positive class (or the desired label) but actually belong to a different class. True Negative (TN) represents the number of data instances that are classified as negative class (or the undesired label) and actually belong to the negative class. False Negative (FN) represents the number of data instances that are classified as negative class (or the undesired label) but actually belong to a different class.

4. Results and Discussion

The process of detecting eggs with cracked and intact classes involves capturing image data using a camera at predefined distances and angles. The training dataset consists of 1.000 images for the cracked class and 1.000 images for the intact class, while the validation dataset consists of 200 images for each class. The data collection process involves using a camera to ensure that all areas of the eggs are captured in the images, and the captured images are stored in a computer for further analysis.

The research model employed in this study is the combination of GLCM (Gray-Level Co-occurrence Matrix) and Deep learning. Prior to the training and testing processes, the image data is preprocessed using GLCM, as depicted in Figure 7.

Figure 7. Images after preprocessing

The original image data of the eggs is divided into smaller images of the same size. Each smaller image is then processed using digital image processing techniques. The next step involves using the processed images as input to generate a feature representation with the aim of enabling the CNN to recognize objects regardless of their position within an image.

This process is performed for all parts of each image using the same filter. Therefore, each part of the image has the same multiplier, which is referred to as weight sharing in the context of neural networks. If there is something interesting present in each image, it will be marked as an object of interest. The results of each smaller image are then stored in a new array.

The next step is to reduce the size of the array by using downsampling, specifically max pooling, which involves taking the maximum pixel value within each pooling kernel. This helps to reduce the number of parameters while retaining the most important information from each part.

Once the image has been transformed from a large-sized image to a sufficiently small array, the next step is to input this small array into another neural network. The final neural network will determine whether the image is a match or not.

To differentiate it from the convolutional steps, this can be referred to as a "fully connected" network.

The CNN model used in this study has an architecture consisting of four blocks of convolutional layers. In each convolutional process, the RELU activation function is used to transform negative values in the matrix. This function applies a threshold from zero to infinity. Zero padding is applied in each convolutional process, where pixels with a value of zero are added to each side of the input matrix.

Before the final Dense layers, a Dropout layer is applied with a probability of 0.5. This means that 50% of the values coming into the Dropout layer will be set to zero, helping to prevent overfitting. The Dense layer has 512 units with a relu activation function. The model will output class probabilities for the two classes, "cracked" and "intact" eggs, using softmax. The performance of the classification model will be evaluated using a confusion matrix.

We compared our own modified GLCM-CNN model with other model architectures, including VGG 19, VGG 16, and RESNET 50. Each architecture was trained for 100 epochs, and the resulting training accuracy and validation accuracy are shown in Figure 8.

(a) VGG 19

(b) VGG 16

(c) RESNET 50

(d) GLCM-CNN

Figure 8. Training and validation accuracy

The proposed GLCM-CNN architecture GLCM-CNN demonstrates remarkably high accuracy (98%), while RESNET 50 exhibits the lowest accuracy (50%). VGG 19 and VGG 16 fall in between, with GLCM-CNN having the highest precision (98%), indicating the model's excellent ability to identify true positives. RESNET 50 has the lowest precision (25%). Moreover, GLCM-CNN also boasts the highest recall (98%), signifying its exceptional capability to identify the majority of positive instances. RESNET 50 has the lowest recall (50%). GLCM-CNN achieves the highest F1-score (98%), illustrating a well-balanced trade-off between precision and recall. RESNET 50 records the lowest F1-score (33%). The sensitivity of RESNET 50 is notably low (0%), suggesting its ineffectiveness in detecting positive instances, whereas GLCM-CNN achieves the highest sensitivity (96%). All architectures exhibit 100% specificity, indicating their excellent performance in identifying negative instances. GLCM-CNN stands out with high accuracy, precision, recall, and F1-score. RESNET 50 performs poorly overall, especially in detecting positive instances, while VGG 19 and VGG 16 show comparable performance across several metrics, as shown in Table 2.

Table 2. Performance comparison of proposed GLCM-CNN with VGG 19 VGG 16 RESNET 50

Architecture

VGG 19

VGG 16

RESNET 50

GLCM-CNN

Accuracy (%)

0.69

0.70

0.50

0.98

Precision (%)

0.81

0.81

0.25

0.98

Recall (%)

0.69

0.70

0.50

0.98

F1-score

0.66

0.67

0.33

0.98

Sensitivity (%)

0.39

0.40

0.00

0.96

Specificity (%)

1.00

1.00

1.00

1.00

The evaluation of the model commonly used is the confusion matrix [58-61], The confusion matrix is a method that can provide highly detailed information about the performance of a classification model. It enables the evaluation of the model's performance for each class separately, offering better insights into the model's tendencies to make errors in specific classes. With elements such as True Positive (TP), True Negative (TN), False Positive (FP), and False Negative (FN), various evaluation metrics like accuracy, precision, recall (sensitivity), specificity, and F1-score can be computed.

In Figure 9, it can be observed that the number and average of the confusion matrix for the cracked and intact classes were perfectly classified with an accuracy of 98%. Previous studies on egg classification achieved accuracies of 96% and 96.1% [2, 3, 9] reported an accuracy of 96.67%, Priyadumkol et al. [32] achieved the best accuracy of 94%, Wu et al. [4] obtained an accuracy of 93%, Botta et al. [13] achieved an accuracy of 95.38%, and Bao et al. [33, 62, 63] reported classification results with accuracies of 90.1%, 91.0%, and 92.5%, respectively. Therefore, it can be concluded that the modified GLCM-CNN architecture used in this study achieved a higher accuracy of 98%.

Figure 9. GLCM-CNN Confusion matrix cracked and intact

The GLCM-CNN study yields superior results due to several key factors. Firstly, the utilization of GLCM as a feature extraction method provides an in-depth understanding of image texture, enabling discrimination between fine and coarse textures. Secondly, the integration of GLCM with CNN allows for more detailed and automated feature extraction, understanding spatial contexts, and performing rotations and resizing, thereby enhancing the model's ability to classify accurately.

Furthermore, the CNN architecture, designed with convolutional layers and appropriate filters, effectively captures complex patterns in egg images. Data augmentation processes contribute significantly by enhancing the diversity of training data, thereby improving the model's generalization capabilities on test data.

Lastly, the transfer learning capability of CNN enables the model to leverage knowledge learned from extensive previous datasets, thereby enhancing performance on smaller datasets related to eggs. The combination of all these factors results in the GLCM-CNN research outperforming theoretical expectations, providing an effective solution for cracked and intact egg classification.

From the classification process, it can be observed that the GLCM-CNN method achieved the highest accuracy of 0.98. The resulting confusion matrix from the GLCM-CNN method is shown in Figure 9. From this matrix, we can obtain the values of True Positive (TP) in the lower right quadrant of 200, False Positive (FP) in the upper right quadrant of 8, True Negative (TN) in the upper left quadrant of 198, and False Negative (FN) in the lower left quadrant of 0.

This research is an interdisciplinary study involving the fields of animal husbandry and computer science. The findings of this research can be utilized by scientists in these fields to expand research on egg quality using artificial intelligence.

5. Conclusions

This study successfully classified and selected the quality of cracked and intact eggs using machine learning with a high level of accuracy. The GLCM-CNN-based system developed in this research involved several different stages, including dimensionality transformation, augmentation, downsampling, GLCM processing, and classifier implementation. The method effectively managed the complexity of the system. The hierarchical model used was able to perform the classification task autonomously without requiring background removal. The proposed GLCM-CNN system has proven to be effective in classifying cracked and intact egg images. The developed GLCM-CNN algorithm in this study demonstrated efficiency in sorting eggs with an accuracy rate of 98%, which is higher compared to the VGG 19, VGG 16, and RESNET 50 models.

The development of the hybrid GLCM CNN framework at the theoretical level has a significant impact on the advancement of image processing theory, particularly in the understanding and utilization of texture information for classification purposes. The findings of this study can assist egg farmers in automatically categorizing eggs based on their conditions, distinguishing between those in good condition and those that are cracked.

The limitation of this study is that it can only be conducted on stationary eggs, allowing the entire surface to be visible under sufficient sunlight conditions. When the egg conditions change or when the eggs roll using a conveyor, the camera may not effectively capture the entire image. Consequently, the classification results are expected to decline. Future research can apply the developed method to moving eggs using an automated conveyor and under various lighting conditions, with a larger dataset.

The egg classification model using the GLCM-CNN method exhibits an accuracy of 98%, indicating an excellent overall performance. Notably, the high sensitivity (recall) for cracked eggs, reaching 96%, signifies the model's capability to identify the majority of genuinely cracked eggs. However, the high specificity of 100% indicates that no intact eggs were misclassified as cracked. Despite the high accuracy, particular attention should be given to evaluating the model's quality in detecting intact eggs. This is evident from the precision value of 98%, indicating that a small portion of intact eggs might be misclassified as cracked. The high F1-score of 98% demonstrates a good balance between precision and recall. In conclusion, the GLCM-CNN model performs exceptionally well in classifying cracked and intact eggs. However, attention is needed to mitigate potential errors in detecting intact eggs. This analysis provides a foundation for model improvement and a deeper understanding of the characteristics of egg classification using the GLCM-CNN method.

Acknowledgment

This research supported by the Doctoral program of Information Systems, School of Postgraduate Studies, Diponegoro University, and Information Systems Study Program, Muria Kudus University.

Nomenclature

CNN

Convolutional Neural Network

GLCM

SVM

Gray Level Cooccurrence Matrix

Support Vector Machine

FN

False Negative

FP

False Positive

TN

True Negative

TP

True Positive

Greek symbols

i,j

pixel coordinates in the GLCM matrix

pi,j

pixel value in coordinate i,j

μx, μy

mean

σx, σy

standard deviations

  References

[1] Nematinia, E., Abdanan Mehdizadeh, S. (2018). Assessment of egg freshness by prediction of Haugh unit and albumen pH using an artificial neural network. Journal of Food Measurement and Characterization, 12(3): 1449-1459. https://doi.org/10.1007/s11694-018-9760-1

[2] Nasiri, A., Omid, M., Taheri-Garavand, A. (2020). An automatic sorting system for unwashed eggs using deep learning. Journal of Food Engineering, 283: 110036. https://doi.org/10.1016/j.jfoodeng.2020.110036

[3] Turkoglu, M. (2021). Defective egg detection based on deep features and Bidirectional Long-Short-Term-Memory. Computers and Electronics in Agriculture, 185: 106152. https://doi.org/10.1016/j.compag.2021.106152

[4] Wu, L., Wang, Q., Jie, D., Wang, S., Zhu, Z., Xiong, L. (2018). Detection of crack eggs by image processing and soft-margin support vector machine. Journal of Computational Methods in Sciences and Engineering, 18(1): 21-31. https://doi.org/10.3233/JCM-170767

[5] Valencia, Y.M., Majin, J.J., Taveira, V.B., Salazar, J. D., Stivanello, M.E., Ferreira, L.C., Stemmer, M.R. (2021). A novel method for inspection defects in commercial eggs using computer vision. The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, 43: 809-816. https://doi.org/10.5194/isprs-archives-XLIII-B2-2021-809-2021

[6] Wang, Y. (2014). Research on the computer vision cracked eggs detecting method. International Journal of Computer Applications in Technology, 50(3-4): 215-219. https://doi.org/10.1504/IJCAT.2014.066730

[7] Yang, J., Shi, Y., Zhou, W., Che, Y.S. (2014). Study on detection method for crack in eggs based on computer vision and support vector machine neural network. Applied Mechanics and Materials, 472: 176-179. https://doi.org/10.4028/www.scientific.net/AMM.472.176

[8] Jin, C., Xie, L., Ying, Y. (2015). Eggshell crack detection based on the time-domain acoustic signal of rolling eggs on a step-plate. Journal of Food Engineering, 153: 53-62. https://doi.org/10.1016/j.jfoodeng.2014.12.011

[9] Wang, H., Mao, J., Zhang, J., Jiang, H., Wang, J. (2016). Acoustic feature extraction and optimization of crack detection for eggshell. Journal of food engineering, 171: 240-247. https://doi.org/10.1016/j.jfoodeng.2015.10.030.

[10] Abdullah, M.H., Nashat, S., Anwar, S.A., Abdullah, M.Z. (2017). A framework for crack detection of fresh poultry eggs at visible radiation. Computers and Electronics in Agriculture, 141: 81-95. https://doi.org/10.1016/j.compag.2017.07.006

[11] Datta, A.K., Botta, B., Gattam, S.S.R. (2019). Damage detection on chicken eggshells using Faster R-CNN. In 2019 ASABE Annual International Meeting, Boston, pp. 1901244. https://doi.org/10.13031/aim.201901244

[12] Jiang, M.L., Wu, P.L., Li, F. (2021). Detecting dark spot eggs based on CNN GoogLeNet model. In Simulation Tools and Techniques: 12th EAI International Conference, SIMUtools 2020, Guiyang, China, pp. 116-126. https://doi.org/10.1007/s11276-021-02673-4

[13] Botta, B., Gattam, S.S.R., Datta, A.K. (2022). Eggshell crack detection using deep convolutional neural networks. Journal of Food Engineering, 315: 110798. https://doi.org/10.1016/j.jfoodeng.2021.110798

[14] Barreneche, J.M., Guigou, B., Gallego, F., et al. (2023). Monitoring Uruguay’s freshwaters from space: An assessment of different satellite image processing schemes for chlorophyll-a estimation. Remote Sensing Applications: Society and Environment, 29: 100891. https://doi.org/10.1016/j.rsase.2022.100891

[15] Aggarwal, M., Tiwari, A.K., Sarathi, M.P., Bijalwan, A. (2023). An early detection and segmentation of Brain Tumor using Deep Neural Network. BMC Medical Informatics and Decision Making, 23(1): 78. https://doi.org/10.1186/s12911-023-02174-8

[16] Pathak, H., Igathinathane, C., Howatt, K., Zhang, Z. (2023). Machine learning and handcrafted image processing methods for classifying common weeds in corn field. Smart Agricultural Technology, 5: 100249. https://doi.org/10.1016/j.atech.2023.100249.

[17] Azgomi, H., Haredasht, F.R., Motlagh, M.R.S. (2023). Diagnosis of some apple fruit diseases by using image processing and artificial neural network. Food Control, 145: 109484. https://doi.org/10.1016/j.foodcont.2022.109484

[18] Chaurasia, A., Gautam, A., Rajkumar, R., Chander, A.S. (2023). Road traffic optimization using image processing and clustering algorithms. Advances in Engineering Software, 181: 103460. https://doi.org/10.1016/j.advengsoft.2023.103460

[19] Okinda, C., Sun, Y., Nyalala, I., Korohou, T., Opiyo, S., Wang, J., Shen, M. (2020). Egg volume estimation based on image processing and computer vision. Journal of Food Engineering, 283: 110041. https://doi.org/10.1016/j.jfoodeng.2020.110041

[20] Yao, K., Sun, J., Chen, C., Xu, M., Zhou, X., Cao, Y., Tian, Y. (2022). Non-destructive detection of egg qualities based on hyperspectral imaging. Journal of Food Engineering, 325: 111024. https://doi.org/10.1016/j.jfoodeng.2022.111024

[21] Uesugi, F. (2023). Novel image processing method inspired by wavelet transform. Micron, 168: 103442.https://doi.org/10.1016/j.micron.2023.103442

[22] Yadav, D., Yadav, A.K. (2020). A novel convolutional neural network based model for recognition and classification of apple leaf diseases. Traitement du Signal, 37(6): 1093-1101. https://doi.org/10.18280/TS.370622

[23] Tabbakh, A., Barpanda, S.S. (2022). Evaluation of machine learning models for plant disease classification using modified GLCM and wavelet based statistical features. Traitement du Signal, 39(6): 1893-1905. https://doi.org/10.18280/ts.390602

[24] Moganam, P.K., Seelan, D.A.S. (2020). Perceptron neural network based machine learning approaches for leather defect detection and classification. Instrumentation, Mesures, Métrologies, 19(6): 421-429. https://doi.org/10.18280/I2M.190603

[25] Li, J., Luo, W., Wang, Z., Fan, S. (2019). Early detection of decay on apples using hyperspectral reflectance imaging combining both principal component analysis and improved watershed segmentation method. Postharvest Biology and Technology, 149: 235-246. https://doi.org/10.1016/j.postharvbio.2018.12.007

[26] Arshaghi, A., Ashourin, M., Ghabeli, L. (2021). Detection and classification of potato diseases potato using a new convolution neural network architecture. Traitement du Signal, 38(6): 1783-1791. https://doi.org/10.18280/ts.380622

[27] Nashrullah, F.H., Suryani, E., Salamah, U., Prakisya, N. P.T., Setyawan, S. (2021). Texture-based feature extraction using gabor filters to detect diseases of tomato leaves. Revue d'Intelligence Artificielle, 35(4): 331-339. https://doi.org/10.18280/ria.350408

[28] Massantini, R., Moscetti, R., Frangipane, M.T. (2021). Evaluating progress of chestnut quality: A review of recent developments. Trends in Food Science & Technology, 113: 245-254. https://doi.org/10.1016/j.tifs.2021.04.036

[29] Prasetyo, E., Dimas, R., Suciati, N., Fatichah, C. (2020). Partial centroid contour distance (PCCD) in mango leaf classification. International Journal on Advanced Science Engineering Information Technology, 10(5): 1920-1926. https://doi.org/10.18517/ijaseit.10.5.8047

[30] Noola, D.A., Basavaraju, D.R. (2021). Corn Leaf Disease Detection with Pertinent Feature Selection Model Using Machine Learning Technique with Efficient Spot Tagging Model. Revue d'Intelligence Artificielle, 35(6): 477-482. https://doi.org/10.18280/ria.350605

[31] Adi, K., Widodo, C.E., Widodo, A.P., Gernowo, R., Pamungkas, A., Syifa, R.A. (2018). Detection lung cancer using gray level co-occurrence matrix (GLCM) and back propagation neural network classification. Journal of Engineering Science & Technology Review, 11(2): 7-13. https://doi.org/10.25103/jestr.112.02

[32] Priyadumkol, J., Kittichaikarn, C., Thainimit, S. (2017). Crack detection on unwashed eggs using image processing. Journal of food engineering, 209: 76-82. https://doi.org/10.1016/j.jfoodeng.2017.04.015

[33] Bao, G.J., Jia, M.M., Yi, X., Cai, S.B., Yang, Q.H. (2019). Cracked egg recognition based on machine vision. Computers and Electronics in Agriculture, 158: 159-166. https://doi.org/10.1016/j.compag.2019.01.005

[34] Zulfira, F.Z., Suyanto, S., Septiarini, A. (2021). Segmentation technique and dynamic ensemble selection to enhance glaucoma severity detection. Computers in Biology and Medicine, 139: 104951. https://doi.org/10.1016/j.compbiomed.2021.104951

[35] Bramarambika, M. (2022). Brain Tumor Classification for MR Images Using Hybrid GLCM-LDTP-Le-Net Feature extraction and Bi-LSTM model. International Journal of Intelligent Engineering & Systems, 15(2): 116-125. https://doi.org/10.22266/ijies2022.0430.12

[36] Kairuddin, W.N.H.W., Mahmud, W.M.H.W. (2017). Texture feature analysis for different resolution level of kidney ultrasound images. IOP Conference Series: Materials Science and Engineering, 226(1): 012136. https://doi.org/10.1088/1757-899X/226/1/012136

[37] Bakheet, S., Al-Hamadi, A. (2021). Automatic detection of COVID-19 using pruned GLCM-Based texture features and LDCRF classification. Computers in Biology and Medicine, 137: 104781.https://doi.org/10.1016/j.compbiomed.2021.104781

[38] Kumar, H.B.B., Chennamma, H.R. (2021). Classification of Computer Graphic Images and Photographic Images Based on Fusion of Color and Texture Features. Revue d'Intelligence Artificielle, 35(3): 201-207. https://doi.org/10.18280/ria.350303

[39] Wu, G., Fang, Y., Jiang, Q., et al. (2023). Early identification of strawberry leaves disease utilizing hyperspectral imaging combing with spectral features, multiple vegetation indices and textural features. Computers and Electronics in Agriculture, 204: 107553. https://doi.org/10.1016/j.compag.2022.107553

[40] Setiawan, A., Adi, K., Widodo, C. E. (2023). Rice foreign object classification based on integrated color and textural feature using machine learning. Mathematical Modelling of Engineering Problems, 10(2): 572-580. https://doi.org/10.18280/mmep.100226

[41] Adi, K., Widodo, C. ., Widodo, A.P., Margiati, U.S. (2022). Detection of foreign object debris (Fod) using convolutional neural network (CNN). Journal of Theoretical and Applied Information Technology, 100(1): 184-191.

[42] LeCun, Y., Bengio, Y., Hinton, G. (2015). Deep learning. nature, 521(7553): 436-444. https://doi.org/10.1038/nature14539

[43] Liu, Y., Pu, H., Sun, D. W. (2021). Efficient extraction of deep image features using convolutional neural network (CNN) for applications in detecting and analysing complex food matrices. Trends in Food Science & Technology, 113: 193-204. https://doi.org/10.1016/j.tifs.2021.04.042

[44] Sheta, A., Mokhtar, S.A. (2022). Autonomous robot system for pavement crack inspection based cnn model. Journal of Theoretical and Applied Information Technology, 100(16): 5119-5128.

[45] Michele, A.., Kusuma, G.P. (2021). Bacterial and virus pneumonia infection detection on chest x-ray images using machine learning. Journal of Theoretical and Applied Information Technology, 99(24): 5638-5649.

[46] Lal, P.V., Srilakshmi, U., Venkateswarlu, D. (2022). Face recognition using deep learning xception cnn method. Journal of Theoretical and Applied Information Technology, 100(2): 531-542.

[47] Tian, Y. (2020). Artificial intelligence image recognition method based on convolutional neural network algorithm. IEEE Access, 8: 125731-125744. https://doi.org/10.1109/ACCESS.2020.3006097

[48] SNI Standar Nasional Indonesia. (2008). ICS 67.120.20. http://blog.ub.ac.id/cdrhprimasanti90/files/2012/05/13586_SNI-3926_2008-Telur-Konsumsi.pdf.

[49] Setiawan, A., Hadiyanto, H., Widodo, C.E. (2022). Distance Estimation Between Camera and Shrimp Underwater Using Euclidian Distance and Triangles Similarity Algorithm. Ingénierie des Systèmes d'Information, 27(5): 717-724. https://doi.org/10.18280/isi.270504

[50] Setiawan, A., Hadiyanto, H., Widodo, C. E. (2022). Shrimp body weight estimation in aquaculture ponds using morphometric features based on underwater image analysis and machine learning approach. Revue d'Intelligence Artificielle, 36(6): 905-912. https://doi.org/10.18280/ria.360611

[51] Garcia-Lamont, F., Cervantes, J., López, A., Rodriguez, L. (2018). Segmentation of images by color features: A survey. Neurocomputing, 292: 1-27. https://doi.org/10.1016/j.neucom.2018.01.091

[52] Rastogi, S., Kumari, V., Sharma, V., Ahmad, F. J. (2022). RGB colorimetric method based detection of oxytocin in food samples using cysteamine functionalized gold nanoparticles. Analytical Biochemistry, 656: 114886. https://doi.org/10.1016/j.ab.2022.114886

[53] Xu, M., Yoon, S., Fuentes, A., Park, D.S. (2023). A comprehensive survey of image augmentation techniques for deep learning. Pattern Recognition, 137: 109347. https://doi.org/10.1016/j.patcog.2023.109347

[54] Huang, H., Liu, X., Yang, R. (2021). Image style transfer for autonomous multi-robot systems. Information Sciences, 576: 274-287. https://doi.org/10.1016/j.ins.2021.06.061

[55] Hu, T., Xie, Q., Yuan, Q., Lv, J., Xiong, Q. (2021). Design of ethnic patterns based on shape grammar and artificial neural network. Alexandria Engineering Journal, 60(1): 1601-1625. https://doi.org/10.1016/j.aej.2020.11.013

[56] Chandra, I.S., Shastri, R.K., Kavitha, D., Kumar, K.R., Manochitra, S., Babu, P. B. (2023). CNN based color balancing and denoising technique for underwater images: CNN-CBDT. Measurement: Sensors, 28: 100835. https://doi.org/10.1016/j.measen.2023.100835

[57] Abade, A., Ferreira, P.A., de Barros Vidal, F. (2021). Plant diseases recognition on images using convolutional neural networks: A systematic review. Computers and Electronics in Agriculture, 185: 106125. https://doi.org/10.1016/j.compag.2021.106125

[58] Muflikhah, L., Widodo, W., Mahmudy, W.F., Solimun, S. (2020). A support vector machine based on kernel k-means for detecting the liver cancer disease. International Journal of Intelligent Engineering & Systems, 13(3): 293-303. https://doi.org/10.22266/IJIES2020.0630.27

[59] Kumar, N., Sikamani, K. (2020). Prediction of chronic and infectious diseases using machine learning classifiers-A systematic approach. International Jourmal of Intelligent Engineering & Systems, 13(4): 11-20. https://doi.org/10.22266/IJIES2020.0831.02

[60] Wakhid, S., Sarno, R., Sabilla, S.I., Maghfira, D.B. (2020). Detection and classification of indonesian civet and non-civet coffee based on statistical analysis comparison using E-Nose. International Journal of Intelligent Engineering & Systems, 13(4): 56-65. https://doi.org/10.22266/IJIES2020.0831.06

[61] Qteat, H., Awad, M. (2021). Using hybrid model of particle swarm optimization and multi-layer perceptron neural networks for classification of diabetes. International Journal of Intelligent Engineering & Systems, 14(3): 11-22. https://doi.org/10.22266/ijies2021.0630.02

[62] Abbaspour-Gilandeh, Y., Azizi, A. (2018). Identification of cracks in eggs shell using computer vision and hough transform. Yuzuncu Yıl University Journal of Agricultural Sciences, 28(4): 375-383. https://doi.org/10.29133/yyutbd.422374

[63] Chen, H., Ma, J., Zhuang, Q., Zhao, S., Xie, Y. (2021). Submillimeter crack detection technology of eggs based on improved light source. IOP Conference Series: Earth and Environmental Science, 697(1): 012018. https://doi.org/10.1088/1755-1315/697/1/012018