Classification of rice varieties using optimal color and ... - IEEE Xplore

3 downloads 160 Views 437KB Size Report
BP Neural networks. Seyed Jalaleddin Mousavi Rad. Department of Computer Engineering. University of Kurdistan. Sanandaj, Iran [email protected].
Classification of rice varieties using optimal color and texture features and BP Neural networks Seyed Jalaleddin Mousavi Rad Department of Computer Engineering University of Kurdistan Sanandaj, Iran [email protected]

Fardin Akhlaghian Tab Department of Computer Engineering University of Kurdistan Sanandaj, Iran [email protected]

Abstract—In this paper, an algorithm for classifying five different varieties of rice, using the color and texture features is presented. The proposed algorithm consists of several steps: image acquisition, segmentation, feature extraction, feature selection, and classification. Sixty color and texture features were extracted from rice kernels. The Set of features contained redundant, noisy or even irrelevant information so features were examined by four different algorithms. Finally twenty-two features were selected as the superior ones. A back propagation neural network-based classifier was developed to classify rice varieties. The overall classification accuracy was achieved as 96.67%. Keywords-Rice classification; feature extraction; feature selection; neural networks; color features; texture features.

I.

Introduction

Rice is one of the most important cereal grain crops. It constitutes the world’s principle source of food, being the basic grain for the planet’s largest population. For tropical Asians it is the staple food and is the major source of dietary energy and protein. In Southeast Asia alone, rice is the staple food for 80% of the population[1]. In the current grain-handling systems, grain type and quality are assessed by visual inspection. This evaluation process is, however, tedious and time consuming. The decision-making capabilities of a grain inspector can be seriously affected by his/her physical condition such as fatigue and eyesight, mental state caused by biases and work pressure, and working condition such as improper lighting condition, etc. Hence, this needs to the automation of process by developing an imaging system that should acquire the rice grain images, rectify, and analyze it. The color of rice is one of the main factors of the evaluating the quality. While detecting the rice varieties by the color features, people adopt more RGB color space and HSV color space; in addition, L*a*b* color space is also commonly used to extract the color feature value [2,3].

Kaveh Mollazade Dept. of Mech. Eng. of Agri. Machinery University of Kurdistan Sanandaj, Iran [email protected]

The meaning of term texture in image processing is completely different from the usual meaning of texture in foods. Image texture can be defined as the spatial organization of intensity variations in an image at various wave lengths, such as the visible and infrared portions of the spectrum [4]. Image texture is an important aspect of image and textural features play a major role in image analysis [5]. These features provide summary information defined from intensity maps of the scene which may be related to visual characteristics (coarseness of the texture, regularity, presence of a privileged direction, etc.), and also to characteristics that cannot be visually differentiated [6]. During the last decades several studies have been carried out related to the application of machine vision for quality evolution, Zhao-yan et al., 2005 proposed a method of identification based on neural network to classify rice variety using color and shape features with accuracy of 88.3% [7]. Verma (2010) extracted six morphological features (area, perimeter, maximum length, maximum width, compactness and elongation) to classify three varieties of Indian rice. A neural network was used with an accuracy ranging from 90 to 95% [8]. In another research, Van Dalan (2004) developed a method for determination of the rice size and the amount of broken rice kernels using image analysis [9]. Regarding the quality evaluation of rice, a new method has been developed to estimate the breakage and fissures ratio [10]. In a primary study Zayas et al., 1989 used machine vision to identify different varieties of wheat and to discriminate wheat from non-wheat components [11]. In later research Zayas et al., 1996 found that wheat classification methods could be improved by combining morphometry (computer vision analysis) and hardness analysis. Hard and soft recognition rates of 94% were achieved for the examined seventeen varieties [12]. In

978-1-4577-1535-8/11/$26.00 ©2011 IEEE

another report, the discrimination power of size, shape, color and texture for the identification of seeds of fifty seven weed species was assessed. Size and shape characteristics had larger discriminating power than color and texture ones. However, all of these features are required to reach an acceptable identification performance for practical applications [13]. In the extension of this work, they used a much larger database and discussed the discriminating power of weed seed characteristics [14]. In this paper, we propose a simple, effective and high accuracy vision-based approach using pattern recognition techniques to identify rice varieties. The specific goal was to generate the optimal color and texture features for classifying the rice varieties with high accuracy using comparing the performance of the some feature selection algorithms during the classification process. II.

segmentation step. The threshold value is generated according to the results of the histogram analysis. This value is supposed to be constant in all images with the same lighting conditions. In this study, it was found that the gray values between the background and the objects are very different. Therefore, a fixed threshold value determined from the histogram of the gray plane could separate the rice kernels from its background.

Materials and methods

In this paper, a new approach for classification of rice kernels variety using Feed-Forward Neural network is presented. The block diagram shown in Fig. 1 illustrates the procedure for recognition and classification of rice grains. First, 8 bit images were obtained by a flatbed scanner. Then images were segmented by thresholding. In the next step, sixty color and texture features were extracted from segmented images. After that superior features were determined through feature selection process. Finally these features were fed to a neural network classifier. Image Acquisition Image of rice kernels was acquired by a flatbed scanner used 8-bit grayscale and a resolution of 600 dpi. Images were stored in jpg format for further analysis (Fig. 2). For each variety, the measurements were conducted for 100 kernels of rice. Using a black background it was possible to easily extract the kernels from the background by standard segmentation routines.

Figure 1. The procedure for classification of rice grain

A.

B.

Segmentation

Image segmentation subdivides an image into different parts or objects and is the first step in image analysis. The image is usually subdivided until the objects of interest are isolated from their background. There are generally two approaches for segmentation algorithms. One is based on the discontinuity of gray level values; the other is based on the similarity of the gray-level values. The first approach is to partition an image based on abrupt changes in gray levels. The second approach uses thresholding and region growing. Region thresholding is an important part of image

Figure 2. A sample of acquires images of rice kernels

A typical histogram of the gray plane of a rice kernels image is shown in Fig. 3. The rice kernels always had the area of gray levels higher than 110 with normal shape distribution, while background pixels had the area of gray levels less than 110 with different shapes. The threshold value for this research was set at 110. All the pixels with gray value less than 110 were assigned the value 0, and all pixels with gray value equal or greater than 110 were not processed is further operations. The level 0 area was set for the background, and the unchanged area was set for the rice kernels region. Fig. 4 shows a typical segmented image. C.

Color feature extraction Currently the common color models are RGB, HSV, and L*a*b* models. In RGB model system, the natural color

and the display color in screen are created exactly in the same way. The HIS and L*a*b* color model system is based on the color of human feeling way, which is very intuitive and easy to understand to analyzing the color of objects. Therefore, this research has selected the RGB, HSV, and L*a*b* color model system to analyze color of rice grains. Algorithms were developed in windows environment using Matlab 7.10 programming languages to extract features. . The following color features were extracted from images of individual rice kernels: • Mean of R,G, and B(red, green and blue) • Square of mean of R, G, and B • Standard deviation of R,G, and B • Kurtosis of R,G, and B • Variance of red, green and blue histograms • Skewness of red, green and blue histograms Also, all of above features, were extracted on H, S, and V in HSV color space and luminance, a, and b in L*a*b* color space. D. Texture feature extraction An important approach to region description is to quantify its texture content. Although no formal definition of texture exits, intuitively this descriptor provides measures of properties such as smoothness, coarseness, and regularity [15]. The following texture features were extracted from images of individual rice kernels: L −1

• Mean (m):

∑ z p( z ) i

(1)

i

i =1

• Standard deviation ( σ ) :

• Entropy (e): −

μ2 ( z)

L −1

∑ p( z ) log i

2

(2)

p( zi )

(3)

i =0

• Uniformity (U):

L −1

∑p

2

( zi )

(4)

− m) 3 p ( z i )

(5)

i =0

• Third moments:

L −1

∑ (z

i

i =1

• Smoothness ( μ 3 ): 1 − 1 /(1 + δ 2 )

(6)

Where Zi is a variable indicating intensity, p(z) is the histogram of the intensity levels in a region, L is the number of possible intensity levels and moments or variance.

μ 2 is

second

Figure 3. Histogram of gray level

Figure 4. Image after segmentation

E.

Feature selection From each rice kernels image, we measured sixty color and texture features which can be used for classification stage. Of course this set of features contains redundant, noisy or even irrelevant information for classification purpose. To optimize the number of features that contributed significantly to the classification, we implemented four feature selection algorithms namely: branch and bound [16], standard sequential forward (SFS) [17], standard backward sequential (SBS) [17], and plus-ltakeaway-r [18] algorithm. The selection algorithm reduced the parameters to nearly optimal set of twenty-two features which were finally used to build the classifier. Additionally, a study was performed to find the best method to classify the kernels of rice with the lowest classification error.

F.

Neural Network classifier A feed-forward neural network was trained for classification of the rice kernels. The number of neurons in the first layer was twenty-two which is equal to the number

Table 1: Result of classification

Classification error (%) Variety

Original Feature (n=60)

Feature selection(n=22) SFS

SBS

B&B

plus-l-takeaway-r

Mahali

10.00

10.00

13.33

13.33

13.33

Neda

76.67

7.66

6.67

13.33

10.00

Gerde

13.33

0.00

20.00

35.00

6.67

Fajr

6.67

0.00

0.00

6.67

6.67

Hashemi

20.00

0.00

6.67

10.00

3.33

of input patterns vector. The number of neurons in the output layer was five, which is equal to the number of pattern classes the neural network has been trained to recognize them. In general, the neural network with too few hidden neurons will not have a sufficient capability to represent the input-output relationship accurately. Contrarily, the network with too many hidden neurons many lead to a problem of data over fitting, and affect the system’s generalization capability [19]. Hence, determining the optimal number of hidden neurons is very crucial step in designing classifiers. However, such a determination is not an easy task since it depends largely on experience and trial and error method. The validation process of dataset has been carried out using the mean square error of the classification result of different neural network structures. Structures of one hidden layer with 1 to 20 hidden nodes and a few structures of two hidden layers were tested. We used a structure of two hidden layers with 3 neurons in the first hidden layer and 6 neurons in the second hidden layers. About the 70% of the samples (70 kernels for each rice type) were randomly selected as training set, while the rest of the samples were used as test set for classification. At the end of the training process, the network was tested with test dataset, and the classification accuracies were 90%, 92.34%, 100%, 100%, and 100% for Mahli, Neda, Gerde, Fajr, and Hashemi varieties, respectively. III.

Results and discussion

Rice kernel of five Iranian varieties namely; Fajr, Neda, Hashemi, Mahali, and Gerde were taken up for classification. The objective of the presented analysis is to

check texture and color features which can classify rice kernels. In the first step, sixty features extracted. Then, selection of features was carried out. Twenty-two features characterized from the sixty features. The selection was carrying out using four methods based on: Branch and bound, standard forward sequential , standard backward sequential , and plus-l-takeaway-r algorithm. Classification error calculated for original data ranged from 6.67% to 76.67% .It was shown that data selection can distinguish varieties of rice with lower classification error. The result of feature selection showed that in the most analyzed cases the classification error was almost zero. The highest error of four methods was 35%. It also appears that the least suitable method for rice kernel classification is SFS. The SFS feature selection gives an error of classification equal with 0 to 10%. Table 1 shows the result of classification for five varieties of Iranian rice. IV.

Conclusion

An algorithm was developed to identify varieties of rice kernels based on color and texture features. sixty features were extracted and twenty-two superior features were selected with standard sequential forward. A neural network was used to classify the rice kernels. In the test dataset, the total classification accuracies were 96.67%. V.

Future works

The present work can be extended for other food grains also other features can be extracted to increase the accuracy rate. Also detection of various defects of rice kernels, like fissures, can be investigated.

REFERENCES [1] V. n. Nguyen, “Fao Rice Information,” , Fao, 2000 [2] J. Cai, “an analysis of color models and criteria for their applications to quality test of farm products,” Jouranl of JiangSu university of science and technology, Vol. 18, 1997, pp. 22-25. [3] T.Vizhanyo, J. Felfoldi, “Enhancing color differences in image of diseased mushrooms,” computer and electronics in agriculture, Vol. 26, 2000, pp. 187-198. [4] R. Haralick, K. Shanmugam, I.Dinstein, “Textural features for image classification” , IEEE transactions on systems, man and sybernetics, Vol. 3, pp. 610-621 [5] A. K. Jain, R. P. W. Duin, J. Mao, “Image textural features as indicators of beef tenderness”, meat science, Vol. 53, pp. 17-22. [6] O. Basset, B. Buquet, S. Abouelkaram, P.Delachartre, J. Culioli, “Application of texture image analysis for the classification of bovine meat”, Food Chemistry, Vol. 69, PP. 437-445 [7] L. Zhao-yan, C. Fang, Y.Yi-bin, R-Xiu-qin, “Identification of rice seed varieties using neural networks,” Journal of Zhejiang University Sscience, Vol. 11, 2005, pp. 1095-1100. [8] B. Verma, “Image Processing Techniques for grading & classification of rice,” Int’l Conf.on Computer& Communication Technology (ICCT 10),2010,pp. 220-223. [9] G.Van Dalan, “Determination of the size distribution and percentage of broken kernels of rice using flatbed scanning and image analysis,” Food Research International, Vol.37, 2004, pp. 51-58. [10] F. Courtois, M. Faessel and C.Bonnazi, “Assessing breakage and cracks of parboiled rice kernels by image analysis technique,” Food Control, Vol. 21, 2010, pp. 567-572. [11] I. Zayas, Y. Pomeranz, F. S. Lai, “discrimination of wheat and nonwheat components in grain samples by image analysis,” Cereal Chemistry, Vol. 66, 1989, pp. 233-237. [12] I. Y. Zayas, C. R. Martin, J.L.Steele, A. Katsevich, “wheat classification using image analysis and crush force parameter,” Transaction of ASABE, Vol. 39, 1996, pp. 2999-2204. [13] P.M. Granitto, H. D. Navone, P. F. Verdes, H. A. Ceccatto, “ Weed seeds identification by machine vision,” Computers And Electronics In Agriculture, Vol. 33, 2002, pp. 91-103. [14] P. M. Granito, P. B. Verdes,H. A. ceccatto, “large scale investigation of weed seed identification by machine vision,” Computer And Electronics In Agriculture, Vol. 47,2005,pp. 15-24. [15] R. C. Gonzalez, “Digital Image Processing,” 2nd ed., Prenhall, 2002, p. 665 [16] P. M. Narendra, K. Fukunaga, “A branch and bound algorithm for feature subset selection,” IEEE Transactions on Computers, Vol. 100, No. 9, 1977, pp. 917-922 [17] P. A. Devijver, and J. kittler, “Pattern Recognition: a Statistical Approach”, Prentice/Hall, 1982 [18] S.D. Stearns, “on selecting features for pattern classifiers,” The Third International Conforance of pattern recognition , 1976, pp. 71-75 [19] S. P. Shouche, R.Rastogi , S. G.Bhagwat, “Shape analysis of grains of Indian wheat varieties” Computers And Electronics In Agriculture, vol. 33, 2001, pp. 55-76.