CN115575405B - Fruit appearance quality detection method based on multispectral image feature quantity - Google Patents
Fruit appearance quality detection method based on multispectral image feature quantity Download PDFInfo
- Publication number
- CN115575405B CN115575405B CN202211299966.0A CN202211299966A CN115575405B CN 115575405 B CN115575405 B CN 115575405B CN 202211299966 A CN202211299966 A CN 202211299966A CN 115575405 B CN115575405 B CN 115575405B
- Authority
- CN
- China
- Prior art keywords
- expression
- fruit
- image feature
- respect
- surface defect
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 235000013399 edible fruits Nutrition 0.000 title claims abstract description 74
- 238000001514 detection method Methods 0.000 title claims abstract description 20
- 230000007547 defect Effects 0.000 claims abstract description 72
- 238000001228 spectrum Methods 0.000 claims abstract 12
- 230000003595 spectral effect Effects 0.000 claims description 69
- 230000014509 gene expression Effects 0.000 claims description 51
- 238000000034 method Methods 0.000 claims description 17
- 238000012804 iterative process Methods 0.000 claims description 12
- 238000005457 optimization Methods 0.000 claims description 5
- 230000002950 deficient Effects 0.000 abstract description 9
- 238000005516 engineering process Methods 0.000 abstract description 5
- 238000012545 processing Methods 0.000 abstract description 5
- 238000000701 chemical imaging Methods 0.000 abstract description 4
- 241000220324 Pyrus Species 0.000 description 10
- 235000014443 Pyrus communis Nutrition 0.000 description 9
- 238000007689 inspection Methods 0.000 description 4
- 208000034656 Contusions Diseases 0.000 description 3
- 238000005299 abrasion Methods 0.000 description 3
- 230000001066 destructive effect Effects 0.000 description 2
- 208000032544 Cicatrix Diseases 0.000 description 1
- 101001121408 Homo sapiens L-amino-acid oxidase Proteins 0.000 description 1
- 102100026388 L-amino-acid oxidase Human genes 0.000 description 1
- 208000034526 bruise Diseases 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 235000013305 food Nutrition 0.000 description 1
- 235000012041 food component Nutrition 0.000 description 1
- 239000005417 food ingredient Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000009659 non-destructive testing Methods 0.000 description 1
- 230000003647 oxidation Effects 0.000 description 1
- 238000007254 oxidation reaction Methods 0.000 description 1
- 238000003909 pattern recognition Methods 0.000 description 1
- 235000021017 pears Nutrition 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000003908 quality control method Methods 0.000 description 1
- 238000011897 real-time detection Methods 0.000 description 1
- 231100000241 scar Toxicity 0.000 description 1
- 230000037387 scars Effects 0.000 description 1
- 238000003860 storage Methods 0.000 description 1
- 238000001308 synthesis method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/84—Systems specially adapted for particular applications
- G01N21/88—Investigating the presence of flaws or contamination
Landscapes
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- General Physics & Mathematics (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
- Investigating Or Analysing Materials By Optical Means (AREA)
Abstract
Description
技术领域Technical Field
本发明属于水果品质检测技术领域,具体涉及一种通过分析多光谱图像的特征量从而优选不同类型表面缺陷对应的光谱波段及多光谱图像特征量来实现水果外观品质检测的方法。The present invention belongs to the technical field of fruit quality detection, and in particular relates to a method for detecting the appearance quality of fruits by analyzing characteristic quantities of multispectral images to thereby select spectral bands corresponding to different types of surface defects and characteristic quantities of multispectral images.
背景技术Background technique
多光谱成像是一种新兴的无损检测技术,其作为对高光谱成像技术的一种重要改进技术,可实现离散光谱范围内收集和分析数据,从而大大简化数据且减少冗余信息而提升处理速度,同时对于光谱数据采用不同化学计量学模型和预处理方法,优选最佳的波段和特征波长,很大程度上可减少数据处理时间并提高光谱数据的有效性。多光谱成像技术在近年来被广泛关注,因其具有非破坏性、快速、简单、绿色且不需要样品预处理等优点,被广泛应用于食品成分和含量的定性和定量检测以及不同品种和掺假的鉴别,可适合食品生产加工、储存、运输等过程的监测和质量控制,为下一步开发快速无损、准确高效的实时检测工具奠定技术基础。Multispectral imaging is an emerging nondestructive testing technology. As an important improvement on hyperspectral imaging technology, it can collect and analyze data within a discrete spectral range, thereby greatly simplifying the data and reducing redundant information to improve processing speed. At the same time, different chemometric models and preprocessing methods are used for spectral data to select the best band and characteristic wavelength, which can greatly reduce data processing time and improve the validity of spectral data. Multispectral imaging technology has received extensive attention in recent years. Due to its advantages of being non-destructive, fast, simple, green, and not requiring sample pretreatment, it is widely used in qualitative and quantitative detection of food ingredients and content, as well as identification of different varieties and adulteration. It is suitable for monitoring and quality control of food production, processing, storage, transportation and other processes, laying a technical foundation for the next step of developing fast, non-destructive, accurate and efficient real-time detection tools.
在水果品质检测与自动化分级系统中通常采用彩色摄像头采集果品图像,而后对采集到的图像进行模式识别,最后根据识别结果进行相应的分级处理。水果图像的采集质量的高低将直接影响最终确定水果品质和级别的准确性,所以采集到的水果图像所包含的信息应尽可能详细地反映水果的各种外部特性。利用计算机视觉技术对水果进行品质检测和分级时,腐烂/烂点/发霉、碰伤/刺伤、干疤/花皮、擦伤氧化、畸形、裂口/裂纹等表面缺陷是水果外观品质的重要指标。考虑到在实际应用中,彩色摄像头采集到的水果图像不能很好地反映水果表面的细微特征,因此为提高检测与分级的可靠性,可利用水果在不同光谱条件下的图像来提取更多的表面特征。在实际应用中可根据RGB(Red Green Blue,红绿蓝)颜色模型理论,把在不同波段下所采集到的图像区域分别用R、G和B等单色表示,然后作为RGB颜色模型中的各个分量进行叠加,分别得到RGB、RGI(Red Green Ratio Index,红绿波段比值)、GBI(Green Blue Ratio Index,绿蓝波段比值)等多光谱图像。In the fruit quality inspection and automatic grading system, color cameras are usually used to collect fruit images, and then the collected images are subjected to pattern recognition, and finally the corresponding grading processing is performed according to the recognition results. The quality of fruit image acquisition will directly affect the accuracy of the final determination of fruit quality and grade, so the information contained in the collected fruit images should reflect the various external characteristics of the fruit as detailed as possible. When using computer vision technology to inspect and grade fruit quality, surface defects such as rot/rotten spots/moldy, bruises/punctures, dry scars/skin spots, abrasions and oxidation, deformities, and cracks/cracks are important indicators of fruit appearance quality. Considering that in practical applications, the fruit images collected by color cameras cannot reflect the subtle features of the fruit surface well, in order to improve the reliability of detection and grading, images of fruits under different spectral conditions can be used to extract more surface features. In practical applications, according to the RGB (Red Green Blue) color model theory, the image areas collected in different bands can be represented by monochrome colors such as R, G and B, and then superimposed as the components in the RGB color model to obtain multispectral images such as RGB, RGI (Red Green Ratio Index), GBI (Green Blue Ratio Index), etc.
发明内容Summary of the invention
本发明的目的在于通过具备表面缺陷的水果残次果样本集分析其不同波段下的光谱图像特征量与正常果特征量的差异程度从而优选光谱波段及多光谱图像特征量,以期提高光谱数据的有效性来应用于水果外观品质检测。The purpose of the present invention is to analyze the difference between the spectral image feature quantities in different bands and the feature quantities of normal fruits through a sample set of defective fruits with surface defects, so as to optimize the spectral bands and multi-spectral image feature quantities, in order to improve the effectiveness of spectral data for application in fruit appearance quality detection.
为了达到上述目的,本发明包括图1中所示的以下步骤:In order to achieve the above object, the present invention includes the following steps shown in Figure 1:
步骤1:设对某种水果残次果样本集中具备表面缺陷的样品k针对表面缺陷j在光谱波段i下进行光谱图像采集时针对图像特征量l可获取对应的数值x(i,j,l,k),其中,k∈[1,K],K为该种水果的残次果样品总数,j∈[1,J],J为表面缺陷种类的总数,i∈[1,I],I为光谱波段的总数,l∈[1,L],L为图像特征量类型的总数;设θj为表面缺陷j的权重系数,且设μi,j为对应表面缺陷j在光谱波段i上的权重系数,且设wi,j,l为对应表面缺陷j在光谱波段i上的图像特征量l的权重系数,且考虑到针对不同表面缺陷种类的外观品质检测对应的最佳光谱波段及其图像特征量的反映状况也不同,提出以残次果与正常果的光谱波段上对应的图像特征量差异程度为目标且引入λ1、λ2和λ3等拉格朗日乘数来建立目标函数F(wi,j,l,μi,j,θj,λ1,λ2,λ3),并通过选择参数wi,j,l,μi,j,θj来实现目标函数F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化:Step 1: Assume that for a sample k with surface defects in a certain fruit defect sample set, when the spectral image is collected for the surface defect j under the spectral band i, the corresponding value x(i,j,l,k) can be obtained for the image feature l, where k∈[1,K], K is the total number of defective fruit samples of this kind of fruit, j∈[1,J], J is the total number of surface defect types, i∈[1,I], I is the total number of spectral bands, l∈[1,L], L is the total number of image feature types; let θ j be the weight coefficient of surface defect j, and Let μ i,j be the weight coefficient of the corresponding surface defect j in spectral band i, and Let wi,j,l be the weight coefficient of the image feature l corresponding to the surface defect j in the spectral band i, and Taking into account that the optimal spectral bands and their image feature quantities corresponding to the appearance quality inspection of different types of surface defects are also different, it is proposed to take the difference degree of the image feature quantities corresponding to the spectral bands of defective fruits and normal fruits as the target and introduce Lagrange multipliers such as λ 1 , λ 2 and λ 3 to establish the objective function F( wi,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 ) and maximize the objective function F(wi,j,l ,μ i, j ,θ j ,λ 1 ,λ 2 ,λ 3 ) by selecting parameters wi ,j ,l ,μ i,j ,θ j :
其中,y(i,j,l)为该种水果的正常果样本集在光谱波段i下进行光谱图像采集时针对图像特征量l可获取由不存在表面缺陷j时对应的平均数值;Among them, y(i,j,l) is the average value corresponding to the absence of surface defect j when the normal fruit sample set of this kind of fruit is collected for the image feature l under spectral band i;
步骤2:由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj求一阶导数和二阶导数,可得:Step 2: Take the first-order and second-order derivatives of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj , and we get:
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj的一阶导数时可知,F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj的二阶导数可见存在θj使得F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化;The first-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj is It can be seen that the second-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj is It can be seen that there exists θ j that maximizes F(w i,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 );
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj的一阶导数可得λ3关于θj的表达式:The first-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj is The expression of λ 3 with respect to θ j can be obtained:
由可得θj关于λ3的表达式:Depend on The expression of θ j with respect to λ 3 can be obtained:
由此可知λ3的理论值表达式可表示为:It can be seen that the theoretical value expression of λ 3 can be expressed as:
则可得θj的理论值表达式:Then the theoretical value expression of θ j can be obtained:
其中,m为中间变量;Among them, m is the intermediate variable;
步骤3:由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l求一阶导数和二阶导数,可得:Step 3: Take the first-order and second-order derivatives of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to wi ,j,l , and we get:
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l的一阶导数时可知,F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l的二阶导数可见存在wi,j,l使得F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化;The first derivative of F(w i,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 ) with respect to w i,j,l It can be seen that the second-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to w i,j,l is It can be seen that there exists w i,j,l that maximizes F(w i,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 );
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l的一阶导数可得λ1关于wi,j,l的表达式:The first derivative of F(w i,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 ) with respect to w i,j,l We can get the expression of λ 1 with respect to w i,j,l :
由可得wi,j,l关于λ1的表达式:Depend on We can get the expression of w i,j,l with respect to λ 1 :
由此可知λ1的理论值表达式可表示为:It can be seen that the theoretical value expression of λ 1 can be expressed as:
则可得wi,j,l的理论值表达式:Then we can get the theoretical value expression of wi,j,l :
其中,n为中间变量;Among them, n is the intermediate variable;
步骤4:由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j求一阶导数和二阶导数,可得:Step 4: Take the first-order and second-order derivatives of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to μi ,j, and we get:
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j的一阶导数时可知,F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j的二阶导数可见存在μi,j使得F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化;The first-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to μi ,j is It can be seen that the second-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to μi ,j is It can be seen that there exists μ i,j that maximizes F(w i,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 );
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j的一阶导数可得λ2关于μi,j的表达式:The first-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to μi ,j is The expression of λ 2 with respect to μ i,j can be obtained:
由可得μi,j关于λ2的表达式:Depend on The expression of μ i,j with respect to λ 2 can be obtained:
由此可知λ2的理论值表达式可表示为:It can be seen that the theoretical value expression of λ 2 can be expressed as:
则可得μi,j的理论值表达式:Then the theoretical value expression of μ i,j can be obtained:
其中,d为中间变量;Among them, d is the intermediate variable;
步骤5:可将目标函数F(wi,j,l,μi,j,θj,λ1,λ2,λ3)满足最大化条件时θj、μi,j和wi,j,l的理论值表达式代入权重系数的迭代过程来生成表面缺陷的实际权重系数光谱波段的实际权重系数和图像特征量的实际权重系数该迭代过程具体表示如下:Step 5: The actual weight coefficient of the surface defect can be generated by substituting the theoretical value expressions of θ j , μ i, j and wi,j,l into the iterative process of the weight coefficient when the objective function F(wi , j,l,μ i,j , θ j,λ 1 ,λ 2 ,λ 3 ) satisfies the maximization condition. Actual weight coefficients of spectral bands and the actual weight coefficient of the image feature The iterative process is specifically expressed as follows:
①在初始化过程中,采集该种水果残次果样本集中具备表面缺陷的样品针对不同表面缺陷在不同光谱波段下的光谱图像特征量x(i,j,l,k)以及水果正常果样本集相应的光谱图像特征量,并求统计平均值得到正常果样本集对应的图像特征量平均数值y(i,j,l),设置θj(t=0)为1/J,μi,j(t=0)为1/I,将θj(t=0)和μi,j(t=0)以及x(i,j,l,k)和y(i,j,l)代入wi,j,l的理论值表达式给出wi,j,l(t=0);① In the initialization process, the spectral image feature values x(i,j,l,k) of samples with surface defects in the defective fruit sample set of the fruit in different spectral bands for different surface defects and the corresponding spectral image feature values of the normal fruit sample set are collected, and the statistical average is calculated to obtain the average value y(i,j,l) of the image feature value corresponding to the normal fruit sample set, and θj (t=0) is set to 1/J, μi ,j (t=0) is set to 1/I, and θj (t=0) and μi ,j (t=0) as well as x(i,j,l,k) and y(i,j,l) are substituted into the theoretical value expression of w i,j,l to obtain w i,j,l (t=0);
②将t加1,将wi,j,l(t-1)和θj(t-1)代入μi,j的理论值表达式给出μi,j(t);② Add 1 to t, substitute w i,j,l (t-1) and θ j (t-1) into the theoretical value expression of μ i,j to give μ i,j (t);
③将wi,j,l(t-1)和μi,j(t)代入θj的理论值表达式给出θj(t);③Substitute w i,j,l (t-1) and μ i,j (t) into the theoretical value expression of θ j to give θ j (t);
④将θj(t)和μi,j(t)代入wi,j,l的理论值表达式给出wi,j,l(t);④Substitute θ j (t) and μ i,j (t) into the theoretical value expression of wi ,j,l to give wi ,j,l (t);
⑤比较|[wi,j,l(t)-wi,j,l(t-1)]/wi,j,l(t)|、|[μi,j(t)-μi,j(t-1)]/μi,j(t)|和|[θj(t)-θj(t-1)]/θj(t)|,若皆小于等于δ则进入迭代过程⑥,否则进入迭代过程⑤,其中δ为迭代过程误差门限;⑤ Compare |[ wi,j,l (t)-wi ,j,l (t-1)]/wi ,j,l (t)|, |[μi ,j (t)-μi ,j (t-1)]/μi ,j (t)| and |[ θj (t) -θj (t-1)]/ θj (t)|. If all of them are less than or equal to δ, enter the iterative process ⑥; otherwise, enter the iterative process ⑤, where δ is the error threshold of the iterative process.
⑥由wi,j,l(t)作为元素建立集合Ψi,j,l={wi,j,l(t)},由μi,j(t)作为元素建立集合Φi,j={μi,j(t)},由θj(t)作为元素建立集合Θj={θj(t)},其中i∈[1,I],j∈[1,J],l∈[1,L];若wi,j,l(t)<εw,说明对应的光谱图像特征量对表面缺陷j在光谱波段i下的检测贡献度较小,则将wi,j,l(t)从Ψi,j,l中剔除,从而实现该光谱波段下多光谱图像特征量的优选,并将相应的i,j,l组合加入集合其中εw为光谱图像特征量权重门限;若μi,j(t)<εμ,说明对应的光谱波段对表面缺陷j的检测贡献度较小,则将μi,j(t)从Φi,j中剔除,从而实现光谱波段的优选,并将相应的i,j组合加入集合其中εμ为光谱波段权重门限;若θj(t)<εθ,说明对应的光谱波段对水果外观品质的整体检测贡献度较小,则将θj(t)从Θj中剔除,并将相应的j加入集合其中εθ为表面缺陷权重门限;⑥ Establish a set Ψ i,j,l ={wi,j, l (t)} with w i, j,l (t) as an element, establish a set Φ i,j ={μ i,j (t)} with μ i,j (t) as an element, and establish a set Θ j ={θ j (t)} with θ j (t) as an element, where i∈[1,I], j∈[1,J], l∈[1,L]; if w i,j,l (t)<ε w , it means that the corresponding spectral image feature contributes little to the detection of surface defect j in spectral band i, then w i,j,l (t) is removed from Ψ i,j,l , so as to achieve the optimization of multi-spectral image feature in this spectral band, and add the corresponding i,j,l combination to the set Where ε w is the weight threshold of the spectral image feature; if μ i,j (t) < ε μ , it means that the corresponding spectral band contributes less to the detection of surface defect j, then μ i,j (t) is removed from Φ i,j to achieve the optimization of spectral bands, and the corresponding i,j combination is added to the set Where ε μ is the spectral band weight threshold; if θ j (t) < ε θ , it means that the corresponding spectral band contributes less to the overall detection of fruit appearance quality, then θ j (t) is removed from Θ j , and the corresponding j is added to the set Where ε θ is the surface defect weight threshold;
⑦由集合Ψi,j,l={wi,j,l(t)}给出由集合Φi,j={μi,j(t)}给出由集合Θj={θj(t)}给出其中i∈[1,I],j∈[1,J],l∈[1,L];⑦ Given by the set Ψ i,j,l = { wi,j,l (t)} Given by the set Φ i,j = {μ i,j (t)} Given by the set Θ j ={θ j (t)} Where i∈[1,I], j∈[1,J], l∈[1,L];
⑧令和则可得:⑧ Order and Then we can get:
由此可得表面缺陷的实际权重系数光谱波段的实际权重系数和图像特征量的实际权重系数进行输出。The actual weight coefficient of surface defects can be obtained from this Actual weight coefficients of spectral bands and the actual weight coefficient of the image feature Output.
步骤6:测量出需要检测的水果r对于不同表面缺陷在范围内光谱波段上的范围内图像特征量,对于表面缺陷j而言,若水果r关于表面缺陷j的图像特征量偏离状况满足时则可视为该水果不存在外观品质检测中的表面缺陷j,否则认为该水果存在表面缺陷j,其中,θj为该种水果关于表面缺陷j的图像特征量偏离门限。Step 6: Measure the surface defects of the fruit to be inspected. Spectral bands within the range For surface defect j, if the deviation of the image feature quantity of fruit r with respect to surface defect j satisfies If the fruit has no surface defect j in the appearance quality inspection, it can be considered that the fruit has surface defect j, otherwise, the fruit is considered to have surface defect j, where θ j is the deviation threshold of the image feature quantity of the fruit with respect to surface defect j.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1:基于多光谱图像特征量的水果外观品质检测步骤图Figure 1: Steps for detecting fruit appearance quality based on multispectral image features
具体实施方式Detailed ways
以下将以930~2548nm的光谱波段区间来进行检测香梨外观品质的具体实施例对本发明提供的技术方案进行详细说明,具体包括图1中所示的以下步骤:The technical solution provided by the present invention is described in detail below using a specific embodiment of detecting the appearance quality of fragrant pears in the spectral band range of 930 to 2548 nm, which specifically includes the following steps shown in FIG1 :
步骤1:设对香梨残次果样本集中存在表面缺陷的样品k针对表面缺陷j在光谱波段i下进行光谱图像采集时针对R、G和B等单色的图像特征量l可获取对应的数值x(i,j,l,k),其中,k∈[1,K],香梨残次果样品总数K设为1000,j∈[1,J],包括腐烂、碰伤、花皮、擦伤、畸形或裂口等表面缺陷种类的总数J为6,i∈[1,I],1000、1025、1076、1152、1203、1279、1300、1406、1431、1533、1609、1634、1888、2092、2142、2320、2473、2500等光谱波段的总数I为18,l∈[1,L],图像特征量类型为R、G和B等单色的总数L为3;设θj为表面缺陷j的权重系数,且设μi,j为对应表面缺陷j在光谱波段i上的权重系数,且设wi,j,l为对应表面缺陷j在光谱波段i上的图像特征量l的权重系数,且考虑到针对不同表面缺陷种类的外观品质检测对应的最佳光谱波段及其图像特征量的反映状况也不同,提出以存在表面缺陷的香梨残次果与正常果的光谱波段上对应的图像特征量差异程度为目标且引入拉格朗日乘数λ1、λ2和λ3来建立目标函数F(wi,j,l,μi,j,θj,λ1,λ2,λ3),并通过选择参数wi,j,l,μi,j,θj来实现目标函数F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化:Step 1: Assume that for sample k with surface defects in the sample set of defective pear fruits, when collecting spectral images for surface defect j under spectral band i, the corresponding value x(i,j,l,k) can be obtained for the image feature l of monochrome such as R, G and B, where k∈[1,K], the total number of defective pear fruits K is set to 1000, j∈[1,J], including the total number of surface defects such as rot, bruise, flower skin, abrasion, deformity or crack. The number J is 6, i∈[1,I], the total number of spectral bands I such as 1000, 1025, 1076, 1152, 1203, 1279, 1300, 1406, 1431, 1533, 1609, 1634, 1888, 2092, 2142, 2320, 2473, 2500 is 18, l∈[1,L], the total number of image feature types such as R, G and B monochrome is 3; let θ j be the weight coefficient of surface defect j, and Let μ i,j be the weight coefficient of the corresponding surface defect j in spectral band i, and Let wi,j,l be the weight coefficient of the image feature l corresponding to the surface defect j in the spectral band i, and Taking into account that the optimal spectral bands and their image feature quantities corresponding to the appearance quality detection of different types of surface defects are also different, it is proposed to take the difference degree of image feature quantities corresponding to the spectral bands of defective pear fruits with surface defects and normal fruits as the target and introduce Lagrange multipliers λ 1 , λ 2 and λ 3 to establish the objective function F( wi,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 ) and maximize the objective function F(wi,j,l ,μ i, j ,θ j ,λ 1 ,λ 2 ,λ 3 ) by selecting parameters wi ,j ,l ,μ i,j ,θ j :
其中,y(i,j,l)为香梨的正常果样本集在光谱波段i下进行光谱图像采集时针对图像特征量l可获取由不存在表面缺陷j时对应的平均数值;Among them, y(i,j,l) is the average value corresponding to the absence of surface defect j when the spectral image of the normal fruit sample set of fragrant pear is collected under spectral band i for the image feature l;
步骤2:由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj求一阶导数和二阶导数,可得:Step 2: Take the first-order and second-order derivatives of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj , and we get:
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj的一阶导数时可知,F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对θj的二阶导数可见存在θj使得F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化,此时θj的理论值表达式可表示为:The first-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj is It can be seen that the second-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to θj is It can be seen that there exists θ j that maximizes F( wi,j,l ,μi ,j ,θ j , λ1 , λ2 , λ3 ), and the theoretical value expression of θ j can be expressed as:
其中,m为中间变量;Among them, m is the intermediate variable;
步骤3:由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l求一阶导数和二阶导数,可得:Step 3: Take the first-order and second-order derivatives of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to wi ,j,l , and we get:
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l的一阶导数时可知,F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对wi,j,l的二阶导数可见存在wi,j,l使得F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化,此时wi,j,l的理论值表达式可表示为:The first derivative of F(w i,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 ) with respect to w i,j,l It can be seen that the second-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to w i,j,l is It can be seen that there exists wi ,j,l that maximizes F(wi ,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ). At this time, the theoretical value of wi,j,l is expressed as The formula can be expressed as:
其中,n为中间变量;Among them, n is the intermediate variable;
步骤4:由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j求一阶导数和二阶导数,可得μi,j的理论值表达式:Step 4: By calculating the first-order derivative and the second-order derivative of μ i, j from F( wi,j,l ,μ i,j ,θ j ,λ 1 ,λ 2 ,λ 3 ), the theoretical value expression of μ i,j can be obtained:
由F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j的一阶导数时可知,F(wi,j,l,μi,j,θj,λ1,λ2,λ3)对μi,j的二阶导数可见存在μi,j使得F(wi,j,l,μi,j,θj,λ1,λ2,λ3)最大化,此时μi,j的理论值表达式可表示为:The first-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to μi ,j is It can be seen that the second-order derivative of F( wi,j,l ,μi ,j , θj , λ1 , λ2 , λ3 ) with respect to μi ,j is It can be seen that there exists μ i,j that maximizes F( wi,j,l ,μ i,j , θj , λ1 , λ2 , λ3 ), and the theoretical value expression of μ i,j can be expressed as:
其中,d为中间变量;Among them, d is the intermediate variable;
步骤5:可将目标函数F(wi,j,l,μi,j,θj,λ1,λ2,λ3)满足最大化条件时θj、μi,j和wi,j,l的理论值表达式代入权重系数的迭代过程来生成表面缺陷的实际权重系数光谱波段的实际权重系数和图像特征量的实际权重系数该迭代过程具体表示如下:Step 5: The actual weight coefficient of the surface defect can be generated by substituting the theoretical value expressions of θ j , μ i, j and wi,j,l into the iterative process of the weight coefficient when the objective function F(wi , j,l,μ i,j , θ j,λ 1 ,λ 2 ,λ 3 ) satisfies the maximization condition. Actual weight coefficients of spectral bands and the actual weight coefficient of the image feature The iterative process is specifically expressed as follows:
①在初始化过程中,采集1000个香梨残次果样品针对不同表面缺陷在不同光谱波段下的光谱图像特征量x(i,j,l,k)以及50个水果正常果建立的样本集相应的光谱图像特征量,并求统计平均值得到正常果样本集对应的图像特征量平均数值y(i,j,l),设置θj(t=0)为0.167,μi,j(t=0)为0.056,将θj(t=0)和μi,j(t=0)以及x(i,j,l,k)和y(i,j,l)代入wi,j,l的理论值表达式给出wi,j,l(t=0);① In the initialization process, the spectral image feature values x(i,j,l,k) of 1000 defective pear fruit samples in different spectral bands for different surface defects and the corresponding spectral image feature values of the sample set established by 50 normal fruits are collected, and the statistical average is calculated to obtain the average value y(i,j,l) of the image feature value corresponding to the normal fruit sample set, and θj (t=0) is set to 0.167, μi ,j (t=0) is set to 0.056, and θj (t=0) and μi ,j (t=0) as well as x(i,j,l,k) and y(i,j,l) are substituted into the theoretical value expression of w i,j,l to obtain w i,j,l (t=0);
②将t加1,将wi,j,l(t-1)和θj(t-1)代入μi,j的理论值表达式给出μi,j(t);② Add 1 to t, substitute w i,j,l (t-1) and θ j (t-1) into the theoretical value expression of μ i,j to give μ i,j (t);
③将wi,j,l(t-1)和μi,j(t)代入θj的理论值表达式给出θj(t);③Substitute w i,j,l (t-1) and μ i,j (t) into the theoretical value expression of θ j to give θ j (t);
④将θj(t)和μi,j(t)代入wi,j,l的理论值表达式给出wi,j,l(t);④Substitute θ j (t) and μ i,j (t) into the theoretical value expression of wi ,j,l to give wi ,j,l (t);
⑤比较|[wi,j,l(t)-wi,j,l(t-1)]/wi,j,l(t)|、|[μi,j(t)-μi,j(t-1)]/μi,j(t)|和|[θj(t)-θj(t-1)]/θj(t)|,若皆小于等于迭代过程误差门限δ则进入迭代过程⑥,否则进入迭代过程⑤,其中δ设置为2%;⑤ Compare |[ wi,j,l (t)-wi ,j,l (t-1)]/ wi,j,l (t)|, |[μi ,j (t)-μi ,j (t-1)]/μi ,j (t)| and |[ θj (t) -θj (t-1)]/ θj (t|. If all of them are less than or equal to the iterative process error threshold δ, then enter iterative process ⑥; otherwise, enter iterative process ⑤, where δ is set to 2%;
⑥由wi,j,l(t)作为元素建立集合Ψi,j,l={wi,j,l(t)},由μi,j(t)作为元素建立集合Φi,j={μi,j(t)},由θj(t)作为元素建立集合Θj={θj(t)},其中i∈[1,I],j∈[1,J],l∈[1,L];若wi,j,l(t)<εw,说明对应的光谱图像特征量对表面缺陷j在光谱波段i下的检测贡献度较小,则将wi,j,l(t)从Ψi,j,l中剔除,从而实现该光谱波段下多光谱图像特征量的优选,并将相应的i,j,l组合加入集合若μi,j(t)<εμ,说明对应的光谱波段对表面缺陷j的检测贡献度较小,则将μi,j(t)从Φi,j中剔除,从而实现光谱波段的优选,并将相应的i,j组合加入集合若θj(t)<εθ,说明对应的光谱波段对水果外观品质的整体检测贡献度较小,则将θj(t)从Θj中剔除,并将相应的j加入集合其中εw设置为0.01,εμ设置为0.02,εθ设置为0.05;⑥ Establish a set Ψ i,j,l ={wi,j, l (t)} with w i, j,l (t) as an element, establish a set Φ i,j ={μ i,j (t)} with μ i,j (t) as an element, and establish a set Θ j ={θ j (t)} with θ j (t) as an element, where i∈[1,I], j∈[1,J], l∈[1,L]; if w i,j,l (t)<ε w , it means that the corresponding spectral image feature contributes little to the detection of surface defect j in spectral band i, then w i,j,l (t) is removed from Ψ i,j,l , so as to achieve the optimization of multi-spectral image feature in this spectral band, and add the corresponding i,j,l combination to the set If μ i,j (t) < ε μ , it means that the corresponding spectral band contributes less to the detection of surface defect j. Then μ i,j (t) is removed from Φ i,j to achieve the optimization of spectral bands, and the corresponding i,j combination is added to the set If θ j (t) < ε θ , it means that the corresponding spectral band contributes less to the overall detection of fruit appearance quality. Then θ j (t) is removed from Θ j and the corresponding j is added to the set Among them, ε w is set to 0.01, ε μ is set to 0.02, and ε θ is set to 0.05;
⑦由集合Ψi,j,l={wi,j,l(t)}给出由集合Φi,j={μi,j(t)}给出由集合Θj={θj(t)}给出其中i∈[1,I],j∈[1,J],l∈[1,L];⑦ Given by the set Ψ i,j,l = { wi,j,l (t)} Given by the set Φ i,j = {μ i,j (t)} Given by the set Θ j ={θ j (t)} Where i∈[1,I], j∈[1,J], l∈[1,L];
⑧令和则可得:⑧ Order and Then we can get:
由此可得表面缺陷的实际权重系数光谱波段的实际权重系数和图像特征量的实际权重系数进行输出。The actual weight coefficient of surface defects can be obtained from this Actual weight coefficients of spectral bands and the actual weight coefficient of the image feature Output.
步骤6:测量出需要检测的香梨r对于不同表面缺陷在范围内光谱波段上的范围内图像特征量,对于表面缺陷j而言,若香梨r关于表面缺陷j的图像特征量偏离状况满足时则可视为该香梨不存在外观品质检测中的表面缺陷j,否则认为该水果存在表面缺陷j,其中,香梨关于表面缺陷j的图像特征量偏离门限θj设为5%。Step 6: Measure the surface defects of the pear to be tested. Spectral bands within the range For surface defect j, if the deviation of the image feature quantity of pear r with respect to surface defect j satisfies If the pear has no surface defects in the appearance quality inspection, it can be considered that the fruit has surface defects. The deviation threshold θ j of the image feature quantity of the fragrant pear with respect to the surface defect j is set to 5%.
在本次具体实施中,可在得到所需的经过去除背景的图像区域后对1000、1025、1076、1152、1203、1279、1300、1406、1431、1533、1609、1634、1888、2092、2142、2320、2473、2500等不同光谱波段下所采集到的图像区域通过以R、G和B等图像特征量方式合成的多光谱图像,其识别率都要明显优于单色图像的识别率,对于腐烂、碰伤、花皮、擦伤、畸形或裂口等表面缺陷的识别误差状况平均降低了4%,表明本方法具有较好的实用效果,且通过图像特征量的实际权重系数也可了解到图像特征量对多光谱图像识别率的贡献程度,从而有利于推荐出多光谱图像的合成方式,同时不同表面缺陷对不同的表面特征其灰度分布也不同,可见通过光谱波段的实际权重系数寻找出对表面缺陷反应更为明显突出的光谱波段,从而优选出对于表面缺陷更合适的光谱波段来实现水果外观品质检测。In this specific implementation, after obtaining the required image area after removing the background, the image areas collected under different spectral bands such as 1000, 1025, 1076, 1152, 1203, 1279, 1300, 1406, 1431, 1533, 1609, 1634, 1888, 2092, 2142, 2320, 2473, 2500 can be synthesized into multispectral images by using image feature quantities such as R, G and B. The recognition rate is significantly better than that of monochrome images, and it is also very effective for rot, bruises, flower skin and abrasions. The recognition error of surface defects such as shape, deformity or crack is reduced by 4% on average, indicating that the method has good practical effect. The actual weight coefficient of the image feature quantity can also be used to understand the contribution of the image feature quantity to the multispectral image recognition rate, which is conducive to recommending the synthesis method of the multispectral image. At the same time, different surface defects have different grayscale distributions for different surface features. It can be seen that the actual weight coefficient of the spectral band can be used to find the spectral band that reacts more obviously to surface defects, so as to select the spectral band that is more suitable for surface defects to realize the appearance quality detection of fruit.
Claims (4)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211299966.0A CN115575405B (en) | 2022-10-24 | 2022-10-24 | Fruit appearance quality detection method based on multispectral image feature quantity |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211299966.0A CN115575405B (en) | 2022-10-24 | 2022-10-24 | Fruit appearance quality detection method based on multispectral image feature quantity |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115575405A CN115575405A (en) | 2023-01-06 |
CN115575405B true CN115575405B (en) | 2024-07-19 |
Family
ID=84587070
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211299966.0A Active CN115575405B (en) | 2022-10-24 | 2022-10-24 | Fruit appearance quality detection method based on multispectral image feature quantity |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115575405B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115575404B (en) * | 2022-10-24 | 2024-07-09 | 绿萌科技股份有限公司 | Fruit appearance quality detection method based on ratio multispectral image |
CN116645664B (en) * | 2023-04-11 | 2024-07-12 | 绿萌科技股份有限公司 | Fruit appearance quality evaluation method based on coloring surface condition analysis |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111539936A (en) * | 2020-04-24 | 2020-08-14 | 河北工业大学 | A Hybrid Weight Multispectral Fusion Method for Lithium Battery Images |
CN114199880A (en) * | 2021-11-22 | 2022-03-18 | 西南大学 | A real-time detection method of citrus diseases and insect pests based on edge computing |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7714997B2 (en) * | 2006-11-07 | 2010-05-11 | Hitachi High-Technologies Corporation | Apparatus for inspecting defects |
CN106568784A (en) * | 2016-11-09 | 2017-04-19 | 石河子大学 | Multispectral imaging system and implementation method which are used for fruit and vegetable surface defect on-line detection |
CN106940292A (en) * | 2017-04-25 | 2017-07-11 | 合肥工业大学 | Bar denier wood raw material quick nondestructive discrimination method of damaging by worms based on multi-optical spectrum imaging technology |
KR102205445B1 (en) * | 2019-02-28 | 2021-01-20 | 충남대학교산학협력단 | Method and System for Detecting Foreign Material on Processing Vegetable Using Multispectral Fluorescence Imaging |
CN110441312A (en) * | 2019-07-30 | 2019-11-12 | 上海深视信息科技有限公司 | A kind of surface defects of products detection system based on multispectral imaging |
CN111999293A (en) * | 2020-07-03 | 2020-11-27 | 中国农业大学 | A kind of fruit and vegetable freshness detection and evaluation method |
CN115144405B (en) * | 2022-09-02 | 2022-12-13 | 扬州中科半导体照明有限公司 | Mini LED wafer appearance defect detection method based on optical detection |
-
2022
- 2022-10-24 CN CN202211299966.0A patent/CN115575405B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111539936A (en) * | 2020-04-24 | 2020-08-14 | 河北工业大学 | A Hybrid Weight Multispectral Fusion Method for Lithium Battery Images |
CN114199880A (en) * | 2021-11-22 | 2022-03-18 | 西南大学 | A real-time detection method of citrus diseases and insect pests based on edge computing |
Also Published As
Publication number | Publication date |
---|---|
CN115575405A (en) | 2023-01-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115575405B (en) | Fruit appearance quality detection method based on multispectral image feature quantity | |
Huang et al. | Rapid and nondestructive prediction of amylose and amylopectin contents in sorghum based on hyperspectral imaging | |
CN111443043B (en) | Hyperspectral image-based walnut kernel quality detection method | |
CN118243644B (en) | Method for estimating nitrogen content of grassland vegetation leaf | |
CN111855608A (en) | A near-infrared non-destructive testing method for apple acidity based on fusion feature wavelength selection algorithm | |
CN114092839B (en) | Unmanned aerial vehicle remote sensing-based soybean harvest period maturity judging method | |
CN111795943A (en) | A method for non-destructive detection of exogenous sucrose in tea based on near-infrared spectroscopy | |
CN106841167A (en) | The lossless detection method of garden stuff pesticide residue | |
CN117288692B (en) | Method for detecting tannin content in brewing grains | |
CN113418892A (en) | Method for rapidly identifying yellow-Ye winter jujubes without damage | |
CN113484278A (en) | Tomato comprehensive quality nondestructive testing method based on spectrum and principal component analysis | |
CN117825352A (en) | A nondestructive detection method for freshness of green beans based on Raman spectroscopy | |
Femenias et al. | Hyperspectral imaging | |
CN111289463A (en) | A hyperspectral nondestructive prediction method for apple impact damage area | |
Zhou et al. | Hyperspectral imaging technology for detection of moisture content of tomato leaves | |
CN117309776A (en) | Raw chicken ingredient detection method based on hyperspectral and single-tag regression | |
CN115575404A (en) | Fruit appearance quality detection method based on ratio multispectral image | |
CN116577283A (en) | Rapid nondestructive testing method for rice fatty acid content | |
CN113310933A (en) | Spectrum identification method for number of days for storing raw buffalo milk | |
Gao et al. | Hyperspectral imaging for prediction and distribution visualization of total acidity and hardness of red globe grapes. | |
CN115184298B (en) | Method for on-line monitoring of soy sauce quality based on near infrared spectrum | |
CN119295972B (en) | A peanut biomass inversion method based on feature extraction and screening | |
CN115326747B (en) | Method for detecting fruit surface decay by short wave near infrared | |
Zhang et al. | Research on apple identity recognition method based on hyperspectral technology and chemometrics method | |
CN115950833A (en) | Method, system, equipment and medium for quality detection of processed tomatoes |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 341600 No. 9, Shuanglong Avenue, High tech Zone, Xinfeng County, Ganzhou, Jiangxi Province Applicant after: Lvmeng Technology Co.,Ltd. Address before: Jiangxi Lumeng Technology Holding Co., Ltd., No. 30, Chengxin Avenue, Xinfeng Industrial Park, Ganzhou City, Jiangxi Province, 341600 Applicant before: JIANGXI REEMOON TECHNOLOGY HOLDINGS Co.,Ltd. |
|
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |