Chicken Egg Fertility Identification using FOS and BP-Neural Networks on Image Processing

This article aims to test FOS (first-order statistical) in extracting features of embryonated eggs. This test uses the initial step of image processing to get the best input image in feature extraction. The image processing method starts from the image acquisition process, then improves with image preprocessing and segmentation. Image acquisition in this study uses the concept of egg candling in a dark place captured with a smartphone camera. The acquisition results are improved by image preprocessing using gray scaling, image enhancement (by Histogram Equalization), and segmentation of chicken egg image. The segmentation results were extracted using FOS with five parameters: mean, entropy, variance, skewness, and kurtosis. Based on the calculation of these parameters, it is graphed and shows the difference in patterns between fertile and infertile eggs. However, some eggs have a similar pattern, thus affecting the identification process. The identification process used neural networks by the backpropagation method for training and testing. The training results provide an accuracy value of 100% of all training data; however, 80% of the new test data obtained test results at testing. This test is carried out with 100 data, 50 each for training and test data. Based on the test results, which significantly affect the level of accuracy is the feature extraction method. FOS pattern in detecting the fertility of chicken eggs by BP Neural Network is still categorized as low, so it is necessary to improve methods to get maximum results.


Introduction
Identifying chicken eggs fertility in hatching chicken eggs is exciting to increase chicken production results. The identification process is carried out using the observation method using light directed at the egg so that the contents of the egg can be seen (candling) [1]- [3]. This identification is still being made manually (done by humans) [1], [4], or there are already several tools from various studies [5], [6], both simulators and implementations [7]- [9]. Even though the tools already exist, there are still many researchers doing development to get better results. This condition is growing along with the development of technology. Technology in identifying the fertility of chicken eggs has been developed in various ways, one of which is the application of image processing to identify the fertility of chicken egg images, either using image segmentation [8], [9] or classification or identification [10].
Image processing in the identification of egg embryos begins with image acquisition which has different methods and tools [4], [11], [12]. Several acquisition processes were carried out using thermal cameras [6], [13], hyperspectral [6], [7], [10], and digital cameras [4], [14]. This study uses a smartphone camera and a candling process to obtain a digital image. Using this tool is easy to obtain, even most people have it, and it is user-friendly by various groups of people.
The acquired digital image was done by image preprocessing and segmentation to get the input image in feature extraction. Image preprocessing in identifying embryos/fertility eggs is carried out in various ways, such as segmentation [15], feature extraction [4], [16], and classification. Segmentation in this detection has been done by methods such as k-means, thresholding. In feature extraction, this detection uses GLCM with various features, including five or seven features. The results of feature extraction are inputted into fertility classification (embryo presence) using the K-means method [7], [9], [17], Backpropagation, SVM [18], and Naïve Bayes. In this study, the segmentation used is when cropping the image according to the egg object in the image preprocessing. In addition, image preprocessing uses resizing and image enhancement. The resizing method aims to reduce the image and speed up processing. The image enhancement uses the concept of histogram equalization and its derivatives (i.e., CLAHE and HE [19], [20]).
In identification, some apply object feature extraction to obtain different patterns that indicate the characteristics of a particular object. Feature extraction in this study uses first-order feature extraction with five parameters [21], namely Mean, Entropy, Variance, Skewness, and Kurtosis. This feature is able to classify omega 3 and leghorn eggs with an accuracy of 91% [22]. In previous studies [4], [12], [17], it was stated that existing features needed to be reduced. Thus, this study reduced GLCM to FOS (using five parameters). In addition, the identification uses an artificial neural network using the Backpropagation (BP) method. This BP uses forward and backward in its training and testing. BP was used in this research because this method can get the best result in our previous research (93% accurate). This study uses BP as a development of our previous research with supervised and unsupervised methods. Although SVM is better than BP (92.5% vs. 87.5%) [23], from our previous study [12], the BP method has a success percentage equal to the presence of preprocessing in image processing (93%). While Naïve Bayes's highest accuracy is 94%, the lowest is 78% with fluctuating accuracy data [24].
This article discusses feature extraction with first-order statistics as input for the identification process. The first section describes the background of the problem, research review (gaps/differences of others), and research objectives. Next, the second section describes proposed methods and theories related to image processing, feature extraction, and classification. The third section discusses the experimental results. Finally, the fourth section concludes the results obtained from this study.

Research Method
This study used the image processing method in the classification process. The primary image processing used is image acquisition, image preprocessing, and image segmentation [25]. The development used feature extraction and classification [26], [27] using the backpropagation neural networks method. This research process in detail used the following stages in Figure 1.
This study uses the concept of image processing and its development, namely feature extraction and classification. The first step in image processing is to take a picture first (image acquisition), and the acquisition results become input for the next steps on image processing. The three main stages in this research are image processing, feature extraction, and classification. Image processing is an image process in which input and output are images with the initial image acquisition process. Image acquisition is used to obtain digital images. In this study, the acquisition process used a smartphone camera to take pictures of chicken eggs irradiated with LED lights (candling). The description of this acquisition process is shown in Figure 2. The smartphone camera takes pictures without using a flash, so the digital image obtained emits light from the LED lamp (from the candling process), as shown in Figure 2. (b). The concept of acquisition in this study is to use reflections from real objects, namely chicken eggs. The resulting image is with several color components, namely Red, Green, Blue (RGB). Image preprocessing aims to improve digital images into better images as input for the following process. Image preprocessing used in this study includes cropping, grayscaling, and image enhancement. Cropping is image preprocessing to get the egg object image for detailed processing. The cropping process will get the image according to the object. In this study, the process detects images from 4 sides, namely, top, left, bottom, and right, to detect objects and select different points that are not close to black (this process used the segmentation method). The cropping result is a color image (RGB) that needs to be converted into a grayscale image (greyscaling process). Grayscaling can be processed (1) Image enhancement is processed using grayscale image input. In this study, image enhancement used the histogram equalization (HE) method. HE is a method used to obtain an image by histogram alignment. In addition, we used the development of HE (Contrast Limited Adaptive Histogram Equalization/CLAHE). [29]. Image enhancement studies using the CLAHE-HE hybrid [19], [20], [30].

First Order Statistics (FOS) Feature Extraction
FOS is a texture feature extraction method [31] using an image histogram for the calculation process [32]. This first-order feature extraction [33] uses five main parameters, namely Mean, Entropy, Variance, Skew, and Kurtosis [34], [35]. These features can classify the omega-3 and leghorn eggs more than 90% accurately [22]. Thus, this research used the reference to get features of eggs fertility on classification. The five parameters can be calculated using (2)-(6) in detail as follows: Mean (μ) is a measurement that shows the size of the image dispersion. This calculation uses calculations based on histogram and grayscale values (2).
Entropy (H) is a measurement used to determine the irregularity of the shape of an image. This measurement uses the calculation of the histogram value and the calculation of its logarithm (3).
Variance ( 2) shows the variation of elements in the histogram of an image. The variance is also called the standard deviation, calculated based on the grayscale, histogram, and mean (4) values.
Skewness ( 3) calculates the relative slope or slope of the histogram curve of an image. This calculation is calculated using components (variance and the cube of variance) and the division of the standard deviation (5).
Kurtosis ( 4) is a calculation of the relative sharpness of the histogram curve of an image using components such as the standard deviation to the power of 4 and the standard deviation divisor (6).

Classification
Classification aims to identify an object based on specific characteristics. In this research, the classification used the backpropagation neural network (BP-NN) method. An artificial neural network represents an artificial brain in a computer program that can complete some calculation processes during the learning process [36]. An artificial neural network has several vital components (such as the human brain), namely a neural network consisting of neurons and connections between neurons. These neurons transform the information received from one neuron to another through their outgoing connections. In comparison, the artificial neural network assigns weights to the process, which stores certain valuable information. Figure 3 shows the structure of neurons in an artificial neural network. Figure 3. Neuron structure activation process in neural networks [36] The workings of artificial neurons are similar to biological neurons [36], namely: 1. Information (input) is sent to neurons with a certain arrival weight. 2. The input is processed by a propagation function which adds up the values of all the incoming weights. 3. This sum is compared with a specific threshold value through the activation function of each neuron. 4. If the input passes a specific threshold value, then the neuron is not activated. 5. If a neuron is activated, it sends output through its output weights to all the associated neurons.
BP-NN is a supervised learning algorithm usually used by multi-layered perceptrons to change the weights associated with the neurons in the hidden layer. The backpropagation algorithm uses error output to change the value of the weights in the backward direction. The error value is obtained by doing forward propagation [37], [38] first by activating the neurons using the sigmoid activation function. The BP-NN architecture is shown in Figure 4. A multi-layer neural network with one hidden layer (unit Z) is shown in Figure 4. The output unit (Y) and the hidden unit have a bias (1). Wok denotes (bias) in the output unit Yk, and Voj denotes the bias in the hidden unit Zj. This bias term acts as a weight on the connection of a unit whose output is always 1. The backpropagation method's training process involves three main stages: feedforward, backpropagation, and weight adjustment. During the feedforward process, each input unit (Xi) receives the input signal and forwards the signal to the hidden unit (Z1, ....., Zj). Each hidden unit counts its activation and sends the signal (zj) to each output unit. Each output unit (Yk) counts activations (yk) to form the network response to a given input pattern. During training, each output unit compares the calculated activation yk with the target value tk to determine the associated error in the pattern with that unit. Based on this error, the factor δ_k (k=1,….,m) is calculated. δ_k is used to distribute the error at the output unit Yk back to all units in the previous layer (hidden units connected to Yk). It is also used (later) to update the weights between the output and hidden layers. The same way is done to calculate the factor δ_j (j=1,….,p) on each hidden unit Zj. It is unnecessary to propagate the error back to the input layer, but δ_j is used to update the weights between the hidden and the input layers. Figure 4. BP-NN architecture with one hidden layer [39] During training, each output unit compares the calculated activation yk with the target value tk to determine the associated error in the pattern with that unit. Based on this error, the factor δ_k (k=1,….,m) is calculated. δ_k is used to distribute the error at the output unit Yk back to all units in the previous layer (hidden units connected to Yk). It is also used (later) to update the weights between the output and hidden layers. The same way is done to calculate the factor δ_j (j=1,….,p) on each hidden unit Zj. It is unnecessary to propagate the error back to the input layer, but δ_j is used to update the weights between the hidden and the input layers.
After the factors have been determined, the weights on all layers are adjusted simultaneously. The wjk weight adjustment (from the hidden Zi unit to the Yk output unit) is based on the δ_k factor and the zj activation of the Zj hidden unit. The adjustment to the weight of vij (from the input unit Xi to the hidden unit Zj) is based on the δ_k factor and xi activation from the input unit. The flowchart of the BP Algorithm is shown in Figure 5.

Results and Discussion
This research produced several outputs and accurate calculations. The outputs produced include image processing, feature extraction using first-order statistical methods. In feature extraction, analysis is carried out based on each object type (fertile and infertile eggs). In addition to focusing on these two things, the experiment in this study is to identify them. The identification method used is BP-NN.

Image processing on the first step for FOS input
Image processing obtained in this study was processed according to Figure 1. The initial process is image acquisition to get a digital image of chicken eggs. This image has a single egg object with a black background, as shown in Figure 6. (a), so it is necessary to do a copping process using the concept of segmentation to detect eggs. The cropping result is an image of an egg with a minimal background according to the edge object.
The cropping process will detect the object whether or not to crop the image according to the object. The cropping result is still in a color image (RGB) to convert to a grayscale image. This conversion uses the segmentation method to get the image of the object only. So that image processing is focused on the object only and does not do many background calculations. The cropped image ( Figure 6. (a)) is converted to a grayscale image. This conversion uses (1) to get an image with a single intensity value (gray level: 0-255). This process is done because the FOS calculation is based on the image's histogram (single) features. Thus, this conversion makes it easy to calculate the parameters; however, it needs to apply image enhancement (CLAHE-HE method) to improve image quality. This method has contributed to segmentation to clarify fertile and infertile eggs (Figure 6. (c)). The final result of image processing is a segmented image, as shown in Figure 6. (d). This process is the end of image processing, which is then used as input to calculate the value of the FOS parameter. A compliment is carried out in the final process to show the resulting egg image object and clarify the egg's characteristics. The sample shown in this image is an image of chicken eggs that are categorized as fertile.

FOS analysis on chicken egg fertility detection by an object of image processing results
The final image results in image processing are used in calculating the parameter values of the FOS. The segmented grayscale image is an image with a value range between 0-255. FOS is calculated based on the existing histogram features [29] and uses (2)-(6) with the results as shown in Table 1. Table 1 is an example of 10 examples of data calculation results using 5 FOS parameters. The first five data shows the calculation results to identify fertile eggs, and the other five shows infertility.
Based on the results of these calculations, the next is the analysis of the patterns generated from these five parameters. From the ten samples (Table 1), the pattern is shown in Figure 7. In Figure 7, there are two main patterns with similar shapes. The shape of the pattern generated from this sample shows that the fertile and infertile egg images have the same pattern, but the limit values obtained from both are different.   Table 1, we only present 10 data to represent the processed data. When the change's average value is calculated, the pattern results are obtained like a trapezoidal image. The trapezoid can be used as a reference for the smallest value by calculating the pattern for each category (fertile/infertile). In the results of the FOS calculation, the parameter data of each image becomes the input for the identification process using BP-NN.

Identification of chicken egg fertility and the accuracy results
The identification process in this study uses input data from the results of first-order feature extraction, with the number of inputs being 5 data according to the feature extraction parameters. The feature extraction value of 50 egg sample data is used for the training process. The training process uses the BP method with three variations in the number of hidden layer neurons, namely 4, 6, and 12 [9], with a learning rate of 0.1 and a maximum iteration of 100. The training process includes five parameter values from all training data in the BP-NN, and the outputs are fertile and infertile. As in the architecture (Figure 4), where the value of X (input) is the FOS parameter (5), the hidden layer (Z) is only one layer (with three variations of neurons), and the output (Y) is 2 (fertile or infertile).
When tested using training data, the training results can recognize all that is being trained. After that, 50 new test data were processed to check the training results carried out. The FOS parameters are input in identifying the fertility of chicken eggs using the BP method, both in the training and testing process. The experimental results with this scheme are shown in Table 2.  Table 2, egg fertility testing using the BP method and 5 FOS parameters has the best accuracy of 80%. This result is obtained with the number of hidden layers being one and the neuron hidden layer being 12. Previous research shows that the implementation of hidden layers of more than 12 gets the same results, so it is enough with the maximum value [2], [9]. In addition, this feature has almost the same distribution of values, namely mean, variance, entropy, and kurtosis. Thus, the resulting patterns do not differ (see Figure 7 and Table  1). However, this method has a good accuracy of 80%.
In addition, the analysis shows that the accuracy obtained is influenced by FOS parameters which have the same pattern. So that in future improvements, we will reduce or change parameters or update the latest feature extraction methods to improve them. In addition, the acquisition process that is less than optimal also affects image processing. Thus, it is also necessary to use acquisition tools and methods that produce a better image or improve it in the preprocessing stage.

Conclusion
The implementation of image processing can identify the fertility of chicken eggs (embryo presence) in the incubator. On the seventh day, image processing starts from image acquisition to identify egg fertility based on feature extraction. Feature extraction in this study is FOS Feature Extraction. FOS has five parameters to form different eggs identified as fertile (embryo) and infertile (no embryo). The resulting pattern has differences in each condition (fertile/infertile). Thus, the FOS and BP-Neural Networks method resulted in accuracy testing 100% data test and 80% on new data. The FOS feature extraction can detect the chicken egg embryo on BP-Neural Networks methods based on the results. However, some of the egg images have a similar pattern (on FOS), so the parameters of the features implemented in the BP Neural Networks method are Shoffan Saifullah, Andiko Putro Suryotomo Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi) Vol. needed to be reduced or changed. Thus, we recommended improving by adding other features or using second-order feature extraction. However, this method can generally be referred to for improvement in the detection process based on statistical feature extraction. In the future, we will combine the supervised method to increase the accuracy and look for the best feature extraction parameters.