摘要
为提高黄桃损伤程度无损检测识别的准确率,采集健康和不同损伤程度黄桃(Amygdalus persica)的反射光谱(R)、吸收光谱(A)、Kubelka-Munk光谱(K-M),并基于反射光谱、吸收光谱、Kubelka-Munk光谱等原始光谱和RAW、BOC、DT、SG、SNV等预处理方法后的光谱建立偏最小二乘判别分析(partial least squares discriminant analysis,PLS-DA)、极限梯度提升(extreme gradient boosting,XGBoost)和随机森林(random forest,RF)模型,比较3种模型检测效果,选出正确率较高模型并构建其特征波长下的模型,并对结果再次进行比较。结果显示,基于3种原始光谱和SG预处理后光谱的RF模型判别效果较优,整体准确率均达到了90.00%以上。利用竞争性自适应重加权(CARS)和无信息变量消除(UVE)算法对3种原始光谱和SG预处理后的光谱进行波长筛选,并再次建立RF模型。结果显示,A-RAW-CARS-RF模型和K-M-SG-CARS-RF模型相比于全光谱下的RF模型判别效果得到了改善,并且在基于特征波长建立的RF模型中,A-RAW-CARS-RF模型的判别效果最好,整体准确率达到了97.12%,对4个子类别的误判数分别为0、1、1、1。
水果类果实在采摘、挑选、分级和包装等处理过程中会发生机械损伤,进而引起果实生理代谢紊乱和微生物感染,导致果实加速老化腐烂,造成果实营养严重流
机器视觉、近红外光谱、热成像、结构光以及高光谱等技术已经被广泛应用于水果碰撞损伤方面检
因此,本研究将基于反射光谱、吸收光谱、Kubelka-Munk光谱(K-M)以及5种预处理方法对3种原始光谱预处理后的光谱建立判别分析模型,探究基于3种原始光谱数据集下对不同损伤程度的黄桃进行鉴定和分类的准确性,旨在为后续高光谱技术在黄桃碰撞损伤检测中的应用提供技术支持。
试验所用的黄桃(Amygdalus persica)来自于山东省临沂市。试验前筛选出420个新鲜无损且成熟度、硬度和大小尺寸相近的黄桃样本,并逐个编号后分为对照组(104个)和试验组(316个)。试验前将编号的黄桃储存在室温25 ℃环境中12 h,使样品温度与室温保持一致。将直径30 mm、质量为100 g的铁球固定在落球冲击试验机上,分别从0.6、1.2、1.8 m 等3个高度释放,冲击黄桃造成其损伤,并定义从0.6、1.2、1.8 m释放造成的损伤分别为Ⅰ级、Ⅱ级和Ⅲ级损

图1 落球冲击试验机及碰伤样品
Fig.1 Falling ball impact tester and bruised sample
本研究试验数据是通过盖亚(GaiaSorter)高光谱分选仪采集的,其组成结构示意图和其采集的三维数据立方体如

图2 高光谱系统示意图及三维数据立方体
Fig.2 Schematic diagram of the hyperspectral system and 3D data cube
在图像采集之前,为防止无关因素对试验结果造成干扰,需将高光谱系统打开预热0.5 h。设置的参数为:相机曝光时间6.0 ms;光谱分辨率3.5 nm,光谱范围397.5~1 014.0 nm;位移平台移动速度2.5 m/s。操作步骤:(1)将黄桃样品放在位移平台上;(2)打开位移平台,并点击保存按钮,采集高光谱图像;(3)通过计算机软件进行记录,最终形成1个包含了影像信息和光谱信息的三维数据立方体。
感兴趣区域为大小约为1 600个像素点的圆形区域,通过ENVI 4.5软件进行提取,碰伤黄桃样品选择正对镜头的碰伤区域,健康黄桃样品则选择位于赤道位置且正对着镜头的区域。由于CCD相机中存在暗电流,导致一些光强度较低的波段出现大量的噪声。因此,在进一步的数据处理和分析之前,高光谱图像需用白色和暗色的参照物进行校
(1) |
从高光谱图像中提取的光谱数据是反射光谱,通过
(2) |
(3) |
通过公式转换得到了3种不同类型的光谱数据集,即R、A和K-M,并用于判别黄桃的损伤程度。
1)光谱数据预处理。高光谱成像系统包括来自各种波长的反射数据,所获信息的复杂性应在不同的分析阶段加以解决。同时,光谱数据包含多种无用信息,本研究采用基线偏移校正(BOC)、去趋势(DT)、卷积平滑(SG)、标准正态变量变换(SNV)和多元散射校正(MSC)对光谱数据进行处理,然后比较不同预处理下模型的判别效果。
2)特征波长的筛选。利用高光谱数据进行分类研究时,去除与样本不相关或冗余数据的特征具有重要意义,本研究采用竞争性自适应重加权(CARS)算法和无信息变量消除(UVE)算法对光谱数据进行变量的挑选。然后比较在这2种波长选择算法下模型的判别效果。
3)模型的建立与评估。PLS-DA作为经典的判别分析方法,当不同类别之间差别较大或同类别之间差别较小时,PLS-DA可以很好对其区

图3 健康黄桃和不同损伤程度黄桃的平均光谱曲线
Fig.3 Average spectral curve of healthy yellow peach and yellow peach with different damage degrees
A:反射光谱曲线Reflection spectral curve;B:吸收光谱曲线Absorption spectral curve;C:K-M光谱曲线Kubelka-Munk spectral curve.
运用Kennard-stone(KS)算法分别将反射光谱、吸收光谱和K-M光谱3种光谱数据集均按照3︰1的比例分成建模集和预测集。然后,分别基于3种原始光谱和各种预处理后的光谱建立PLS-DA、XGBoost和RF模型,各种模型的预测集整体准确率如
光谱类型 Spectral type | 模型 Model | RAW | BOC | DT | SG | SNV |
---|---|---|---|---|---|---|
反射光谱 Reflection spectrum | PLS-DA | 76.92 | 76.92 | 72.12 | 76.92 | 77.88 |
XGBoost | 84.62 | 77.88 | 81.73 | 84.62 | 85.58 | |
RF | 93.27 | 84.62 | 81.73 | 93.27 | 84.62 | |
吸收光谱 Absorption spectrum | PLS-DA | 68.27 | 71.15 | 66.35 | 69.23 | 74.04 |
XGBoost | 84.62 | 76.92 | 81.73 | 86.54 | 77.88 | |
RF | 95.19 | 85.58 | 84.62 | 93.27 | 84.62 | |
Kubelka-Munk光谱 Kubelka-Munk spectrum | PLS-DA | 61.54 | 56.73 | 57.69 | 66.35 | 62.50 |
XGBoost | 84.62 | 74.04 | 73.08 | 85.58 | 80.77 | |
RF | 92.31 | 76.92 | 78.85 | 92.31 | 84.62 |
由

图4 不同模型预测结果的混淆矩阵
Fig. 4 Confusion matrix for the prediction results of different models
Sound:健康样品Health sample;Ⅰ、Ⅱ和Ⅲ:Ⅰ、Ⅱ和Ⅲ级损伤Ⅰ, Ⅱ and Ⅲ level damage yellow peaches;A:反射光谱-原始光谱-随机森林R-RAW-RF;B:反射光谱-卷积平滑-随机森林R-SG-RF;C:吸收光谱-原始光谱-随机森林A-RAW-RF;D: 吸收光谱-卷积平滑-随机森林A-SG-RF;E:Kubelka-Munk光谱-原始光谱-随机森林K-M-RAW-RF;F: Kubelka-Munk光谱-卷积平滑-随机森林K-M-SG-RF.
全光谱的使用通常会引入噪声,导致过度拟合、非线性以及效率或准确性的损

图5 CARS算法筛选变量过程
Fig.5 The process of screening the variables of CARS algorithm

图6 CARS算法挑选波长结果
Fig.6 The results of CARS algorithm to select wavelength
A:反射光谱-原始光谱R-RAW;B:反射光谱-卷积平滑R-SG;C:吸收光谱-原始光谱A-RAW;D:吸收光谱-卷积平滑A-SG;E:Kubelka-Munk光谱-原始光谱K-M-RAW;F:Kubelka-Munk光谱-卷积平滑K-M-SG.

图7 UVE算法筛选变量过程
Fig.7 The process of screening variables of UVE algorithm

图8 UVE算法挑选波长结果
Fig.8 The results of UVE algorithm to select wavelength
A:反射光谱-原始光谱 R-RAW;B:反射光谱-卷积平滑 R-SG;C:吸收光谱-原始光谱 A-RAW;D:吸收光谱-卷积平滑 A-SG;E: Kubelka-Munk光谱-原始光谱 K-M-RAW;F:Kubelka-Munk光谱-卷积平滑 K-M-SG.
利用CARS和UVE算法对3种原始光谱及SG预处理后光谱进行特征波长筛选,利用筛选后的波长再次建立RF模型。基于特征波长建立的RF模型预测集整体准确率如
波长筛选方法 Wavelength screening method | 反射光谱Reflection spectrum | 吸收光谱Absorption spectrum | Kubelka-Munk光谱Kubelka-Munk spectrum | |||
---|---|---|---|---|---|---|
RAW | SG | RAW | SG | RAW | SG | |
CARS | 89.42 | 89.42 | 97.12 | 88.46 | 91.35 | 93.27 |
UVE | 91.35 | 93.27 | 91.35 | 93.27 | 89.42 | 92.31 |

图9 不同模型预测结果的混淆矩阵
Fig.9 Confusion matrix for different model prediction results
Sound:健康样品Health sample;Ⅰ、Ⅱ和Ⅲ:Ⅰ、Ⅱ和Ⅲ级损伤Ⅰ,Ⅱ and Ⅲ level damage yellow peaches;A:吸收光谱-原始光谱-竞争性自适应重加权-随机森林A-RAW-CARS-RF;B:Kubelka-Munk光谱-卷积平滑-竞争性自适应重加权-随机森林 K-M-SG-CARS-RF.
客观定量描述水果损伤程度不仅是评估其品质的重要参考,也对改善黄桃采后处理和贮存操作具有重要意义。前人检测水果损伤程度大部分都是基于反射光谱建立模型,文献[
本研究观察并比较了高光谱成像的反射光谱、吸收光谱和K-M光谱对黄桃早期损伤程度的检测能力。基于原始光谱和各种预处理后的光谱建立PLS-DA、XGBoost和RF模型,发现基于3种原始光谱和SG预处理后光谱的RF模型判别效果较优,整体准确率均达到90.00%以上。然后,利用CARS和UVE算法对3种原始光谱和SG预处理后的光谱进行波段筛选,并再次建立RF模型,发现A-RAW-CARS-RF模型和K-M-SG-CARS-RF模型相比于全光谱下的RF模型判别效果得到改善,并且在基于特征波长建立的RF模型中,A-RAW-CARS-RF模型的判别效果最好,整体准确率达到97.12%,对4个子类别的误判数分别为0、1、1、1。综上所述,本研究表明,基于吸收光谱检测黄桃早期损伤程度具有可行性,同时,利用3种光谱同时检测水果的损伤程度,可大大提高模型的普适性和可移植性。
参考文献References
TAN W Y,SUN L J,YANG F,et al.Study on bruising degree classification of apples using hyperspectral imaging and GS-SVM[J].Optik,2018,154:581-592. [百度学术]
黄余年,张维,张群,等.采前套袋与未套袋处理对黄桃采后贮藏品质的影响[J].中国食品学报,2021,21(6):231-242.HUANG Y N,ZHANG W,ZHANG Q,et al.Effects of pre-harvest bagging and non-bagging treatment on postharvest storage quality of yellow-flesh peach[J].Journal of Chinese Institute of Food Science and Technology,2021,21(6):231-242(in Chinese with English abstract). [百度学术]
于笑颜,吕健,毕金峰,等.基于果胶特性改变的罐藏黄桃质构软化机制[J].食品科学,2020,41(19):45-52.YU X Y,LÜ J,BI J F,et al.Mechanism for texture softening of canned yellow peaches based on modification of pectin characteristics[J].Food science,2020,41(19):45-52(in Chinese with English abstract). [百度学术]
LI Z G,THOMAS C.Quantitative evaluation of mechanical damage to fresh fruits[J].Trends in food science & technology,2014,35(2):138-150. [百度学术]
安小松,宋竹平,梁千月,等.基于CNN-Transformer的视觉缺陷柑橘分选方法[J].华中农业大学学报,2022,41(4):158-169.AN X S,SONG Z P,LIANG Q Y,et al.A CNN-Transformer-based method for sorting citrus with visual defects[J].Journal of Huazhong Agricultural University,2022,41(4):158-169(in Chinese with English abstract). [百度学术]
刘燕德,黎丽莎,李斌,等.多品种苹果可溶性固形物近红外无损检测通用模型研究[J].华中农业大学学报,2022,41(2):237-244.LIU Y D,LI L S,LI B,et al.General near-infrared model of soluble solids content in multi-variety apples[J].Journal of Huazhong Agricultural University,2022,41(2):237-244(in Chinese with English abstract). [百度学术]
LU Y,SAEYS W,KIM M,et al.Hyperspectral imaging technology for quality and safety evaluation of horticultural products:a review and celebration of the past 20-year progress[J/OL].Postharvest biology and technology,2020,170:111318[2022-09-04].http://doi.org/10.1016/j.postharvbio.2020.111318. [百度学术]
EKRAMIRAD N,KHALED A Y,DOYLE L E,et al.Nondestructive detection of codling moth infestation in apples using pixel-based NIR hyperspectral imaging with machine learning and feature selection[J/OL].Foods(Basel,Switzerland),2021,11(1):8[2022-09-04].https://doi.org/10.3390/foods11010008. [百度学术]
TIAN X,ZHANG C,LI J B,et al.Detection of early decay on citrus using LW-NIR hyperspectral reflectance imaging coupled with two-band ratio and improved watershed segmentation algorithm[J/OL].Food chemistry,2021,360:130077[2022-09-04].https://doi.org/10.1016/j.foodchem.2021.130077. [百度学术]
TANG Y,GAO S J,ZHUANG J J,et al.Apple bruise grading using piecewise nonlinear curve fitting for hyperspectral imaging data[J].IEEE access,2020,8:147494-147506. [百度学术]
ZHANG M,LI G H.Visual detection of apple bruises using AdaBoost algorithm and hyperspectral imaging[J].International journal of food properties,2018,21(1):1598-1607. [百度学术]
LIU Q,SUN K,PENG J,et al.Identification of bruise and fungi contamination in strawberries using hyperspectral imaging technology and multivariate analysis[J].Food analytical methods,2018,11(5):1518-1527. [百度学术]
FU X P,WANG M Y.Detection of early bruises on pears using fluorescence hyperspectral imaging technique[J].Food analytical methods,2022,15(1):115-123. [百度学术]
TAN W Y,SUN L J,YANG F,et al.The feasibility of early detection and grading of apple bruises using hyperspectral imaging[J/OL].Journal of chemometrics,2018,32(10):e3067[2022-09-04].https://doi.org/10.1002/cem.3067. [百度学术]
LI B,HAN Z Y,WANG Q,et al.Study on qualitative impact damage of loquats using hyperspectral technology coupled with texture features[J/OL].Foods (Basel,Switzerland),2022,11(16):2444[2022-09-04].https://doi.org/10.3390/foods11162444. [百度学术]
LI B,YIN H,LIU Y D,et al.Study on qualitative impact damage of yellow peaches using the combined hyperspectral and physicochemical indicators method[J/OL].Journal of molecular structure,2022,1265.133407[2022-09-04].https://doi.org/10.1016/j.molstruc.2022.133407. [百度学术]
LI B,YIN H,LIU Y D,et al.Detection storage time of mild bruise’s yellow peaches using the combined hyperspectral imaging and machine learning method[J/OL].Journal of analytical science and technology,2022,13(1):24[2022-09-04].https://doi.org/10.1186/s40543-022-00334-5. [百度学术]
王晓宾,马枭,杨蕾,等.基于PLS-DA拉曼光谱特征提取的中性笔油墨MLP模式识别[J].激光与光电子学进展,2021,58(1):329-335.WANG X B,MA X,YANG L,et al.Multi-layer perceptron pattern recognition of handwriting ink based on PLS-DA Raman spectral feature extraction[J].Laser & optoelectronics progress,2021,58(1):329-335 (in Chinese with English abstract). [百度学术]
CHEN T Q,GUESTRIN C.XGBoost:a scalable tree boosting system[C]//Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining.August 13-17,2016,San Francisco,California,USA.New York:ACM,2016:785-794. [百度学术]
李欣海.随机森林模型在分类与回归分析中的应用[J].应用昆虫学报,2013,50(4):1190-1197.LI X H.Using “random forest” for classification and regression[J].Chinese journal of applied entomology,2013,50(4):1190-1197(in Chinese with English abstract). [百度学术]
LEE W H,KIM M S,LEE H,et al.Hyperspectral near-infrared imaging for the detection of physical damages of pear[J].Journal of food engineering,2014,130:1-7. [百度学术]
PAN T T,CHYNGYZ E,SUN D W,et al.Pathogenetic process monitoring and early detection of pear black spot disease caused by Alternaria alternata using hyperspectral imaging[J].Postharvest biology and technology,2019,154:96-104. [百度学术]
LI X P,JIANG H Z,JIANG X S,et al.Identification of geographical origin of Chinese chestnuts using hyperspectral imaging with 1D-CNN algorithm[J/OL].Agriculture,2021,11(12):1274[2022-09-04].https://doi.org/10.3390/agriculture11121274. [百度学术]
SU W H,YANG C,DONG Y H,et al.Hyperspectral imaging and improved feature variable selection for automated determination of deoxynivalenol in various genetic lines of barley kernels for resistance screening[J/OL].Food chemistry,2021,343:128507[2022-09-04].https://doi.org/10.1016/j.foodchem.2020.128507. [百度学术]