Detection of Walnut Varieties Using Impact Acoustics and Artificial Neural Networks ( ANNs )

In this study, an acoustic-based intelligent system was developed for classifying of sangi and kaghazi genotypes of Iranian Walnuts. To develop the ANN models a total of 4000 Walnut sound signals, 2000 samples for each genotypes, were recorded. The nuts were randomly selected, slide down a chute, inclined 30 above the horizontal, on which nuts slide down to impact a steel plate and their acoustic signals were recorded from the impact. The resulting acoustic signals, processed and potential features were extracted from the analysis of sound signals in both time and frequency domains. The method is based on feature generation by Fast Fourier Transform (FFT), feature reduction by PCA and classification by Multilayer Feedforward Neural Network. Features such as amplitude, phase and power spectrum of sound signals are computed via a 1024-point FFT. By using PCA more than 98% reduction in the dimension of feature vector is achieved. In developing the ANN models, several ANN architectures, each having different numbers of neurons in hidden layer, were evaluated. The optimal model was selected after several evaluations based on minimizing the mean square error (MSE), correct detection rate (CDR) and correlation coefficient (r). Selected ANN for classification was of 47-18-2 configuration. CDR of the proposed ANN model for two walnut genotypes, Sangi and Kaghazi were 99.64 and 96.56 respectively. MSE of the system was found to be 0.0185.


Introduction
Nuts, including walnuts, are a traditional food in the Mediterranean, South America and Asia.Walnuts are one of the oldest tree foods known to humans, with historical references dating back to Persia in 7000 B.C. (Dreher, et al., 1996).Persian walnut, Juglans regia, is one of the most important nutritive nut crops.Iran is considered as one of the walnut centers of diversity and cultivation in middle-eastern part of the world (Patel, 2005).In spite of high production of walnuts (150000 ton Based on FAO statistics), there is not a considerable world's market for Iranian walnut yet.Non-uniformity in size and shell thickness of walnut causes serious problems for offering the product and other complementary production procedures.
Kaghazi and Sangi are the most famous genotypes of Iranian walnuts that refers to thin and thick shell walnuts respectively.For more consumer, shell thickness is the most significant and important factor.Separation of the mixed walnuts is important for economical as well as aesthetical reasons and for offering a uniform product to the consumer.Due to closeness of physical sizes, morphological and optical properties of the walnuts, a fully efficient separation system could not be accomplished through mechanical or electro-optical devices.Acoustical methods have been introduced as an alternative in the literature.
Recently, non destructive acoustical experiments have been increasingly implemented in detection and classification of agricultural products (Diezma-Iglesias, et al., 2004;Pearson, 2001;Pearson, et al., 2007).A good correlation between fruit firmness and resonant frequency has been reported in some investigations (Garcia-Ramos, et al., 2003;Jivanuwong, 1998;Sugiyama, et al., 1998;Younce and Davis, 1995).Pearson (2001) used discriminant analysis on data obtained from sound signal sampling, in time domain, for separation of open and closed shell Kerman variety of pistachio nuts.The classification accuracy of this method was approximately 97%.Quite recently, by (Hosainpour, et al., 2011) an acoustic impact method used to discriminating between potato tubers and clods.The accuracy and capacity of this technique was reported about 97% and 20 ton/hr, respectively.
Artificial neural networks (ANN) offer much faster and more flexible approach in classification fields (Kavdir and Guyer, 2008).Artificial neural networks (ANNs) have been widely applied to classification problems in many fields.Several successful implementations of ANN classifiers reveal their capability to extract trends and patterns from the large data sets (Das and Evans, 1992;Ghazanfari, et al., 1996;Hosainpour, et al., 2010).They offer significant advantages when dealing with noisy or obscure patterns over the statistical pattern classifiers (Jindal and Sritham, 2003).
An intelligent pistachio nut sorting system combining acoustic emissions analysis, Principal Component Analysis (PCA) and Multilayer Feed forward Neural Network (MFNN) classifier was developed and tested.The CSR or total weighted average in system accuracy for the 40-12-4 structure was 97.5%, that is, only 2.5% of nuts were misclassified (Omid, et al., 2009).
Other study discusses the design and evaluation of an intelligent sorting system for open and closed-shell pistachio nuts.The results indicated the size of pistachio nuts has no effect on the accuracy of the sorter.Experimental results establish the superior performance of the proposed approach when compared to prior techniques reported in the literature or used in the field (Omid, et al., 2010).
The main goal of this study is to investigate the feasibility of using impact sound signals for rapid classification of two different genotype of Iranian walnut, namely Sangi and Kaghazi.An artificial neural network was used as a decision making unit for this purpose.

Materials and Method
The appearance of two genotype of investigated walnut is shown in Figure 1.
In order to devise a classification system for walnut genotypes, 2000 nuts of each genotype were selected randomly (4000 nuts altogether).A test rig was built to feed samples, drop them onto an impact plate, acquire sound signal upon impact, process the signal data and discriminate between Sangi and Kaghazi walnut genotypes.The schematic diagram of the experimental apparatus is shown in Figure 2. The system consisted of a feeding platform, an impact plate, an acoustic unit and a PC based data acquisition system.A 2 meter V-shaped steel profile was used as feeding platform and a chain was used for adjusting the slid angle.At 30º inclination of the slid, the best trajectory for walnuts was obtained.Flatter angles of incline would tend to bounce twice before falling off of the plate since in more inclined angle the trajectory would not be as consistent.This angle was determined by trial and error.Preliminarily experimental results indicated that steel plates proved better than glass or wooden for separating different walnut genotypes sounds.The impact plate was made up by a polished block of stainless steel approximately 150×150×20 mm.The mass of a single walnut is negligible compared to the mass of the impact plate, hence the possibility of vibrations from the plate interfering with acoustic emissions from nuts was minimized.The drop distance from the end point of the feeder to the impact plate was 25 cm.The impact plate in horizontal situation produces proper sound signals for complementary processing.A low cost Panasonic Electret capsule microphone (VM-034CY model), sensitive to frequencies up to 100 kHz, was used for capturing impact sound signals.The microphone was installed inside an isolated acoustic chamber to eliminate environmental noise effects.To prevent the chamber from acoustic reflections, it was filled with glass wool.Microphone output was send to a PC based data acquisition system, where it was digitized using a sound card (Intel® 82801 BA/BAM AC`97Audio controller) at a sampling frequency of 44.1 kHz, with 16 bit resolution.The personal computer was used for acquiring, saving and processing of data as well as classification samples.A schematic diagram describing the overall detection system is shown in Figure 3.A parallel hardware and software architecture is used to perform the described duty.
In each stage of experiment, walnuts samples were manually released from inclined feeding platform.It caused walnuts impact to plate separately and one bye one.The emitted sound signals were acquired by the microphone, digitized by the sound card and saved by using Matlab data acquisition toolbox (Math-Works, MATLAB User's Guide, & The MathWork, 2010).
Since the maximum frequency of the sound card was 44.1 kHz and data acquisition continued for 22.6 ms after triggering, upon receiving a trigger signal the computer acquired 1000 data points from every sample in the time-domain.Matlab software was used for data collection and management.
For extracting potential features, recorded sound signals were processed and analyzed in both time and frequency-domains.In order not to lose any useful transient feature, all 1000 data point amplitude (Amp) values were considered as features.A 1024-point Fast Fourier Transform (FFT) was computed from each sound signal, using a Mathwork Windows.
The magnitude, power spectral density (PSD) and phase angle of each spectrum was computed (Figure 4, 5 and 6).According to symmetry of sound signal in Frequency domain, only 512 data from 1024 data point were used for calculating PSD and phase (Figure 5 and 6).A total of 2024 features were obtained for each walnut.
For real time systems, the dimension of the input vector is large, but the components of the vectors are highly correlated (redundant).It is useful in this situation to reduce the dimension of the input vectors.Principle Component Analysis (PCA) was used to reduce the dimension of the input vectors to a maximmu of 50 features.After normalization of data, PCA analysis was performed on data using Matlab software.

Back propagation neural networks:
The Multilayer Perceptron (MLP) is one of the most widely implemented neural network topologies that are being used in the classification applications.MLPs are normally trained with the Back Propagation Algorithm (BPA).The back propagation rule propagates the errors through the network and allows adaptation of the hidden processing elements (PEs).The MLP is trained with error correction learning, which means that the desired response for the system must be known a priori.After adequate training, the network weights are adapted and employed for cross validation in order to determine overall performance of the ANN model.Gradient descent with momentum (GDM) learning rule is an improvement to the straight GD rule in the sense that a momentum term is used to speed up learning and stabilizing convergence.Therefore, the GDM method of learning was used throughout this study.
In order to minimize ANN training time, only one hidden layer was considered in the network.The number of neuron in hidden layer was determined using an exhaustive search from 1 to 40 nodes.The Neural Network with 18 nodes in hidden layer had the least standard deviation error as well as high stability.In developing ANN models, the linear function at the input layer and the non-linear hyperbolic tangent function at both hidden and output layer were used as transfer functions.Learning rate was 0.7 throughout the momentum learning rule.As an additional guard against over-fitting, the data sets were divided into three randomly selected data sets; 70% of data were used for training, 15% for testing and the remaining 15% were used for cross validation.NeuroSolutions 5.0 software was used for designing and testing of ANN models.

Results
To find the best combinations of potential features and optimal ANN configuration, 15 different combinations of principle component features were selected and tested by neural network (Table 1).These features were fed to the ANN models and their performances were determined by evaluation of the mean square error (MSE), correct detection rate (CDR) and correlation coefficient (r).In summery, the best combination was 16 amplitudes and 31 PSD features.The phase angles features had not enough potential to discriminate between sangi and kaghazi walnuts.The final structure of network was 47 input nodes, 18 hidden nodes and 2 output nodes.This relatively low number of input vector was used to guard against the possibility of over-fitting the neural network.
Table 2 shows the performance of optimal ANN configuration.Table 3 shows the number of correctly classified nuts using proposed method in test stage.
Figure 7 shows the neural network training procedure.It illustrates that the training and cross validation curve are convergent and both MSE reaches to an acceptable magnitude Figure 7 shows the neural network training procedure.It illustrates that the training and cross validation curve are convergent and both MSE reaches to an acceptable magnitude

Discussion and Conclusions
In this paper a separation system, based on combination of acoustic detection and artificial neural networks, was designed for classifying two Iranian's walnuts genotype.This method has high accuracy and can be used for separation of walnut genotypes.A rejection system is needed to study the real separation accuracy.So, currently the design and development of a high speed rejecter is being conducted by the authors.Moreover the feasibility of mentioned method for measuring density and volume of walnuts is being conducted.

Figure 1 .
Figure 1.The typical images of two genotype of walnut.(a) Sangi (b) Kaghazi

Table 1 .
Results of selecting and testing by neural networks