hyperspectral imaging , as a tool for spectrochemical analysis , integrates the advantage of conventional imaging and spectroscopic technique , which can obtain both spatial and spectral information from a tested object and has been widely used in detecting quality of fruit products . hypercubes ,  are made up of hundreds of contiguous wavebands for each spatial position of a target . hypercubes  are three - dimensional ( x  y   ) blocks of data , comprising two spatial dimensions ( x and y direction ) and one wavelength dimension (  ) . hyperspectral images often contain mass wavebands , which can result in modelling complicated . in addition , the existence of multicollinearity problem could reduce the accuracy of the calibration models . feature transformation is a process that creates a new set of features   and this method has been applied to extract feature in hyperspectral data . used principal component analysis ( pca ) and independent component analysis ( ica ) to reduce the spectral dimension of the hyperspectral reflectance images of cucumber leaves and combined them with linear regression model to estimate chlorophyll concentration based on the extracted pcs and ics . implemented minimum noise fraction ( mnf ) rotation on important wavebands to extract the defective feature of hyperspectral images of loquat fruits and finally obtained that the identification accuracy was 92.3% . however , those methods only were used to eliminate useless information in view of spectra and neglect the relationship between spectral values and chemical concentrations . feature transformation aims at preserving the topological structure of the data whereas the variables selection aims at enhancing the predictive power . recently , many studies proved that the selection of important variables can predigest calibration modelling and improve the results in terms of accuracy and robustness . moreover , selection of important wavelengths instead of full spectra of hyperspectral images has an advantage to generate chemical spatial distribution and provide a reference for developing portable multispectral imager . random frog ( rf ) methodology is a novel and efficient technique for variable selection , which borrows the framework like reversible jump markov chain monte carlo ( rjmcmc ) [ 7 , 8 ] . it executes a search in the model space through both fixed - dimensional and transdimensional moves between different models , and then a pseudo - mcmc chain is computed and used to calculate selection probability ( sp ) for each variable . important variables can be selected in terms of the ranking of all variables based on sp . hu et al .   used a combination of rf selected reflectance and transmittance spectra from hyperspectral data to predict blueberry mechanical properties , and the results showed that prediction models based on rf had similar results with full spectral model . li et al .   detected tea polyphenols ( tp ) of 14 cultivars of tea using infrared spectroscopy with important wavenumbers selected by interval partial least squares ( ipls ) combined with rf ; finally , a linear formula with 18 wavenumbers provided satisfactory results for predicting tp measurement . yu et al .   employed rf and partial least squares regression ( plsr ) to establish calibration model for predicting total nitrogen content of pepper plant on the basis of hyperspectral imaging in the region of 3801030  nm . the  hypercube  could provide visualization of biochemical constituents of a sample by calculating the chemical value of each pixel based on the spectral prediction model . there are many ways to develop calibration models , such as principal components regression ( pcr ) , multiple linear regression ( mlr ) , partial least squares regression ( plsr ) , backpropagation neutral network ( bpnn ) , and least - square support vector regression ( ls - svr ) . the widespread uses of plsr make it possible to process visualization of hyperspectral images . jin et al .   applied rcs - plsr model to shift the spectrum of each pixel into its mc value for visualizing the mc distribution map in peanut kernels . k value spatial distribution map in grass carp and silver carp fillets was generated by employing the successive projection algorithm- ( spa- ) plsr model of the hyperspectral images ( 4001000  nm ) . simplified mlr model was used to visualize the thiobarbituric acid ( tba ) values distribution in fish fillets and obtained good results ( of 0.8395 and rmsep of 0.1147  mg some authors attempted to realize chemical concentration visualization of hyperspectral images using nonlinear calibration model . for example , bpnn model considerably improved the performance of prediction set ( rp of 0.938 and 0.965 , rpd of 4.590 and 9.335 ) for detecting lycopene and total phenolic content in intact tomatoes and the bpnn model made it possible to predict the bioactive compounds in each pixel of the hyperspectral images . .   used hyperspectral imaging technique to detect different browning levels of lychee pericarp fruits that were affected by moisture contents . a few studies reported that spa - ls - svm was successfully applied to generate various indexes ( freshness , total viable counts ( tvc ) , and warner - bratzler shear force ( wbsf ) ) distribution of meat for detecting quality of meat products . other methods also could be used to map component distribution based on hyperspectral images ; siripatrawan and makino   detected fungal infection on brown rice grains at early stage by using unsupervised self - organizing map ( som ) and visualized data classification of different levels of fungal infection . mulberry ( fructus mori ) fruits with bumpy surface and good taste were popular in food processing . total soluble solids ( tss ) , which include the carbohydrates , organic acids , proteins , fats , and minerals , can contribute to the quality of fruits . consequently , there is a need in the main producing industries to determine tss rapidly and nondestructively to assure that fruits meet a minimum level of acceptance . spectroscopic techniques have been proved to be an effective approach to detect the internal quality of fresh fruits . unfortunately , the spectroscopic technology fails to provide the quality parameters spatial information , which is essential to detail the analysis of the products ' features . what is more , based on the scanning mode , spectroscopic technology generally detects the small areas of fruits ' surface and the information of the whole sample might be lost in the testing process . visualization of chemical components using hyperspectral imaging has received an increasing attention in food - processing industry . the specific objectives of this study were to ( 1 ) investigate the potential of vis - nir hyperspectral imaging to detect tss of the mulberry fruits , ( 2 ) select the important wavelengths using rf algorithm , ( 3 ) evaluate the performance of the different calibration models with rf - plsr and rf - ls - svm based on linear and rbf kernel function , ( 4 ) compare the tss visualization results which were developed with plsr and ls - svm and select the optimal calibration model , and ( 5 ) predict tss value of each pixel in tested samples on the basis of the optimal calibration model and generate tss spatial distribution . mulberries from local orchards ( hangzhou , zhejiang , china ) were selected for the research . prior to measurement , all 310 fruits were mature with the absence of any green area . each single fruit constituted a sample , and as a result , 310 samples were collected and stored in the refrigerator at a constant temperature at 3c in the laboratory before the hyperspectral images were acquired . samples were removed from the refrigerator and placed under room condition ( ~20c ) for more than 2 hours . mulberry samples were scanned by a push - broom hyperspectral imaging apparatus with reflectance mode as shown in figure 1 . the hyperspectral imaging system mainly consisted of an imaging spectrograph ( imspectorv10e , spectral imaging ltd . , finland ) covering the spectral range of 3801,030  nm ; a ccd camera ( c8484 - 05 , hamamatsu , japan ) coupled with a zoom lens ( oles23 , specim , spectral imaging ltd . , oulu , finland ) ; an assembled illumination source coupled with two 150-w quartz tungsten halogen lamps ( fiber - lite dc950 illuminator , dolan jenner industries inc . , usa ) ; a mobile platform operated by a stepper motor ( ircp0076 , isuzu optics corp . , taiwan ) ; and a computer with the spectral imaging system v10e software ( isuzu optics corp . , taiwan ) , which was used to set and adjust the parameters of the device , including exposure time , motor speed , imaging acquisition , wavelength range , and image correction . the spectral resolution is 2.8  nm ; the resolution of ccd camera is 672  512 ( spatial  spectral ) pixels . some parameters of apparatus for acquiring hyperspectral images should be set and adjusted before acquiring hyperspectral images of mulberries . in this work , the moving speed of mobile platform is 1.6  mm / s , exposure time of the ccd camera is 0.008  s , and the distance from the lens to samples is 295  mm . the whole system ( except the computer ) was assembled in a dark chamber to minimize the effects of ambient light during the sample scanning [ 4 , 24 ] . due to the existence of dark current in ccd camera and the uneven intensity of the light source in different bands , several bands with weaker light intensity contained the biggest noises . here , raw hyperspectral images were calibrated using the white and dark reference based on ( 1 ) for weakening the effect of dark current in the ccd camera and the uneven intensity of light in different bands:(1)i = irawidarkiwhiteidark , where i is the calibrated hyperspectral images , iraw is the raw hyperspectral images , iwhite is the white reference images ( ~99% reflectance ) , and idark is the dark reference images ( ~0% reflectance ) . hyperspectral data were extracted from the calibrated hyperspectral images using envi software ( version 4.6 , itt visual information solutions , boulder , usa ) . before acquiring accurate spectra of the samples , background information should be removed in batches and this process has shorter processing time than manually extracted roi of the individual sample . the results subtracted from waveband at 893  nm ( a ) and 569  nm ( b ) are shown in figure 2(c ) , in which it was found that there were big differences on gray value between tested samples and background images . then threshold of 0.4 was used to remove the background and good masks ( d ) were obtained . by implementing the masks in the original hyperspectral images , the background information was removed . the separated region was identified as the region of interest ( roi ) of the sample . the average spectrum of spectra of all pixels in a mulberry was considered as the spectrum of a sample and 310 spectrums were collected . to avoid the low signal - noise ratio and diminish the problem of high dimensionality of feature spaces , the wavebands of 4201,000  nm were considered in the analysis . ultimately , a spectral data matrix of 310  460 ( samples  wavebands ) was obtained for further analysis . total soluble solids ( tss , brix% ) in mulberry samples were measured using traditional destructive tests . after acquiring the hyperspectral data , each fruit unit was juiced and tss were measured by using way-2s digital refractometer ( shanghai precision & scientific instrument co. , ltd . , the instrument range covered from 0 to 95% with temperature correction and refractive index accuracy is 0.0002 . all measurements were averaged over the data from three replicates in a room at 20c . the key steps of rf are illustrated in figure 3 and the detailed algorithm of rf was described in literatures [ 7 , 8 ] . before running rf algorithm , five parameters ( t , q ,  ,  , and  ) should be assigned to proper values . t was the number of iterations and needed to be sufficiently large to achieve convergence ( t = 10,000 ) ; q was the number of variables in the initialized variables set ( q = 50 ) ;  controlled variance of a normal distribution (  = 0.3 ) ;  was a coefficient explained in step  2 (  = 3 ) ;  represented the upper bound of the probability (  = 0.1 ) . partial least squares regression ( plsr ) is a multivariate data analysis technique which generalizes and combines features from principal component analysis ( pca ) and multiple linear regression ( mlr ) . plsr has been successfully used in developing multivariate calibration models , as it uses the concentration information ( y ) in determining how regression factors are computed from the spectral data matrix ( x ) , thereby reducing the impact of irrelevant x - variations in the calibration model . there were three steps to develop plsr ; the first step is to decompose the matrix and the model is(2)x = tp+e , y = uq+f , where t and u are the score matrices of x matrix and y matrix , p and q are the loading matrices of x matrix and y matrix , and e and f are the errors which come from the process of pls . it must build the following linear correlation:(3)u = bt+e , where b = ( tt)ty . ls - svm is an alternate formulation of svm regression proposed by suykens et al . . the main advantage is that it is computationally more efficient than the standard svm method . optimization problem of ls - svm is formulated:(5)minjw , e=12wtw+12k=1nek2 subject to the constraints(6)yk = wtxk+b+ek ,  k=1,  ,n , where  is the regularization parameter which balances the model 's complexity and the training errors ; ek is the random error ; xk and yk are input and output variables ; k is sample number . and then , lagrange function is applied to solve the optimization problem(7)lw , b , e,=jw , ek=1nkwtxk+b+ekyk , where k  r is lagrange multipliers . the solution of the above equation can be obtained by partially differentiating with respect to each variable:(8)lw=0w=k=1nkxk,lb=0k=1nk=0,lek=0k=ek ,  k=1,  ,n,lk=0wtxk+b+ekyk=0 ,  k=1,  ,n . when the variables w and e are removed , the equation can be rewritten as a linear function group(9)01t1+1iba=0y with(10)y = y1,  ,yn,1=1,  ,1,=1,  ,n,=kl ,n , where k  ( xi , xj ) is defined as the kernel function and must satisfy mercer 's condition . kernel function can map sample in original space to high - dimensional feature space to solve the linear inseparable problem . there are several typical examples of kernel function such as linear kernel , polynomial kernel , rbf , and sigmoid kernel . each kernel has some parameters , while rbf kernel function is strongly recommended and widely used for its performance and complexity . ls - svm with rbf kernel and linear function were selected in our work to compare the predictive performance with plsr . grid - research and leave - one - out cross - validation were used to find out the optimal  ( gam ) value and  ( sig2 ) , which is the bandwidth in the case of the rbf kernel . is the regularization parameter , determining the trade - off between structural risk minimization principle and empirical risk minimization , and is important to improve the generalization performance of ls - svm models , while  controls the value of function regression error and influences the number of initial eigenvalues   and  is absent in linear kernel function . in this case , we use leave - one - out cv to determine the tuning parameters . the performances of models were evaluated using correlation coefficient ( r ) and root mean square error ( rmse ) in calibration set ( rc , rmsec ) , cross - validation set ( rcv , rmsecv ) , and prediction set ( rp , rmsep ) . generally , an optimal model should offer high r values and low rmse values ; small difference existed between calibration and prediction set . the optimized model was employed to predict tss of mulberries . as shown in figure 4 , in method ( i ) , the hyperspectral image of a sample is a 3d data cube ( x  y   ) ( a ) , and there are n pixels in x and y direction , respectively . first , unfold the three - dimensional data matrix into a two - dimensional ( n  n ) matrix and the data matrix with n  n pixels being defined as variable xi ( b ) , and plsr model ( c ) was applied to predict the chemical value of each pixel , forming a prediction image ( g ) . in method ( ii ) , the pixels at the same position at important wavebands were extracted and arranged in a row , and all pixels were arranged at column ; in all , i  n data matrix ( d ) was formed . ls - svm was used to calculate tss values of pixels , 1  n data ( e ) was figured out , and then ( e ) was folded into a n  n matrix ( f ) , namely , the image of the tested sample with predictive tss value . pseudo - colour images were created with different colours representing different levels of tss that were predicted by the optimal simplified model . there are many kinds of noise in hyperspectral images , such as electrical noise from ccd detector ; the noise was caused by transmitting procedure and others . the presence of the noise seriously affects the feature extraction and recognition accuracy of the tested objects . median filtering , in which gray value of every pixel is set to be the average gray value in a certain neighbourhood window , is a nonlinear filtering technique that has been successfully applied to many signal and image processing tasks . median filtering ( 5  5 ) was applied to denoise hyperspectral images in this study . random frog ( version 2.0 ) toolbox , ls - svm lab v1.8 toolbox , median filtering toolbox , and the visualization program were finished with matlab r2009a ( version 7.8 ) software . origin pro 8.0 sr0 ( origin lab corporation , northampton , ma , usa ) software was employed to design the curve figures . all the processes were run on a pc ( cpu : g2020 @ 2.90  ghz , ram 4.00  gb ) operating on windows 7 . in order to establish the calibration models of the tss in mulberries , all mulberry samples were divided into a calibration set and prediction set according the ratio about 3  :  1 ( 235  :  75 ) by spxy method , in which sample set partitioning is based on joint x - y distances . table 1 summarized the measured tss of all samples , the maximum and minimum value of calibration set were 10.99brix and 3.21brix , and the range of prediction set was 9.863.86brix . usually , calibration set with a wide range of the chemical component could establish a robust model . spectra of all mulberries covering the range of 4201,000  nm are displayed in figure 5 . lower reflectance ( < 10% ) in the visible region of 420650  nm was attributed to the relatively homogeneous and dark purple or black colour of mature fruits and mainly caused by anthocyanin and chlorophyll [ 35 , 36 ] . reflectance for mulberry samples started to increase dramatically from 650 to 800  nm and reached a peak at 850  nm . an obvious valley located around 960980  nm , which was attributed to the combination effect of -oh groups from carbohydrate and water . chemometrics methods were introduced to analyze the spectra and establish the relationship between spectra and measured tss to determine the internal quality of mulberries in the future study . figure 6 displays sps of wavelengths , and a small number of wavelengths displayed had high sp ( over 0.9 ) ; most of the wavelengths were with low sp , and these results showed that there existed a lot of useless information to make tss content be predicted using hyperspectral imaging . if the cutoff of sp was 0.7 ( 1 ) and 0.85 ( 2 ) , there were 23 ( 960 , 929 , 814 , 849 , 432 , 500 , 877 , 995 , 903 , 915 , 831 , 956 , 967 , 954 , 923 , 511 , 454 , 840 , 835 , 527 , 509 , 850 , and 883  nm ) and 11 ( 960 , 929 , 814 , 849 , 432 , 500 , 877 , 995 , 903 , 915 , and 831  nm ) important wavelengths selected , respectively . these wavebands were ranked by descending order of sps . the concentration of anthocyanin and chlorophyll caused low reference in the visible region and contributed to the maturity of mulberry fruits . wavelengths at 814  nm , 975989  nm , and 981  nm correspond to second and third overtones of nh , 877  nm and 900950  nm were assigned to ch third overtone , and 960  nm was assigned to oh second overtone . these bands are assigned to mono- and ploy - carbohydrates ( fructose , glucose , and pectin ) and water in mulberry . in order to establish calibration models with fewer features , two important wavelengths sets ( 23 versus 11 ) were employed to establish calibration models and these results were compared to obtain optimal visualization map of tss in mulberry . multivariate analyses , developed with leave - one - out cv , were used to find accurate plsr and ls - svm models for the prediction of tss . the predictive models of tss in mulberry fruits were built using the two kinds of the selected wavelengths ( 23 versus 11 ) and the results of these models are enumerated in table 2 . overall , ls - svm regression models had better performance for predicting tss than plsr models because ls - svm is a nonlinear regression model and it could transform the original data into a high dimension space to make linear solution . ls - svm with rbf kernel function based on 23 wavelengths with rp of 0.956 and rmsep of 0.430 could provide the most effective tss estimation compared to other models , while ls - svm models with linear function had similar results with rf - plsr models ( except with full wavelengths ) . this consequence caused by the rbf kernel function of ls - svm has an advantage in conducting samples in multidimensional space . in addition , linear kernel function in ls - svm was considered as a special form of rbf kernel function . model ( 9 ) with 11 important wavelengths had an approving expression with rp of 0.925 and rmsep of 0.557 , and these results were equal to the performance of the full - plsr model ( rp of 0.959 and rmsep of 0.411 ) . when the number of important wavelengths reduced to almost a half ( 11 versus 23 ) , model ( 9 ) only had a little reduction of 3.24% ( rp ) and an increase of 29.5% ( rmsep ) compared to model ( 6 ) . although ls - svm had better performance , plsr with 23 important wavelengths offered acceptable results . model ( 4 ) provided a reliable result of rp of 0.899 and rmsep of 0.675 . compared with full - plsr model , rc , rcv , and rp in model ( 4 ) showed a slight reduction of 3.88% , 2.52% , and 5.47% ; rmsec , rmsecv , and rmsep provided a change of 0.213 , 0.101 , and 0.228 , respectively . however , 95.0% of the variables ( 23 versus 460 ) were removed in rf - plsr model . the accuracy of rf - plsr model was higher than spa - mlr model in the literature of   for predicting tss of mulberries , because hyperspectral imaging could provide both spectra and image information about tested samples . in addition , spectra of whole fruit were averaged as the spectrum of the sample to avoid the loss of spectra . but beyond that , there were only two wavelengths in the spa - mlr model which meant that useful spectral information might be over - removed . however , rf - plsr model for predicting tss of mulberries was not as good as monte carlo - uninformative variable elimination- ( mc - uve- ) spa ( mc - uve - spa ) model for predicting tss of  ya  pear . this phenomenon could be explained that the mulberry fruit has a bumpy surface that has more influence on the spectra than does a smooth surface . tss prediction of mulberries based on rf - plsr model was parallel to the prediction tss of blueberries that were acquired by interval partial least square- ( ipls- ) plsr model . in order to seek an optimal calibration model for realizing tss visualization in mulberry fruits , models ( 4 ) , ( 8) , and ( 9 ) the comparative maps of six samples developed by three models are exhibited in figure 7 . six mulberry fruits were used to compare the reliability of tss distribution maps , which were predicted by three models . plsr ( figure 7(a ) ) and ls - svm with linear kernel function ( figure 7(b ) ) could provide clearly tss distribution , while ls - svm with rbf kernel function ( figure 7(c ) ) failed to display tss visualization of mulberry fruits . there are four possible reasons to explain this phenomenon : ( 1 ) the special modelling way of ls - svm with rbf kernel function , which needed to transfer the raw data into high - dimensional space , might change the original data form ; ( 2 ) there were two parameters (  ,  ) to control the predicted results of ls - svm , which might add the complexity of ls - svm ; ( 3 ) using calibration model with 235 variables to predict a map ( such a map of a mulberry was about 100  200 pixels ) might produce problem of overfitting ; ( 4 ) the mulberry fruit with bumpy appearance would bring the variation of spectral reflectance , which might affect the accuracy of models . the linear kernel function is the special form of rbf kernel function , and ls - svm with linear kernel function ( ls - svm - linear ) ( b ) had better tss distribution ( b ) than that of ls - svm - rbf . however , in figure 7(b ) , it was hard to distinguish the tss level of mulberry and a mistake was made in sample ( 2 ) . the measured tss value of sample ( 2 ) was 8.2brix and it was the highest tss value among these six samples , while in figure 7(b ) , it had the lightest colour . plsr had the best performance compared to ls - svm for its simple linear combination . at the same time , the fitting effects of plsr and ls - svm with linear kernel function ( ls - svm - linear ) were compared and expressed in figure 7(d ) . the correlation coefficients between measured tss values and predicted tss values in plsr and ls - svm with linear kernel function ( ls - svm - linear ) were 0.857 and 0.500 , respectively . although ls - svm could offer satisfactory results in calibration model , plsr with simple algorithm was feasible to map tss distribution in mulberry fruits . when the simplified model was finally established , it was subsequently employed to predict tss in each pixel of the image resulting in new pseudo - colour images and this process was called  prediction map  . as the last step of analyzing hyperspectral image , rf - plsr model was used to predict tss of each pixel and transferred its hyperspectral image to the tss distribution map . the multilinear function for the tss prediction of the mulberries was obtained:(12)ytss=16.2070.19110.81821.71731.4814 + 0.0075 + 0.03761.29170.19381.11291.017101.606110.230120.168130.132140.92415 + 0.04216 + 0.023171.541181.57419 + 0.04720 + 0.040211.474221.25223,where i is the spectral reflectance value at the wavelength of i nm ( i was 960 , 929 , 814 , 849 , 432 , 500 , 877 , 995 , 903 , 915 , 831 , 956 , 967 , 954 , 923 , 511 , 454 , 840 , 835 , 527 , 509 , 850 , and 883 , resp . ) and ytss is the predictive tss values of the mulberry fruits . new hyperspectral data with only 23 wavelengths could speed up the visualization process and make it easier to establish a multispectral imaging system . the function ( 12 ) was employed to predict the tss of each pixel within the mulberry fruits hyperspectral images . the predicted tss concentration of each pixel was mapped with a linear colour scale using different colours from red to blue to represent different tss concentrations from high to low . mulberries with higher tss values have more pixels shown in red , such as in figure 8 ( 16 ) samples . the more the pixels coloured in green and blue , the lower the tss values . there were unsatisfying results : the blue pixels in samples ( 13 ) and ( 14 ) were saturated points and were not considered in the analysis . different values in the maps of tss distribution were in quantitative proportion to the spectrum of the corresponding pixels . the ability to provide spatial information makes hyperspectral imaging available to focus on detecting both external and internal quality of fruits . to sum up , the successful mapping of tss distribution in mulberries suggested that the application of hyperspectral imaging to realize the visualization of mulberry fruits ' internal quality is feasible and promising . the plsr and ls - svm model based on 23 and 11 wavelengths had a good performance to predict tss of mulberries , which indicated that rf algorithm was effective in reducing three - dimensional data . it could be revealed that plsr was feasible to map chemical component concentration ( tss ) distribution of mulberry fruits . this research provided a theoretical basis for developing the instrument for measuring the internal quality of fruits and made it possible to sort mulberries based on tss spatial distribution .
chemometrics methods coupled with hyperspectral imaging technology in visible and near infrared ( vis / nir ) region ( 3801030  nm ) were introduced to assess total soluble solids ( tss ) in mulberries . 
 hyperspectral images of 310 mulberries were acquired by hyperspectral reflectance imaging system ( 512 bands ) and their corresponding tss contents were measured by a brix meter . random frog ( rf ) 
 method was used to select important wavelengths from the full wavelengths . 
 tss values in mulberry fruits were predicted by partial least squares regression ( plsr ) and least - square support vector machine ( ls - svm ) models based on full wavelengths and the selected important wavelengths . the optimal plsr model with 23 important wavelengths 
 was employed to visualise the spatial distribution of tss in tested samples , and tss concentrations in mulberries were revealed through the tss spatial distribution . 
 the results declared that hyperspectral imaging is promising for determining the spatial distribution of tss content in mulberry fruits , which provides a reference for detecting the internal quality of fruits .