Automated Marble Plate Classification System Based On Different Neural Network Input Training Sets and PLC Implementation

The process of sorting marble plates according to their surface texture is an important task in the automated marble plate production. Nowadays some inspection systems in marble industry that automate the classification tasks are too expensive and are compatible only with specific technological equipment in the plant. In this paper a new approach to the design of an Automated Marble Plate Classification System (AMPCS),based on different neural network input training sets is proposed, aiming at high classification accuracy using simple processing and application of only standard devices. It is based on training a classification MLP neural network with three different input training sets: extracted texture histograms, Discrete Cosine and Wavelet Transform over the histograms. The algorithm is implemented in a PLC for real-time operation. The performance of the system is assessed with each one of the input training sets. The experimental test results regarding classification accuracy and quick operation are represented and discussed.

Many modern systems for automated vision control in stone production industry are developed for inspection and classification of the surface texture of marble slabs and plates after cutting. .Many of them have high market price and are compatible only with the proprietarily company production equipment.The existing software products for texture recognition are not intended for implementation in Programmable Logic Controllers (PLC) widely used for control of technological processes.A specific task in marble plate production is the sorting of tiles with identical surface textures.The high accuracy classification in this case is difficult because the parametrical descriptions of the textures are high correlated.
In addition the textures have to be recognized during movement (transportation on a conveyer belt) and with some changes in the working area illumination corresponding to the specifics of the production process.That is the reason to develop effective methods and algorithms aiming at high recognition accuracy for different kinds of similar textures when evaluating them in real production environment conditions.On the other hand optimal (considering accuracy, quick-operating and cost) software and hardware system solutions have to be soughtsuitable for implementation in PLCs, because these devices are preferable and widely used in up-to-date automated production systems.In this paper, a new approach for design of an Automated Marble Plate Classification System (AMPCS) based on different neural network input training sets is proposed, aiming at high classification accuracy using simple processing and application of only standard devices and communication protocols.

II. EXISTING METHODS FOR TEXTURE CLASSIFICATION
There are many contemporary methods and algorithms for texture analysis and classification.The task of classification is to associate an undefined texture with a preliminary known class.Tuceryan and Jain [1] divide the classification methods in four basic categories: statistical, geometrical, model based and filter based methods.Statistical first order data as the mean value and the dispersion are not appropriate for description of the pixel cross correlation.The second order data given by the differential statistics and the auto-correlation functions are more appropriate for texture classification [2].The geometrical method is based on extraction of primitives, detects all the particles in the image applying operators as Sobel, Prewitt, Roberts etc. and after morphological analysis builds a detailed report on the geometrical parameters of each particle [3].The application of statistical and filter based approaches [4] is due to the fact, that there are many software products, offering an opportunity for easy simulation and test of the results.Context analysis based on -direct local neighborhood‖ is also lately applied and it is a variant of a method based only on filtration.The model based analysis aims construction of a base model of the image.On the base of the constructed model a description and synthesis of the texture is feasible.The main disadvantage of the existing methods is the very high computational complexity and relatively low recognition accuracy.All of these methods are not efficient when the textures are very www.ijarai.thesai.orgsimilar and have overlapping parametrical descriptions.When investigating recognition and classification of a preliminary known texture classes, more suitable is to apply an adaptive recognition method and a supervised learning scheme [5], since this method gives the more accurate results.In this instance the best variant is to choose neural networks (NN) because of the good NN capabilities to adapt to changes in the input vector, to set precisely the boundaries between the classes therefore offering high recognition accuracy and fast computations in the recognition phase [6].After choosing a NN for combination between a supervised learning scheme and utilization of the histogram parameters, the more important thing is the right choice of the input NN data.This choice is influential for the right and fast convergence of the NN, for the number of parameters in the input vector and the whole NN topology.The initial choice of variables is guided by intuition.Next the number of NN input parameters has to be optimized, developing a suitable method for their reduction aiming to preserve only the informative parameters without loose of any information useful for accurate class determination [7].plate images through a high resolution CCD industrial camera, they are transferred using Ethernet communication to a conventional PC [8].The system is working in two modesoff-line or training and on-line or classification mode.

IV. CALCULATION OF THE INPUT TRAINING SETS A. Histograms
The image histogram is the most important statistical characteristic.It contains information about the image contrast and brightness.Textures can also be described through their histograms.The mathematical definition of a histogram is as follows: ∑ where for an image with a number of k grey levels, is each of columns, containing the number of pixels with intensity value of i.Since the histogram values are used as NN input training vector, the values have to be fitted to the range of NN's transfer function argument -i.e. between 1 and -1.Therefore, each histogram value is divided by the maximum histogram value.To reduce NN's input layer neurons, the normalized histogram is reduced through sampling each sixth histogram value according to the method given in [9].where the integers m and n control the wavelet dilation and translation respectively; a0 is a specified dilation step parameter set at a value greater than 1, and b0 is the location parameter which must be greater than zero [12].Substituting a0 = 2 and b0 = 1 into equation ( 4) we see that the dyadic grid wavelet can be written in a very compact form as: ⁄ Using the dyadic grid wavelet, the discrete wavelet transform (DWT) can be written using wavelet (detail) T m,n coefficients as:

∫
The scaling function can be convolved with the signal to produce approximation coefficients as follows:

∫
In our case the discrete input signal S0,n = h[t] is the gray scale image histogram of finite length N=256 and M=8, which is an integer power of 2: N = 2M .Thus, the range of scales we can investigate is 0 < m < M. We can represent the histogram signal h[t] using a combined series expansion using both the approximation coefficients Sm,n and the wavelet (detail) Tm,n coefficients as follows [12]:

D. Applied Wavelet multi-resolution calculation algorithm
Once we have our discrete input signal S0,n, we can compute S m,n and T m,n.This can be done for scale indices m > 0, up to a maximum scale determined by the length of the input signal.To do this, we use an iterative procedure as follows.www.ijarai.thesai.orgIntegrating both sides of the above equation, we can show that the scaling coefficient must satisfy the following constraint:

∑
In addition, in order to create an orthogonal system we require that

∑ {
The reconfigured coefficients used for the wavelet function are written more compactly as: Next, applying the Haar filtering algorithm [10,11,12,13,14] we can find S2,n and T2,n from the approximation coefficients S 1,n and so on, up to those coefficients at scale index M, where only one approximation and one detail coefficient is computed: SM,0 and TM,0.At scale index M we have performed a full decomposition of the finite-length, discrete input signal.We are left with an array of coefficients: a single approximation coefficient value, SM,0, plus the detail coefficients, Tm,n, corresponding to discrete waves at scale a = 2m and location b = 2mn.The finite time series is of length N = 2M.This gives the ranges of m and n for the detail coefficients as respectively 1 < m < M and 0 < n < 2 M-m -1 [12].At the smallest wavelet scale, index m = 1, 2M=21 = N/2 coefficients are computed, at the next scale 2M=22 = N/4 are computed and so on, at larger and larger scales, until the largest scale (m = M) where only one (= 2M=2M) coefficient is computed.The total number of detail coefficients for a discrete time series of length N = 2M is then, 1 + 2 + 4 + 8 + … + 2 M-1 = N -1.In addition to the detail coefficients, the single approximation coefficient SM,0 remains.
As the histogram S0,n = h[t] input signal vector contains N=256 components, the decomposition of the signal in our case corresponds to a number of 32 approximation coefficients Sm,n when stopped at subsequent level m=3.
The obtained S3,n approximation coefficients for the texture Balmoral Red are illustrated in Fig. 6.

V. EXPERIMENTS AND RESULTS
The experiments were carried out with the ten classes of marble textures shown in Figure 2. The image acquisition was accomplished using a CCD camera Basler scA1000-20gm with exposure time of 120µs to 29.5 ms and resolution 1034 x 779 pixels.The value of 9Pix Motion Blur (MB), corresponding to an image resolution of 300 dpi or 118 Pix/cm, 25 m/min linear velocity of the conveyer belt, and 1/500 sec camera exposure time was applied to the images.Also 10% brightness variations were added to some of the texture samples.The MLP NN structure was trained in off-line mode of AMPCS, consecutively with sampled histogram values (each 8th value was sampled) of the ten textures, with their DCTs, sampled on the same way, and with DWTs approximating coefficients S3,n.Thus, all MLP NN input vectors are composed of 32 components.The right choice of MLP NN topology (number of layers, number of neurons in the layers) and NN parameters (activation function, MSE -mean square error, input data) is decisive for optimal training the NN [15].Initially we use three -layered 32-50-10 MLP NN topology, where 10 is the number of output layer neurons, corresponding to the number of tested texture classes.With the training of MLP NN we want to obtain "softer" transitions or larger regions, where the output stays near to "1" or "-1" (using tangent hyperbolic as activation function).
With 3D graphic presentation it is possible to view the input/output characteristic of two inputs and one output of the neural network in spatial representation, Fig. 7.After fixing the number of input values, the number of neurons in the hidden layer and applying the method given in [16], the training is repeated with reduced MSE.These reduction aims at establishing the boundaries between the classes more precisely.After that the 3D-surfaces are observed, repeating the step and reducing MSE again until the 3D-surfaces of almost all outputs have areas, where the output have regions near to "1" or "-1" as on Figure 5/b.At this point the train phase is completed.The number of hidden neurons in MLP NN best final topology varies between 25 and 50 with MSE between 0.01 and 0.31.It was trained after 32000 iterations on the average for all 10 classes with 300 training samples per class for each of the calculated three input sets.Finally the trained NN for the three investigated input training sets is downloaded in the Programmable Logic Controller -SIMATIC S7-317 DP [17] for on-line mode operation.www.ijarai.thesai.orgThese reduction aims at establishing the boundaries between the classes more precisely.After that the 3D-surfaces are observed, repeating the step and reducing MSE again until the 3D-surfaces of almost all outputs have areas, where the output have regions near to "1" or "-1" as on Fig. 7/b.At this point the train phase is completed.The number of hidden neurons in MLP NN best final topology varies between 25 and 50 with MSE between 0.01 and 0.31.It was trained after 32000 iterations on the average for all 10 classes with 300 training samples per class for each of the calculated three input sets.Finally the trained NN for the three investigated input training sets is downloaded in the Programmable Logic Controller -SIMATIC S7-317 DP [18] for on-line mode operation.

VI. CLASSIFICATION PERFORMANCE
The algorithms for a particular neuro -application are calculated in the processor of the SIMATIC S7-317 DP and more precisely, after an unconditional call by a user program or cyclically at time-controlled intervals.MLP NN in the PLC is represented with a pair of a Function Block (reserved for NN is FB101) and an associated instance Data Block (DB101).The results of the trained NN -i.e. the obtained matrix of adapted weight coefficients are stored in the DB101.When calling FB101, NN inputs are provided with the calculated histogram, DCT or DWT values over the current accepted texture.Next a FDL-Final Decision Logic procedure for automated evaluation and finding the MLP output with maximal value (corresponding to the recognized texture class) was designed, using ladder diagram method in the PLC.
At that point we use FB1 and instance data block DB1.FB1 receives as inputs the output values of MLP NN (Fig. 9).FB1 contains the developed algorithm for finding the maximum value of NN outputs.Fig. 10 shows a single compare logic element (CMP), which compares one of the NN outputs with the current memorized maximum value MD201.MLP outputs together with FDL results were applied to the physical PLC outputs and to other FBs in the PLC for direct control of the sorting mechanical devices.The results given in Table 1 show that the highest classification accuracy is obtained when DWT coefficients are used in AMPCS -i.e.100% (calculated as the number of correct classified/common number of tested samples) with Mexican hat is used as mother wavelet and only 32 approximated DWT coefficients are used.When DCT coefficients are used as input set, an accuracy of 87.5 -95% is achieved by the same length of the input vector.When a histogram with 32 sampled values is used, the accuracy is between 80% -85%.
The best accuracy is obtained when NN has 45 hidden neurons applying the histogram method, 50 neuronsfor the DCT method, and only 25 neurons for the DWT method.It is a good precondition for further minimizing the number of hidden neurons without affecting the accuracy and at the same time for reducing the real-time operation.Another good research continuation would be the testing of the accuracy and computational time applying DWT approximation coefficients with m>3 -i.e.reducing the input vector components to n=16 and even n=8.Because the faster real-time operation is achieved for the histogram method and the slowestfor the DWT method, this would compensate the relatively complicated calculations.
Finally, it is recommended to investigate the crosscorrelation between texture histograms before choosing one of the proposed in this paper input sets [17].When the crosscorrelation coefficient is greater than 0.6 -0.7, it is recommended to apply DWT method because Wavelets are building blocks that can quickly de-correlate data.In the case of slight correlated histograms (i.e.not very similar textures), it is better to apply histogram or DCT method because according to Table1 they ensure faster computation and sufficient accuracy.The proposed adaptive algorithm is implemented and proved for real-time operation on standard PLC SIMATIC S7-317 DP instead of on other embedded systems, because PLCs are widely used as control devices in automated production.Therefore, there is no need to develop additional equipment to the PLCs and this is a good opportunity for replication of the proposed AMPCS results in similar processes.The achieved short maximum system reaction time and estimated high recognition accuracy is a good precondition for proper system operation even under worse production conditions.
It is based on training a classification Multi-Layer-Perceptron Neural Network (MLP NN) with three different input training sets: extracted texture histograms, Discrete Cosine Transform (DCT) and Discrete Wavelet Transform (DWT) over the histograms.The algorithm is implemented in a PLC for realtime operation.The system performance is assessed with each one of the input training sets.The modeling technique performance is assessed with different training and test sets.The experimental test results regarding classification accuracy and quick operation are represented and discussed.

Figure 2 .
Figure 2. Exemplars of the tested marble textures.

Figure 3 .
Figure 3. Normalized and sampled histogram of marble texture Balmoral Red Figure 3 shows the normalized and sampled histogram for class Balmoral red.

Figure 4 .
Figure 4. DCT over the histogram of the texture Balmoral Red given in Fig.3

First∑
we compute S1,n and T1,n from the input coefficients S0,n, i.e.Here the scaling equation (or dilation equation) describes the scaling function in terms of contracted and shifted versions of itself as follows: ∑ where (2t -k) is a contracted version of (t) shifted along the time axis by an integer step k and factored by an associated scaling coefficient, ck.

Figure 8 .
Figure 8.Output neuron values for classification of a sample of class8 -Santa Cecilia Dourado Each class was tested with 40 samples of textures not included in the training set.The tests were provided with the defined three different input sets.Fig.8 shows the output neuron values for classification of a sample of class8 -Cecilia Dourado.The obtained classification accuracy, calculated as the overall number of correct classifications, divided by the number of instances in the data testset given on the average for the ten classes is presented in Table1.The maximum value of the time needed for image acquisition, histogram/DCT/DWT calculation, giving the values to the PLC NN Function Block, classification through the trained NN and giving the result to the physical PLC outputs is calculated for different number of hidden neurons with different MSE.Fig.11 shows MLP NN outputs for correct classification of 40 test samples of class 4 -Gris Mondaris.

Figure 11 .
Figure 11.Classification of 40 test samples of class 4 Gris Mondaris