# Identification of Damage in Pear Using Hyperspectral Imaging Technology

Authors: Cheng-Tao Su; Bin Li; Hai Yin; Ji-Ping Zou; Feng Zhang; Yan-De Liu
Journal: Journal of Spectroscopy
 (2022)

---

## Abstract

Crown pears are an important economic crop, but their quality and economy are seriously affected by the different levels of damage. To improve the overall quality of crown pears, sorting of crown pears with different levels of damage is required. However, there are some shortcomings in the traditional detection methods, such as low efficiency and large error. Therefore, the hyperspectral technology was used to discriminate between sound and 3 different levels of damage (defined as level I, II, and III damage, respectively) of crown pears in this study. To improve the discriminatory accuracy of the model, absorbance (A) spectra and Kubelka–Munk (K-M) spectra were added to reflectance (R) spectra. The three spectra were pretreated; then, the partial least squares discriminant analysis (PLS-DA) model and the support vector machine (SVM) model were established to discriminate the crown pears with different levels of damage. The results of the discriminant model show that the discrimination accuracy of the SVM based on R, A, and K-M spectra is higher than that of PLS-DA of them; the A-RAW-SVM model has the best discrimination performance with an overall discrimination accuracy of 100% for the test and 98.98% for calibration sets, respectively. Finally, the spectra were selected by the competitive adaptive reweighted sampling (CARS) and the uninformative variables elimination (UVE) to obtain the characteristic wavelengths, and the SVM models were built based on the filtered R, A, and K-M. Their discrimination results show that the A-RAW-CARS-SVM model has the best discrimination ability, and the discrimination accuracies of the test and calibration sets of the model are 96.88% and 100%, respectively. The results show that the best discrimination of different levels of damage of crown pears is the SVM model based on a spectra. This study provides a theoretical basis and experimental basis for detecting the damage of crown pears using hyperspectral.


---

## Body

## 1. Introduction

Crown pears are an important economic crop, and they are widely grown in subtropical regions. It is popular because of their crisp, sweet, juicy, and thin skin [1]. Due to the characteristics of thin skin, crown pears produce unavoidable mechanical damage during picking, transportation, and storage after ripening, which can be divided into surface damage, epidermal abrasion, and impact damage according to the different levels of damage [2]. The damaged crown pears are easy to breed bacteria and rot and deteriorate in a relatively short time, and they also infect the sound crown pears, affecting the shelf life of the sound crown pears [3]. The crown pears after damage can be sorted and taken different treatment according to the different levels of damage to obtain higher economic benefits. The crown pears with mild damage can still be eaten normally in the early stage. The crown pears with severe damage can be considered to remove the damaged part after making processed food. At present, the damaged crown pears mainly rely on manual sorting. This sorting method has a large error and low efficiency. Therefore, it is necessary to explore a precise, nondestructive, and efficient inspection method to realize the sorting of crown pears with different damaged levels.In order to discriminate the different levels of damage of crown pears more efficiently, researchers have proposed various detection techniques to investigate. Kim et al. [4] used infrared-locked thermography to assess the damage of pears by feeding periodic thermal energy to the pear, and then, thermal radiation from the pear was collected to identify the size of the damage and the depth of the damage. The results showed that the phase information generated by thermography could be used to detect the damaged fruit. However, thermal radiation can cause some damage to the quality of fruit. Luo et al. [5] used spatial frequency domain imaging (SFDI) to detect different levels of damage (sound, slight, and severe damage) of pears. The results showed that the accuracy of SFDI was 100% at 527 nm; this demonstrated that the SFDI technique could be used to detect the damage level of fruit. However, SFDI is strongly influenced by the color of the peel, and the difference in peel color poses a great difficulty in characterizing the optical properties. Zhou et al. [6] used optical coherence tomography (OCT) to detect the damage of pears. The results indicated that the OCT could be used for damage detection in pears, but the resolution and detection depth of OCT technique needed to be improved. The insignificant difference between the early damaged and sound areas of crown pears increases the difficulty of sorting by visual techniques [7]. To overcome the limitations of the above detection techniques, the hyperspectral technique is proposed to detect the damaged level of pears. The hyperspectral technique is seen as an emerging nondestructive testing technique, and it provides a large amount of information about the characteristics of sample [8].Many scholars have studied the damage of fruit using the hyperspectral technique and have obtained many satisfactory results. Li et al. [9] used hyperspectral to achieve the detection of early damage in peaches. They compared the ability of short-wave NIR and long-wave NIR to distinguish bruises, and it concluded that the short-wave NIR had better discriminatory ability with an accuracy of 96.5% for bruised peaches. Tan et al. [10] used hyperspectral to detect early damage and determine the damaged level of apples with the accuracy of 97.5%. Sun et al. [11] used hyperspectral to identify different levels of damage in tomatoes with the accuracy of 90.93%. The above studies show the feasibility of using hyperspectral detection damage of fruit. Most of the studies based on hyperspectral detection quality of fruit used the reflectance spectra to establish analytical models [12].The physical and chemical properties of fruit may change after being damaged, and these physical and chemical properties can be connected with the spectra [13]. The combination of hyperspectral and chemometrics can be used to detect the change in the content of compounds in fruits [14]. However, there are a lot of background information, noise information, and useless information in the spectra when judging based on the reflectance spectra directly obtained by the spectral instrument, those lead to the low-discrimination accuracy (90.93%) of fruit with various degrees of damage. Therefore, the reflectance (R) spectra, absorbance (A) spectra, and Kubelka–Munk (K-M) spectra combining with chemometrics was proposed to identify the various degrees of damage of fruit to improve the identification accuracy.


## 2. Materials and Methods

### 2.1. Crown Pear Sample

The crown pear samples used for the experiment were obtained from local orchards in Jiangxi. Samples without external damage were selected by visual inspection, and the samples with equatorial diameter between 70 and 80 mm and weight between 250 and 280 g were stored at the room temperature of 25°C.


### 2.2. Quantitative Damage Experiments

The samples subjected to impact damage experiments using the pendulum device are shown in Figure1(a). The pendulum consists of a pendulum arm and an impact surface, and the sample is fixed at the end of the pendulum arm. The pendulum arm is released by different angles, which can cause the different levels of damage samples. The samples caused by 30°, 40°, and 50° release are defined as level I, II, and III damage, respectively. Samples with different levels of damage are shown in Figure 1(b). The samples are divided into 4 groups, one of which served as the control group, and the remaining 3 groups are subjected to 3 levels of impact damage experiments. 64 samples each of sound, I, II, and III damage are obtained by the impact damage experiments.Figure 1
Pendulum quantitative damage of the experimental setup: (a) pendulum quantitative damage device, schematic; (b) sound and different levels of damage of the crown pear samples.
(a)(b)


### 2.3. Acquisition of Hyperspectral Images

Images of all samples are acquired by the Gaia Sorter hyperspectral instrument. The composition of the hyperspectral image acquisition system is shown in Figure2, and the instrument is manufactured by Dualix Spectral Imaging Ltd. Crown pear samples are sequentially placed on the transport platform, and the spectral acquisition is performed sequentially to generate a 3D data body containing image information and spectral information. The hyperspectral acquisition instrument is preheated for 30 min before acquisition to reduce the acquisition error caused by the baseline drift.Figure 2
Schematic diagram of a hyperspectral acquisition system.


### 2.4. Spectral Calibration

The dark current and uneven distribution of light sources exist in the hyperspectral instrument when the acquisition is carried out directly, and they may cause large experimental errors, so the spectral correction process is carried out by(1)R=R0−RyRZ−Ry,where R is the calibrated sample image acquisition data, Ry is the all-black image acquisition data, Rz is the all-white image acquisition data, and R0 is the original sample image acquisition data.


### 2.5. Spectral Extraction

Spectral extraction is performed on the acquired hyperspectral images to obtain the spectral information that it can be used to characterize the sample. The VIS-NIR spectra cover the wavelength range of 397.5∼1014.0 nm with a resolution of 3.5 nm. The region of interest (ROI) is selected in the equatorial region of sound samples and damaged samples to reduce the uneven degree of light. The average value of the reflectance within the ROI is calculated as the reflectance spectra (R of this sample. The R spectra are calculated by (2) and (3) to obtain the absorbance (A) spectra and Kubelka–Munk (K-M) spectra, respectively.(2)A=−lgR,(3)K−M=1−R22R.


### 2.6. Spectral Data Pretreatment

TheR, A, and K-M spectral data may contain information about anomalies caused by some unrelated characteristics of the sample in addition to the information about the sample being tested. Therefore, the raw data need to be processed to eliminate or attenuate the influence of anomalous information and retain valid information to improve the applicability and robustness of the discrimination model. The pretreatment methods of Gaussian filter (GF), standard normal variation (SNV), Savitzky–Golay derivative (SGD), multiplicative scatter correction (MSC), and correlation optimized warping (COW) are commonly used.


### 2.7. Characteristic Wavelength Selection

There are multiple correlations betweenR, A, and K-M spectra at different wavelengths, resulting in redundant information in the spectra. This redundant information reduces the discrimination speed and accuracy of the model, and therefore, the redundant information needs to be eliminated [15]. In practice, a good performing classification model requires not only high discrimination accuracy but also has fast discrimination speed; therefore, the original spectra can be downscaled by the competitive adaptive reweighted sampling (CARS) and the uninformative variables elimination (UVE) [16]. CARS is a sampling method for wavelength selection based on regression coefficients, and UVE is a sampling method for rejecting uninformative variables based on the value of the stability of the model variables. These two methods are widely used for the selection of characteristic wavelengths of spectral data [17].


### 2.8. Model Building

The Kennard–Stone (KS) algorithm achieves stratified sampling by uniformly selecting samples in the characteristic space based on the Euclidean distance between variables, reducing the impact on the final results due to the introduction of additional bias in the partitioning process [18]. The KS algorithm is used to divide the spectral data of the samples into two mutually exclusive calibration sets and test set (calibration set: test set = 3 : 1). The partial least squares discriminant analysis (PLS-DA) and the support vector machine (SVM) models are based on R, A, and K-M spectra, respectively. The PLS-DA is used to find a linear regression model by projecting the predictor and observed variables into a new space [19]. SVM can be used to perform nonlinear classification by kernel methods with a decision boundary of the maximum margin hyperplane solved for the learned samples [20]. The precision and accuracy can be used to evaluate the performance of the classification model. The precision based on the confusion matrix is usually evaluated by the F1 value, which is a harmonic mean based on the accuracy and recall. The closer the F1 value is closer to 1, the higher the precision of the model [21]. The F1 value is calculated by the following equation:(4)F1=TP2×TP+FN+FP,where TP is the true case, FN is the false counter case, and FP is the false positive case.TheF1 value is applicable to the binary classification model, for the evaluation of the accuracy rate of the multiclassification model needs to calculate the F1 value of each category, and the average of it is taken to get the macro-F value of the model, and the macro-F value is calculated by(5)Macro−F=1n∑i=1nFi,where Fi is the F1 value of each category and n is the number of categories.


## 2.1. Crown Pear Sample

The crown pear samples used for the experiment were obtained from local orchards in Jiangxi. Samples without external damage were selected by visual inspection, and the samples with equatorial diameter between 70 and 80 mm and weight between 250 and 280 g were stored at the room temperature of 25°C.


## 2.2. Quantitative Damage Experiments

The samples subjected to impact damage experiments using the pendulum device are shown in Figure1(a). The pendulum consists of a pendulum arm and an impact surface, and the sample is fixed at the end of the pendulum arm. The pendulum arm is released by different angles, which can cause the different levels of damage samples. The samples caused by 30°, 40°, and 50° release are defined as level I, II, and III damage, respectively. Samples with different levels of damage are shown in Figure 1(b). The samples are divided into 4 groups, one of which served as the control group, and the remaining 3 groups are subjected to 3 levels of impact damage experiments. 64 samples each of sound, I, II, and III damage are obtained by the impact damage experiments.Figure 1
Pendulum quantitative damage of the experimental setup: (a) pendulum quantitative damage device, schematic; (b) sound and different levels of damage of the crown pear samples.
(a)(b)


## 2.3. Acquisition of Hyperspectral Images

Images of all samples are acquired by the Gaia Sorter hyperspectral instrument. The composition of the hyperspectral image acquisition system is shown in Figure2, and the instrument is manufactured by Dualix Spectral Imaging Ltd. Crown pear samples are sequentially placed on the transport platform, and the spectral acquisition is performed sequentially to generate a 3D data body containing image information and spectral information. The hyperspectral acquisition instrument is preheated for 30 min before acquisition to reduce the acquisition error caused by the baseline drift.Figure 2
Schematic diagram of a hyperspectral acquisition system.


## 2.4. Spectral Calibration

The dark current and uneven distribution of light sources exist in the hyperspectral instrument when the acquisition is carried out directly, and they may cause large experimental errors, so the spectral correction process is carried out by(1)R=R0−RyRZ−Ry,where R is the calibrated sample image acquisition data, Ry is the all-black image acquisition data, Rz is the all-white image acquisition data, and R0 is the original sample image acquisition data.


## 2.5. Spectral Extraction

Spectral extraction is performed on the acquired hyperspectral images to obtain the spectral information that it can be used to characterize the sample. The VIS-NIR spectra cover the wavelength range of 397.5∼1014.0 nm with a resolution of 3.5 nm. The region of interest (ROI) is selected in the equatorial region of sound samples and damaged samples to reduce the uneven degree of light. The average value of the reflectance within the ROI is calculated as the reflectance spectra (R of this sample. The R spectra are calculated by (2) and (3) to obtain the absorbance (A) spectra and Kubelka–Munk (K-M) spectra, respectively.(2)A=−lgR,(3)K−M=1−R22R.


## 2.6. Spectral Data Pretreatment

TheR, A, and K-M spectral data may contain information about anomalies caused by some unrelated characteristics of the sample in addition to the information about the sample being tested. Therefore, the raw data need to be processed to eliminate or attenuate the influence of anomalous information and retain valid information to improve the applicability and robustness of the discrimination model. The pretreatment methods of Gaussian filter (GF), standard normal variation (SNV), Savitzky–Golay derivative (SGD), multiplicative scatter correction (MSC), and correlation optimized warping (COW) are commonly used.


## 2.7. Characteristic Wavelength Selection

There are multiple correlations betweenR, A, and K-M spectra at different wavelengths, resulting in redundant information in the spectra. This redundant information reduces the discrimination speed and accuracy of the model, and therefore, the redundant information needs to be eliminated [15]. In practice, a good performing classification model requires not only high discrimination accuracy but also has fast discrimination speed; therefore, the original spectra can be downscaled by the competitive adaptive reweighted sampling (CARS) and the uninformative variables elimination (UVE) [16]. CARS is a sampling method for wavelength selection based on regression coefficients, and UVE is a sampling method for rejecting uninformative variables based on the value of the stability of the model variables. These two methods are widely used for the selection of characteristic wavelengths of spectral data [17].


## 2.8. Model Building

The Kennard–Stone (KS) algorithm achieves stratified sampling by uniformly selecting samples in the characteristic space based on the Euclidean distance between variables, reducing the impact on the final results due to the introduction of additional bias in the partitioning process [18]. The KS algorithm is used to divide the spectral data of the samples into two mutually exclusive calibration sets and test set (calibration set: test set = 3 : 1). The partial least squares discriminant analysis (PLS-DA) and the support vector machine (SVM) models are based on R, A, and K-M spectra, respectively. The PLS-DA is used to find a linear regression model by projecting the predictor and observed variables into a new space [19]. SVM can be used to perform nonlinear classification by kernel methods with a decision boundary of the maximum margin hyperplane solved for the learned samples [20]. The precision and accuracy can be used to evaluate the performance of the classification model. The precision based on the confusion matrix is usually evaluated by the F1 value, which is a harmonic mean based on the accuracy and recall. The closer the F1 value is closer to 1, the higher the precision of the model [21]. The F1 value is calculated by the following equation:(4)F1=TP2×TP+FN+FP,where TP is the true case, FN is the false counter case, and FP is the false positive case.TheF1 value is applicable to the binary classification model, for the evaluation of the accuracy rate of the multiclassification model needs to calculate the F1 value of each category, and the average of it is taken to get the macro-F value of the model, and the macro-F value is calculated by(5)Macro−F=1n∑i=1nFi,where Fi is the F1 value of each category and n is the number of categories.


## 3. Results and Discussion

### 3.1. Spectral Analysis of Crown Pear

TheR, A, and K-M spectral data for sound and samples with different levels of damage were averaged, and their spectral curves were plotted. The mean values of the damage levels of the R spectra are shown in Figure 3(a), with the sound samples exhibiting the highest spectral reflectance, followed by the level I damage and level II damage and finally the level III damage. There is a significant decrease in the spectral reflectance of the damaged crown pear, and the reason for the spectral difference is mainly due to the rupture of the cell membrane of the crown pear after damage, which led to water loss and easy oxidation, which is consistent with the results of research on apple damage [22]. Figures 3(b) and 3(c) show that the curve characteristics of the A spectral and K-M spectral are different, and the A spectral and K-M spectral curves show that the spectral values of level III damage, level I damage, level II damage, and sound samples become lower in sequence. The different trends and characteristics presented by the three spectral curves are the basis for model discrimination.Figure 3
Raw spectral curves of(a)R, (b) A and, (c) K-M.
(a)(b)(c)


### 3.2. Spectral Pretreatment

The spectra are usually pretreated before building a discriminant model. The purpose of pretreatment is to extract valid information and eliminate background information and noise. TheR, A, and K-M spectra of crown pears were pretreated based on GF, MSC, SNV, COW, and SGD, and the changes in the spectra after pretreatment were described as an example of reflectance spectra. Figure 4 shows that the spectral characteristics of the R spectra change significantly after different pretreatments, and these changes are more pronounced at the wave peaks and troughs. Gaussian filtering is calculated by Gaussian function to reduce the self-noise of raw spectra. MSC and SNV methods are mainly used to eliminate the scattering effect from the inhomogeneous distribution of particles and particle size. COW aligns two signals by segmenting the spectra with linear stretching and compression. SGD can be used to effectively eliminate the baseline and other background interference by performing 1st derivative on the spectral curve.Figure 4
Curves of raw and pretreatedR spectra.


### 3.3. Model Building and Analysis

The accuracy of the discrimination results of PLS-DA based onR spectra, A spectra, and K-M spectra is shown in Table 1. The best model based on the R spectra is the model pretreated by SNV with the discrimination accuracies of 64.06% and 65.63% for the test and calibration sets. The best model based on A spectra is the model pretreated by COW with discrimination accuracies of 60.94% and 54.17% for the test and calibration sets. The best model based on K-M spectra is the model based on RAW with the discrimination accuracies of 64.06% and 75.52% for the test and calibration sets, respectively. From the discriminant results, it is clear that the K-M spectra exhibits the best modeling performance in the PLS-DA discriminant model.Table 1
Discriminant accuracy of the PLS-DA model based onR, A, and K-M spectra.
SpectraPretreatmentAccuracy (%), test set/calibration setSoundIIIIIITotalRRAW50.00/66.6787.50/62.531.25/60.4268.75/70.8363.33/65.10GF50.00/66.6787.50/62.531.25/60.4268.75/70.8363.33/65.10SNV62.50/7587.50/64.5843.75/60.4262.50/62.564.06/65.63MSC62.50/7587.50/64.5843.75/60.4262.50/62.564.06/65.63COW43.75/66.67100/70.8337.5/85.4268.75/77.0862.5/75SGD50/72.9281.25/81.2543.75/70.8362.5/77.0859.38/74.48ARAW43.75/68.7587.50/7537.5/79.1762.50/72.9257.81/73.96GF50.00/68.7593.75/7537.5/79.1762.50/70.8357.81/73.44SNV68.75/72.9268.75/68.7537.5/60.4256.25/62.557.81/66.15MSC68.75/72.9268.75/68.7537.5/60.4256.25/62.557.81/66.15COW62.5/62.535.42/93.7518.75/54.1768.75/64.5860.94/54.17SGD50/79.1762.5/39.5825/43.7562.5/54.1750/48.96K-MRAW50/7587.5/77.0850/81.2543.75/81.2564.06/75.52GF50/70.8387.5/77.0831.25/81.2556.25/81.2556.25/74.48SNV43.75/81.2575/70.8337.5/62.556.25/60.4253.13/68.75MSC43.75/79.1781.25/68.7537.5/58.3356.25/62.552.08/67.19COW43.75/7593.75/81.2543.75/62.568.75/68.7562.5/71.88SGD37.5/58.3393.75/64.5831.25/54.1750/56.2553.13/58.33The accuracy of the discrimination results of the SVM model based onR spectra, A spectra, and K-M spectra is shown in Table 2. The best model based on R spectra is the model based on RAW with discrimination accuracy of 96.88% and 98.96% for the test and calibration sets. The best model based on A spectra is the model based on RAW with discrimination accuracies of 100% and 98.98% for the test and calibration sets. The best model based on K-M spectra is the model based on COW with discrimination accuracy of 95.31% and 98.44% for the test and calibration sets. From the discriminant results, it is clear that the SVM model has the best discriminant performance based on A spectra.Table 2
Discriminant accuracy of SVM models based onR, A, and K-M spectra.
SpectraPretreatmentAccuracy (%), test set/calibration setSoundIIIIIITotalRRAW100/97.92100/10087.5/97.9293.75/10095.31/98.96GF100/97.92100/10087.5/97.92100/10096.88/98.96SNV98.44/10081.25/95.8381.25/10081.25/97.9284.38/98.44MSC93.75/10081.25/89.5881.25/93.7587.50/95.8385.94/94.79COW87.5/95.8393.75/83.3375/87.5100/93.7589.06/90.10SGD93.75/95.8381.25/87.568.75/85.4287.5/95.8381.25/91.15ARAW100/98.44100/100100/98.44100/100100/98.98GF100/98.4493.75/10093.75/100100/10096.88/99.48SNV93.75/10075/93.7587.5/95.8381.25/10084.38/96.88MSC93.75/10075/93.7587.5/95.8381.25/98.4484.38/96.88COW100/97.9287.5/10087.5/10093.75/95.8392.19/98.44SGD100/97.9262.5/87.562.5/91.6775/89.5875/91.67K-MRAW100/10093.75/97.9287.5/10093.75/10093.75/99.48GF100/10093.75/97.9287.5/10093.75/10093.75/99.48SNV87.5/10085.71/91.6768.75/89.5887.5/95.8379.69/94.27MSC87.5/10085.71/91.6768.75/89.5887.5/95.8379.69/94.27COW100/10087.5/95.8393.75/100100/97.9295.31/98.44SGD75/10087.5/10068.75/10093.75/97.9279.69/99.48From the discriminant results in Tables1 and 2, it is clear that the performance of the SVM model by GF is best among the models based on R spectra. Among the models based on the A spectra, the SVM model when the A spectra is not pretreated has the best performance. Among the models based on K-M spectra, the SVM model by COW pretreatment has the best performance. The discrimination results of the models show that the SVM model has a higher discrimination accuracy than the PLS-DA model. The reason for the poor discriminatory ability of PLS-DA may be due to the fact that the spectral information does not have a linear correlation with the level of cellular water loss of the sample under test reducing the predictive ability. In contrast, SVM is a nonlinear classification by the kernel method, so it obtains high discrimination accuracy in the detection different damage levels of crown pears. Cao et al. [23] used hyperspectral combined with SVM and PLS models to detect the damage level of pears, and the results showed that the SVM model was more accurate in predicting the damage level of pears. The results of the experimental discrimination show that SVM can be used to effectively discriminate the damage level of pears.The discriminant results of the optimal models inR, A, and K-M spectra are analyzed separately. The optimal model based on R spectra is R-GF-SVM, and the confusion matrix of the model discrimination results is shown in Figure 5(a). 2 level II damage samples in the test set are misclassified as level I damage sample: 1 sound sample in the calibration set is misclassified as level I damage sample, and 1 level II damage sample is misclassified as level III damage sample. The optimal model based on A spectra is A-RAW-SVM, and the confusion matrix of model discrimination results is shown in Figure 5(b). There are no misclassified samples in the test set; 1 sound sample in the calibration set is misclassified as level II damage sample, and 1 level II damage sample is misclassified as level III damage sample. The optimal model based on K-M spectra is K-M-COW-SVM, and the confusion matrix of the model discrimination results is shown in Figure 5(c). 2 level I damage samples in the test set are misclassified as level II damage sample, and 1 level II damage sample is misclassified as 1 sound sample. 2 level I damage samples in the calibration set are misclassified as level II damage samples, and 1 level III damage sample is misclassified as level II damage sample.Figure 5
Confusion matrix of the discriminant results of the optimal SVM model based onR, A, and K-M spectra. Confusion matrix of discriminant results of the (a) R-GF-SVM model, (b) A-RAW-SVM model, and (c) K-M-COW-SVM model.
(a)(b)(c)The precision of the model discrimination is calculated, and the discrimination results are shown in Figure5. The accuracy rates of the R-GF-SVM model, A-RAW-SVM model, and K-M-COW-SVM model are calculated by (4), and the results are shown in Table 3.Table 3
Results of macro-F for SVM models based on R-GF, A-RAW, and K-M-COW spectra.
Discriminant modelFi valueMacro-F valueSoundIIIIIIR-GF-SVM0.99210.97710.97600.99220.9844A-RAW-SVM0.992110.98440.99220.9922K-M-COW-SVM0.99220.96770.95460.99210.9767The macro-F value of the R-GF-SVM model, A-RAW-SVM model, and A-RAW-SVM is 0.9844, 0.9922, and 0.9767, respectively. The closer the macro-F value is to 1, the higher the precision of the model is indicated [24]. From Tables 2 and 3, it can be found that the performance model based on A spectra is best, and its accuracy and precision are higher than R spectra and K-M spectra.


### 3.4. Selection of Characteristic Wavelength

To simplify the spectral dataset and enhance the speed of the model run, CARS and UVE were used to filter the spectra with better modeling results for the characteristic wavelengths, respectively. A total of nine spectra were selected, and their discrimination accuracies were all greater than 89.06%, which were R-RAW, R-GF, R-COW, A-RAW, A-GF, A-COW, K-M-RAW, K-M-GF, and K-M-COW. The subset of wavelengths with the smallest RMSECV was obtained by first building a partial least squares model in CARS, and then, the wavelengths in the model were selected that correspond to the larger regression coefficients [25]. The A-RAW spectra are used as an example to introduce the characteristic wavelength selection of CARS, and its selection process is shown in Figure 6. CARS is performed 100 times sampling by sampling, and the number of sample variables gradually decreases as the number of samples sampled increase. RMSECV decreases and then increases to a minimum value of 0.4902 at 20 runs, with the characteristic wavelength determined by the minimum RMSEP during the sampling run [26].Figure 6
Process and results of A-RAW-CARS characteristic wavelength selection.The PLS model was established in UVE by cross-validation, and then, the ratio of the mean and standard deviation of the regression coefficients of the PLS model was calculated to select valid spectral information [27]. The wavelength selection process of UVE is introduced by using A-RAW spectra as an example, and it its selection process is shown in Figure 7. Yellow curve is the original variable and red curve is the filtered-free variable. The dotted line in Figure 7 shows the threshold splitting line with upper and lower limits of ±37.9147. According to the UVE selection principle, wavelengths within the threshold split line should be discarded, and wavelengths outside the threshold split line region are selected as characteristic wavelengths [28].Figure 7
Process and results of A-RAW-UVE characteristic wavelength selection.The results of theR spectra characteristic wavelength selection are shown in Figure 8. The R-RAW spectra have 10 characteristic wavelengths selected by the CARS algorithm, accounting for 5.68% of the total number of spectra. The 21 characteristic wavelengths selected by UVE for the R-RAW spectra are shown in Figure 8(b), accounting for 11.93% of the total number of spectra. The 10 characteristic wavelengths selected by CARS for R-GF spectra are shown in Figure 8(c), accounting for 5.68% of the total number of spectra. The 57 characteristic wavelengths selected by the R-GF spectra by the UVE algorithm are shown in Figure 8(d), accounting for 32.39% of the total number of spectra. The 16 characteristic wavelengths selected by CARS for the R-COW spectra are shown in Figure 8(e), accounting for 9.09% of the total number of spectra. The 111 characteristic wavelengths of the R-COW spectra selected by the UVE algorithm are shown in Figure 8(f), accounting for 63.07% of the total number of spectra.Figure 8
Results ofR spectra characteristic wavelength selection based on CARS and UVE. Characteristic wavelength of R-RAW spectra selected based on (a) CARS and (b) UVE. Characteristic wavelength of R-GF spectra selected based on (c) CARS and (d) UVE. Characteristic wavelength of R-COW spectra selected based on (e) CARS and (f) UVE.
(a)(b)(c)(d)(e)(f)The results of characteristic wavelength selection for theA spectra are shown in Figure 9. The 75 characteristic wavelengths selected by CARS for the A-RAW spectra are shown in Figure 9(a), accounting for 42.61% of the number of wavelengths in the full spectra. The 98 characteristic wavelength points selected by CARS for the A-RAW spectra are shown in Figure 9(b), accounting for 55.68% of the number of wavelengths in the full spectra. The 85 characteristic wavelengths selected by CARS for the A-GF spectra are shown in Figure 9(c), accounting for 48.3% of the number of wavelengths in the full spectra. The 97 characteristic wavelengths of the A-GF spectra selected by UVE are shown in Figure 9(d), accounting for 55.11% of the number of wavelengths in the full spectra. The 6 characteristic wavelengths selected by CARS for the A-COW spectra are shown in Figure 9(e), accounting for 3.41% of the number of wavelengths in the full spectra. The 71 characteristic wavelengths of the A-COW spectra selected by UVE are shown in Figure 9(f), accounting for 40.34% of the number of wavelengths in the full spectra.Figure 9
Results of the selection ofA spectra characteristic wavelengths based on CARS and UVE. Characteristic wavelength of the A-RAW spectra selected based on (a) CARS and (b) UVE. Characteristic wavelength of the A-GF spectra selected based on (c) CARS and (d) UVE. Characteristic wavelength of the A-COW spectra selected based on (e) CARS and (f) UVE.
(a)(b)(c)(d)(e)(f)The results of characteristic wavelength selection forK-M spectra are shown in Figure 10. 75 characteristic wavelengths selected by CARS for K-M-RAW spectra are shown in Figure 10(a), accounting for 42.61% of the number of wavelengths in the full spectra. The 98 characteristic wavelengths selected by CARS for K-M-RAW spectra are shown in Figure 10(b), accounting for 55.68% of the number of wavelengths in the full spectra. The 43 characteristic wavelengths selected by CARS for K-M-GF spectra are shown in Figure 10(c), accounting for 24.43% of the number of wavelengths in the full spectra. The 103 characteristic wavelengths of K-M-GF spectra selected by UVE are shown in Figure 10(d), accounting for 58.52% of the number of wavelengths in the full spectra. The 33 characteristic wavelengths selected by CARS for K-M-COW spectra are shown in Figure 10(e), accounting for 18.75% of the number of wavelengths in the full spectra. The 60 characteristic wavelengths of A-GF spectra selected by UVE are shown in Figure 10(f), accounting for 34.09% of the number of wavelengths in the full spectra.Figure 10
Results ofK-M spectral characteristic wavelength selection based on CARS and UVE. Characteristic wavelength of the K-M-RAW spectra selected based on (a) CARS and (b) UVE. Characteristic wavelength of the K-M-GF spectra selected based on (c) CARS and (d) UVE. Characteristic wavelength of the K-M-COW spectra selected based on (e) CARS and (f) UVE.
(a)(b)(c)(d)(e)(f)From the characteristic wavelength selection results of CARS and UVE, it can be seen that the number of characteristic wavelengths selected by UVE is significantly more than the number of characteristic wavelengths selected by CARS. The reason for this may be that both CARS and UVE are characteristic wavelength selection methods based on the regression coefficients of the PLS model, but UVE uses the regression coefficients as a measure of wavelength importance, while the CARS uses the absolute value of the regression coefficients as a measure of wavelength importance [22, 23]. Zhou et al. [6] used hyperspectral to detect sugar content in pears, and the characteristic wavelength selection of spectral wavelengths was performed by CARS and UVE, and their results showed that the number of characteristic wavelengths selected by UVE (390) was more than the number of characteristic wavelengths selected by CARS (42).


### 3.5. Results and Analysis of Spectral Models of Characteristic Wavelengths

The SVM model based on the characteristic spectra selected by CARS and UVE screening was selected with the number of wavelengths from 6 (A-COW-CARS) to 111 (K-M-RAW-UVE). The discrimination results of the SVM model are shown in Table4. The 58 characteristic wavelengths of the R-GF spectra selected by UVE in the R spectra have the highest discrimination accuracy, with 95.32% and 100% for the test and calibration sets. The 75 characteristic wavelengths of the A-RAW spectra selected by CARS in the A spectra have the highest discrimination accuracy, with 96.88% and 100% for the test and calibration sets. The 43 characteristic wavelengths of K-M-GF spectra selected by CARS in K-M spectra have the highest discrimination accuracy, with 93.75% and 96.88% for the test and calibration sets.Table 4
Discriminant results of SVM based on the characteristic wavelengths ofR, A, and K-M spectra.
SpectraPretreatmentWavelength selectionNumber of characteristic wavelengthsDiscriminant accuracy (%)Test setCalibration setRRAWCARS1084.3881.81GF1085.9483.33COW1693.7592.19RAWUVE2196.8895.83GF5895.31100COW11195.3193.75ARAWCARS7596.88100GF8593.7597.4COW682.8190.63RAWUVE9890.6397.4GF9789.0691.67COW7192.1999.48K-MRAWCARS1587.591.67GF4393.7596.88COW3378.1386.46RAWUVE11193.7594.79GF10395.3194.27COW6093.7594.27The optimal model based on theR spectra after characteristic wavelength selection is the R-RAW-UVE-SVM model, and the confusion matrix of model discrimination results are shown in Figure 11(a). 1 sound sample in the test set is misclassified as level I damage sample, and 1 level II damage sample is misclassified as level I damage sample. 2 sound samples in the calibration set are misclassified as level II damage samples, 2 level I damage samples are misclassified as level II damage samples, 2 level II damage samples are misclassified as level I damage samples and level III damage, and 2 level III damage samples are misclassified as level II damage samples. The optimal model based on the A spectra after characteristic wavelength selection is A-RAW-CARS-SVM, and the confusion matrix of the model discrimination results is shown in Figure 11(b). 1 sound sample in the test set is misclassified as the level II damage sample, and 1 level II damage sample was misclassified as the level I damage sample. There are no misclassified samples in the calibration set. The optimal model based on the A spectra after characteristic wavelength selection is A-RAW-CARS-SVM. The confusion matrix of the model discrimination results is shown in Figure 11(b), where 1 sound sample in the test set is misclassified as level II damage sample and 1 level II damage sample is misclassified as the level I damage sample. There are no misclassified samples in the calibration set. The optimal model based on K-M spectra is the K-M-GF-UVE-SVM model. The confusion matrix of model discrimination results is shown in Figure 11(c). 1 sound sample in the test set is misclassified as level I damage sample; 2 level II damage samples is misclassified as level I damage samples. 2 sound samples in the calibration set are misclassified as level II damage samples, 1 sound sample is misclassified as level I damage sample, 2 level I damage samples are misclassified as level II damage samples, 1 level I damage sample is misclassified as level III damage sample, 2 level III damage samples are misclassified as level I damage, 2 level III damage samples are misclassified as level II damage samples, and 1 level III damage sample is misclassified as level I damage sample.Figure 11
Confusion matrix of the optimal SVM model discrimination results based onR, A, and K-M spectra after wavelength selection. Confusion matrix for the discriminant results of the (a) R-RAW-UVE-SVM model, (b) A-RAW-CARS-SVM model, and (c) K-M-GF-UVE-SVM model.
(a)(b)(c)The discriminant results are shown in the confusion matrix of Figure11, the macro-F values of the R-RAW-UVE-SVM model, A-RAW-CARS-SVM model, and K-M-GF-UVE-SVM model are calculated by (4), and the results are shown in Table 5.Table 5
Macro-F1 results of SVM model discrimination based on R-RAW-UVE, A-RAW-CARS, and K-M-GF-UVE spectra.
Spectral modelsFi valueMacro-F valueSoundIIIIIIR-RAW-UVE0.97600.95820.93130.97640.9605A-RAW-CARS0.99210.99220.984410.9922K-M-GF-UVE0.96770.92430.92310.96830.9481Table5 shows that the macro-F value of the R-RAW-UVE-SVM model, RAW-CARS-SVM model, and K-M-GF-SVM model is 0.9605, 0.9922, and 0.9481, respectively. The closer the macro-F value is to 1, the higher the precision of the model is indicated. From Tables 4 and 5, it can be found that the accuracy and precision of the SVM model based on the A spectra after characteristic wavelength selection are higher than those of the R spectra and K-M spectra after characteristic wavelength selection. The results demonstrate that the A spectra by CARS has the best model discrimination performance. The CARS, which is widely used for characteristic wavelength selection of spectral data, is an effective characteristic wavelength selection method. Xuan et al. [29] used the characteristic wavelengths of R spectra selected by CARS to build MLR models to assess soluble solids (SSC) and hardness of peaches, and the results showed that hyperspectral combined with MLR had best discrimination results. Zhan et al. [30] selected the characteristic wavelengths of hyperspectral by pairing methods such as CARS and UVE. The results showed that the nonlinear model partial least squares support vector machine (LS-SVM) by CARS-selected spectra had the best results for pear fragrance identification.


## 3.1. Spectral Analysis of Crown Pear

TheR, A, and K-M spectral data for sound and samples with different levels of damage were averaged, and their spectral curves were plotted. The mean values of the damage levels of the R spectra are shown in Figure 3(a), with the sound samples exhibiting the highest spectral reflectance, followed by the level I damage and level II damage and finally the level III damage. There is a significant decrease in the spectral reflectance of the damaged crown pear, and the reason for the spectral difference is mainly due to the rupture of the cell membrane of the crown pear after damage, which led to water loss and easy oxidation, which is consistent with the results of research on apple damage [22]. Figures 3(b) and 3(c) show that the curve characteristics of the A spectral and K-M spectral are different, and the A spectral and K-M spectral curves show that the spectral values of level III damage, level I damage, level II damage, and sound samples become lower in sequence. The different trends and characteristics presented by the three spectral curves are the basis for model discrimination.Figure 3
Raw spectral curves of(a)R, (b) A and, (c) K-M.
(a)(b)(c)


## 3.2. Spectral Pretreatment

The spectra are usually pretreated before building a discriminant model. The purpose of pretreatment is to extract valid information and eliminate background information and noise. TheR, A, and K-M spectra of crown pears were pretreated based on GF, MSC, SNV, COW, and SGD, and the changes in the spectra after pretreatment were described as an example of reflectance spectra. Figure 4 shows that the spectral characteristics of the R spectra change significantly after different pretreatments, and these changes are more pronounced at the wave peaks and troughs. Gaussian filtering is calculated by Gaussian function to reduce the self-noise of raw spectra. MSC and SNV methods are mainly used to eliminate the scattering effect from the inhomogeneous distribution of particles and particle size. COW aligns two signals by segmenting the spectra with linear stretching and compression. SGD can be used to effectively eliminate the baseline and other background interference by performing 1st derivative on the spectral curve.Figure 4
Curves of raw and pretreatedR spectra.


## 3.3. Model Building and Analysis

The accuracy of the discrimination results of PLS-DA based onR spectra, A spectra, and K-M spectra is shown in Table 1. The best model based on the R spectra is the model pretreated by SNV with the discrimination accuracies of 64.06% and 65.63% for the test and calibration sets. The best model based on A spectra is the model pretreated by COW with discrimination accuracies of 60.94% and 54.17% for the test and calibration sets. The best model based on K-M spectra is the model based on RAW with the discrimination accuracies of 64.06% and 75.52% for the test and calibration sets, respectively. From the discriminant results, it is clear that the K-M spectra exhibits the best modeling performance in the PLS-DA discriminant model.Table 1
Discriminant accuracy of the PLS-DA model based onR, A, and K-M spectra.
SpectraPretreatmentAccuracy (%), test set/calibration setSoundIIIIIITotalRRAW50.00/66.6787.50/62.531.25/60.4268.75/70.8363.33/65.10GF50.00/66.6787.50/62.531.25/60.4268.75/70.8363.33/65.10SNV62.50/7587.50/64.5843.75/60.4262.50/62.564.06/65.63MSC62.50/7587.50/64.5843.75/60.4262.50/62.564.06/65.63COW43.75/66.67100/70.8337.5/85.4268.75/77.0862.5/75SGD50/72.9281.25/81.2543.75/70.8362.5/77.0859.38/74.48ARAW43.75/68.7587.50/7537.5/79.1762.50/72.9257.81/73.96GF50.00/68.7593.75/7537.5/79.1762.50/70.8357.81/73.44SNV68.75/72.9268.75/68.7537.5/60.4256.25/62.557.81/66.15MSC68.75/72.9268.75/68.7537.5/60.4256.25/62.557.81/66.15COW62.5/62.535.42/93.7518.75/54.1768.75/64.5860.94/54.17SGD50/79.1762.5/39.5825/43.7562.5/54.1750/48.96K-MRAW50/7587.5/77.0850/81.2543.75/81.2564.06/75.52GF50/70.8387.5/77.0831.25/81.2556.25/81.2556.25/74.48SNV43.75/81.2575/70.8337.5/62.556.25/60.4253.13/68.75MSC43.75/79.1781.25/68.7537.5/58.3356.25/62.552.08/67.19COW43.75/7593.75/81.2543.75/62.568.75/68.7562.5/71.88SGD37.5/58.3393.75/64.5831.25/54.1750/56.2553.13/58.33The accuracy of the discrimination results of the SVM model based onR spectra, A spectra, and K-M spectra is shown in Table 2. The best model based on R spectra is the model based on RAW with discrimination accuracy of 96.88% and 98.96% for the test and calibration sets. The best model based on A spectra is the model based on RAW with discrimination accuracies of 100% and 98.98% for the test and calibration sets. The best model based on K-M spectra is the model based on COW with discrimination accuracy of 95.31% and 98.44% for the test and calibration sets. From the discriminant results, it is clear that the SVM model has the best discriminant performance based on A spectra.Table 2
Discriminant accuracy of SVM models based onR, A, and K-M spectra.
SpectraPretreatmentAccuracy (%), test set/calibration setSoundIIIIIITotalRRAW100/97.92100/10087.5/97.9293.75/10095.31/98.96GF100/97.92100/10087.5/97.92100/10096.88/98.96SNV98.44/10081.25/95.8381.25/10081.25/97.9284.38/98.44MSC93.75/10081.25/89.5881.25/93.7587.50/95.8385.94/94.79COW87.5/95.8393.75/83.3375/87.5100/93.7589.06/90.10SGD93.75/95.8381.25/87.568.75/85.4287.5/95.8381.25/91.15ARAW100/98.44100/100100/98.44100/100100/98.98GF100/98.4493.75/10093.75/100100/10096.88/99.48SNV93.75/10075/93.7587.5/95.8381.25/10084.38/96.88MSC93.75/10075/93.7587.5/95.8381.25/98.4484.38/96.88COW100/97.9287.5/10087.5/10093.75/95.8392.19/98.44SGD100/97.9262.5/87.562.5/91.6775/89.5875/91.67K-MRAW100/10093.75/97.9287.5/10093.75/10093.75/99.48GF100/10093.75/97.9287.5/10093.75/10093.75/99.48SNV87.5/10085.71/91.6768.75/89.5887.5/95.8379.69/94.27MSC87.5/10085.71/91.6768.75/89.5887.5/95.8379.69/94.27COW100/10087.5/95.8393.75/100100/97.9295.31/98.44SGD75/10087.5/10068.75/10093.75/97.9279.69/99.48From the discriminant results in Tables1 and 2, it is clear that the performance of the SVM model by GF is best among the models based on R spectra. Among the models based on the A spectra, the SVM model when the A spectra is not pretreated has the best performance. Among the models based on K-M spectra, the SVM model by COW pretreatment has the best performance. The discrimination results of the models show that the SVM model has a higher discrimination accuracy than the PLS-DA model. The reason for the poor discriminatory ability of PLS-DA may be due to the fact that the spectral information does not have a linear correlation with the level of cellular water loss of the sample under test reducing the predictive ability. In contrast, SVM is a nonlinear classification by the kernel method, so it obtains high discrimination accuracy in the detection different damage levels of crown pears. Cao et al. [23] used hyperspectral combined with SVM and PLS models to detect the damage level of pears, and the results showed that the SVM model was more accurate in predicting the damage level of pears. The results of the experimental discrimination show that SVM can be used to effectively discriminate the damage level of pears.The discriminant results of the optimal models inR, A, and K-M spectra are analyzed separately. The optimal model based on R spectra is R-GF-SVM, and the confusion matrix of the model discrimination results is shown in Figure 5(a). 2 level II damage samples in the test set are misclassified as level I damage sample: 1 sound sample in the calibration set is misclassified as level I damage sample, and 1 level II damage sample is misclassified as level III damage sample. The optimal model based on A spectra is A-RAW-SVM, and the confusion matrix of model discrimination results is shown in Figure 5(b). There are no misclassified samples in the test set; 1 sound sample in the calibration set is misclassified as level II damage sample, and 1 level II damage sample is misclassified as level III damage sample. The optimal model based on K-M spectra is K-M-COW-SVM, and the confusion matrix of the model discrimination results is shown in Figure 5(c). 2 level I damage samples in the test set are misclassified as level II damage sample, and 1 level II damage sample is misclassified as 1 sound sample. 2 level I damage samples in the calibration set are misclassified as level II damage samples, and 1 level III damage sample is misclassified as level II damage sample.Figure 5
Confusion matrix of the discriminant results of the optimal SVM model based onR, A, and K-M spectra. Confusion matrix of discriminant results of the (a) R-GF-SVM model, (b) A-RAW-SVM model, and (c) K-M-COW-SVM model.
(a)(b)(c)The precision of the model discrimination is calculated, and the discrimination results are shown in Figure5. The accuracy rates of the R-GF-SVM model, A-RAW-SVM model, and K-M-COW-SVM model are calculated by (4), and the results are shown in Table 3.Table 3
Results of macro-F for SVM models based on R-GF, A-RAW, and K-M-COW spectra.
Discriminant modelFi valueMacro-F valueSoundIIIIIIR-GF-SVM0.99210.97710.97600.99220.9844A-RAW-SVM0.992110.98440.99220.9922K-M-COW-SVM0.99220.96770.95460.99210.9767The macro-F value of the R-GF-SVM model, A-RAW-SVM model, and A-RAW-SVM is 0.9844, 0.9922, and 0.9767, respectively. The closer the macro-F value is to 1, the higher the precision of the model is indicated [24]. From Tables 2 and 3, it can be found that the performance model based on A spectra is best, and its accuracy and precision are higher than R spectra and K-M spectra.


## 3.4. Selection of Characteristic Wavelength

To simplify the spectral dataset and enhance the speed of the model run, CARS and UVE were used to filter the spectra with better modeling results for the characteristic wavelengths, respectively. A total of nine spectra were selected, and their discrimination accuracies were all greater than 89.06%, which were R-RAW, R-GF, R-COW, A-RAW, A-GF, A-COW, K-M-RAW, K-M-GF, and K-M-COW. The subset of wavelengths with the smallest RMSECV was obtained by first building a partial least squares model in CARS, and then, the wavelengths in the model were selected that correspond to the larger regression coefficients [25]. The A-RAW spectra are used as an example to introduce the characteristic wavelength selection of CARS, and its selection process is shown in Figure 6. CARS is performed 100 times sampling by sampling, and the number of sample variables gradually decreases as the number of samples sampled increase. RMSECV decreases and then increases to a minimum value of 0.4902 at 20 runs, with the characteristic wavelength determined by the minimum RMSEP during the sampling run [26].Figure 6
Process and results of A-RAW-CARS characteristic wavelength selection.The PLS model was established in UVE by cross-validation, and then, the ratio of the mean and standard deviation of the regression coefficients of the PLS model was calculated to select valid spectral information [27]. The wavelength selection process of UVE is introduced by using A-RAW spectra as an example, and it its selection process is shown in Figure 7. Yellow curve is the original variable and red curve is the filtered-free variable. The dotted line in Figure 7 shows the threshold splitting line with upper and lower limits of ±37.9147. According to the UVE selection principle, wavelengths within the threshold split line should be discarded, and wavelengths outside the threshold split line region are selected as characteristic wavelengths [28].Figure 7
Process and results of A-RAW-UVE characteristic wavelength selection.The results of theR spectra characteristic wavelength selection are shown in Figure 8. The R-RAW spectra have 10 characteristic wavelengths selected by the CARS algorithm, accounting for 5.68% of the total number of spectra. The 21 characteristic wavelengths selected by UVE for the R-RAW spectra are shown in Figure 8(b), accounting for 11.93% of the total number of spectra. The 10 characteristic wavelengths selected by CARS for R-GF spectra are shown in Figure 8(c), accounting for 5.68% of the total number of spectra. The 57 characteristic wavelengths selected by the R-GF spectra by the UVE algorithm are shown in Figure 8(d), accounting for 32.39% of the total number of spectra. The 16 characteristic wavelengths selected by CARS for the R-COW spectra are shown in Figure 8(e), accounting for 9.09% of the total number of spectra. The 111 characteristic wavelengths of the R-COW spectra selected by the UVE algorithm are shown in Figure 8(f), accounting for 63.07% of the total number of spectra.Figure 8
Results ofR spectra characteristic wavelength selection based on CARS and UVE. Characteristic wavelength of R-RAW spectra selected based on (a) CARS and (b) UVE. Characteristic wavelength of R-GF spectra selected based on (c) CARS and (d) UVE. Characteristic wavelength of R-COW spectra selected based on (e) CARS and (f) UVE.
(a)(b)(c)(d)(e)(f)The results of characteristic wavelength selection for theA spectra are shown in Figure 9. The 75 characteristic wavelengths selected by CARS for the A-RAW spectra are shown in Figure 9(a), accounting for 42.61% of the number of wavelengths in the full spectra. The 98 characteristic wavelength points selected by CARS for the A-RAW spectra are shown in Figure 9(b), accounting for 55.68% of the number of wavelengths in the full spectra. The 85 characteristic wavelengths selected by CARS for the A-GF spectra are shown in Figure 9(c), accounting for 48.3% of the number of wavelengths in the full spectra. The 97 characteristic wavelengths of the A-GF spectra selected by UVE are shown in Figure 9(d), accounting for 55.11% of the number of wavelengths in the full spectra. The 6 characteristic wavelengths selected by CARS for the A-COW spectra are shown in Figure 9(e), accounting for 3.41% of the number of wavelengths in the full spectra. The 71 characteristic wavelengths of the A-COW spectra selected by UVE are shown in Figure 9(f), accounting for 40.34% of the number of wavelengths in the full spectra.Figure 9
Results of the selection ofA spectra characteristic wavelengths based on CARS and UVE. Characteristic wavelength of the A-RAW spectra selected based on (a) CARS and (b) UVE. Characteristic wavelength of the A-GF spectra selected based on (c) CARS and (d) UVE. Characteristic wavelength of the A-COW spectra selected based on (e) CARS and (f) UVE.
(a)(b)(c)(d)(e)(f)The results of characteristic wavelength selection forK-M spectra are shown in Figure 10. 75 characteristic wavelengths selected by CARS for K-M-RAW spectra are shown in Figure 10(a), accounting for 42.61% of the number of wavelengths in the full spectra. The 98 characteristic wavelengths selected by CARS for K-M-RAW spectra are shown in Figure 10(b), accounting for 55.68% of the number of wavelengths in the full spectra. The 43 characteristic wavelengths selected by CARS for K-M-GF spectra are shown in Figure 10(c), accounting for 24.43% of the number of wavelengths in the full spectra. The 103 characteristic wavelengths of K-M-GF spectra selected by UVE are shown in Figure 10(d), accounting for 58.52% of the number of wavelengths in the full spectra. The 33 characteristic wavelengths selected by CARS for K-M-COW spectra are shown in Figure 10(e), accounting for 18.75% of the number of wavelengths in the full spectra. The 60 characteristic wavelengths of A-GF spectra selected by UVE are shown in Figure 10(f), accounting for 34.09% of the number of wavelengths in the full spectra.Figure 10
Results ofK-M spectral characteristic wavelength selection based on CARS and UVE. Characteristic wavelength of the K-M-RAW spectra selected based on (a) CARS and (b) UVE. Characteristic wavelength of the K-M-GF spectra selected based on (c) CARS and (d) UVE. Characteristic wavelength of the K-M-COW spectra selected based on (e) CARS and (f) UVE.
(a)(b)(c)(d)(e)(f)From the characteristic wavelength selection results of CARS and UVE, it can be seen that the number of characteristic wavelengths selected by UVE is significantly more than the number of characteristic wavelengths selected by CARS. The reason for this may be that both CARS and UVE are characteristic wavelength selection methods based on the regression coefficients of the PLS model, but UVE uses the regression coefficients as a measure of wavelength importance, while the CARS uses the absolute value of the regression coefficients as a measure of wavelength importance [22, 23]. Zhou et al. [6] used hyperspectral to detect sugar content in pears, and the characteristic wavelength selection of spectral wavelengths was performed by CARS and UVE, and their results showed that the number of characteristic wavelengths selected by UVE (390) was more than the number of characteristic wavelengths selected by CARS (42).


## 3.5. Results and Analysis of Spectral Models of Characteristic Wavelengths

The SVM model based on the characteristic spectra selected by CARS and UVE screening was selected with the number of wavelengths from 6 (A-COW-CARS) to 111 (K-M-RAW-UVE). The discrimination results of the SVM model are shown in Table4. The 58 characteristic wavelengths of the R-GF spectra selected by UVE in the R spectra have the highest discrimination accuracy, with 95.32% and 100% for the test and calibration sets. The 75 characteristic wavelengths of the A-RAW spectra selected by CARS in the A spectra have the highest discrimination accuracy, with 96.88% and 100% for the test and calibration sets. The 43 characteristic wavelengths of K-M-GF spectra selected by CARS in K-M spectra have the highest discrimination accuracy, with 93.75% and 96.88% for the test and calibration sets.Table 4
Discriminant results of SVM based on the characteristic wavelengths ofR, A, and K-M spectra.
SpectraPretreatmentWavelength selectionNumber of characteristic wavelengthsDiscriminant accuracy (%)Test setCalibration setRRAWCARS1084.3881.81GF1085.9483.33COW1693.7592.19RAWUVE2196.8895.83GF5895.31100COW11195.3193.75ARAWCARS7596.88100GF8593.7597.4COW682.8190.63RAWUVE9890.6397.4GF9789.0691.67COW7192.1999.48K-MRAWCARS1587.591.67GF4393.7596.88COW3378.1386.46RAWUVE11193.7594.79GF10395.3194.27COW6093.7594.27The optimal model based on theR spectra after characteristic wavelength selection is the R-RAW-UVE-SVM model, and the confusion matrix of model discrimination results are shown in Figure 11(a). 1 sound sample in the test set is misclassified as level I damage sample, and 1 level II damage sample is misclassified as level I damage sample. 2 sound samples in the calibration set are misclassified as level II damage samples, 2 level I damage samples are misclassified as level II damage samples, 2 level II damage samples are misclassified as level I damage samples and level III damage, and 2 level III damage samples are misclassified as level II damage samples. The optimal model based on the A spectra after characteristic wavelength selection is A-RAW-CARS-SVM, and the confusion matrix of the model discrimination results is shown in Figure 11(b). 1 sound sample in the test set is misclassified as the level II damage sample, and 1 level II damage sample was misclassified as the level I damage sample. There are no misclassified samples in the calibration set. The optimal model based on the A spectra after characteristic wavelength selection is A-RAW-CARS-SVM. The confusion matrix of the model discrimination results is shown in Figure 11(b), where 1 sound sample in the test set is misclassified as level II damage sample and 1 level II damage sample is misclassified as the level I damage sample. There are no misclassified samples in the calibration set. The optimal model based on K-M spectra is the K-M-GF-UVE-SVM model. The confusion matrix of model discrimination results is shown in Figure 11(c). 1 sound sample in the test set is misclassified as level I damage sample; 2 level II damage samples is misclassified as level I damage samples. 2 sound samples in the calibration set are misclassified as level II damage samples, 1 sound sample is misclassified as level I damage sample, 2 level I damage samples are misclassified as level II damage samples, 1 level I damage sample is misclassified as level III damage sample, 2 level III damage samples are misclassified as level I damage, 2 level III damage samples are misclassified as level II damage samples, and 1 level III damage sample is misclassified as level I damage sample.Figure 11
Confusion matrix of the optimal SVM model discrimination results based onR, A, and K-M spectra after wavelength selection. Confusion matrix for the discriminant results of the (a) R-RAW-UVE-SVM model, (b) A-RAW-CARS-SVM model, and (c) K-M-GF-UVE-SVM model.
(a)(b)(c)The discriminant results are shown in the confusion matrix of Figure11, the macro-F values of the R-RAW-UVE-SVM model, A-RAW-CARS-SVM model, and K-M-GF-UVE-SVM model are calculated by (4), and the results are shown in Table 5.Table 5
Macro-F1 results of SVM model discrimination based on R-RAW-UVE, A-RAW-CARS, and K-M-GF-UVE spectra.
Spectral modelsFi valueMacro-F valueSoundIIIIIIR-RAW-UVE0.97600.95820.93130.97640.9605A-RAW-CARS0.99210.99220.984410.9922K-M-GF-UVE0.96770.92430.92310.96830.9481Table5 shows that the macro-F value of the R-RAW-UVE-SVM model, RAW-CARS-SVM model, and K-M-GF-SVM model is 0.9605, 0.9922, and 0.9481, respectively. The closer the macro-F value is to 1, the higher the precision of the model is indicated. From Tables 4 and 5, it can be found that the accuracy and precision of the SVM model based on the A spectra after characteristic wavelength selection are higher than those of the R spectra and K-M spectra after characteristic wavelength selection. The results demonstrate that the A spectra by CARS has the best model discrimination performance. The CARS, which is widely used for characteristic wavelength selection of spectral data, is an effective characteristic wavelength selection method. Xuan et al. [29] used the characteristic wavelengths of R spectra selected by CARS to build MLR models to assess soluble solids (SSC) and hardness of peaches, and the results showed that hyperspectral combined with MLR had best discrimination results. Zhan et al. [30] selected the characteristic wavelengths of hyperspectral by pairing methods such as CARS and UVE. The results showed that the nonlinear model partial least squares support vector machine (LS-SVM) by CARS-selected spectra had the best results for pear fragrance identification.


## 4. Conclusions

In this study, theR spectra of sound as well as level I, II, and III damaged crown pears were acquired separately using a hyperspectral acquisition system, and then, the A spectra and K-M spectra were obtained from the R spectra by transformation of the equations. Linear PLS-DA models and nonlinear SVM models were developed for each of the three spectra and the discriminant results were explained. It was found that as the level of damage of the crown pears increases, the spectral reflectance decreased and the spectral absorbance increased. In the R, A, and K-M spectra models, the nonlinear SVM model was found to outperform the linear PLS-DA model by discriminating the results. The SVM discriminant model based on the A spectra outperformed the R and K-M spectra, and the discriminant accuracy of the test and correction sets of the SVM model based on A-RAW spectra was 100% and 98.98%, respectively. Moreover, the macro-F value of the model was 0.9922, and the A-RAW-SVM model showed high discrimination accuracy. Two false samples were found in the SVM discriminant model based on the characteristic wavelengths of the A-RAW spectra after CARS selection, and the number of false samples was the same as before CARS selection. The macro-F value of the A-RAW-CARS-SVM model after CARS selection was 0.9922, and the accuracy of the model was the same as that of the full spectra model, while the discriminant time of the model time was greatly reduced. In conclusion, the hyperspectral technology can be used to discriminate different damage levels of crown pears, and the nonlinear SVM model based on the A spectra has better discriminative effect on different damage levels of crown pears.



---

*Source: 9094249-2022-12-03.xml*