Coconut Fruit Maturity Classification Using Fuzzy Logic

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Coconut Fruit Maturity Classification using Fuzzy Logic

Irister M. Javela, Argel A. Bandalaa, Rodolfo C. Salvador Jr. a, Rhen Anjerome R. Bedruzb,
Elmer P. Dadiosb, and Ryan Rhay P. Vicerrab
Electronics and Communications Engineering Departmenta
Manufacturing Engineering and Management Departmentb
De La Salle University Manila, Philippines
[email protected], [email protected], [email protected], [email protected],
[email protected], [email protected]

Abstract—The coconut is one of the most useful trees in the A simulation only of the coconut fruit maturity
world. Its fruit, with the scientific name cocos nucifera, is one of classification using fuzzy logic will be covered. The harvesting
the major agricultural products of the Philippines. The coconut of the coconut fruit is not covered in the study as there are
fruit depending on its maturity is used as a food or as a beverage. other studies focused on this process by which the
There are three stages of maturity namely: malauhog,
implementation is through robots [6].
malakanin, and malakatad. The classification into each stage
may be based on the color and hardness of its shell so as the The intended use for a coconut fruit is based on its maturity
amount and tenderness of its meat. To categorize maturity stage, stage. The quality of the coconut fruit has impact on the quality
this paper uses fuzzy logic with color and sound as fuzzy inputs. of the food it is used for or processed for. This may happen if
Image color analysis for determining the percentage brown in the
shell. Sound spectral analysis for relating the shell hardness and
the coconut fruit given does not match the maturity needed.
meat condition. Fuzzy inference system for evaluating the The expertise to properly classify requires years of experience.
relationship of sound and color with the maturity of a coconut Even for expert farmers, their classification may vary [3]. The
fruit. This study is able to simulate coconut fruit maturity system may present a way to standardize the classification of
classification system using a fuzzy logic approach. coconut fruit maturity.
The variability in the husk color and meat condition may be
Keywords – coconut fruit; cocos nucifera; maturity stage; fuzzy accounted for as fuzzy logic works on the principles of making
logic, image analysis, sound spectral analysis sound decisions from conflicting data. The non-linearity
amongst the factors affecting maturity of a coconut fruit even
I. INTRODUCTION the parameters not used directly as inputs to the system may be
accounted for by the proposed system.
There are 68 out of 81 provinces considered as coconut
areas in the Philippines amounting to 26% of total agricultural
II. RELATED LITERATURE
land in the country. There are 329.9 million bearing trees with
an average of 45 nuts per tree per year [1]. The coconut tree is A. Uses of Coconut Fruit based on Maturity
called as the tree of life as any of its part may be useful – roots,
trunk, palm, and the fruit. The coconut fruit based on its The three stages of a coconut fruit are intended for
maturity into different stages or age levels determine whether different use. These are the tagalog terms for each maturity
the nut is used as a food or as beverage. classification: Malauhog (mucus-like stage), Malakanin
(cooked-rice stage), and Malakatad (leather-like stage). The
The malauhog stage is observed as a mucus-like stage when fruit in the first stage may have its meat easily removed from
the meat is very soft and jelly-like with the husk being the shell. The fruit in the second stage is used in salad
greenish. The malakanin stage is a cooked rice-like stage where preparation and in making buko pie. The fruit in the third
the meat changes from jelly-like to a firm opaque-white solid stage is used in making sweets or desserts [2].
mass with the husk being yellowish. The malakatad stage has a
leather-like coconut meat as it is very much firmer with the
color being brownish [2]. There is no standard way of B. Coconut Fruit Color
determining the three stages of coconut fruit maturity [3]. The coconut has been divided in terms of color such as
green, yellow and brown depending on its cultivation [7]. As
This study proposes a fuzzy logic approach for classifying the fruit matures, the peel of the fruit turns color from green to
coconut fruit maturity using color and sound. The coconut fruit brown [4]. The color of the coconut husk is a good indication
turn into its full maturity from green to brown husk color and of ripeness. An immature coconut is mostly filled with
from soft to hard meat condition. The reference for color is coconut water and has a shell color that appears bright green.
brown as its occurrence increases as the fruit matures. The At this stage, the coconuts are not ready for harvest until six or
reference for sound is average power in the normalized seven months later. Upon peak maturity this is when the meat
magnitude spectrum as meat thickens as the fruit matures [4]. has hardened, and the outer husk is solid brown throughout the
There is a high correlation between flesh thickness and fruit coconut fruit [8]. Fig. 1 shows the color of coconut fruit as it
maturity [5]. ages.

978-1-5386-7767-4/18/$31.00 ©2018 IEEE


A. Image Analysis
An overview of the vision system for the proposed
classification system is shown in Fig 3. The system consists of
three main steps: image acquisition, image pre-processing, and
percent color detection.

Fig. 1 Color of coconut fruit as it ages

C. Acoustical Property of Coconut Fruit


Fig 3. Stages of the Image Analysis

A review on the studies of the acoustical property of The block diagram of the image analysis is shown in Fig 4.
coconut fruit shows a correlation on the sound produced and The implementation may be done via OpenCV python or via
stage of maturity. Gatchalian (1994) established that malauhog MatLab using a camera. A fixed setup must be followed
produces a solid sound while malakanin and malakatad during the image acquisition so as not to introduce variability
produce hollow sounds. Terdwongworakul et al. (2009) in the acquired images. The percentage of brown color in a
predicted the maturity from flesh thickness via resonant coconut fruit is the target output of this part.
frequency at R2 of 0.927. Thomas et al. (2017) used a novel
method based on audioception to grade coconut as good or
bad [9].
III. METHODOLOGY
The proposed classification system uses image analysis and
sound spectral analysis prior having these parameters
connected into a fuzzy inference system. The pbrown is the
expected parameter from the image analysis. The psound is
the expected parameter from the sound spectral analysis.
These two are the input parameters to be used in the fuzzy Fig. 4 Block Diagram of Image Analysis
inference system given the high correlation of color and sound
in the maturity of a coconut fruit as established from the The respective function in openCV for the block diagram
literature review. The fuzzy logic classifier will then process of image analysis is shown in Fig 5. The image is read. The
the information as per its knowledge base and come up with a color channel is obtained as RGB. A 3-D matrix consisting of
decision which corresponds to a maturity stage. The output of row number, column number and color channel must be
the system is any of the coconut maturity stage: malauhog, reshaped to a 2-D matrix. K-means clustering is applied to
malakanin, and malakatad. find and analyze groups formed organically. The number of
histograms is limited to the number of clusters. The relative
percentage of each cluster is displayed in a color bar.

Fig. 5 Respective function in OpenCV for


the block diagram of image analysis
Fig. 2 shows the theoretical framework of the proposed classification system.
Fig. 6 shows a simulated output of the image processing
technique discussed above. The percentage of brown color in a
coconut fruit thus may be obtained. The percentage of green
color may also be used but not preferred as its shell has that
color from onset prior to any maturity stage.

(a) (b)

Fig. 6 Simulated Output of Image Analysis

B. Sound Spectral Analysis (c)


An overview of the audio processing for the proposed
classification system is shown in Fig 7. The system consists of Fig. 9 Sample Signal Graphs: (a) Original audio signal, (b) FFT of audio
signal, and (c) normalized FFT
three main steps: harnessing of sound signal, signal
processing, and computation of percent sound.
C. Fuzzy Inference System
Fuzzy inference systems (FIS) are knowledge-based
systems that deal with imprecise or uncertain information. It is
derived from the principles of fuzzy logic that is motivated by
the human capabilities of making sound decisions despite the
imperfectness, imprecision, incompleteness and conflicting
information. It uses IF-THEN statements and “AND” or “OR”
rule statements for the decision rules. The system consists of a
fuzzifier, a knowledge base, fuzzy inference engine and
defuzzifier. The fuzzifier converts measured data (crisp
Fig. 7 Stages of the Sound Analysis values) into fuzzy variables. The knowledge base consists of a
database and rule base. The rule base contains the set of fuzzy
The block diagram of the sound analysis is shown in Fig 8. IF-THEN rules. The database defines the membership
The implementation may be done via MatLab using a functions of the fuzzy sets. The fuzzy inference engine
microphone. The recording of sound must be done in a (decision making unit) maps the input space into output space
controlled environment so as not to introduce variability in the based on the set of fuzzy rules. The defuzzifier converts the
recorded sound. The percentage of sound in a coconut fruit is processed fuzzy variables back into real values [10].
the target output of this part.

Fig. 8 Block Diagram of Sound Analysis


Fig. 10 Fuzzy Inference System Architecture.
Sounds produced by tapping coconut fruit is recorded. A
conversion from analog to digital is applied on the signal. The
magnitude spectrum of the sound signal is displayed using fast The fuzzy inference system architecture as shown in Fig.
fourier transform. Then, normalization of the spectral 10 is similar to conventional classification system where
magnitude is done. The average power is computed as average inputs are processed and an output is generated. It is executed
of the normalized spectral magnitude. The relative percentage everytime a classification is needed. The process in fuzzy
of sound is then obtained. logic is divided into three parts: fuzzification, fuzzy logic
processing and defuzzification.
Fig. 9 shows the sample signal graphs from the audio
processing technique discussed above. The percentage of
sound in a coconut fruit thus may be obtained for each
maturity stage.
IV. SIMULATION
The fuzzy logic toolbox of MATLAB is used in the
simulation of the classification of coconut fruit maturity. The
fuzzy inference system as shown in Fig. 11 has two inputs
denoted as PBrown and PSound and one output denoted as
Maturity. The percentage of brown color, PBrown, in a
coconut fruit is obtained from the image analysis. The average
power in the normalized magnitude sound spectrum, PSound,
is obtained from the sound spectral analysis. The maturity
may be classified into: Malakanin, Malauhog, and Malakatad.

Fig. 13 Input Membership Function (Average Power)

The maturity of a coconut fruit as the output is fuzzified


into membership functions such as Malauhog, Malakanin, and
Malakatad following a triangular shape as shown in Fig 14.

Fig. 11 Fuzzy Inference System of the Fuzzy Logic Classifier

The variables in a fuzzy inference system be it the input or


output are mapped by sets of membership functions known as
fuzzy sets. These are functions that define a fuzzy set to a
certain degree of membership using any of the following
shape: triangular (), trapezoidal () or Gaussian [11].
Fig. 14 Output Membership Function (Maturity)
The color of the coconut fruit as one of the inputs is The relationship between input and output in fuzzy logic is
fuzzified into membership functions such as low, normal, and determined by the rules set in the form of IF-THEN
high following a trapezoidal shape as shown in Fig 12. statements. For each rule, the inference mechanism uses the
membership values and according to the condition of the rule
comes to a conclusion [12].
The rules set in the proposed classification system are
shown via the rule editor as shown in Fig 15 and the rule
viewer as shown in Fig 16.

Fig. 12 Input Membership Function (% brown)

The average power in the normalized magnitude sound


spectrum as one of the inputs is fuzzified into membership
functions such as low, normal, and high following a gaussian
shape as shown in Fig 13.

Fig. 15 Fuzzy Rules: If Then Rule via Rule Editor


of MATLAB Fuzzy Logic Toolbox
Fig. 18 Fuzzy Surface Output
Fig 16 Fuzzy Rules: Rule Viewer of MATLAB Fuzzy Logic Toolbox
In summary, PBrown and Psound are fuzzified into
degrees of membership then evaluated against the inference
The output of the fuzzy logic system is also a fuzzy value rules which returns a crisp output value converted to maturity
computed by means of center of gravity. An output crisp value stage following center of gravity computation. Even with
must be converted back to a conventional expression. The conflicting information coming from the inputs, the fuzzy
defuzzification dissolves multiple degree of ambiguitiy into a logic system is able to output a maturity stage to classify a
numerical value which is then associated to the output coconut fruit. The novelty of the proposed classification
membership function. The result is a specific stage of maturity system is on the degrees of membership for the input variables
[13]. and the output variable.
The relationship of the inputs and output which formed the
rules set in the MATLAB fuzzy logic toolbox is summarized V. CONCLUSION
in the fuzzy associative matrix as shown in Fig 17. The This study demonstrated that the proposed classification
membership functions by row represent that of PSound while system is able to determine coconut maturity based from color
by column represent that of PBrown. and sound. Depending on the color of the husk and thickness
of the meat, the maturity of a coconut fruit may be classified.
To have the parameters color and sound be interpreted by the
fuzzy logic system, the image taken undergoes image analysis
to provide the percent color and the sound recording from
tapping undergoes spectral analysis to provide the percent
sound.
Fuzzy logic proves to be an effective algorithm for a
classification system as it is able to account for the non-linear
relationship between the inputs so as other factors indirectly
affecting the decision. It is also a flexible classification system
Fig. 17 Fuzzy Associative Matrix in terms of increasing accuracy as it may be easily done by
The numerical and graphical presentation of the adjusting the membership functions of the variables.
parameters for coconut fruit maturity classification can be
seen on Figure 18. The input variables PSound and Pbrown VI. RECOMMENDATION
plotted along the x and y axes. The output variable maturity Having established through simulation that a classification
plotted along the z axis. The indication of maturity based on system is feasible through a fuzzy logic system, it is
color and sound of a coconut fruit is established in the fuzzy recommended that implementation and testing be done on
surface output as shown in Fig 18. actual coconut fruits. The coconut maturity classification
system must be specific to coconut fruits that are produced
locally. From thereon, the membership functions for the color
and sound may be further fine tuned. In doing so, a fixed setup
for the camera and controlled environment for the microphone
is required as changes in the setup will affect the features or
parameters. The future researchers must work together with an
agricultural expert for the classification of the coconut fruits to
be tested. An automated system using robot may also be
implemented [14].
REFERENCES

[1] Philippine Statistics Authority (2015). Coconut Statistics: Areas


Planted to Coconut, Number of Coconut Trees, Nut Production . Philippine
Coconut Authority 29 October 2015. Retrieved 14 April 2018 from
http://pca.da.gov.ph/index.php/2015-10-26-03-15-57/2015-10-26-03-22-
41#area
[2] Pascua, A. M. (2017). Impact Damage Threshold of Young Coconut
(Cocos nucifera L.). International Journal of Advances in Agricultural Science
and Technology. Vol. 4(11): Pg. 1-9. Retrieved 30 November 2017 from
http://ijaast.com/publications/vol4issue11/V4I1101.pdf
[3] M. Siddiq, Tropical and Subtropical Fruits: Postharvest Physiology,
Processing and Packaging, John Wiley & Sons, 2012.
[4] M. Gatchalian, "Measurement of young coconut (Cocos nucifera, L.)
maturity by sound waves," Journal of Food Engineering, 1994.
[5] Terdwongworakul, A., Jarimopas, B., Chaiyapong, S., Singh, S. P.,
and Singh, J., "Determination of Physical, Acoustical, Mechanical, and
Chemical Properties of Fresh Young Coconut Fruit for Maturity
Separation," Journal of Testing and Evaluation, Vol. 38, No. 1, 2010, pp. 119-
126, https://doi.org/10.1520/JTE102276. ISSN 0090-3973
[6] Megalingam, Rajesh Kannan & Pathmakumar, Thejus & Allan, P &
Trayesh, V & Gokul, M. (2015). Robotic Arm Design for Coconut-Tree
Climbing Robot. Applied Mechanics and Materials. 786. 328-333.
10.4028/www.scientific.net/AMM.786.328.
[7] Lorenzi, H., Bacher, L., Lacerda, M., and Sartori, S. (2006). Frutas
Brasileiras e Exóticas Cultivadas (de Consumo in Natura), Instituto Plantarum
de Estudos da Flora, São Paulo, Brazil
[8] A. Allonsy (2018) How to Tell When Coconuts Are Ripe on the Tree
26 January 2018 Retrieved: 14 April 2018 from
https://homeguides.sfgate.com/tell-coconuts-ripe-tree-60198.html
[9] Thomas P & Anita HB, “A Novel Automated Method for Coconut
Grading based on Audioception”, Journal of Theoretical and Applied
Information Technology, Vol.. 95, No. 10, 2017
[10] R. K. C. Billones, M. P. Vicmudo and E. P. Dadios, "Fuzzy
inference system wireless body area network architecture simulation for
health monitoring," 2015 International Conference on Humanoid,
Nanotechnology, Information Technology,Communication and Control,
Environment and Management (HNICEM), Cebu City, 2015, pp. 1-6.
doi: 10.1109/HNICEM.2015.7393231
[11] Baldovino, R. G., & Dadios, E. P. (2015). Fuzzy logic control:
design of a ‘mini’ fuzzy associative matrix (FAM) table algorithm in motor
speed control. IEEE Region 10 Conference (TENCON), Macau
[12] Basu, S. (2012, June 6). Realization of fuzzy logic temperature
controller. International Journal of Emerging Technology and Advanced
Engineering, 2 (6).
[13] Mangaban K. D., Malubay J.J., Montecillo E.R., Precilla R.G., Caldo
R.B. (2016). A Fuzzy Logic Model of Early Warning System for Typhoon
Preparedness. 2016 DLSU Research Congress
[14] Anjum A & Devi YAS, “Robotic Arm for Object Sorting Based on
Color”, Internation Journal of Professional Engineering Studies, Vol 8, Issue
3, 2017

You might also like