Introduction

Sugar content or soluble solids content (SSC, mostly sugars) is one of the most important fruit quality properties appealed to consumers. Traditional method used to measure fruit SSC requires samples from the internal tissues, and is carried out by using digital refractometer or Abbe refractometer. However, it is a destructive measurement. Developing a rapid, nondestructive method on measuring fruit SSC is welcome by fruit producers, processors, and distributors. Near infrared (NIR) spectroscopy is a fast and nondestructive analysis technique, and has been widely used for quality analysis of fruits, such as apples (Zou et al. 2007a), pears (Li et al. 2013), and peaches (Shao et al. 2011). However, NIR spectra were usually obtained on one point of a sample. Big difference in SSC values in different parts of a fruit, for example, higher than 2 °Brix difference in an apple (Zou et al. 2007b), causes the NIR spectroscopy could not offer the general SSC value of a whole fruit.

Hyperspectral imaging technique is a newly developed rapid detection technique. The acquired hyperspectral image is in a three-dimensional form, called hypercube, which has spectral and spatial information together (Kamruzzaman et al. 2012). This technique has potential in identifying and quantifying chemical constituents as well as their location or spatial distribution simultaneously. At present, the hyperspectral imaging technique has been used in fruits quality analysis including surface defects detection and internal qualities determination. In SSC determination, apples (Huang and Lu 2010; Lu 2007; Mendoza et al. 2011; Noh and Lu 2007; Peng and Lu 2008), pears (Hong et al. 2007), peaches (Cen et al. 2012), strawberries (ElMasry et al. 2007), and blueberries (Leiva-Valenzuela et al. 2013) have been investigated. These studies have shown that it is feasible to predict SSC of fruits by using hyperspectral imaging technique.

China ranks the first in the world and Shaanxi Province ranks the first in China in apple production and acreage (Bai et al. 2012). Since the apple qualities are influenced by geographical location, climate, planting technique, etc. (Wei et al. 1998), the apples produced in different places have different internal qualities. On the other hand, bagging apples is a general technique used in apple planting to reduce production loss caused by insect and disease, and to improve apple appearance quality. Polyethylene film and light-impermeable paper which have different physicochemical characteristics are the two kinds of usually used bag materials in apple bagging treatment during fruit ripening in China (Wen and Ma 2006). Different bag materials cause the apples to have different internal qualities (Huang et al. 2009). Developing a universal model used to predict SSC of apples produced in different areas and bagged with different materials will be helpful to develop SSC detector with wide applications. Few studies have been reported on SSC prediction of apples produced in different areas and treated with different bagging materials. Therefore, the objectives of this study were to investigate the feasibility of hyperspectral imaging technique combined with chemometrics to detect the SSC values of intact postharvest ‘Fuji’ apples bagged with light-impermeable paper or polyethylene film and picked from four different orchards in Shaanxi Province, and to offer the optimal SSC determination model.

Materials and Methods

Samples

Matured ‘Fuji’ apples were picked from four different orchards in Shaanxi Province, China. Two orchards are located at Yangling District, Xi’an, one is located at Liquan County, and another is located at Baishui County. The apples picked from the two orchards located in Yangling District were bagged with polyethylene film, and other apples were bagged with light-impermeable paper during apple ripening. After the apples were transported to a laboratory, 10–12 apples were stored in a polyethylene bag with air holes at room temperature (22 ± 2 °C). Measurements were taken initially and at 1-week interval during the 5-week storage period. Before the experiment, about 10 intact apples from each orchard were washed with tap water to remove any foreign materials on surface and wiped dry. Then, they were marked and used for acquiring hyperspectral images and for SSC measurement. In total, 196 apples were used in the study, including 49 apples from each orchard. That is, 98 apples were bagged with polyethylene film, and the other 98 apples were bagged with light-impermeable paper during apple ripening. Table 1 lists the orchard location, bag materials, and the sample number of apples used in the study.

Table 1 Statistics for the SSC values of apples

NIR Hyperspectral Imaging System

A NIR hyperspectral reflectance imaging system (Fig. 1) in the spectral range of 900–1700 nm was used to acquire the hyperspectral images of apples. The system mainly consists of a high-performance 8-bit charged couple device (CCD) camera (OPCA05G, Hamamastu, Japan) coupled with a camera lens, an imaging spectrograph (Imspector N17E, Spectral Imaging Ltd., Oulu, Finland), an illumination unit equipped with four 100 W halogen lamps at angle of 45° (HSIA-LS-TAIF, Zolix instruments Co., Ltd., Beijing, China), a translation platform (PSA200-11-X, Zolix Instruments Co., Ltd., Beijing, China), a dark box, a stepper motor, a motor controller, a computer and data acquisition software Spectra SENS (Zolix Instruments Co., Ltd., Beijing, China). The distance between the CCD camera lens and translation platform was fixed at 65 cm, and the exposure time of the camera was set as 10 ms. Apples were placed on the translation platform operated by the stepper motor moving at a speed of 20 mm/s. NIR hyperspectral image acquisition was finished by Spectral SENS and carried out at room temperature (22 ± 2 °C). Each image was acquired as a three-dimensional image (x, y, λ) which includes 320 × 250 pixels in spatial dimension (x, y) and 256 spectral bands from 865.11 to 1711.71 nm with 3.32 nm interval between contiguous bands in spectral dimension (λ).

Fig. 1
figure 1

The schematic diagram of applied NIR hyperspectral imaging system

Procedures

To obtain repeatable readings, the NIR hyperspectral reflectance imaging system was turned on and kept in a standby condition for at least 1 h. Then, the system was calibrated with white reference using a standard Teflon white board with 99 % reflectance and dark reference by closing the lens cap. One NIR hyperspectral image was obtained at blush side, and another image was obtained at the opposite of the blush side. After completion of the NIR hyperspectral image acquisition on each apple, a peeler was used to remove the peel on four spots in the equatorial region of the apple with an interval of 90°. Two spots were on the blush side and non-blush side which were used for hyperspectral image acquisition. The pulp at each spot was put into a garlic press to squeeze juice for measuring SSC using a digital refractometer (PR-101α, Atago Co., Ltd., Japan). One reading was recorded for one spot. The mean of four readings at four spots was used as the SSC value of the apple.

Image Extraction

To eliminate the differences in camera quantum and physical configuration of hyperspectral imaging systems, the original image X O was calibrated with dark reflectance image D and with white reflectance image W. The corrected image X was calculated using Eq. (1).

$$ X=\frac{X_{\mathrm{O}}-D}{W-D}\times 100\% $$
(1)

A region of interest (ROI) with the size of 40 pixel × 40 pixel in the center of each apple image was manually identified. The average reflectance spectrum of the ROIs in two images of each apple was calculated and used for further analysis. The calculation was carried out using Environment for Visualizing Images software (ENVI 4.8) software (ITT Visual Information Solutions, Boulder, CO, USA).

Spectral Preprocessing

To reduce or even eliminate the effects on images arising from instrument and measurement environment, the spectral preprocessing methods, such as standard normal variate (SNV), multiplicative scatter correction, first and second derivatives were used to preprocess spectra. It was found that SNV could offer better SSC determination performance than other three methods. Therefore, SNV was used to preprocess spectra here. SNV preprocessing was carried out using the Unscrambler 9.7 (CAMO, Trondheim, Norway).

Sample Division

The method used for data partitioning was the sample sets partitioning method based on the joint xy distances (SPXY), developed by Galvão et al. (2005) and extended from the classic Kennard-Stone (KS) algorithm. Contrasted with KS algorithm, SPXY considered spectra and reference values together. In this study, the 49 samples picked from each orchard were divided into calibration set and prediction set according to the ratio of 3:1, that is 37 apples in calibration set and 12 apples in prediction set. Totally, the calibration set and the prediction set had 148 (74 apples bagged with light-impermeable paper and 74 apples bagged with polyethylene film) and 48 apples (24 apples bagged with light-impermeable paper and 24 apples bagged with polyethylene film), respectively.

Effective Wavelengths Selection

An immense amount of spectral data is generated during hyperspectral imaging acquisition. Some spectral bands are highly correlated, and some contiguous spectral bands may contain redundant information. Therefore, it is essential to find the most influential effective wavelengths (EWs) on quality evaluation. In this study, successive projections algorithm (SPA) and uninformative variable elimination (UVE) were applied to select EWs from the full spectra (FS).

Successive Projections Algorithm

SPA is a forward variable selection technique specifically designed to improve the condition of multiple linear regression by minimizing collinearity effects in the calibration set (Galvão et al. 2008). After a wavelength is chosen, another new wavelength is added each time until the preset wavelength number is reached. The selected new wavelength has the maximum projection value on the orthogonal sub-space of the previous selected variables. The optimal number of wavelengths could be determined based on the smallest root-mean-square error of calibration set (RMSEC) in multiple linear regression calibration. The detailed description of SPA can be found in the literature (Galvão et al. 2008).

Uninformative Variable Elimination

UVE is a variable selection method based on the stability analysis of the regression coefficients of partial least squares (PLS) models. A stability value S and cutoff threshold are used to evaluate the dependability of each variable. S is defined as:

$$ {S}_i=\frac{\mathrm{mean}\left({b}_i\right)}{\mathrm{std}\left({b}_i\right)};\ i=1,\ 2,\dots, m $$
(2)

where S i is the stability of the ith variable of calibration sample, b i denotes the regression coefficient of the ith variable of calibration sample. Mean(b i ) and std(b i ) are the mean and standard deviation of b i , respectively, and m is the number of input variables. In this study, m is the number of used wavelengths to analyze, and it was 211 (see Section 3.2). An artificial random variables matrix with the same size as the spectral matrix is added to the original data set to compute their stability. The variables whose stabilities are less than a threshold are regarded as uninformative and are eliminated. The cutoff threshold is calculated as:

$$ \mathrm{cutoff}=k\times \max \left(\mathrm{abs}\left({S}_{\mathrm{random}}\right)\right) $$
(3)

where k is the contribution coefficient, and S random expresses the stability of random variables matrix. More details on the UVE process can be found elsewhere (Centner et al. 1996).

Modeling Methods

Partial Least Squares

PLS regression is a widely utilized multianalysis and regression algorithm in present chemometric analysis. In PLS regression, an orthogonal on the basis of latent variables (LVs) is constructed one by one in such a way that they are oriented to along directions of maximal covariance between the spectral matrix and the variable matrix (Guidetti et al. 2010). The LVs were determined using leave-one-sample-out cross-validation (LOOCV) method combined with the smallest root-mean-square error of cross-validation (RMSECV). The calculation of RMSECV is as follows (Chen et al. 2012):

$$ \mathrm{RMSECV}=\sqrt{\frac{{\displaystyle \sum_{i=1}^n{\left({\widehat{y}}_{\backslash i}-{y}_i\right)}^2}}{n}} $$
(4)

where y i is the measured SSC value of ith sample, ŷ \i is the estimated SSC value for sample i when the model is constructed with sample i removed, n is the number of samples in calibration set. In this study, n is 148.

Least Squares Support Vector Machine

LSSVM is a modified algorithm of the standard support vector machine. It is capable of dealing with linear and nonlinear multivariate analysis and resolving these problems in a relatively fast way. The LSSVM regression model can be expressed as follows (Li et al. 2013):

$$ y(x)={\displaystyle \sum_{k=1}^N{\alpha}_kK\left(x,{x}_k\right)+b} $$
(5)

where y(x) is the predicted values of calibration set, K(x, x k ) is the kernel function, x k is the input vector, α k is the Lagrange multiplier called support value, b is bias, and N is the number of samples in calibration set. In this study, y(x) is predicted SSC values and N is 148. Linear kernel, polynomial kernel, and radial basis function (RBF) kernel could be used as kernel function. Contrasted with linear and polynomial kernel functions, RBF kernel function is more able to reduce the computational complexity of training procedure and could handle the nonlinear relationships between the spectra and target attributes (Liu and He 2009). The procedure of LSSVM was performed in Matlab 2013b (Math Works, Natick, MA, USA) based on the free LSSVM toolbox (LSSVM v1.5, Suykens, Leuven, Belgium).

Extreme Learning Machine

ELM is a learning algorithm for single-hidden layer feedforward networks proposed by Huang et al. (2006). It can provide good generalization performance at an extremely fast speed. The main ELM algorithm can be summarized as follows: (1) assign the number of nodes in the hidden layer and randomly generate parameters of weights (w i ) and bias (b i ) for hidden nodes; (2) choose a suitable activation function and calculate the hidden layer output matrix H; (3) calculate the weights β of the output layer as: β=H + T, where H + is the Moore-Penrose generalized inverse of the hidden layer output matrix H, T is the target matrix.

Model Assessment

The model performances were evaluated by correlation coefficient of calibration set (R c ), correlation coefficient of prediction set (R p ), root-mean-square error of calibration set (RMSEC), and root-mean-square error of prediction set (RMSEP). A good model should have high values of R c and R p , and low values of RMSEC and RMSEP. Moreover, the number of input variables of the established model should be as low as possible.

Results and Discussion

Statistics of Samples

The statistics for the SSC values of total apples and apples in calibration and prediction sets, which were produced in different areas and bagged with different materials are listed in Table 1. Also, the results of the analysis of variance (ANOVA) on SSC of the total apples of four orchards are listed, too. The results show that even the apples produced in the same area (Yangling) and bagged with same material (polyethylene film), their SSC values still had significant differences at the significance level of 5 %. Although the apples produced in different areas (Yangling and Liquan) and bagged with different materials (polyethylene film and light-impermeable paper), their SSC values had not significant difference. The sample division results shows that the SSC values in the calibration set cover the ranges those in the prediction set, indicating the sample division was reasonable.

Spectral Features

Since heavy noises existed at both ends of the spectral range, spectrum data below 928.19 nm and above 1625.39 nm were discarded, leading to spectra within the range of 928.19–1625.39 nm with 211 bands for further analysis. Figure 2 shows the spectra preprocessed by SNV for the 196 apples between 928.19 nm and 1625.39 nm. It was found that the first absorption peak was in the region of 960–980 nm, which was likely attributed to the combination effect of second overtone of bond O–H from carbohydrates and water (Leiva-Valenzuela et al. 2013). The second absorption peak was at about 1200 nm, which was likely attributed to C–H stretching second overtone from carbohydrates (fructose, sucrose, and glucose). Another strong absorption peak found at 1450 nm was due to water absorption bands related to O–H stretching first overtone, indicating moisture dominates the spectral signatures (Cen and He 2007).

Fig. 2
figure 2

The spectra preprocessed by SNV of 196 samples

Linear Correlation Between Reflectance Value and SSC

Figure 3 shows the linear correlation coefficient between the reflectance value and SSC. It was noted that there was negative linear relationship between the values of reflectance and SSC with coefficient higher than −0.41 and lower than −0.30, and the wavelengths at the absorption peaks had high correlation to SSC. However, no single wavelength was strongly correlated with SSC, indicating the necessity to use more wavelengths or even full spectra for SSC prediction. Therefore, chemometrics was used to select EWs, and some modeling methods were used to build nonlinear SSC determination models.

Fig. 3
figure 3

Linear correlation coefficient between SSC and reflectance value at each wavelength from 928.19 to 1625.39 nm

Effective Wavelengths Selection

Effective Wavelengths Selected by SPA

Figure 4 shows the calculated RMSEC at different number of selected EWs by SPA from 1 to 40 with an interval of 1. The RMSEC decreased with the number of selected EWs when the number was lower than 33, and the smallest RMSEC (0.839 °Brix) was found at 33 variables (Fig. 4). Since more variables included in model will decrease model calculation speed, the number of selected EWs was determined according to an F test criterion with a significance level α = 0.25, suggested by Galvão et al. (2008). Finally, 24 EWs (RMSEC = 0.915 °Brix) were selected. They are 928.2, 938.2, 961.4, 964.7, 977.0, 974.7, 994.6, 1011.2, 1017.8, 1021.2, 1077.6, 1097.5, 1104.2, 1120.8, 1353.2, 1376.4, 1396.3, 1466.0, 1549.0, 1569.0, 1572.3, 1575.0, 1578.9, and 1598.8 nm.

Fig. 4
figure 4

Changed RMSEC with increasing number of variables in SPA

Effective Wavelengths Selected by UVE

Since the variables selected by UVE were influenced by the number of LVs in PLS, the RMSECV was calculated when the LVs was set from 1 to 20 with an interval of 1, shown in Fig. 5. When the number of LVs was 4, the RMSECV was the smallest (2.091 °Brix). So, the optimal number of LVs was 4 in this study. According to the stability value S of random variables in Eq. (3), the cutoff threshold in Eq. (4) was calculated as 28.46. Figure 6 shows the stability of each wavelength in the spectra for SSC prediction by UVE with four latent variables. The input wavelengths were at the left of the vertical line, while random wavelengths were at the right side. The cutoff threshold of UVE is indicated by dashed lines. The wavelengths whose stabilities were within the cutoff lines were treated as uninformative and eliminated. Finally, 122 EWs were selected by UVE. The EWs were mainly distributed in the wavelength bands of 928.19–951.43 nm, 1021.15–1080.91 nm, 1163.91–1207.07 nm, 1246.91–1339.87 nm, 1456.07–1539.07 nm, and 1562.31–1625.39 nm.

Fig. 5
figure 5

Changed RMSECV with the number of LVs in PLS of UVE

Fig. 6
figure 6

Stability distribution of each variable for SSC predication by UVE with 4 LVs in PLS

Modeling Results

PLS Modeling Results

LOOCV method combined with RMSECV was used to determine the optimal number of LVs in SSC determination model of PLS. The calculated RMSECV values at different number of LVs from 1 to 20 with an interval of 1 at different EWs selection methods are shown in Fig. 7. The determined numbers of LVs were decided by the smallest RMSECV, shown in Table 2. Table 3 lists the SSC determination results using PLS at different EWs selection methods. The PLS model based on selected EWs by UVE (UVE-PLS) had the highest R p (0.863) and the lowest RMSEP (0.956 °Brix ), but lower R c (0.744) and higher RMSEC (1.460 °Brix). SPA-PLS had the highest R c (0.752), the lowest RMSEC (1.441 °Brix), higher R p (0.861) and lower RMSEP (0.971 °Brix). FS-PLS had the poorest calibration and prediction performance. Since the EWs selected by SPA was only 24, much less than 122 selected by UVE, SPA-PLS was regarded as the best PLS model in apple SSC prediction.

Fig. 7
figure 7

Changed RMSECV with the number of LVs in PLS model at different EWs selection methods

Table 2 Parameters of PLS, LSSVM, and ELM
Table 3 SSC determination results of PLS, LSSVM, and ELM models based on different variables selection methods

LSSVM Modeling Results

Determining the proper kernel function and the best kernel parameters are two crucial problems that need to be solved before LSSVM modeling. In this study, radial basis function (RBF) kernel was used as the kernel function. Regularization parameter γ and the RBF kernel function parameter σ 2 are two key parameters. γ determined the trade-off between minimizing the training error and minimizing model complexity. σ 2 was the bandwidth parameter. Small σ 2 produces a large number of regressors and may lead to overfitting. On the contrary, large σ 2 could simplify the model, but may lead to lower accuracy (Wu et al. 2008). Simplex technique and tenfold cross-validation were applied to find the optimal parameter values. The determined parameter values are listed in Table 2. The SSC determination performance of LSSVM at different EWs selection methods are listed in Table 3. Obviously, SPA-LSSVM had the highest R c (0.791) and R p (0.878), and the lowest RMSEC (1.339 °Brix) and RMSEP (0.908 °Brix ), indicating SPA-LSSVM was the best LSSVM model. UVE-LSSVM was superior to FS-LSSVM in prediction performance, but poorer than FS-LSSVM in calibration performance.

ELM Modeling Results

The activation function used here was sigmoid function. The number of hidden layer nodes was obtained by a trial and error method (Lan et al. 2010). It was set from 1 to 100, and increased by 5 from 1. The optimal number was determined based on the lowest RMSEC, shown in Table 2. Since the initial weights were generated randomly, in order to overcome the problem of unstable results, each ELM model at each EWs selection methods was repeated 1000 times. The average R c , R p , RMSEC, and RMSEP in 1000 times repetition were calculated and listed in Table 3. Table 3 shows that SPA-ELM had the highest R c (0.802) and R p (0.816), and the lowest RMSEC (1.304 °Brix) and RMSEP (1.121 °Brix ), indicating SPA-ELM was the best ELM model. Although FS-ELM had higher R c (0.783) and lower RMSEC (1.358 °Brix), it had the lowest R p (0.769) and the highest RMSEP (1.267 °Brix), meaning the stability of FS-ELM was poor. UVE-ELM had the worst calibration performance, but had better prediction performance than FS-ELM. Since the number of hidden layer nodes of SPA-ELM was 40, less than 45 of UVE-ELM and 50 of FS-ELM, it can be said that SPA-ELM is capable of improving calculation speed.

Comparison

When comparing the performance of different models at different EWs selection methods for determining SSC of apples, it was found that the PLS and LSSVM models had better prediction performance than ELM, and the EWs selected by SPA could offer better calibration and prediction performance than FS and UVE. This illustrates that EWs is helpful in extracting useful information from full spectra. In all developed models, SPA-LSSVM had the highest R p and the lowest RMSEP, as well as higher R c and lower RMSEC. Moreover, the number of selected EWs by SPA was 24, much less than 122 by UVE and 211 by FS. It can be concluded that SPA-LSSVM was the best SSC prediction model in this study.

To investigate the effect of bag materials on SSC prediction of ‘Fuji’ apples, the SSC of the apples bagged with polyethylene film and light-impermeable paper were predicted using SPA-LSSVM, respectively. It showed that R p and RMSEP of the apples bagged with polyethylene film were 0.919 and 0.865 °Brix , respectively, and the values of the apples bagged with light-impermeable paper were 0.860 and 0.951 °Brix, respectively. Obviously, the prediction performance for the apples bagged with polyethylene film was better than those bagged with light-impermeable paper. The reason that causes this different prediction performance and the correction of this result will be investigated in more varieties of apples in the future.

Comparing to other reported studies on SSC prediction for apples based on hyperspectral imaging technique, the obtained prediction performance of SPA-LSSVM here was superior to the results reported by Huang and Lu (2010) (R p  = 0.822, RMSEP = 0.78), by Mendoza et al. (2011) (R p  = 0.66–0.88 and SEP = 0.7–0.9), and by Noh and Lu (2007) (R p  = 0.66, SEP = 1.19), but poorer than that obtained by Lu (2007) (R 2 = 0.79, SEP = 0.72) for ‘Gold Delicious’ apple, by Peng and Lu (2007) (R p  = 0.816, SEP = 0.92) and by Huang et al. (2013) (R 2 = 0.9501, RMSEP = 0.3087). Although the apple used in the study was of ‘Fuji’ variety only, different production areas and different bagging materials caused the apples had much different SSC values, which restrict the improvement of model prediction performance. Contrasted with the model developed for the samples produced in one area or bagged with the same material during ripening, the developed models considering production areas and bag materials should be used for more apples. Further research is needed to establish a more universal model considering more production areas and different bag materials for different varieties of apples.

Conclusions

NIR hyperspectral reflectance images were acquired from 900 to 1700 nm on 196 ‘Fuji’ apples picked from four orchards (49 from each orchard) and bagged with polyethylene film and light-impermeable paper, and the SSC of apples were measured with digital refractometer. According to the sample division method of SPXY, 148 apples were used for calibration and other 48 samples were used for prediction. Twenty-four and 122 EWs were selected by SPA and UVE from the full spectra with 211 bands from 928.19 and 1625.39 nm, respectively. The EWs selected by SPA could offer better calibration and prediction performance than FS and UVE. ELM had the best calibration performance while LSSVM had the best prediction performance. Generally, LSSVM models were superior to PLS and ELM models in apple SSC prediction. The optimal SSC prediction model was SPA-LSSVM with R c , R p , RMSEC, and RMSEP of 0.791, 0.878, 1.339 °Brix, and 0.908 °Brix, respectively. This study demonstrates that hyperspectral imaging technique is capable of predicting SSC values of apples produced in different areas and bagged with different materials during on-tree ripening.