An Application of ANN Trained by ABC Algorithm for Classification of Wheat Grains

Artificial Neural Networks (ANNs) have emerged as an important tool for classification problem. This paper presents an application of ANN model trained by artificial bee colony (ABC) optimization algorithm for classification the wheat grains into bread and durum. ABC algorithm is used to optimize the weights and biases of three-layer multilayer perceptron (MLP) based ANN. The classification is carried out through data of wheat grains (#200) acquired using image-processing techniques (IPTs). The data set includes five grain’s geometric parameters: length, width, area, perimeter and fullness. The ANN-ABC model input with the geometric parameters are trained through 170 wheat grain data and their accuracies are tested via 30 data. The ANN-ABC model numerically calculate the outputs with mean absolute error (MAE) of 0.0034 and classify the grains with accuracy of 100% for the testing process. The results of ANN-ABC model are compared with other ANN models trained by 4 different learning algorithms. These results point out that the ANN trained by ABC optimization algorithm can be successfully applied to classification of wheat grains.


o obtain flou
.The amount of protein contained in each wheat specie is different and therefore different wheat species are used for each flour product.For example, durum wheat contains more protein than bread wheat.The bread wheat grains mixing into durum grains lead to a reduction in its protein content.For this reason, classification of wheat grains is important to reduce costs and increase quality.Agricultural products are classified manually and automatically with different techniques.Manual classification has disadvantages in terms of time and cost.In the literature, image processing techniques (IPT) are widely used for the classification of agricultural products.In addition, image processing techniques and artificial intelligence techniques (AITs) are used in combination to increase classification accuracy [1][2].Neural networks such as artificial neural network (ANN), support vector machine (SVM), adaptive neuro-fuzzy inference system (ANFIS) and decision tree (DT), K-nearest neighbors (KNN), Naive Bayes (NB) and discriminant analysis (DA) are the most utilized with IPT for classifying agricultural products [3][4][5][6][7].Over a last decade ANN which is widely used artificial intelligence technique model adopts remarkable importance in classification of agricultural grains due to its fast and accurate modelling.Studies which is classified the agricultural products by various methods are presented in the literature.The wheat grains were classified using a near infrared hyperspectral image analysis technique by (Berman et al;2007).(Jamuna et al;2010) determined the efficiencies of cotton seeds by classifying based on the DT and the multilayered perceptron (MLP).In (Guevara-Hernandez et al; 2011), the wheat and barley seeds were classified using DA and KNN.A progressive analysis and meta-multiple class method was used by (Zapotoczny;2011) to classify wheat grains.The KNN method based ultraviolet visible spectrophotometry was used for classification of the spice (Anibal et al; 2012).The classification of objects was studied for machine vision implementations with classifier algorithms of the Naive Bayes and KNN by (Prakash et al;2012).In (Pazoki et al;2014), the rice grains into five species with respect to the morphological features were classified with ANN and ANFIS models.By (Muñiz-Valencia et al; 2014) were utilized a model which is MLP based ANN for classification of coffee grains according to their mineral content.The classification of green coffee grains into four groups was carried out using ANN by (Oliveira et al; 2016).The wheat grains as durum and bread were classified using computer vision based ANFIS and ANN methods by (Sabanci et al;2017).In (Aslan et al;2017), three different wheat species from the UCI library were classified with ANN and extreme learning machine (ELM) techniques.The combination of ANN models and optimization algorithms based on the swarm intelligence has been used to solve complex learning problems.Swarm intelligence algorithms are used to carry out some complications in the construction of the ANNs.Swarm intelligence algorithms were used to adjust the parameters of neural networks in the literature [20][21][22][23][24]. Artificial bee colony (ABC) algorithm which is one of the swarm intelligence algorithms was proposed by (Karaboga;2005) and it was inspired by collective behaviours of bees gathering honey.Training neural networks are one of the most interesting application of the ABC algorithm [26].The ABC algorithm has good performance in the training of neural networks.In this study, an ANN model combining with an ABC algorithm (ANN-ABC) is used for classification of the wheat grains into bread and durum according to their dimension features with high accuracy.The ABC algorithm has been used to determine the weight and bias values of the neural network model by minimizing the mean square error value of between target and out of the ANN model.Thus, the ABC algorithm in the network training phase provides for avoiding the local minima solutions by performing a high-performance search process in the solution space.5 dimension features of 200 wheat grains are acquired for each grain through IPTs for input ANN-ABC model.The feature data of 170 grains and 30 grains which are uniformly selected from the total number of 200 grains are respectively employed to train and test the accuracy of the model.In the wheat grains classification, ANN is used as modelling technique and ABC employed as learning algorithm.The weights of the network are obtained by using artificial bees to search best training parameters in an iterative manner.The purpose of this study is to improve the classification of wheat grains accuracy by using the convergence and optimization ability of ABC.The ANN-ABC model correctly classifies the wheat grains into durum and bread with 100% for the training process.Moreover, the results of ANN-ABC model are compared with other ANN models trained by different learning algorithm such as Levenberg Marquardt (LM), Bayesian regularization (BR), one step secant (OSS) and scaled conjugate gradient (SCG) [27].


Proposed ANN-ABC Model

The application of the ABC algorithm is relatively simple [26] and it has the advantage of not requiring a lot of parameters to be tuned [28].All processes related to proposed ANN-ABC model are illustrated in (Figure .1).The processes in the (Figure.1)will be described in the subsections.


Image Processing Technique and Data Preparation

In this section, the data set is obtai

d by applying IPT to th
wheat images in order to model the AITs as shown in (Figure .2).A setup including a computer, a camera and a box arranged by camera holder and a strip LED lighting is used in order to obtain the images as shown in (Figure .3).The camera is a Logitech C920 CCD with the specifications of full

(1080p), 15 MP, H.264 encoding, Carl Zeiss opti
s.The photographs are taken by the camera fixed at 35 cm height from the wheat at the bottom of the box which is closed and self-illuminated.The inside of the box is covered with black background.The images of the wheat grains for bread and durum taken by the camera are illustrated in (Figure .4).As can be seen, the main discrimination between the two grains is that the durum wheat grain is bigger than that of bread wheat.Therefore, dimension features of the wheat grains are considered in this study to model.As given in (Figure .5), the photographs of 100 bread wheat grains and 100 durum wheat grains are taken via the high resolution camera.The wheat used for classification is cultivated in Konya, Turkey.The IPTs are conducted through MATLAB®2014b software to acquire the feature data.Firstly, the RGB level of each pixel in the images are determined.These images are then converted to grayscale format as shown in (Figure .6a& 6b).Secondly, the grayscale images seen from (Figure .6c& 6d) are converted to binary images (black/white) using Otsu's method [29].Thus the noise of each image is eliminated using morphological process.Thirdly, each grain's position is fixed and they are tagged according to its position through a segmentation process.Each grain's dimensions in terms of the length (L), width (W), area (A) and perimeter (P) are extracted from binary images.Feature of fullness (F) related to dimension is reproduced from these parameters by (Equation.1).

(1) images of durum wheat (originally given in Figure 5)


Artificial Neural Network

ANN consists of neurons organized into different layers.These neurons containing non-linear types of functions are mutually connected by synaptic weights [30].The neuron number of the input layer equals to the number of the input parameters.A function given in (Equation .2) processes in each neuron.

(
)2
here, i and j are respectively indexe

for neurons of input and h
dden layers.Neurons in the input layer act as buffers for distributing the input signals xi to neurons in the hidden layer.Each neuron j in the hidden layer sums up its input signals xi after weighting them with the strengths of the respective connections wji from the input ayer and computes its output j as a function f of the sum and θi is the threshold (or bias) of the node.During training, these strengths weaken or strengthen to bring closer the output to the target of the network.f can be a simple threshold function such as sigmoid, hyperbolic tangent, tangent sigmoid, radial basis, purelin etc.The goal is to minimize the mean square error (MSE) function given by (Equation .3)
2 1 1 ( ( )) (
)
n k j j E w t n d o = = − ∑(3)
where E(w(t)) is the error at the tth iteration; w(t), the weight in the connections at the tth iteration; dj is the desired output node; oj is the target value for the jth output node.


Artificial Bee Colony Algorithm

The A modification position from the position of the employed bee is generated by using (Equation.4).If t e n new position, the new position is memorized by a bee and then the old position is abandoning.Otherwise, the old position is kept by a bee in the memory.

(
)4
where k ∈ {1, 2,…….SN} and

∈ {1, 2,……D} are randomly chosen
index s.k is determined randomly and should be differ from i. Φij us a random generated number between [-1,1].The search process is completed by all the employed bees and then the information about the food sources found by the employed bees is shared with the onlooker bees.These information covers of the nectar quality and position of the food sources.

A food source is selected by an onlooker bee evaluating the probability value of food sources.This probability pi related to the nectar quality of the food source is calculated by (Equation.5).

(5) Generate new positions representing of new solutions vi by the emp oyed bees using (Equation.4)and evaluate the nectar quality of new positions.6
1 fit i p i SN φ =+ −
Apply greedy selection process to solutions found by employed bee .7

Compute the probability values pi of the solutions xi by using (Eq.5) 8

Generate the new solutions vi for the onlookers from the solutions xi selecte depending on pi values and evaluate the nectar quality of new posit

ns.
Apply greedy selection process to solutions found by onlooker bees.

10 Determine the abandoned solution for the scout, if exists, nd replace it with a new randomly produce solution xi by (Equation.6)11

Memorize the best solution achieved so far 12 cycle = cycle+1 13 until Until cycle = MCN; fitness value of the solution i and SN is the number of food sources.A modification position from the position of the onlooker bee is generated by using (Equation.4).If the nectar quality of previous position is lower than new position, the new position is memorized by a bee and then the old position is abandoning.Otherwise, the old position is kept by a bee in the memory.If the nectar of a food source is consumed by an employed bee.This employed bee transforms a scout bee and the old food source is abandoned.A positi

of a new food source is found by scout be
using (Equation.6).( 6)


Results of Classification of Wheat Grains

In this study, the ABC optimization algorithm is used in the ANN model as learning algorithm.ABC updates the weight/bias values and minimizes a linear combination of squared errors.It also modifies the linear combination so that at the end of th

training the resulting network has
good generalization qualities.


Training Process of ANN-ABC Model

The dimension parameters (L, W, A, P and F) of the wheat grains were given as inputs and their respective classification results of IPT were given as output to the ANN-ABC model.The data set of 170 wheat grains representing the overall problem space is used to train the ANN-ABC model and the remainders 30 wheat grains that are not included in the training process are utilized to test the accuracy of the model.ANN-ABC model based on MLP having one input layer with five neurons, one hidden layer with five neurons and one output layer with one neuron was constructed, as shown in (Figure .6).


Testing Process Results of ANN-ABC Model

The testing data including 5 dimension features of 30 grains (15 bread wheat grains

d 15 durum wheat grains) and their testin
results are tabulated in Table 2 to further inspect the data and results.While the number of "2" is assigned to specify bread grains, "1" is appointed to define the durum grains as targets of the ANN-ABC model.The ANN-ABC model proposed in this study accurately classifies 19 grains with 0 (zero) and 11 grains with very small absolute errors.Therefore, it classifies the total grains of 30 with a negligible MAE of 0.0034 and with 100% accuracy.It demonstrates that the proposed IPT based ANN-ABC model can be successfully utilized to classify the wheat grain varieties in an automatic manner.


Conclusion

In this article ANN model trained by ABC optimization algorithm is proposed for accurate classification of the wheat gra

s into bread and du
um.The ANN-ABC model based on the MLP with three layers is designed for this purpose.5 features of dimensions for 100 bread and 100 durum wheat grains are acquired by using IPTs.The ANN-ABC model is trained by 170 grains and its accuracy is tested through 30 grains of 200 wheat grains data.The ANN-ABC model classifies the wheat grains with the MAE of 0.0034 for the testing process.Moreover, proposed model is compared with 4 different learning algorithm such as LM, BR, OSS and SCG and it is seen to be more successful.The results achieved in this study show that ANN-ABC model based on IPT can be successfully used to classify the wheat grains according to their dimension features with high accuracy.

Figure 1 .Figure 2 .Figure 3 .Figure 4 .Figure 5 .Figure 6 .
123456
Figure 1.Proposed ANN-ABC model process




ABC algorithm as named of heuristic technique is a powerful optimization method by (Karaboğa et al; 2007).In ABC algorithm phases, the search process performed for solution of optimization problems mimi

the foragi
g behavior of honey bees.The detailed implementation of the ABC algorithm is shown in Algorithm 1.At the initial of the ABC algorithm, the bee population (P) having a randomly distributed is generated.The number of solutions (represented food source positions, SN) is equal to the half of the population.Each solution xi (i=1, 2, ..., SN) has a D-dimensional vector named of optimization parameters.Therefore, these vectors having D-dimensional will be optimized solutions by ABC algorithm.The positions representing of possible solutions are improved by employed, onlooker and scout bee phases until reach maximum cycle (MCN, cycle=1, 2, …, MCN).


Algorithm 1 :
1
Public ABC algorithm[25] 1Produce the initial positions of bees in the population xi; i = 1, …, SN 2 Evaluate the nectar quality of the initial position point.


Figure 6 .
6
Figure 6.ANN-