-
由于原始光谱的起始端和末端有较大的噪声,为了消除噪声的影响,选择波长204.7nm~997.6nm为有效的光谱区域,该区域有1024个波段,去除噪声的苹果疤痕区域和正常区域的光谱反射率曲线如图 3所示。其中图 3a为200个苹果样本的光谱反射率,图 3b为苹果表面疤痕区域和正常区域的平均光谱反射率曲线。整体上来看,完好无损和表面具有疤痕苹果的平均光谱曲线的变化趋势基本一致,在400nm~700nm波段内,光谱反射率呈现出由低→高→低的趋势,即在蓝光波段430nm~500nm低,黄绿波段520nm~590nm高,橙红波段600nm~680nm低[19]。在680nm~710nm波段内急剧上升,在720nm~930nm波段内平均光谱反射率较高,在930nm~1000nm波段出现吸收谷。在450nm和675nm处具有明显的吸收峰,主要由苹果表面叶绿素的吸收引起的,反映了苹果的表面颜色信息,而980nm处的吸收峰则主要由苹果中的水分吸收所引起的,反映了苹果的水分含量信息[20]。然而,由于完好无损和表面具有疤痕苹果表面叶绿素含量以及水分含量的不同,导致完好无损和表面具有疤痕苹果的平均光谱反射率在400nm~1000nm波段内存在较大的差异。因此, 根据此光谱差异建立识别模型进而识别苹果表面疤痕。
-
在建立识别模型之前需对原始光谱数据进行预处理,以减少噪声的干扰,提高模型的识别准确率和稳定性。本实验中分别采用了两种光谱预处理方法(SNV和1阶导数)来消除原始光谱数据中的噪声,获得更高信噪比的光谱,以助于后续建立识别模型的稳健性和识别结果的扩展性。经过SNV和1阶导数处理后的光谱反射率曲线如图 4所示。将获得预处理后的光谱数据导入MATLAB软件中建立相关模型。
-
将SNV和1阶导数处理后的光谱数据进一步经PCA变换后的第一主成分和第二主成分2维平面分布图如图 5所示。从图中可以发现, 除个别样本是分散开的,总体上分为两类(如图中实线和虚线所示),具有较好的分类结果。经PCA变换后的前8个主成分(P1~P8)得分的贡献率及其累计贡献率见表 1。从表 1可以看出, 前8个主成分(P1~P8)的累计贡献率为99.21%,即可表达99%以上的原始光谱数据的信息。因此,为了提高识别模型的识别准确率,将前8个主成分(P1~P8)作为样本集特征光谱,很好地实现了光谱数据的降维,提高了模型的识别效率。
Table 1. Contribution rate of principal component score
principal component P1 P2 P3 P4 P5 P6 P7 P8 contribution rate /% 55.63 31.59 5.86 3.54 2.27 0.55 0.45 0.32 cumulative contribution rate /% 55.63 87.22 93.08 96.62 97.89 98.44 98.89 99.21 -
结合不同的光谱预处理方法以及PCA变换,建立KNN和PLS-DA识别模型,分别对200个实验样本进行识别检测,检测结果见表 2。从表 2可以看出,经过SNV和1阶导数预处理后建立的两种识别模型对校正集和预测集中样本的识别正确率均在92.0%以上,且KNN识别模型的整体识别性能要优于PLS-DA识别模型,其中1阶导数+KNN识别模型对校正集中正常果和疤痕果正确检出144个,正确率高达96.0%,而SNV+KNN识别模型对预测集中正常果和疤痕果正确检出48个,正确率高达96.0%;整体上来看,1阶导数光谱预处理方法具有较好的建模效果,SNV光谱预处理方法具有较好的预测效果。另外,两种识别模型都误将校正集和预测集中的疤痕果识别为正常果,误检的主要原因是部分苹果表面有疤痕的区域较小,利用光纤光谱采集系统收集表面有疤痕区域苹果样本的光谱反射率包含了部分正常区域,为了提高识别正确率,以后要联合多种识别方法完成对水果表面疤痕的检测。
Table 2. Discriminant results of KNN and PLS-DA models
discriminant models calibration set (150) prediction set (50) number rate/% number rate/% derivative+KNN 144 96.0 46 92.0 SNV+KNN 141 94.0 48 96.0 derivative+PLS-DA 142 94.7 46 92.0 SNV+PLS-DA 140 93.3 47 94.0
光纤光谱结合模式识别无损检测苹果表面疤痕
Nondestructive detection of apple defect combining optical fiber spectra with pattern recognition
-
摘要: 为了实现基于光纤光谱技术结合模式识别无损检测苹果表面疤痕, 利用光纤光谱采集系统采集了完好无损和表面有疤痕苹果的光谱数据, 采用标准正态变换(SNV)和1阶导数对原始光谱数据进行预处理; 利用主成分分析方法对预处理后的光谱数据进行降维, 以提取能反映苹果表面疤痕的特征光谱; 利用k最近邻(KNN)模式识别方法和偏最小二乘判别分析方法, 建立了苹果表面疤痕的识别模型。结果表明, 采用主成分分析法选择了累计贡献率超过99%的前8个主成分作为样本集特征光谱数据, 很好地实现了光谱数据的降维; 利用1阶导数+KNN识别模型对校正集以及SNV+KNN识别模型对预测集中正常果和疤痕果的正确率识别均高达96.0%。验证了基于光纤光谱技术结合模式识别方法无损检测苹果表面疤痕的可行性。Abstract: In order to prove that the non-destructive detection of apple surface defect combining optical fiber spectroscopy with pattern recognition was effective, an optical fiber spectrum acquisition system was used to collect spectral data of apples with and without surface defect. Standard normal variation (SNV) and first derivative were used to preprocess the original spectral data. Principal component analysis (PCA) was used to reduce the dimension of the pre-processed spectral data to extract the characteristic spectra of apples with surface defect. By using k nearest neighbor (KNN) pattern recognition method and partial least squares discriminant analysis method, recognition model of apple defect was established. The results show that, the first eight principal components with cumulative contribution over 99% are selected as the characteristic spectral data of the sample set by using principal component analysis and the dimensionality reduction of spectral data is well realized. By using first order derivative+KNN recognition model for correction set and SNV+KNN recognition model for prediction concentration, the recognition rate of normal apples and defected apples is 96.0%. The feasibility of non-destructive detection of apple surface defect based on optical fiber spectroscopy and pattern recognition is verified.
-
Key words:
- fiber optics /
- nondestructive detection /
- pattern detection /
- apple defect
-
Table 1. Contribution rate of principal component score
principal component P1 P2 P3 P4 P5 P6 P7 P8 contribution rate /% 55.63 31.59 5.86 3.54 2.27 0.55 0.45 0.32 cumulative contribution rate /% 55.63 87.22 93.08 96.62 97.89 98.44 98.89 99.21 Table 2. Discriminant results of KNN and PLS-DA models
discriminant models calibration set (150) prediction set (50) number rate/% number rate/% derivative+KNN 144 96.0 46 92.0 SNV+KNN 141 94.0 48 96.0 derivative+PLS-DA 142 94.7 46 92.0 SNV+PLS-DA 140 93.3 47 94.0 -
[1] GUO W Ch, WANG M H, GU J S, et al. Identification of bruised kiwifruits during storage by near infrared spectroscopy and extreme learning machine[J]. Optics and Precision Engineering, 2013, 21(10): 2720-2727 (in Chinese). doi: 10.3788/OPE.20132110.2720 [2] ZHENG C Y, GUO Zh H, JIN L. Measurement of total viable count on chilled mutton surface based on hyperspectral imaging technique[J]. Laser Technology, 2015, 39(2): 284-288 (in Chinese). [3] ZOU X B, SHEN T T, SHI J Y, et al. Discrimination on maturity of plums based on hyperspectral imaging information[J]. Modern Food Science and Technology, 2016, 32(4): 235-240 (in Chinese). [4] ZHAO F, DONG J L, GUO W Ch. Effect of spectral extraction regions in hyperspectral images on the precision in determining the sugar content of kiwifruits [J]. Modern Food Science and Technology, 2016, 32(4): 223-228 (in Chinese). [5] GUO W Ch, ZHAO F, DONG J L. Nondestructive measurement of soluble solids content of kiwifruits using near-infrared hyperspectral imaging[J]. Food Analytical Methods, 2016, 9(1): 38-47. doi: 10.1007/s12161-015-0165-z [6] LI L L, WANG B, ZHANG X H, et al. Discrimination on maturity of plums based on hyperspectral imaging information[J]. Modern Food Science and Technology, 2017, 33(12): 228-232 (in Chinese). [7] ERKINBAEV C, HENDERSON K, PALIWAL J. Discrimination of gluten-free oats from contaminants using near infrared hyperspectral imaging technique[J]. Food Control, 2017, 80: 97-203. [8] MO C, KIM G, KIM M S, et al. Fluorescence hyperspectral imaging technique for foreign substance detection on fresh-cut lettuce[J]. Journal of the Science of Food & Agriculture, 2017, 97(12): 3985-3993. [9] SONG X Sh, CHEN G Q, ZHU Zh W, et al. Determination of vo-lume fraction of acid in Chinese aged liquor by 3-D fluorescence spectrometry[J]. Laser Technology, 2018, 42(4):531-535 (in Chin-ese). [10] YIN X H, JIANG Y, LV B Ch, et al. Quantitative analysis of 2-mercaptobenzothiazole based on terahertz time-domain spectroscopy[J]. Laser Technology, 2019, 43(1):1-9 (in Chinese). [11] PU H B, LIU D, WANG L, et al. Soluble solids content and pH prediction and maturity discrimination of lychee fruits using visible and near infrared hyperspectral imaging[J]. Food Analytical Methods, 2016, 9(1): 235-244. doi: 10.1007/s12161-015-0186-7 [12] SIEDLISKA A, BARANOWSKI P, ZUBIK M, et al. Detection of pits in fresh and frozen cherries using a hyperspectral system in transmittance mode[J]. Journal of Food Engineering, 2017, 215: 61-71. doi: 10.1016/j.jfoodeng.2017.07.028 [13] LIU Y D, WU M M, LI Y F, et al. Comparision of reflection and diffuse transmission for detecting solid soluble contents and ratio of sugar and acid in apples by on-line vis/NIR spectroscopy[J]. Spectroscopy and Spectral Analysis, 2017, 37(8): 2424-2429 (in Ch-inese). [14] LIU Y D, XU H, SUN X D, et al. Non-destructive measurement of tomato maturity by near-infrared diffuse transmission spectroscopy[J]. Laser Technology, 2019, 43(1): 25-29 (in Chinese). [15] ZHAO J, PENG Y K, ZHAO S W, et al. Detection of defects in apples based on hyperspectral imaging technology[J]. Journal of Food Safety and Quality, 2012, 3(6): 681-684 (in Chinese). [16] TIAN Y W, CHENG Y, WANG X Q, et al. Recognition method of insect damage and stem/calyx on apple based on hyperspectral imaging[J]. Transactions of the Chinese Society of Agricultural Engineering, 2015, 31(4): 325-331 (in Chinese). [17] ZHANG B F, YUAN L B, ZHANG B X. Study on prediction total acid and soluble sugar of tomato juice by near infrared optical fiber spectrometer technique[J]. Spectroscopy and Spectral Analysis, 2014, 34(2): 350-353 (in Chinese). [18] NI L J, ZHANG L G. Basic chemometrics and its application[M]. Shanghai: East China University of Science and Technology Press, 2011: 64-69(in Chinese). [19] LI Y, GUO J X, MUHETAER M, et al. Effect of spectral data pretreatment on visible/near infrared spectroscopy model of soluble so-lids content of apples[J]. Northern Horticulture, 2016, 20: 1-4 (in Chinese). [20] HUANG W Q, CHEN L P, LI J B, et al. Effective wavelengths determination for detection of slight bruises on apples based on hyperspectral imaging[J]. Transactions of the Chinese Society of Agricultural Engineering, 2013, 29(1): 272-277 (in Chinese).