0% found this document useful (0 votes)
105 views7 pages

Soil Nutrient Detection Using Genetic Algorithm: November 2019

Uploaded by

sushi ashushi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views7 pages

Soil Nutrient Detection Using Genetic Algorithm: November 2019

Uploaded by

sushi ashushi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/340893073

Soil Nutrient Detection using Genetic Algorithm

Conference Paper · November 2019


DOI: 10.1109/HNICEM48295.2019.9072689

CITATIONS READS

0 115

6 authors, including:

John Carlo Velasco Puno Rhen Anjerome Bedruz


De La Salle University De La Salle University
12 PUBLICATIONS   39 CITATIONS    39 PUBLICATIONS   195 CITATIONS   

SEE PROFILE SEE PROFILE

Ryan Rhay P. Vicerra Argel Bandala


De La Salle University De La Salle University
100 PUBLICATIONS   224 CITATIONS    198 PUBLICATIONS   664 CITATIONS   

SEE PROFILE SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Vision-Based Intelligent Aquaponics System View project

Smart Farm Project View project

All content following this page was uploaded by John Carlo Velasco Puno on 21 July 2020.

The user has requested enhancement of the downloaded file.


Soil Nutrient Detection using Genetic Algorithm
John Carlo V. Puno1, Rhen Anjerome R. Bedruz1, Allysa Kate M. Brillantes2,
Ryan Rhay P. Vicerra1, Argel A. Bandala2, Elmer P. Dadios1
1
Manufacturing Engineering and Management Department
2
Electronics and Communications Engineering Department
De La Salle University
Manila, Philippines
[email protected]

Abstract—Genetic Algorithm is the method used in this study There are a lot of studies and applications that uses
in classifying the qualitative level of the soil nutrients. The data Genetic Algorithm for soil analysis. In [6], Genetic
set includes images coming from the result of the soil testing. Algorithm is used in predicting the Calcium and Magnesium
The extracted features were the HSV values and the LAB content in soil together with generalized regression neural
values color space. Out of the six extracted features from the
data set, the B from LAB color space is the most linear so with
networks. Another study predicts the soil moisture content
that, it is the input of genetic algorithm in identifying the as the basis of agriculture in saving water from the irrigation.
qualitative level of the soil nutrients. For the run of the It uses Genetic Neural Network based on Annealing
program using python programming language and pyCharm Algorithm [7]. In a separate study, detecting soil moisture is
CE as IDE, the values of each parameters follow: the being studied by combining finite element with genetic
population size is 10, mutation rate is 0.01, the number of cross algorithm [8]. Most of Genetic Algorithm applications for
over points is 2 and the maximum number of generations is soil concentrate on determining soil moisture and some
1000. The population’s final best fitness has 98.2609% that nutrient parameters stated above.
proves that Genetic Algorithm is an effective method in
classifying the qualitative level of the soil nutrients.
For soil nutrient detection, existing studies uses image
Index Terms—Soil, Genetic Algorithm, MATLAB, Python, processing techniques such as thresholding and masking to
Nutrients extract features and machine learning algorithm such as
neural network to identify or classify the nutrient level. In
I. INTRODUCTION [2], it uses a box that has a controlled light environment that
is used for data acquisition. The box also considers the
Soil Preparation is essential because with lacking or distance of camera so that the soil sample is fixed. The image
excessive use of fertilizer may harm the planted crop. The that will be captured from the module box will undergo
amount of fertilizer also affects the percentage yield [1]. Soil image processing to identify the qualitative level of nutrients
Nutrients can be subdivided into two groups namely: and pH level of the soil. In [9]–[11], different sensors such
Macronutrients (Nitrogen, Phosphorus, and Potassium) and as optical, electrochemical, and radiometric sensors were
Micronutrients (Zinc, Calcium, and Magnesium). The used as on-the-go sensor since it is portable. From these
former is the basis of common commercial fertilizer that sensors, electromagnetic sensors are widely used together
makes the management of the use of these fertilizers with electrical sensors. Combining Analog-to-Digital
essential [2]. Converter, Photodiodes, LED and Field Programmable Gate
Array (FPGA) were also used in determining nutrient level
There are a lot of ways on how to determine soil nutrients of the soil in a separate study [12]. Ion Selective Electrodes
and one of these is by using the Soil Test Kit (STK) invented (ISEs) are very common type of sensors used in detecting
by the Bureau of Soils and Water Management (BSWM). It certain parameter that it was used in [13]. Adding to these
is an organization in the Philippines under the Department existing studies, [14] uses color detector sensor in extracting
of Agriculture (DA) that caters the needs of our farmers by the RGB values of the result of soil testing then interpret its
providing new technologies that will help our farmers nutrient level. Lastly, RF spectroscopy is also now being
improve their yield [3]. Not only in the Philippines, STK used in determining the soil nutrients such as potassium and
was widely used in other countries including over 50 nitrogen [15]. Genetic Algorithm alone is not used in
locations in the United States [4]. STK uses chemicals that determining the soil nutrient level, it is always partnered
changes its color depending on the nutrient level present in with neural network. GA was generally used for
the sample. For Nitrogen and Phosphorus, it can be Low, optimization of parameters [16], [17]. In general, this study
Medium or High, while for Potassium, it can be Deficient or aims to use Genetic Algorithm in identifying the qualitative
Sufficient. The result of this test will be the basis for the level of the nutrient of the soil. Specifically, this paper
fertilizer recommendation computed by the soil technician focuses on the development of a program that identify the
[5]. qualitative level of Potassium, Phosphorus, and using
genetic algorithm via python programming language.

978-1-7281-3044-6/19/$31.00 ©2019 IEEE


II. METHODOLOGY

(a)

Figure 1. General Structure (b)

The general structure shows the stages that the system Figure 3. (a) Design of the Image Acquisition Box (b) Web camera
will undergo to identify the qualitative level of soil nutrient.
First the captured image will be the input of the system taken The box has a physical dimension of 9.5” x 8” x 5”
from the sample acquisition box. The image will undergo (LWH). To come up with these measurements, an
image processing where in it will be cropped with the setting experiment was conducted that considers the distance of the
of the region of interest. Thresholding and Masking will also camera and the sample with good focus. The height of the
take place in this stage. After this, the extracted feature will test tube from the STK was also considered for the height of
be generated. Six features will be extracted namely: Hue, the box. The width considers the spaces between the test
Saturation, Value (from the HSV colorspace), Lightness, A, tubes being used in data acquisition. An image will be
and, B (From LAB colorspace) [18]. One feature will be the acquired from the box that will undergo image processing
input of the genetic algorithm. Choosing the best feature from the result of the soil testing. A specific spot in the box
depends on what feature among the six is the most linear. is allotted for each test tube with sample and chemicals to be
And finally, the genetic algorithm will generate the analyzed before image acquisition.
optimized genotype values that will identify the qualitative
level of the soil nutrients. B. Image Processing

A. Captured Image Image processing focuses on the discussion of three sub


sections namely: capturing, pre-processing, and
The captured image will be made after the soil testing segmentation of the image [19]. Acquisition of image was
took place. Figure 2 shows the soil test kit made by the done using a web camera installed in the module. The image
BSWM. The output of the soil testing is the one being placed produced will undergo image processing is shown in the
in the image acquisition box shown in figure 3. This box has figure below.
a camera inside that is responsible for image capturing.

Figure 4. Sample Image


Figure 2. Soil Test Kit
There are certain processes that can be used in pre-
Soil Test Kit (STK) uses set of chemicals to classify the
processing images [20]. Adjusting the contrast and the
qualitative level of the soil. It has a separate chemical for
brightness as well as noise reduction are the ones being
each parameter being tested. These chemicals will be
considered in the study. after this, the image must be
combined with the soil sample by following the procedure
cropped, thresholded and masked. These processes are
that comes also with the kit.
inside image segmentation. The sample image must be
cropped focusing on the area that is subjected to feature
extraction. This concern can be addressed by setting the
region of interest (ROI). These are used to emphasize the
managing and evaluating a specific part in an image [21].
For instance, in figure 4, a part of the image is only needed
for image processing and that is the color of the chemical for
each test tube. The location of the ROI will be distinctive for
each soil nutrient.

Figure 6. Masked and thresholded image

C. Feature Extraction

Feature extraction gives the values from the color


Figure 5. Cropped Image analysis. Mean values of the HSV color space and LAB
color space are the feature extracted that will be the used in
The cropped image as shown in figure 5, will be identifying the qualitative level of the soil nutrients.
thresholded and masked. The process of thresholding was
used to remove the part of the image that is not needed. The The values listed in table 1 below are sample from the
thresholder app in MATLAB was used and it is shown in extracted features after image processing. It shows that the
figure 6. Setting a threshold value will make each pixel B feature is the most linear among them and can be used as
either a background or object depending on the setting [22]– the input for Genetic Algorithm.
[25].

Table 1
Extracted Features Values from the Data Set
Hue Saturation Value Lightness A (green-red) B (blue-yellow) Output
0.12134542 0.68493809 0.75923074 171.713299 134.8569862 2.2506 0
0.11215798 0.64827186 0.79513425 178.327265 136.5039821 2.2448 0
0.10305924 0.77199426 0.59952233 124.115814 144.1264641 2.2304 0.5
0.10305924 0.77199426 0.59952233 124.115814 144.1264641 2.2304 0.5
0.11911921 0.47210589 0.6100488 147.141608 130.1967846 2.1953 1
0.13941705 0.38207285 0.65903802 165.209968 126.3918676 2.1943 1
0.14331611 0.28621919 0.6079092 156.039663 125.8943338 2.1695 1.5
0.14454301 0.33996554 0.45111107 116.096634 126.3925358 2.1695 1.5
0.26319809 0.23388569 0.36483279 96.3220065 121.02589 2.1416 2
0.26319809 0.23388569 0.36483279 96.3220065 121.02589 2.1416 2
0.53082889 0.06333821 0.60716562 157.454028 130.4744601 2.113 2.5
0.57804457 0.06305313 0.59997807 156.823595 129.7232186 2.1107 2.5
0.57900937 0.22964307 0.52506363 128.023666 123.5312311 2.0775 3
0.61087501 0.23975916 0.51466893 121.214881 126.147322 2.0724 3
0.64988685 0.52740648 0.40379337 70.5724729 135.1198938 2.0178 3.5
0.61756202 0.48380261 0.52320037 100.767923 129.0790533 2.0138 3.5
Legend: 0 – Potassium Deficient, 0.5 – Potassium Sufficient, 1 – Nitrogen Low, 1.5 – Nitrogen Medium, 2 – Nitrogen High, 2.5 – Phosphorus Low,
3 – Phosphorus Medium, 3.5 – Phosphorus High

The values of the most linear among the extracted The GA finds individuals with optimal parameters for a
features (B) undergone natural logarithm function to lower linear function whose output is a number near 0 to 3.5 with
its numerical value. The output is the numerical value increment of 0.5; whichever of those numbers the output is
corresponding to the nutrient level of the soil. closest to, the classification is that number. More
specifically, the function is f[B(Blue-Yellow)] = (173 +
D. Genetic Algorithm (A/B) * [B(Blue-Yellow)]^3) - (1131 + (C/D) * [B(Blue-
Yellow)]^2) + (2443 + (E/F)* [B(Blue-Yellow)]) – 1745.2,
The Genetic Algorithm codes were inspired from a Mini- and the parameters are A, B, C, D, E, F. These parameters
Project to build a classifier for Fisher’s Iris Data Set [26]. are allowed to have the integer range -100 and 100
(inclusive). Other extracted features were not considered
because other extracted features were non-linear and can be III. DESIGN CONSIDERATIONS
named as “noisy data”.
MATLAB was used for image processing. It includes
E. Result image pre-processing, image segmentation, and feature
extraction. The most linear extracted feature (B (Blue-
The Result of the Genetic Algorithm after run are 6 Yellow)) will be the input for Genetic Algorithm that uses
different integers correspond to the values of the 6 python programming language and pyCharm CE as the IDE.
parameters (A, B, C, D, E, and F). Substituting these
parameters will lead to a numerical value from 0 to 3.5.

IV. EXPERIMENTS AND RESULTS

A. Preferences Setting

Before the run of the Genetic Algorithm some to 20. These values can be changed with your own
parameters for GA must be set. For the population size, it is preference but for this run, it has a Population’s Best Fitness
set to 10. For the mutation rate, 0.01 is the value being input. of 98.2609% with Genotype values of -18, -67, -29, 106, -
Cross over rate has a value of 0.6. the cross over points is set 39, and 105. The Result of the run from #1 to #20 is shown
to 2. Then the maximum number of generation is 1000. The in table 2.
number of times to run the GA with these parameters is set

Table 2
Summary of test Run of GA with the Best Fitness and Genotype Values

Note: Genotype Values are arranged from A to F respectively.

B. Validation substituted to function above and must have the same value
By cross-checking the correctness of the genotype values for the output. Figure 7 shows some of the comparison of the
produced by the genetic algorithm, the values were output and the value of the function.
Figure 7. Comparison of the Result the output vs the value of the function after substitution of genotypes

Column G is the output of the data set, Column K is the your-soil/.


[2] N. M. Arago, J. W. F. Orillo, J. J. I. Haban, J. S. Juan, J. C. V.
value of the function after substituting the values of 6
Puno, J. F. C. Quijano, and G. M. A. Tuazon , “SoilMATe: Soil
genotypes and Colum L indicated that if Column G and macronutrients and pH level assessment for rice plant through
Column K is equal, then Column L will be equal to 1. The digital image processing using artificial neural network,” J.
sum of Column L is 452 and has an average or accuracy of Telecommun. Electron. Comput. Eng., vol. 9, no. 2–5, pp. 145–
149, 2017.
98.26%
[3] B. M. Qutain and R. M. David, “Reliability of soil test kit,” in
V. CONCLUSION Supplement no. 1, Volume 12, 1987.
[4] M. Sarrantonio, J. W. Doran, M. A. Liebig, and J. J. Halvorson,
The program developed in the study that is able to “On-Farm Assessment of Soil Quality and Health,” Methods
Assess. Soil Qual. Madison, WI Soil Sci. Soc. Am., pp. 83–105,
identify the qualitative level of soil nutrients using Genetic 1996.
Algorithm was successfully applied using python. The result [5] Bureau of Soils and Water Management - Laboratory Services
shows that the program produces an accuracy rate of Division, Soil Analysis and Fertilizer Usage. 2013.
98.26%. Upon the completion of the project, it is highly [6] Y. Labrador, C. Chang, and J. Viloria, “Prediction of the
calcium and magnesium content in soils through a generalized
recommended to add soil samples to improve the accuracy regression neural networks and genetic algorithms,” Proc. -
of the model. In addition, this data set can be used with other 2012 11th Int. Conf. Mach. Learn. Appl. ICMLA 2012, vol. 1,
machine learning algorithm to be trained and tested to know pp. 661–666, 2012.
which model performs the best. [7] R. Liang, Y. Ding, X. Zhang, and W. Zhang, “A real-time
prediction system of soil moisture content using genetic neural
network based on annealing algorithm,” Proc. IEEE Int. Conf.
ACKNOWLEDGMENT Autom. Logist. ICAL 2008, no. September, pp. 2781–2785,
2008.
The authors would like to extend their utmost gratitude [8] L. Zhenhua, Z. Yingshi, and Z. Xia, “The study of the
combining finite element with genetic algorithms method for
to BSWM by sharing their knowledge as well as their soil moisture,” Int. Geosci. Remote Sens. Symp., vol. 6, pp.
resources to make this project possible. To De La Salle 4489–4492, 2005.
University, especially the Gokongwei College of [9] W. Isaac and A. Na, “On-the-go soil nitrogen sensor based on
Engineering for endless support to their graduate students. near infrared spectroscopy,” 2016 Int. Conf. Inf. Technol.
InCITe 2016 - Next Gener. IT Summit Theme - Internet Things
And above all, God for His continuous guidance. Connect your Worlds, pp. 312–315, 2017.
[10] M. Futagawa, Y. Ban, K. Kawashima, and K. Sawada, “On-site
REFERENCES monitoring of soil condition for precision agriculture by using
multimodal microchip integrated with EC and temperature
sensors,” 2013 Transducers Eurosensors XXVII 17th Int. Conf.
[1] C. Nardozzi, “How to Test Your Soil.” [Online]. Available:
Solid-State Sensors, Actuators Microsystems, TRANSDUCERS
http://www.dummies.com/home-garden/gardening/how-to-test-
EUROSENSORS 2013, no. June, pp. 112–115, 2013.
[11] W. S. Lee, V. Alchanatis, C. Yang, M. Hirafuji, D. Moshou, and Ocampo, I. C. Valenzuela, A. B. Culaba, and E. P. Dadios,
C. Li, “Sensing technologies for precision specialty crop “Identification of philippine herbal medicine plant leaf using
production,” Comput. Electron. Agric., vol. 74, no. 1, pp. 2–33, artificial neural network,” HNICEM 2017 - 9th Int. Conf.
2010. Humanoid, Nanotechnology, Inf. Technol. Commun. Control.
[12] V. Ingale, R. Vaidya, A. Phad, and P. Shingare, “A sensor Environ. Manag., vol. 2018-January, pp. 1–8, 2017.
device for measuring soil macronutrient proportion using [20] J. A. I. Diaz, M. I. Ligeralde, J. A. C. Jose, and A. A. Bandala,
FPGA,” Int. Conf. Commun. Signal Process. ICCSP 2016, pp. “Rust detection using image processing via Matlab,” IEEE Reg.
715–718, 2016. 10 Annu. Int. Conf. Proceedings/TENCON, vol. 2017-
[13] J. V. Sinfield, D. Fagerman, and O. Colic, “Evaluation of December, pp. 1327–1331, 2017.
sensing technologies for on-the-go detection of macro-nutrients [21] A. R. F. Quiros, R. A. Bedruz, A. C. P. Uy, A. Abad, A. A.
in cultivated soils,” Comput. Electron. Agric., vol. 70, no. 1, pp. Bandala, E. P. Dadios, and A. H. Fernando, “A kNN-based
1–18, 2010. approach for the machine vision of character recognition of
[14] R. G. Regalado and J. C. Dela Cruz, “Soil pH and nutrient license plate numbers,” IEEE Reg. 10 Annu. Int. Conf.
(Nitrogen, Phosphorus and Potassium) analyzer using Proceedings/TENCON, vol. 2017-December, pp. 1081–1086,
colorimetry,” IEEE Reg. 10 Annu. Int. Conf. 2017.
Proceedings/TENCON, pp. 2387–2391, 2017. [22] J. C. V. Puno, A. A. Bandala, E. P. Dadios, and E. Sybingco,
[15] S. R. Vernekar, I. A. P. Nazareth, J. S. Parab, and G. M. Naik, “Vision System for Soil Nutrient Detection Using Fuzzy
“RF spectroscopy technique for soil nutrient analysis,” Proc. - Logic,” IEEE Reg. 10 Annu. Int. Conf. Proceedings/TENCON,
Int. Conf. Technol. Sustain. Dev. ICTSD 2015, pp. 4–7, 2015. vol. 2018-October, no. October, pp. 617–622, 2019.
[16] A. C. P. Uy, R. A. Bedruz, A. R. Quiros, A. Bandala, and E. P. [23] Y. Li, J. Zhang, P. Gao, L. Jiang, and M. Chen, “Grab Cut
Dadios, “Machine vision for traffic violation detection system Image Segmentation Based on Image Region,” 2018 3rd IEEE
through genetic algorithm,” 8th Int. Conf. Humanoid, Int. Conf. Image, Vis. Comput. ICIVC 2018, pp. 311–315, 2018.
Nanotechnology, Inf. Technol. Commun. Control. Environ. [24] H. Gao, L. Dou, W. Chen, and G. Xie, “The applications of
Manag. HNICEM 2015, no. December, 2016. image segmentation techniques in medical CT images,” Proc.
[17] A. C. P. Uy, A. R. Quiros, R. A. Bedruz, A. Abad, A. A. 30th Chinese Control Conf. CCC 2011, pp. 3296–3299, 2011.
Bandala, E. Sybingco, and E. P. Dadios, “Automated traffic [25] A. K. M. Brillantes, A. A. Bandala, E. P. Dadios, and J. A. Jose,
violation apprehension system using genetic algorithm and “Detection of Fonts and Characters with Hybrid Graphic-Text
artificial neural network,” IEEE Reg. 10 Annu. Int. Conf. Plate Numbers,” IEEE Reg. 10 Annu. Int. Conf.
Proceedings/TENCON, pp. 2094–2099, 2017. Proceedings/TENCON, vol. 2018-October, no. October, pp.
[18] J. C. Puno, E. Sybingco, E. Dadios, I. Valenzuela, and J. Cuello, 629–633, 2019.
“Determination of soil nutrients and pH level using image [26] ZachAlford, “Genetic Algorithm Mini Project 2.” [Online].
processing and artificial neural network,” HNICEM 2017 - 9th Available:
Int. Conf. Humanoid, Nanotechnology, Inf. Technol. Commun. https://github.com/ZachAlford/GeneticAlgorithmMiniProject2
Control. Environ. Manag., vol. 2018-January, pp. 1–6, 2017.
[19] R. G. De Luna, R. G. Baldovino, E. A. Cotoco, A. L. P. De

View publication stats

You might also like