You are on page 1of 9

Computers and Electronics in Agriculture 106 (2014) 6674

Contents lists available at ScienceDirect

Computers and Electronics in Agriculture


journal homepage: www.elsevier.com/locate/compag

Classication models of bruise and cultivar detection on the basis of


hyperspectral imaging data
Anna Siedliska, Piotr Baranowski , Wojciech Mazurek
Institute of Agrophysics, Polish Academy of Sciences, ul. Doswiadczalna 4, 20-290 Lublin, Poland

a r t i c l e

i n f o

Article history:
Received 13 November 2013
Received in revised form 19 February 2014
Accepted 26 May 2014

Keywords:
Apple bruising
Supervised classication
Hyperspectral imaging

a b s t r a c t
The aim of this paper is to create supervised classication models of bruise detection and cultivar
detection for ve apple cultivars with the use of hyperspectral imaging system in the VNIR (Visible
and Near-Infrared) and SWIR (short wavelength infrared) spectral regions. The Correlation-based Feature
Selection (CFS) algorithm and 2nd derivative pre-treatments of the hyperspectral data were used when
constructing supervised classication models of bruise and cultivar detection. The best prediction
accuracy for the bruise detection models was obtained for the Support Vector Machines (SVM), Simple
Logistic (SLOG) and Sequential Minimal Optimization (SMO) classiers (more than 95% of the success rate
for the training/test set and 90% for the validation set). Even higher prediction accuracies were obtained
for the cultivar detection models. The percentage of correctly classied instances was very high in these
models and ranged from 98.2% to 100% for the training/test set and up to 93% for the validation set. The
performance of the studied models was presented as Receiver Operating Characteristics (ROC) for the
bruise detection models and confusion matrices for the cultivar classication models.
2014 Elsevier B.V. All rights reserved.

1. Introduction
Apple quality and texture evaluations during harvesting and
storage are really important for producers and it is a goal of some
research (Zdunek et al., 2011). A great problem in apple production
is to nd an effective way of sorting fruits to eliminate damage of
various kinds (Brosnan and Sun, 2004; Sun, 2008; Sun, 2010;
Leemans and Magin, 2002). A large percentage of harvested apple
fruits are wasted each year because of bruising damage that results
from various static and dynamic loads occurring during picking,
packing, and distribution operations. Bruise damage can be caused
in apples due to impact, compression, vibration, or abrasion. Additionally, the susceptibility of apples to bruise damage depends on
the mechanical properties of apple skin and esh which are cultivar dependent and can be modied by soil cultivation, nutrition
and weather conditions in the eld during fruit growth
(Drogoudi and Pantelidis, 2011; Ferguson et al., 1999; Grimm
et al., 2012; Lle et al., 2011; Xing et al., 2007). Therefore, the
location, shape and depth of bruising vary and damage detection
is difcult, especially in case of dark skin colour or a small surface
area of the bruise (Sun, 2008). Although bruising is the reason for
rejecting the highest number of fruits in sorting lines, the accuracy

Corresponding author. Tel.: +48 81 7445061; fax: +48 81 7445067.


E-mail address: pbaranow@ipan.lublin.pl (P. Baranowski).
http://dx.doi.org/10.1016/j.compag.2014.05.012
0168-1699/ 2014 Elsevier B.V. All rights reserved.

of existing automatic sorting systems is still insufcient and the


manual sorting method has still to be used (Leemans and Magin,
2002; Xing et al., 2007; Qin et al., 2009). Therefore, early detection
of mechanical defects in apples is really important, especially for
an automatic sorting system.
In recent years, machine vision technology has been successfully used in the eld of pre- and post- harvest product quality
evaluation and also to detect mechanical damage to objects (Xing
et al., 2007; Brosnan and Sun, 2004; Wang et al., 2011). Thermography and hyperspectral imaging deserve a special attention
among other non-destructive technologies which enable quick
and reliable online inspection of fruit products. Baranowski et al.
(2009) used active thermography to detect early bruises in apples.
It was noticed that local changes of tissue thermal properties
caused by inner defects of fruit tissue could be successfully registered using pulsed-phase thermography (PPT). These authors
found a linear correlation between the depth of bruising and the
frequency of the thermal response. In another approach, the same
authors tested a system that incorporated hyperspectral reected
radiation in the VNIR and SWIR ranges and infrared thermal imaging of emitted radiation in the MWIR range (Baranowski et al.,
2012). The obtained results showed a better performance of the
classication of normal versus bruised apples when a combination
of the VNIR, SWIR and MWIR ranges was used, but it was found
that the same combination of spectral ranges did not signicantly

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

affect the classication between deep and shallow bruises.


Hyperspectral imaging in the VNIR and SWIR regions can also be
successfully used for determining the time elapsed from the occurrence of bruising within a period of two weeks after bruising of
apples (Baranowski et al., 2013).
Combining various wavelengths in differential reectance
improves detection and often identication of defects (Lee et al.,
2008; Kleynen et al., 2003; Mendoza et al., 2011; Peng and Lu,
2006; Wang et al., 2011). A multispectral system was created by
Mehl et al. (2002) which used a chlorophyll absorption wavelength
at 685 nm and two wavelengths in the NIR band to separate defective areas in four cultivars of apples, with a high spatial resolution
between 0.5 and 1 mm. X-ray imaging was also tested for early
apple bruise detection (Schatzki et al., 1997). However, the linescan X-ray imaging experiment revealed not adequate separation
of one-day bruises in Golden and Red Delicious (Shahin et al.,
2002). Considerable development was recently achieved in the efciency of Magnetic Resonance Imaging (MRI) for detecting and
monitoring the progression of internal browning in Fuji apples
stored under two different controlled atmosphere conditions
(Gonzalez et al., 2001). Distinct regions with internal browning
were observed which had lower signal intensity than normal tissue. The progression in time of browning symptoms was noticed.
The system used allowed the speed of image acquisition to be
improved from 5.5 min to 20 s, by reducing the spatial resolution
of the images.
The aim of this study is to examine the applicability of hyperspectral imaging in the VNIR and SWIR wavelength ranges for
detecting the occurrence of apple bruising in apples of ve selected
cultivars. The specic aims of the paper are:
 To distinguish between bruised and unaffected tissues in apples
of ve studied cultivars in the rst two weeks after bruising by
using supervised classication models based on VNIR and SWIR
hyperspectral data.
 To check the effectiveness of distinguishing various cultivars
based on spectral characteristics using classication models.
2. Materials and methods
2.1. Material and its preparation for measurements
The fruit material, including ve apple (Malus domestica Borkh)
cultivars: Champion, Gloster, Golden Delicious, Idared and
Topaz, was collected from an orchard of the STRYJNO-SAD Fruit
Producers Association (15 km from Lublin, Poland), directly after
hand harvesting in autumn 2011. During the experiment, apples
were stored in a climate chamber at 21 C and at 80% relative
humidity.
Four hundred and eighty apples with a diameter of 78 cm
where divided into two groups and tested using analytical
methods and hyperspectral imaging. Apples from one group were
bruised, whereas apples from the other group were left nonbruised. Each apple was bruised along the equatorial line of its surface. A plastic roller with a diameter of 10 mm and a thickness of
1 mm was used for bruising. It was put on the apple surface and
a cylindrical weight of 0.2 kg was dropped (the contact surface
was the base of the cylinder) from a height of 400 mm.
The quality parameters of apple fruit, including rmness, soluble solids content (SSC) and bulk density, were measured for all the
studied cultivars before creating the prediction models. Fruit
rmness was measured using a Lloyd LRX Universal Testing
Machine, produced by Lloyd Instruments Ltd., Hampshire, UK,
and expressed in N. An Atago pocket refractometer, produced by
Atago Co., Ltd., Tokyo, Japan, was used for the determination of soluble solids content (SSC). Bulk densities were determined by using

67

an electronic digital Mettler XS1003S balance, Mettler Inc., Switzerland (an operating capacity of up to 1000 g with a readability
of 0.001 g).
2.2. Hyperspectral imaging system
The spectral characteristics in VNIR and SWIR of apples studied
were acquired using a hyperspectral imaging system which consists of spatial (2-dimensional) and spectral (1-dimensional) data.
They create a 3-dimensional spectral cube (Fig. 1) in which the
spectral characteristics of selected pixels can be studied as well
as images obtained for various wavelengths can be analysed using
available image processing methods.
A visible and near infrared (VNIR) camera with an ImSpector
V10E imaging spectrograph (4001000 nm) and a short
wavelength infrared (SWIR) camera with a N25E 2/3 imaging
spectrometer (10002500 nm), manufactured by SPECIM, Finland,
were placed 40 cm above the belt conveyor. The illumination
source for each camera consisted of eight halogen lamps of 20 W
placed in two opposite frames positioned at an angle of 45 towards
the conveyor belt surface. The measurements were performed in a
dark room to prevent the inuence of external illumination. The
fruits examined were placed on the belt conveyor which had the
speed regulated for each camera. The belt conveyor speed was
adjusted individually for each camera because of the differences
in spatial resolution and integration time of the cameras (Fig. 2).
The hyperspectral images obtained during the measurements
were recorded using data acquisition software SpectralDAQ ver.
2.1 for SPECIM cameras. Initially, the acquired images were
corrected with white and dark references.
2.3. Analysing Algorithms
Bruised and non-bruised areas were selected from the hyperspectral cube. To distinguish the bruised areas from the hyperspectral images, a script was written in ImageJ software (Rasband,
19972001). A modication of the procedure proposed earlier by
ElMasry et al. (2009) was used for segmentation. The implementation of the Otsu thresholding algorithm was used. It divides the
histogram into two classes and inter-class variance is minimized.
Additionally, for images that enable regions of sizes ranging from
50 to 5000 pixels to be distinguished, particle nucleus counting
was applied. This range was suitable for creating masks of bruised
regions. The segmentation procedure was used as a reference to
distinguish the areas with bruise for all the studied apples. It
enabled to create a database of the areas within the studied fruits
with and without the defects. Such a method of visual inspection of
the fruit surface is not sufcient for sorting systems as was indicated earlier (Leemans and Magin, 2002; ElMasry et al., 2009;
Sun, 2010). Therefore, the main interest of this study was to analyse the reected spectrum in VNIR and SWIR ranges to create an
effective classication models of apple bruise and cultivars.
The reectance was calculated separately for all the bands and
taken as an average from pixels in regions containing bruised and
sound tissues.
All the classication algorithms were implemented from comprehensive software called the Waikato Environment for Knowledge Analysis, or Weka for short, which is available as source
code on the World Wide Web at http://www.cs.waikato.ac.nz/ml/
weka. The system is written in Java and is available for all major
computer platforms. This software allows various methods to be
provided for data pre- and post-processing and for evaluating the
result of learning schemes. Pre-processing of the hyperspectral
data consisted in choosing, from the whole spectral range
registered by the two cameras, the range in which the spectral
characteristics of the signal were sufciently strong. Due to low

68

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

Fig. 1. Diagram of a hyperspectral image (hypercube) for an apple presenting the spectral and spatial dimensions.

Fig. 2. Setup of VNIR and SWIR hyperspectral cameras.

efciencies of the system at both ends of the spectrum, only the


wavelength range from 432 to 2450 nm was used for the analysis,
with approximately 6 nm increments per pixel. In this way, 344
bands were selected for further processing.
The pretreatment of the spectral data consisted in the application of the 2nd derivative for the raw spectral data. The effectiveness of this pretreatment method for apple classication models
was conrmed by Baranowski et al. (2013). The main advantage
of treating the spectral data with the 2nd derivative is that it
ignores the offset and is not affected by any linear tilt that may
exist in the data. Therefore, it is a way to effectively remove the
baseline offset and the slope from a spectrum.
To reduce the high dimensionality of the spectral data, the Correlation-based Feature Selection (CFS) algorithm was applied to the
original spectral data (Hall, 1998). The idea of this algorithm is to
evaluate the worth of a subset of attributes by considering the individual predictive ability of each feature along with the degree of
redundancy between them. The best-rst search method was
applied in this algorithm with forward direction.
The classiers in Weka software are divided into several
categories, from which functions, trees, lazy classiers, and meta

classiers were included in the study (Witten and Frank, 2005). Initially, the majority of classiers available in Weka software were
tested on representative groups of training and testing data. Ten
of them with the best prediction accuracies were chosen for comparison. These classiers are presented in Table 1, together with a
general description and the actual parameters determined in this
study.
Two groups of dependent variables were studied: bruising and
cultivars. The prediction model for bruised (BR)/non-bruised (NB)
apples of ve cultivars (Champion, Gloster, Golden Delicious,
Idared, Topaz), as dependent variables, was created using the
Weka Knowledge Flow Interface for all the classiers studied. This
graphical interface allows the design and execution of congurations for streamed data processing (Fig. 3). Within this interface,
the appropriate data le for each group was loaded in ARFF format
(the native le format in Weka). Then, the dependent variable (a
class) was selected with the Class Assigner and a value for the positive class was chosen for each model with the Class Value Picker.
The Cross-Validation Fold Maker split the dataset into folds (10
folds were chosen). It has been conrmed in a study (Witten and
Frank, 2005) that stratied 10-fold cross-validation is the standard

69

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674


Table 1
Chosen features of the classiers used in the study.
Name of
classiers
library

Description of algorithm

Acronym

Chosen parameters of classier

Multilayer
perceptron
Furia

Uses Backpropagation Neural Networks to classify instances

BNN

Fuzzy Unordered Rule Induction Algorithm

FURIA

IB1

Nearest-neighbour classier. The normalized Euclidean distance is used to


nd the training instance closest to the given test instance
A wrapper class for the liblinear classier

NNC

AutoBuild: true; learning rate: 0.3; momentum: 0.2;


training time: 500 hidden layers = (attribs + classes)/2
Debug: false; TNorm: standard TNorm; seed: 1; folds: 3;
optimizations: 2 runs
Debug: false

Builds linear logistic regression models


A wrapper class for the libsvm tools. Allows users to experiment with oneclass SVM, regressing SVM, and nu-SVM supported by LibSVM tool
Naive Bayes classier which uses estimator classes. Numeric estimator
precision values are chosen based on analysis of the training data
Classier for constructing a forest of random trees

LOG
SVM

Builds linear logistic regression models with built-in attribute selection

SLOG

Sequential Minimal Optimization algorithm for support vector classication

SMO

LibLINEAR
Logistic
LibSVM
Naive Bayes
Random
forests
Simple
Logistic
SMO

Class Value
Picker
e.g. bruise

data
set

Classifiers:
Multilayer Perceptron

data
set
Class Assigner
e.g. cultivar

data
set

ARFF Loader
data file
in ARFF format

Cross Validation
Fold Maker
folds: 10
preserve order:
false
seed: 1

training set
data set

Furia
IB1
LibLinear

LINE

NB
RF

SVM type: L2 loss Support Vector Machines; bias: 1.0;


normalize: true
Debug: false; MaxIts: -1; ridge: 1.0E-8
SVM type: nu-SVC; kernel type: linear; Nu: 0.5;
normalize: true; probability estimates: true
Use supervised discretization: true; debug: false; use
kernel estimator: false
Debug: false; MaxDepth: 0; num of features: 0; num of
trees: 10; seed: 1
Heuristic stop: 50; MaxBoostingIterations: 500;
NumboostingIterations: 0
Filter type: normalize; training data; kernel: PolyKernel C250007-E1.0

batch
Classifier

Text
Viewer

text
Classifiers
Performance

Logistic
LibSVM
Naive Bayes
Random Forests
Simple Logistic

Evaluation

threshold
data
Model
Performance
Chart

SMO

Fig. 3. The Knowledge Flow interface arrangement for the studied classication models with the main components of data ow.

evaluation technique in situations where only limited data are


available and it is regarded as the most rigorous one. The idea of
10-fold cross-validation is that data are partitioned randomly into
10 complementary subsets. Each subset is held out in turn and the
learning scheme trained on the remaining nine-tenths. Then, its
error rate is calculated on the holdout set. The learning procedure
is executed a total of 10 times on different training sets. In the earlier chosen Classiers panel, ten classiers were included to be
executed simultaneously and the results were sent to the Classier
Performance Evaluators, through which they were presented (and
then stored) as text les in the Text Viewer Panel and as ROC
threshold curves (Fawcett, 2006; Yang, 2010).
3. Results
The highest mean values of rmness (52.1 N and 43.4 N) and
density (0.1237 g/cm3 and 0.1366 g/cm3) as well as the lowest
mean values of soluble solids content (12.4 brix and 13.6 brix)
were found for the cultivars Idared and Topaz, respectively. It
was expected that the differences in these properties between cultivars affected the spectral characteristics of apples.
The spectral characteristics of bruised and sound tissue of the
ve studied cultivars in the VNIR and SWIR ranges on the seventh

day after bruising are presented in Fig. 4. In these gures, the spectra were obtained from ROIs, which represented the average for
sound tissue and bruised tissue. In all the spectral characteristics,
the typical water absorption bands, i.e. 660 nm, 970 nm, 1200 nm,
1470 nm and 1900 nm, appear as localized minima. The decrease
of reectance of bruised tissue for these wavelengths is caused by
the outow of water from the bruised tissues in the rst period after
damage. Fig. 4 shows that signicant differences in the spectral
characteristics exist between bruised and non-bruised regions of
apples for various cultivars in the VNIR and SWIR ranges.
The chemical bonds of biological materials absorb light energy
at specic wavelengths. The spectra of all the studied apple cultivars indicated peaks at about 680 nm, which was attributed to
the absorption by chlorophyll in the fruit tissue. For the spectral
range less than 550 nm, absorption due to carotenoid in the fruit
tissue, which has an absorption peak at 480 nm, became evident
for the Champion, Gloster and Idared apples. This specic
absorption peaks can be used as a means for the determination
of some defects or chemical contamination within fruit tissues. A
strong absorption peak was found near 550 nm for Golden Delicious and Idared apples due to absorption by anthocyanin in
the fruit tissue. The absorption valleys in the NIR at 840 and
960 nm represent sugar and water absorption bands.

70

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

Champion

Bruised tissue
0.6

Sound tissue
0.4

Reflectance

0.8

Reflectance

Gloster

0.8

Bruised tissue
0.6

Sound tissue

0.4
0.2

0.2

0
400

400

700 1000 1300 1600 1900 2200 2500

700 1000 1300 1600 1900 2200 2500

Wavelength (nm)

Wavelength (nm)
1
0.8

Bruised tissue

0.6

Idared

0.8

Reflectance

Reflectance

Golden Delicious

Sound tissue

0.4
0.2

Bruised tissue
Sound tissue

0.6
0.4
0.2

0
400

0
400

700 1000 1300 1600 1900 2200 2500

700 1000 1300 1600 1900 2200 2500

Wavelength (nm)

Wavelength (nm)
1

Topaz

Reflectance

0.8

Bruised tissue
0.6

Sound tissue

0.4
0.2
0
400

700 1000 1300 1600 1900 2200 2500

Wavelength (nm)
Fig. 4. Spectral characteristics of bruised and sound tissue of the ve studied cultivars on the seventh day after bruising.

In the ranges 718890 nm and 10171118 nm, non-bruised tissue of Gloster and Golden Delicious reects more radiation than
bruised tissue. For the other cultivars, the reverse situation takes
place: bruised tissue shows higher reectance in these two ranges
than sound tissue. This effect was observed earlier by (Lu, 2003; Lu
et al., 2010). The authors noticed for Golden Delicious apples that
in the range 700900 nm, between fth and ninth day after bruising absorption for the normal apples was higher than that for the
bruised apples. The contrary effect was noticed for Red Delicious
in that range. The authors explained it by changes of relation
between scattering and absorption during bruise development
and they indicated the spectral properties in this range are strongly
inuenced by variety and bruise severity, and they change with
time and at different rates, even for the same apple fruit. This effect
can be explained by analysing antioxidant activity in apples with
bruises. It was reported by Duda- Chodak et al. (2010) that Golden
Delicious and Gloster have considerably higher antioxidant activity than Idared, Champion. It was also observed by Coesteng and
Lee (2006) that there is high difference in relationship between
degree of browning and enzyme activity. In Golden Delicious
degree of browning was related to phenolic concentration. Further
studies of the chemical compounds inuencing spectral response
in 718890 nm and 10171118 nm is needed.
Signicant differences in bruised and non-bruised tissues were
also observed in two SWIR ranges: 14951871 nm and 2052
2382 nm. In these ranges, bruised tissue exhibited lower reectance than sound tissue for all the cultivars.

Two classication experiments were performed on the


hyperspectral data of the fruit surface. From 480 available
instances (the spectral characteristics of bruised and sound tissues
of 5 cultivars), 450 randomly selected instances were chosen as a
training/test set and another 30 instances as a validation set.
After selecting independent variables by using the CFS
algorithm, 58 spectral bands were obtained for the cultivar classication model and 33 spectral bands for bruise classication. All
the selected bands used for the classications are presented in
Fig. 5 against the background of exemplary spectral characteristics
of apple tissue. In the case of the bruise detection models, the
majority of spectral bands used for classication were in a range
of 11001700 nm, whereas the classication models of cultivar
detection used the bands which were distributed over the whole
spectrum studied.
The experiment of learning and testing was repeated 10 times
with random data selection (cross-validation method). For each
fold, the proportion between the data used for learning and data
used for testing was 9010%. The cross-validation idea was
described in Analysing Algorithms.
The rst experiment was to distinguish between bruised and
sound tissues. The nal results are presented in Table 2. It shows
the results of 10 different numeric prediction techniques on a
given dataset, measured using cross-validation.
For the training test/data set, the best prediction accuracy was
obtained for NNC (97.8% of correctly classied instances), BNN
(96.4%), and FURIA (95.5%). A very good (higher than 95%)

71

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

Table 3
Detailed accuracy analysis by class of the studied classiers: bruised tissue has a
positive class label and non-bruised tissue has a negative class label.

Wavelength [nm]
430
1

554

680

809

940

1156

1471

1784

2096

2407

0.9
0.8

Reflectance

0.7
0.6
0.5
0.4
0.3
0.2
0.1

Classication model for


distinguishing bruised apples

TP rate
recall

FP
rate

Precision

Fmeasure

BNN
FURIA
NNC
LINE
LOG
SVM
NB
RF
SLOG
SMO

0.951
0.951
0.991
0.915
0.951
0.857
0.843
0.937
0.942
0.915

0.022
0.040
0.036
0.027
0.081
0.040
0.031
0.031
0.049
0.013

0.977
0.959
0.965
0.971
0.922
0.955
0.964
0.968
0.959
0.986

0.964
0.955
0.978
0.942
0.936
0.903
0.900
0.952
0.950
0.949

Fig. 5. Spectral bands obtained using the CFS attribute selection algorithm for the
classication models of bruise detection and cultivar detection.

prediction accuracy was also obtained for the RF, SMO and SLOG
models. The analysis of the models using the validation set
resulted in slightly lower classication accuracy, but in the case
of three models (SVM, SLOG, SMO) it was equal to 90%. When comparing the correctly classied instances, Kappa statistic and root
mean squared error, it can be stated that the SLOG and SMO
models are the best for detection of bruising in apples of the ve
studied cultivars.
To analyse the performance of the tested classiers, the results
of the analysis of the detailed accuracy by class are presented in
Table 3. The classication problem of distinguishing between
bruised and sound tissue is treated as a binary (two-class) problem. A binary classier algorithm maps an object into one of two
classes, denoted as positive (+), which in this case is bruised tissue
(BR), and negative (), which in our case is non-bruised tissue
(NB). The parameters of the classier are derived from training
on known (+) and () instances. Then, the classier is tested on
instances that were not part of the training sets. There are four
possible outcomes. If an object is positive and it is classied as
positive, it is counted as a true positive (TP). If a positive object
is classied as negative, it is counted as false negative (FN). If the
negative object is classied as negative, it is counted as a true
negative (TN), and if it is classied as positive, it is counted as a
false positive (FP). Various numeric measures (some of them are
presented in Table 3) which characterize the performance of the
classication model can be constructed. The true positive rate (also
called a recall) of a classier is estimated as:

TP rate

Positives Correctly Classified TP


recall
Total positives P

The false positive rate of the classier is:

FP rate

Negatives Incorrectly Classified FP


Total negatives N

The precision of the classier is:

Precision

TP
TP FP

The F-measure of the classier is:

F-measure

2
1=Precision 1=recall

These quantities are between 0 and 1 and are interpreted as


probabilities. Table 3 shows that the model with the best performance is the nearest-neighbour classier (NNC). It has the highest
values of the true positive rate (0.991) and F-measure (0.978) and a
small false positive rate (0.036). Three other models with the best
performance measures are, respectively: the Backpropagation
Neural Networks (BNN) with the true positive rate of 0.951 and
F-measure of 0.964, the linear logistic regression model (LOG) with
the true positive rate of 0.951 and F-measure of 0.936, and Fuzzy
Unordered Rule Induction Algorithm (FURIA) with the same positive rate 0.951 and F-measure of 0.955.
Another method of evaluating the performance of the classication models used in this study was the Receiver Operating Characteristics (ROC). An ROC graph depicts relative trade-offs between
benets (true positives) and costs (false positives) and its X axis
is the false positive rate (called specicity), whereas the Y axis is
the true positive rate of the model (called sensitivity). Each prediction result represents one point in the ROC space. Maximizing sensitivity corresponds to some large Y value on the ROC curve.
Maximizing specicity corresponds to a small X value on the ROC
curve. The best possible prediction method would lead to a point
in the upper left corner or coordinate (0.1) of the ROC space (called
the perfect classication point), representing 100% sensitivity (no
false negatives) and 100% specicity (no false positives). A completely random guess would give a point along a diagonal line from
the left bottom to the top right corners (regardless of the positive
and negative base rates). The diagonal divides the ROC space.

Table 2
Results of classication models for distinguishing bruised and non-bruised apple tissue.
Classication model for distinguishing bruised and
non-bruised apple tissue

Training/test set
Correctly classied
instances %

Kappa
statistic

Root mean
squared error

Correctly classied
instances %

Validation set
Kappa
statistic

Root mean
squared error

BNN
FURIA
NNC
LINE
LOG
SVM
NB
RF
SLOG
SMO

96.4
95.5
97.8
94.4
93.5
90.8
90.1
95.3
95.1
95.1

0.928
0.910
0.955
0.888
0.870
0.816
0.812
0.906
0.901
0.901

0.180
0.200
0.150
0.237
0.252
0.303
0.391
0.209
0.203
0.222

86.7
76.7
83.3
86.7
73.3
90.0
83.3
86.7
90.0
90.0

0.733
0.533
0.667
0.733
0.467
0.800
0.667
0.733
0.800
0.800

0.339
0.416
0.408
0.365
0.516
0.316
0.411
0.323
0.299
0.316

72

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

Points above the diagonal represent good classication results


(better than random), points below the line poor results (worse
than random). To avoid having to select a single threshold for classication, it is common to scan through all possible thresholds and
observe the effect on the true positive rate and the false positive
rate. When plotted as coordinate pairs, these measures form the
receiver operating characteristic curve (ROC curve). The ROC curve
describes the performance of a model across the entire range of
classication thresholds. The area under the ROC curve (AUC) is a
summary index associated with the ROC curve. The AUC is a
combined measure of sensitivity and specicity and of the overall
performance of a diagnostic test. It can be interpreted as the average value of sensitivity for all possible values of specicity. It takes
on any value between 0 and 1, since both the X and Y axes have
values ranging from 0 to 1. The closer AUC is to 1, the better the
overall diagnostic performance of the test.
For the classication models for distinguishing bruised tissue
based on the spectral characteristics of the surface of apples, the
ROC curves are presented in Fig. 6. The NNC, FURIA and BNN models show the best performance graphs and the highest AUC values
(between 0.975 and 0.978). It should be noted that the values of
the AUC performance measure of the other models studied is also
quite high.
The second classication experiment was performed to distinguish between particular cultivars based on the spectral characteristics. The cultivar class consisted of ve elements (the cultivars
Champion, Gloster, Golden Delicious, Idared, and Topaz).
The prediction accuracy of the created models is presented in
Table 4. The percentage of correctly classied instances was very
high for all the models and ranged from 98.2% to 100%. The models
with the best prediction accuracies were the following: the linear
logistic regression model (LOG) correctly classied instances
(100%) and the lowest error values (e.g. the root mean squared
error was 0.006), as well as the Backpropagation Neural Networks
(BNN) correctly classied instances (99.8%) and the root mean

squared error was 0.027. The experiment on the validation data


set conrmed very high prediction accuracy of the majority of
the models studied, except for the SLOG model (66% of correctly
classied instances) and the FURIA model (56.7% of correctly classied instances). The best classication accuracy in the validation
experiment was obtained for the SMO model (93.3%).
To analyse the performance of all the tested models of cultivar
detection and to illustrate how the cases belonging to different
classes were classied by the particular models, the confusion
matrices of these models were collected in Fig. 7. The rows in this
matrix represent the actual outputs, while the columns the targets.
The numbers in this table which are depicted with various colours
for the specic models are the average numbers of the actually recognized classes in training/testing mode. The diagonal entries of
the matrix (in the grey background) represent the mean quantities
of the properly recognized cases. Each entry outside the diagonal
means an error (the number of misclassications). The highest
number of models misclassied apples of the cultivar Topaz
which was interpreted as Champion, Golden Delicious or Idared
in a number of cases. For all the models, the best performance was
observed in the case of the Golden Delicious model (100% of
correctly classied instances) and the Gloster model (one misclassied instance in the FURIA model).
To evaluate the importance of particular bands selected with
CFS method in the created classication models, the weights of
these bands for BNN models of bruise detection and cultivar detection were analysed. The weights presented in Fig. 8 refer to the
BNN models, which had one of the best prediction accuracies, both
for testing and validation data sets. This analysis was based on a
weights from a hidden sigmoid node of each model which had
the greatest inuence of the overall model output. For the BNN
model of cultivar detection the largest group of weights with highest positive and negative values was observed for the spectral
range from 500 nm to 700 nm and for the band 1740.4 nm,
whereas for bruise detection model the weights with highest

Fig. 6. ROC curves for detecting bruised tissue in apples. Left: the entire ROC graph. Right: a magnication. The diagonal corresponds to the random classier.

Table 4
Results of classication models for distinguishing various cultivars of apples.
Classication model for
distinguishing varieties

Training/Test set
Correctly classied
instances %

Kappa
statistic

Root mean squared


error

Correctly classied
instances %

Validation set
Kappa
statistic

Root mean squared


error

BNN
FURIA
NNC
LINE
LOG
SVM
NB
RF
SLOG
SMO

99.8
98.4
99.8
98.7
100.0
98.2
98.3
99.3
99.8
99.8

0.997
0.981
0.997
0.983
1.000
0.978
0.981
0.992
0.997
0.997

0.027
0.076
0.030
0.073
0.006
0.085
0.076
0.075
0.035
0.316

90.0
56.7
86.6
90.0
83.3
86.7
86.7
86.7
66.7
93.3

0.875
0.449
0.832
0.875
0.791
0.832
0.830
0.834
0.583
0.916

0.173
0.373
0.231
0.200
0.248
0.231
0.233
0.243
0.278
0.322

73

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

CH

89, 86, 90,


87, 90, 89,
CH 87, 88, 90,
90

GD
1, 3, 1

I
1

T
1, 2, 2

BNN
91, 90, 91,
91, 91, 91,
91, 91, 91,
91

FURIA
NNC
LINE

87, 87, 87,


87, 87, 87,
87, 87, 87,
87

GD

1, 2

LOG
SVM
NB

88, 88, 88,


88, 88, 87,
86, 88, 88,
88

RF
SLOG

2, 1, 3, 4, 1,
1, 1

90, 88, 89,


87, 90, 84,
88, 89, 89,
89

SMO

Fig. 7. Confusion matrices of the classication models for cultivars as an independent variable. Each model has a specic colour representation and the diagonal cells
(in grey) present the correct classications.

positive and negative values were spread along the whole studied
spectral range, with the highest absolute values for bands
506.3 nm,
581.3 nm,
1131.0 nm,
1376.5 nm,
1382.8 nm,
2202.3 nm.
4. Discussion
The obtained results conrmed the applicability of hyperspectral imaging for bruise detection in apples and for precise determination of apple cultivar. The available hyperspectral systems
cannot be treated as online sorting systems at the present technological stage (Sun, 2010), but their usefulness for detecting selected
spectral bands in order to construct multichannel sorting devices is
invaluable. Reectance images of apples in visible region are predominantly affected by the presence of plant pigment such chlorophyll and carotene species. In the previous studies it is reported
that a lot of biological materials with similar pigmentation have
a different appearance in the NIR spectrum (ElMasry et al., 2008).
The absorption valleys around 500 and 680 represent carotenoids
and chlorophyll pigments which are responsible for colour characteristic in the fruit. This wavebands represent the typical bruise
characteristics: the browning and loss of chlorophyll (ElMasry

et al., 2008). On the other hand, the use of SWIR range enables to
evaluate changes of water characteristics in affected tissues. The
water absorption minima are dominant factors in this range.
The CSF algorithm and 2nd derivative pretreatment of the
hyperspectral system applied in this study, and conrmed in
(Baranowski et al., 2013), proved to be very effective in constructing supervised classication models of bruise and cultivar detection. The thirty-three wavelengths selected for bruise
classication models cover a broad range of the spectrum. However, the majority of these wavelengths are in the SWIR range,
which can suggest that water absorption bands play an important
role in distinguishing between sound and mechanically damaged
tissue. This result is in agreement with Lu (2003) who used the
ranges of 9001700 nm and 10001300 nm as the most appropriate for bruise detection in Red Delicious and Golden Delicious,
respectively. This result of bruise classication indicates the need
to use the SWIR range to construct classication models. Some of
previous studies (Xing et al., 2005; ElMasry et al., 2008) used the
VNIR range for detection of bruised tissues in apples of individual
cultivars. In these studies the wavelength selection algorithm was
based on Principal Components or Minimum Noise Fraction Algorithms or just pixel grey values were used. The advantage of the
CFS wavelength selection algorithm applied in this study is that
it is a fully automatic procedure and that the selected wavelengths
correspond to physically based absorptions valleys (Baranowski
et al., 2013). On the other hand, the numbers of selected bands
for bruise (33) and cultivar (58) classications with the use of
the CFS algorithm were considerably higher than in previous studies. ElMasry et al. (2008) selected 5 optimal wavelengths for bruise
classication models, while Kavdir and Guyer (2004) selected 3
optimal wavelengths sufcient for their models. The wavelengths
selected in our study with the CFS algorithm for cultivar discrimination cover the VNIR spectral range to a larger extent than in the
case of bruise detection. It suggests that chlorophyll and other
pigments of apple skin play an important role in cultivar detection.
The comparison of ten supervised classication models for distinguishing between bruised and non-bruised apples as well as
between the cultivars studied indicated very high prediction accuracy of the majority of them. The obtained classication results are
comparable to or even better than those in the study of Kavdir and
Guyer (2004) who used Backpropagation Neural Networks,
decision trees, K-nearest neighbours, and Bayesian classication
models. In their study, the success rate in Empire apples was
the highest with the use of a Backpropagation Neural Network
with texture features (93.8%). In our study, the success rate for
the same classier was 96.4%. However, some other classiers,
such as FURIA, NNC, SLOG and SMO, gave very high classication

BNN model for cultivar detection

BNN model for bruise detection

Weights

0
-1
-2
-3
-4
-5
430

554

680

809

940

1156

1471

1784

2096

2407

Wavelength (nm)
Fig. 8. Weights for the bands selected by CFS algorithm and used in Backpropagation Neural Network (BNN) models of bruise detection and cultivar detection.

74

A. Siedliska et al. / Computers and Electronics in Agriculture 106 (2014) 6674

accuracies (more than 95%) in spite of the fact that training and
testing instances contained bruised and non-bruised apples of ve
cultivars. Automatic classication of apples with respect to cultivar
detection can be successfully used in sorting systems. The results
presented in this study indicated very high applicability of hyperspectral imaging for cultivar classication. Because the classication rates of the majority of the cultivar classication models
used were very high (both for training/testing and validation sets),
hyperspectral imaging technology seems to be promising compared to existing computer vision systems of cultivar classication
(Yang, 1993).
5. Conclusions
Overall, hyperspectral imaging proved to be the precise method
in detecting bruised tissues and distinguishing particular cultivars
of apples. The study was limited to ve cultivars, therefore further
studies on more varied apple material is needed. Both VNIR and
SWIR spectral ranges are important in presented classication
models of bruise detection and cultivar detection. The very high
accuracy and prediction performance of the obtained models could
be a basis for implementation of the results in sorting systems. The
limited number of the spectral wavelengths required to deliver
input data in the elaborated classication models enables to distinguish selected features of the studies apples efciently and can
lead to creation of considerably cheap on-line sensors for apple
sorting.
References
Baranowski, P., Mazurek, W., Witkowska-Walczak, B., Sawinski, C., 2009. Detection
of early apple bruise with the use of pulsed-phase thermography. Postharvest
Biol. Technol. 53, 91100.
Baranowski, P., Mazurek, W., Wozniak, J., Majewska, U., 2012. Detection of early
bruises in apples using hyperspectral data and thermal imaging. J. Food Eng.
110, 345355.
Baranowski, P., Mazurek, W., Pastuszka-Wozniak, J., 2013. Supervised classication
of bruised apples with respect to the time after bruising on the basis of
hyperspectral imaging data. Postharvest Biol. Technol. 86, 249258.
Brosnan, T., Sun, D.W., 2004. Improving quality inspection of food products by
computer vision a review. J. Food Eng. 61, 316.
Coesteng, M.Y., Lee, C.Y., 2006. Changes in apple polyphenoloxidase and polyphenol
concentrations in relation to degree of browning. J. Food Sci. 52, 985989.
Drogoudi, P.D., Pantelidis, G., 2011. Effects of position on canopy and harvest time
on fruit physico-chemical and antioxidant properties in different apple
cultivars. Sci. Hortic. 129, 752760.
Duda- Chodak, A., Tarko, T., Satora, P., Sroka, P., Tuszynski, T., 2010. The prole of
polyphenols and antioxidant properties of selected Apple cultivars grown In
Poland. J. Fruit Ornam. Plant Res. 18, 3950.
ElMasry, G., Wang, N., Vigneault, C., Qiao, J., ElSayed, A., 2008. Early detection of
apple bruises on different background colors using hyperspectral imaging. LWT
41, 337345.
ElMasry, G., Wang, N., Vigneault, C., 2009. Detecting chilling injury in Red Delicious
apple using hyperspectral imaging and neural networks. Postharvest Biol.
Technol. 52, 18.
Fawcett, T., 2006. An introduction to ROC analysis. Pattern Recogn. Lett. 27, 861
874.
Ferguson, I., Volz, R., Woolf, A., 1999. Preharvest factors affecting physiological
disorders of fruit. Postharvest Biol. Technol. 15, 255262.

Gonzalez, J.J., Valle, R.C., Bobroff, S., Biasi, W.V., Mitcham, E.J., McCarthy, M.J., 2001.
Detection and monitoring of internal browning development in Fuji apples
using MRI. Postharvest Biol. Technol. 22, 179188.
Grimm, E., Khanal, B.P., Winkler, A., Knoche, M., Kpcke, D., 2012. Structural and
physiological changes associated with the skin spot disorder in apple.
Postharvest Biol. Technol. 64, 111118.
Hall, M.A., 1998. Correlation-based feature subset selection for machine learning.
PhD thesis. University of Waikato, Hamilton, New Zealand.
Kavdir, I., Guyer, D.E., 2004. Comparison of articial neural network and statistical
classiers in apple sorting using textural features. Biosyst. Eng. 89, 331344.
Kleynen, O., Leemans, V., Destain, M.F., 2003. Selection of the most efcient
wavelength bands for Jonagold apple sorting. Postharvest Biol. Technol. 30,
221232.
Lee, K., Kang, S., Delwiche, St.R., Kim, M.S., Noh, S., 2008. Correlation analysis of
hyperspectral imagery for multispectral wavelength selection for detection of
defects on apples. Sens. Instrumen. Food Qual. 2, 9096.
Leemans, V., Magin, H., Destain, M.F., 2002. On-line fruit grading according to their
external quality using machine vision. Biosyst. Eng. 83, 397404.
Lle, L., Roger, J.M., Herrero-Langreo, A., Diezma-Iglesias, B., Barreiro, P., 2011.
Comparison of multispectral indexes extracted from hyperspectral images for
the assessment of fruit ripening. J. Food Eng. 104, 612620.
Lu, R., 2003. Detection of bruises on apples using near-infrared hyperspectral
imaging. Trans. ASAE 46, 523530.
Lu, R., Cen, H., Huang, M., Ariana, D.P., 2010. Spectral absorption and scattering
properties of normal and bruised apple tissue. ASABE 53, 263269.
Mehl, P.M., Chao, K., Kim, M., Chen, Y.R., 2002. Detection of defects on selected apple
cultivars using hyperspectral and multispectral image analysis. Appl. Eng. Agric.
18, 219226.
Mendoza, F., Lu, R., Ariana, D., Cen, H., Bailey, B., 2011. Integrated spectral and image
analysis of hyperspectral scattering data for prediction of apple fruit rmness
and soluble solids content. Postharvest Biol. Technol. 62, 149160.
Peng, Y., Lu, R., 2006. An LCTF-based multispectral imaging system for estimation of
apple fruit rmness. Part II. Selection of optimal wavelengths and development
of prediction models. Trans. ASAE 49, 269275.
Qin, J., Lu, R., Peng, Y., 2009. Prediction of apple internal quality using spectral
absorption and scattering properties. ASABE 52 (2), 499507.
Rasband, W.S., 1997-2011. ImageJ, U.S. National Institutes of Health, Bethesda,
Maryland, USA, <http://imagej.nih.gov/ij/>.
Schatzki, T.F., Haff, R.P., Young, R., Can, I., Le, L.C., Toyofuku, N., 1997. Defect
detection in apples by means of X-ray imaging. Trans. ASAE 40, 14071415.
Shahin, M.A., Tollner, E.W., McClendon, R.W., Arabnia, H.R., 2002. Apple
classication based on surface bruises using image processing and neural
networks. Trans. ASAE 45, 16191627.
Sun, D.W., 2008. Computer Vision Technology for Food Quality Evaluation, rst ed.,
Academic Press/Elsevier, San Diego, California, USA, p. 583.
Sun, D.W., 2010. Hyperspectral Imaging for Food Quality Analysis and Control, rst
ed., Academic Press / Elsevier, San Diego, California, USA, p. 496.
Wang, J., Nakano, K., Ohashi, S., Kubota, Y., Takizawa, K., Sasaki, Y., 2011. Detection
of external insect infestations in jujube fruit using hyperspectral reectance
imaging. Biosyst. Eng. 108, 345351.
Witten, I.H., Frank, E., 2005. Data mining. In: Practical machine learning tools and
techniques, second ed. Morgan Kaufmann Publishers/Elsevier, p. 525.
Xing, J., Bravo, C., Jancso, P., Ramon, H., De Baerdemaeker, J., 2005. Bruise detection
on Golden Delicious apples by using hyperspectral imaging with multiple
wavebands. Biosyst. Eng. 90, 2736.
Xing, J., Jancso, P., De Baerdemaeker, J., 2007. Stem-end/calyx identication on
apples using contour analysis in multispectral images. Biosyst. Eng. 96, 231
237.
Yang, Q., 1993. Classication of apple surface features using machine vision and
neural networks. Comput. Electron. Agric. 9, 112.
Yang, Z.R., 2010. machine learning approaches to bioinformatics. In Science,
Engineering, and Biology Informatics, rst ed., vol. 3. World Scientic
Publishing Co., Pte. Ltd., UK, London.
Zdunek, A., Cybulska, J., Konopacka, D., Rutkowski, K., 2011. Inter-laboratory
analysis of rmness and sensory texture of stored Apple. Int. Agrophysics 25,
6775.

You might also like