IMAGE SEGMENTATION WITH ARTIFICIAL NEURAL NETWORK FOR NUTRIENT DEFICIENCY IN COTTON CROP

The leaf analysis in a crop can present the need of a nutrient determined in the plant. The macronutrients deficiency in the cotton crop can be identified by specific type of colors variation by leaves images. Early identification of macronutrients deficiency can help in the growing suitable of the crop and reduce the use of agricultural inputs. This study investigates the image segmentation of the cotton leaves with deficiency of the phosphor. The segmentation is performed by difference of leaf pigmentation, according with the pattern related to macronutrient type in deficit and the cultivate. The image segmentation is made by an artificial neural network and the Otsu method. The results show satisfactory values with an optimized artificial neural network and better than the Otsu method. The results are presented by images and distinct parameters of quality analysis in the segmentation.


INTRODUCTION
Precision Agriculture (PA) aims improve the agricultural production system with use of new technologies, for increase the productivity, reduce costs and minimize the environment degradation. For an efficient management of the crop is necessary the monitoring suitable of the essentials resources to plants, without leave occur the lack or overload of nutrients. Techniques to infer the variations spatial and temporal in the crop can determined the insertion of the necessary resources in each plantation area. Furthermore, in all production system can be reduced the use of agricultural inputs, as fertilizers and pesticides.
Plantation monitoring for PA is performed of various forms, nowadays the use of images is in rise. The cheap costs in the acquisition of digitals cameras are encouragement in use its technology. This monitoring can use different sensors and definitions for images acquisition, generally related to color models, resolution and distance.
The main diversity in the images acquisitions are defined according with: The colors models: Red, Green, Blue (RGB), Hue, Saturation, Intensity (HSI), images in gray scale and histogram; the resolution type: Spatial with matrix M×N of pixels, hyper-spectral and multispectral with infrared; and the distances are associates with region size to be monitored, for example, orbital, air and land.
Analysis of orbital images, by satellite, are more popular among researchers by wide coverage of regions in applications like the cultures recognition, determination degraded areas and soil analysis. Nonetheless, images acquisitions are made in an elevated time interval, usually in weeks or months. Land and air imagery oversee a smaller region, but in real-time. The monitoring is more specific with a smaller region. This is Science Publications JCS usually directed to analysis of the color variation and leaves forms for identify nutrients deficiency (Liu and Pattey, 2010), weeds (Burgos-Artizzu et al., 2011) and diseases (Cui et al., 2010).
The difficulty and delay in the monitoring can prejudice the management of culture. The adjournment of the nutrients identification makes easy the emergence of diseases and retard in the plant development. The nutrients deficiencies in the cotton crop, as in others crops, can be identified by color variation symptoms in the leaves. The recognition of nutrients deficiencies by leaves bring a noninvasively form of identify and apply proper fertilizer rates.
Most methods are related with measures chlorophyll content for nutrients analysis (Moghaddam et al., 2011) or "greenness" (Pagola et al., 2009), usually measure by reflectance (Pacumbaba and Beyl, 2011). The Artificial Neural Network (ANN) is often used like method of leaves analysis in various situations. Moghaddam et al. (2011) the chlorophyll estimation in the plant leaf was available in the sugar-beet crop and compared with SPAD chlorophyll meter. Fu and Chi (2006) the authors proposing the plants classification based in the refined segmentation of the leaf veins used ANN.
The use of ANN for image processing is popular in others areas like medical, showing the ANN robustness in several applications. The Fuzzy Edge Detection and Segmentation (FEDS) and Fast Hartley Transform (FHT) were implemented for features extracting in Sriramakrishnan and Shanmugam (2012). The ANN uses these features to training and test of the algorithm with classification accuracy of 93.2%. Baranidharan and Ghosh (2012) was proposed to implement a novel Neural Network algorithm to improve the classification accuracy in medical image retrieval with good results.
Image processing and ANN based in classifiers have been studied extensively in PA. But the monitoring in smaller region is few explored by researchers and segmentation is inexistent. In this study is made the monitoring in leaves individual for posterior increase of the analysis region. Thus, with a bigger analysis can identify early the nutrient deficiency in the crop.
In this study, we develop an ANN Multilayer Perceptron (MLP) with goal of identify the existence of nutrient deficiency in the cotton. The ANN function is the deficiency segmentation by pigmentation variation in the leaf with base in colors images acquire by conventional digital camera. Two methods distinct are compared, ANN and Otsu method, for show the efficiency of the ANN for image segmentation.
The section 2 presents the materials and methods used in the work and system developed in section 3. The results achieved in the system are presented in the section 4, by several quality parameters analyzed on image segmentation and discussion in the section 5. The finals considerations of the work are in the Section 6.

Experiments
The experiment analyzed is 2012/13 harvest and was the last year of the harvest with begins in 2009/10. Experimental station is located in Itiquira-MT, Brazil (-17° 5' 52.03", -54° 45' 34.55"). This station belong the Fundação MT (FMT) that providing the information and images of the crop. The soil is a latosol red dystrophic and very clayey (with 65% of clay) in all experiments.
In the set of tests in experiment with the cotton culture were performed applications distinct of two macronutrients, Nitrogen (N) e Phosphorus (P). Nitrogen was vary between doses of 0, 20, 45 and 70 Kg ha −1 and the phosphorus in 0, 50, 100 Kg ha −1 of P2O5. The experiment correspond in 36 variations, in 9 types of treatments with 4 samples in each 4 different blocks analyzed. The cotton crop analyzed is FMT 709.
Laboratory analysis of the experiment can be related to color and deficiencies observed in the cotton leaves. The treatment application without macronutrient P presents results of deficiencies in the cotton leafs. The selected images were with more high degree of severity analyzed, i.e., without phosphorus fertilization, treatment number 1, 2 and 3 in Table 1. Macronutrient P deficiency presented in its leaves the pigmentation purple.
The least values of P were acquired these treatments between all analyzed itself with nitrogen application of 20 and 70 Kg ha −1 . Values are defined in the "very low" range with 1.4, 1.45 and 1.65. The others treatments are above of 1.7 and near of the "low" range. The recommended for cotton in soils above of 65% clay is 4.1 to 6.0 (Carvalho and Ferreira, 2006).
The cases with deficiencies have values considered "very low", but the treatments in the "low" range are near the 2.0 and not present deficiencies of nutrients in the leaves. The Table 1 shows the results of the full laboratory analysis in all treatments with the nutrients follow: Nitrogen (N), Phosphorus (P), Potassium (K), Calcium (Ca), Manganese (Mg) e Sulfur (S). Results of the laboratory analysis

ANN and Imagery
In the two methods ANN and Otsu have the same inputs images. In all images were removed the background (soil) with graph editor. These images were used as new samples for the ANN training. All images were trained in the ANN according its respective segmented image by graph editor. ANN was trained in all stages with white (255) in the background and segmented area in black or with gray level scale near the 0. Otsu method uses a gray image for results analysis with phosphorus deficiency different of the ANN, more details in section 4.
The analyses were performed with 6 images, 3 without deficiency and 3 with phosphorus deficiency. With graph editor were generate more 6 images without background and 9 desirables images, i.e., with the segmentation of the region without and with nutrient deficiency in the leaf. Furthermore, ANN inputs are based in 12 images with and without background and in each two images correspond the same desirable image or segmented. Three images extras were generated for Otsu method with deficiency.
The images were acquired by a digital camera Sony DSC-W530 and redefined in a resolution of 320×300 with graph editor. In the cross-validation were used 12 images and the ANN training with 2% of each image, i.e., 1920 pixels for first analysis of the section 4.
The others 98% were defined for validation of the ANN test and results analysis. The low percentage defined in each image have goal of obtain the best combination for ANN as Learning Rate (LR), Constant Momentum (CM) and Quantity of Neurons in the Hidden Layer (QNHL).

ANN System
ANN was defined with backpropagation learning algorithm and supervised training in all experiments. ANN application can be parameterized in various aspects, the mains are: Amount layers, neurons in the hidden and out layers, quantity and data types of entries, learning rate, constant momentum, activation function type and stopping criterion.
Several trainings were performed for determine suitable parameters to ANN targeting a more optimized structure. Furthermore, the amount of ANN layers are three with a hidden layer and its neurons quantity varied in 3, 4, 5, 6, 7, 8, 12 e 16. The LR and CM were changed in (0.01, 0.05, 0.1) and (0.3, 0.5, 0.7, 0.9), respectively according to recommended limits in (Haykin, 1998) and initials simulations. Activation function (hyperbolic tangent) is used in all ANN neurons. The function is applied after computing of the weighed sum between inputs and its respective weighs. The amounts of epochs have variation in 200 and 500, the first for definition of the ANN parameters and other for validation of the results with the better combination found.
ANN training is performed with images inputs and desirables and finished according to stopping criterion (epochs). Input image (f(x,y)) is included in the ANN after normalization (f''(x,y)) of the values in the interval between [0:1]. The terminus of the training will generate the weights necessaries for run feedforward mode and full image segmentation according to nutrient deficiency.
The system inputs are sequential pixel to pixel and each input corresponds in an image component Red, Green and Blue (RGB), as show The output generated through the Digital Image Processing (DIP) methods for reconstruct the image in a M×N structure, but the results in this study are available by output values of the ANN and Otsu method.
ANN output is weighted in gray scale with 8 bits of resolution and normalized between [0:1]. The image reconstruction convert real values in integer numbers for facilitate later adjustments in the segmentation between classes, with and without nutrient deficiency in the leaf. The Fig. 1 presents the general execution of the system, the training is made with image part and feedforward mode is run with full image.
The Otsu method (Otsu, 1979;Gonzalez and Woods, 2007) was choice for make comparison with the ANN results. This method is a classical algorithm for image segmentation based in statistics models of variation between distinct classes in images. The Otsu method with threshold multiple was development and performed tests before of apply in this study. The methods used in this study were development in Matlab without support of toolbox or functions. Furthermore, in the near future will be made transcription for an object-oriented programming languages and providing in a website.

RESULTS
The work results show segmentation with ANN suitable in the identification of nutrient deficiency. The results are present through several parameters for quality analysis of the image segmentation.

Quality Parameters
For analyze the results found in the segmentations were defined four parameters: Percentage of Hit-or-Miss (PHM), Mean Squared Error (MSE), Peak Signal-to-Noise Ratio (PSNR) and Quality Index (QI).
PHM measure precision in each pixel with base in the output gray scale in methods ANN and Otsu. The evaluate is performed by hit amount in each simulation, according to interval defined in the Equation 1 and 2. The calculate is based in the increment of the hit and miss according to suitable limits of gray scale for result.
In the output layer in ANN have a neuron for determine the pattern output or segmentation image. Therefore, the generated image in the output of the ANN and Otsu method are in gray scale. The variable "Hit (H)", Equation 1, is incremented just when the output belong to close interval between 1/4 of the possibilities of gray levels (L) for above and below of the desirable value. Otherwise, the variable "Miss (M)" is incremented. Thus, each pixel is analyzed individually and defining a acceptable margin of error. In the Equation 1, D is desirable value of the pixel for comparison in the outputs. The values of Lz, Lx e Ly are found by Lz = (1/4)*LMax, Lx = LMin+1/4 e Ly = LMax-1/4. If any a three possibilities of H increment no occur is incremented the value of M.
Another simple form for this analysis is determine a threshold, e.g., in the half of the gray levels. The superior part corresponds in a class and inferior in other. However, this form is investigated just if the value belong in a class and no the results precision.

JCS
The results acquired with this methodology were better than present in Table 1. However, the method of the Equation 1 and 2 were used for obtain suitable analysis of the value acquire in the output: Two parameters were analyzed with base in the error of the comparison results between the images output and desirable. MSE is obtained by Equation 3 and Pn is the pixels amount of the image used in the validation of the tests data. ANN output is normalized and for the best analysis of the values in relation to gray levels was performed the product of the image resolution with MSE. The PSNR brings measure of the signal peak in decibels (dB). This measure is related with image energy and noise, similar approach to MSE.
The fourth parameter (QI) is related the lost of correlation, luminance distortion and contrast between two images evaluate, output and desirable. The correlations between the images are calculated by covariance of the images through statistical analysis of the data, according to Equation 5 of (Wang and Bovik, 2002). The quality index has values in the interval of [-1:1], the value is 1 when the images are equals: For facilitate the results analysis was defined a parameter of Quality Factor (FQ), for calculate the average weight between the four parameters, according to Equation 6. The value of FQ is in the interval of [0:10] and 10 how the best result. The values of PSNR and QI were normalized for keep the same interval of the others. The parameters related with error (MSE and PSNR) are not more suitable for analysis of the segmentation results (Wang and Bovik, 2002;Juca and Mello, 2011), thus were given more low values of weighting: For obtain the best combination of the ANN organizations were performed 27 simulations. Each simulation or training were run and after apply the feedforward mode for 12 images and average of the results are present in the

Quality Analysis in the Segmentations
For experiment with phosphorus deficiency were defined four stages. In the first stage run 12 trainings with purpose to find the best values in the LR and CM. The second stage aims find the best value for QNHL. The third stage evaluates the results with percentage variation of the images set used in the training. The last stage is generated the results with the best combination and a greater quantity of epochs.
In the first stage are performed 12 simulations for define the best combination with variation in LR and CM, Table 2. The LR has more influence in the FQ and the best results are with least value of LR in all parameters, except on PHM. This parameter has a uniform behavior with least value of LR, i.e., averages values in all inputs images. With bigger values of LR provide the greater variation of the results (nonuniform), with best values and others very poor.
From first stage others 8 simulations were performed changing the QNHL that correspond to second stage. Table 3 show best results with least QNHL due the neurons quantity in output layer be 1 and the QNHL must follow the rule of Inputs ≤QNHL≤ 2xInputs (Haykin, 1998), how occur in the results of the Table 3.

Fig. 2. Images without phosphorus deficiency symptoms and with background
The best combination between all simulation correspond the organization following: QNHL = 3, LR = 0.01 and CM = 0.3. This organization was employed on results in the Table 4 and 5. In trainings were used 200 epochs to targeting the results of the Table 2-4 and 500 epochs in the Table 5.
Third stage evaluates the influence of the images percentage in the training with more 6 simulations and differences in the segmentations results are related in the Table 4.
The last stage evaluates the best combination with a greater quantity of epochs. The simulations odd and even of the Table 5 correspond, respectively, images with and without background. The results show the interference of the background in the image segmentation. This is clear for PHM with Otsu method, but in the ANN is the difference with least values.

Visual Analysis of the Image Segmentation
In all stages and its respective trainings are run of independent form and with the same images set. For each image are generate three segmentations types: Segmentation with Otsu method, Segmentation with ANN and Segmentation with graph editor. The Fig. 2-5 present 54 images divided in 2 groups of 12 images and 2 groups of 15 images. Two first groups have images without deficiency, Fig. 2 and 3 and two others groups with severe deficiency of phosphorus, Fig. 4 and 5. In the Fig. 2 and 3 have three images samples and each sample have a source image and three segmentations, graph editor (ideal), ANN and Otsu. In the Fig. 4 and 5 have three images samples, but have two image segmentation with graph editor (ideal), one for ANN and other for Otsu method, for correct analysis of the segmentation. The results are presented by images with segmentations and several parameters of quality measure.
The visual results of the segmentations in the images are related the Fig. 2-5. In the Fig. 2 and 3 have images without phosphorus deficiency and in Fig. 4 and 5 have images with deficiency.
Segmentations are presented in Fig. 2 and 3 of following way: (a;e;i) source image; (b;f;j) Segmentation with graph editor (ideal for two types methods of segmentations); (c;g;k) Segmentation with ANN and it's the best combination; (d;h;i) Segmentation with Otsu method. in the Fig. 4 and 5 have addition of more a column before of the segmentation by Otsu method, that correspond Segmentation with graph editor (ideal) for this method. The ideal for ANN continued with its previous item. . 3. Images without phosphorus deficiency symptoms and without background

Fig. 4. Images with phosphorus deficiency symptoms and with background
Science Publications

DISCUSSION
In Table 5 present the results with the same images set for ANN and Otsu method. In the comparison between the methods in the Table 5, the ANN achieves better results than the Otsu method in the general average FQ. The reason is directly related with the PHM parameter that makes analysis of the precision in each pixel. The QI parameter in the two methods obtain similar average. The Otsu method achieves better results in the two parameters related with error (MSE and PSNR). However, the visual results in the image segmentation of the Fig. 2-5 show that segmentation by Otsu is very deficient in relation to ideal image. Juca and Mello (2011) and Wang and Bovik (2002) comment that error analysis in the image segmentation is not suitable for quality analysis in the segmentation. Therefore, weight values in the Equation 6 were least. Only in the inputs images without background and with phosphorus deficiency, Fig. 4, the Otsu method achieved good results. To achieve these results was necessary the inversion of the segmentations classes, but preserved the same form in the measure acquisition of separability based in variance between classes.
ANN achieved satisfactory visual results in all images. Optimized ANN with few neurons can obtain suitable image segmentation same with background. The best results with FQ found are related to images without nutrient deficiency, Table 5 (1 to 6).
The Results in Fig. 3 and 4 show the unsuitable segmentation with Otsu method when compared to ideal (segmentation with graph editor). The segmentation with ANN present results better than Otsu method and near to ideal results.

CONCLUSION
We have demonstrated that a optimized ANN can be used for image segmentation of the P macronutrient by cotton leaf. The system show be robust same with few neurons units in nonlinear application as image segmentation.
For find the best ANN combination and organization were performed several simulations. From in this combination were analyzed several parameters for determine a quality factor to segmentation. The Segmentation quality of the ANN was compared with Otsu method. The visuals results prove the superiority of the ANN about Otsu method for image segmentation. The parameters related to error (MSE and PSNR) are not

Science Publications
JCS suitable for quality analysis of the image segmentation. ANN show be more efficient than Otsu method in various aspects and suitable to goal defined in this study.
Image analysis was performed with individual leaf, in future works intend increase the region analyzed and change of the crop and macronutrient for verify the results with our proposed.