孫衛(wèi)紅 楊程杰 邵鐵鋒 梁曼 鄭健
摘要:針對目前人工選繭誤選率高、效率低的問題,本文以上車?yán)O、黃斑繭、爛繭為研究對象,提出一種基于多尺度色彩恢復(fù)算法與注意力機(jī)制的群體蠶繭智能識別算法。首先,將原始圖像進(jìn)行低通濾波,并乘以色彩恢復(fù)因子,在多尺度內(nèi)恢復(fù)蠶繭色彩與表面細(xì)節(jié)信息,得到多尺度高頻細(xì)節(jié)圖像。其次,通過修改YOLOv3算法主干特征提取網(wǎng)絡(luò)中的殘差層引入注意力機(jī)制,對卷積后特征圖中的分支特征重新標(biāo)定,增大有效特征的權(quán)重。最后,在非極大值抑制算法基礎(chǔ)上增加一項(xiàng)得分與相鄰框重合度計(jì)算過程,篩除YOLOv3后期無效預(yù)測框,實(shí)現(xiàn)群體蠶繭種類識別。實(shí)驗(yàn)結(jié)果表明,本文算法的均值平均精度達(dá)到85.52%,相較于YOLOv3增加4.85%。
關(guān)鍵詞:蠶繭;智能識別;MSRCR算法;YOLOv3算法;注意力機(jī)制;NMS算法
中圖分類號:TS101.91文獻(xiàn)標(biāo)志碼:A文章編號: 10017003(2022)06005808
引用頁碼: 061108
DOI: 10.3969/j.issn.1001-7003.2022.06.008(篇序)
基金項(xiàng)目: 國家市場監(jiān)管總局科技計(jì)劃項(xiàng)目(S2021MK0217);浙江省公益技術(shù)應(yīng)用研究項(xiàng)目(LGG20E050014);江西省市場監(jiān)督管理局科技項(xiàng)目(GSJK202003)
作者簡介:孫衛(wèi)紅(1969),男,教授,博士,主要從事檢驗(yàn)技術(shù)及自動化裝置、數(shù)字化設(shè)計(jì)制造、制造業(yè)信息化的研究。
繭絲綢行業(yè)內(nèi)根據(jù)制絲時(shí)工藝要求差異對原料蠶繭進(jìn)行分類的過程稱為選繭[1]。肉眼評定法是目前行業(yè)內(nèi)應(yīng)用最廣泛的選繭方式,選繭效率依賴于操作人員的熟練程度,無法避免主觀意識與情緒,難以恒定評估蠶繭的質(zhì)量[2]。為解決人工選繭速度慢、誤差大等問題,國內(nèi)外學(xué)者將圖像處理技術(shù)應(yīng)用至蠶繭種類識別研究。陳浩等[3]采用Matlab軟件對采集的單粒蠶繭圖像進(jìn)行二值化、空洞填充及面積計(jì)算等處理,達(dá)到表面污斑面積自動檢測的目的;宋亞杰等[4]運(yùn)用數(shù)字圖像處理技術(shù),根據(jù)數(shù)學(xué)形態(tài)對蠶繭進(jìn)行劃分;孫衛(wèi)紅等[5]基于不同蠶繭在HSV空間模型下的顏色特征,結(jié)合支持向量機(jī)設(shè)計(jì)并構(gòu)造分類器方案。上述檢測方法應(yīng)用于單粒蠶繭或者數(shù)量較少場合,自動化程度較高,但在面對蠶繭數(shù)量較多情況時(shí),算法的檢測精度大幅下降。因此,亟需一種可準(zhǔn)確識別群體蠶繭種類的檢測算法。
目前國內(nèi)外學(xué)者在群體目標(biāo)檢測方面的研究已取得一定進(jìn)展。曹詩雨等[6]通過改進(jìn)Fast R-CNN(Fast Region-based Convolutional Network)目標(biāo)檢測算法,可準(zhǔn)確識別城市道路中的公交車、小型汽車;彭紅星等[7]以四種水果為研究對象,提出一種改進(jìn)的SSD(Single Shot MultiBox Detector)深度學(xué)習(xí)水果檢測算法,解決了自然環(huán)境下水果識別率低、泛化性弱等問題;Loey等[8]基于ResNet-50提取深度遷移學(xué)習(xí)模型的特征,并采用YOLOv2(You Only Look Once)算法對人群中的醫(yī)用口罩特征進(jìn)行標(biāo)注與定位;趙德安等[9]為實(shí)現(xiàn)復(fù)雜環(huán)境中機(jī)器人對蘋果的檢測,采用一種基于YOLOv3的蘋果識別算法,準(zhǔn)確定位蘋果的同時(shí),驗(yàn)證YOLOv3算法對群體目標(biāo)識別檢測的可行性。
為提高YOLOv3算法對群體蠶繭種類識別的精度與魯棒性,本文以上車?yán)O、黃斑繭與爛繭為研究對象,提出基于多尺度色彩恢復(fù)算法(Multi-Scale Retinex with Color Restoration,MSRCR)與注意力機(jī)制(Convolution Block Attention Module,CBAM)的群體蠶繭智能識別算法,在深度學(xué)習(xí)訓(xùn)練前對暗箱內(nèi)拍攝的蠶繭原始圖片進(jìn)行MSRCR算法預(yù)處理得到多尺度高頻細(xì)節(jié)圖像,增加蠶繭圖像細(xì)節(jié)信息,解決蠶繭圖像表面細(xì)節(jié)清晰度低的問題。將注意力機(jī)制引入YOLOv3的主干特征提取網(wǎng)絡(luò),對高保真圖像的分支特征重新標(biāo)定,使網(wǎng)絡(luò)聚焦于有效疵點(diǎn)特征,抑制背景的干擾。后期預(yù)測框篩選策略增加一項(xiàng)得分與相鄰框重合度的計(jì)算過程,提高預(yù)測框篩選的合理性,降低算法對群體蠶繭識別的漏檢率。
1 方 法
1.1 蠶繭圖像色彩恢復(fù)
深度學(xué)習(xí)前需對采集圖像進(jìn)行預(yù)處理,其目的是改善視覺效果,轉(zhuǎn)換為機(jī)器更為適合分析的形式[10]。蠶繭圖像均拍攝自暗箱,由于蠶繭呈橢圓球狀,受光源照射不均勻,圖像中蠶繭表面局部細(xì)節(jié)清晰度較低。本文通過MSRCR算法進(jìn)行圖像預(yù)處理,恢復(fù)陰暗圖像中蠶繭色彩,減小光照對算法檢測精度的影響。MSRCR算法的原理公式如式(1)(2)[11-13],式(3)采用色彩恢復(fù)因子C調(diào)節(jié)式(2)輸出項(xiàng)RMSR(x,y),凸顯蠶繭表面較暗區(qū)域的特征信息,解決圖像局部區(qū)域?qū)Ρ榷仍鰪?qiáng)而導(dǎo)致色彩失真的問題,得到結(jié)合色彩恢復(fù)因子的第i顏色通道的多尺度濾波高頻細(xì)節(jié)圖像RMSRCRi(x,y)。
G(x,y)=k·exp-x2+y2θ2??? (1)
RMSR(x,y)=∑nsn=1λn·{logI(x,y)-log[I(x,y)·G(x,y)]}??? (2)09B613B9-6D44-4542-91B1-A1F0EE71EE1A
RMSRCRi(x,y)=Ci(x,y)·RMSRi(x,y)Ci(x,y)=β·log[α·Ii(x,y)]-log∑Ni=1Ii(x,y)??? (3)
式(1)為高斯函數(shù),其中k和θ分別為歸一化參數(shù)和高斯環(huán)繞尺度參數(shù);式(2)利用式(1)對原圖I(x,y)先選取多個(gè)尺度參數(shù)進(jìn)行低通濾波,再進(jìn)行加權(quán)平均求和,得到多尺度濾波后的蠶繭高頻細(xì)節(jié)圖像R(x,y),式(2)中λn表示權(quán)值,ns為尺度數(shù)目;式(3)中i為顏色通道,N為圖像中所有顏色通道,α為非線性強(qiáng)度控制因子,β為可調(diào)的增益參數(shù)。β決定圖像色彩恢復(fù)的最終效果,需根據(jù)實(shí)際目標(biāo)增強(qiáng)效果調(diào)整并取值[12]。本文采用200萬像素的相機(jī),暗箱內(nèi)平均光照強(qiáng)度為106 Lux,通過改變增益參數(shù)β獲得不同增益效果的上車?yán)O、黃斑繭和爛繭多尺度高頻細(xì)節(jié)圖像。經(jīng)YOLOv3算法檢測,最后檢測效果評價(jià)指標(biāo)采用均值平均精度(mean Average Precision,mAP),實(shí)驗(yàn)結(jié)果如圖1所示。由圖1可知,本實(shí)驗(yàn)中β取值35時(shí),均值平均精度較高。
蠶繭原始圖像與MSRCR圖像增強(qiáng)后的多尺度高頻細(xì)節(jié)圖像示例如圖2所示。圖2(c)(d)中的蠶繭圖像色彩得到恢復(fù),相較于圖2(a)(b)的對比度與清晰度提高,且在高動態(tài)范圍內(nèi)得到壓縮。因此,經(jīng)MSRCR算法預(yù)處理后的蠶繭圖像可作為YOLOv3訓(xùn)練的數(shù)據(jù)集。
1.2 YOLOv3算法改進(jìn)
YOLOv3是目前主流的目標(biāo)檢測算法之一,在實(shí)時(shí)性與精準(zhǔn)度方面表現(xiàn)突出。針對YOLOv3算法在群體蠶繭識別時(shí)出現(xiàn)誤檢、漏檢等問題,本文采用Darknet53[14-16]作為主干特征提取網(wǎng)絡(luò),將輸入圖像固定尺寸至416×416像素,經(jīng)卷積層、殘差層及注意力機(jī)制提取特征后,輸出層得到13×13、26×26、52×52三種不同像素尺寸的特征圖,其中Concat的作用是將相同尺寸特征圖的通道進(jìn)行拼接,達(dá)到上采樣的目的。經(jīng)過Soft-NMS算法篩除無效預(yù)測框,改進(jìn)后的YOLOv3算法達(dá)到群體蠶繭種類識別的目的。具體算法流程如圖3所示。
1.2.1 基于注意力機(jī)制的主干特征提取網(wǎng)絡(luò)
YOLOv3算法應(yīng)用于群體蠶繭識別時(shí),發(fā)現(xiàn)對中小目標(biāo)的識別存在缺陷,極易出現(xiàn)誤檢。本文通過修改主干特征提取網(wǎng)絡(luò)的殘差層,對中間層的蠶繭特征圖沿通道和空間兩個(gè)獨(dú)立維度推導(dǎo)權(quán)重,將權(quán)重與輸入特征圖相乘,劃分圖中有效疵點(diǎn)特征與無效背景,進(jìn)行自適應(yīng)特征細(xì)化。注意力機(jī)制結(jié)構(gòu)如圖4所示,由通道注意力與空間注意力組成,F(xiàn)為原始特征圖,MC和MS分別表示通道注意力特征圖與空間注意力特征圖,F(xiàn)′和F″分別表示經(jīng)通道注意力與空間注意力處理后輸出的蠶繭特征圖[17]。蠶繭圖像經(jīng)注意力機(jī)制提取特征后,有效特征(呈紅色)與背景實(shí)現(xiàn)分割,神經(jīng)網(wǎng)絡(luò)注意力區(qū)域集中于蠶繭表面,提升了通道內(nèi)有效特征的權(quán)重。
注意力機(jī)制由通道和空間注意力組成[18]。通道注意力使用最大池化與平均池化聚合特征圖中的信息,再使用共享網(wǎng)絡(luò)層,采用逐元素求和方式輸出特征向量,對經(jīng)過特征矩陣卷積后的通道進(jìn)行過濾,提升有效疵點(diǎn)特征在特征圖中的權(quán)重,突出蠶繭圖像關(guān)鍵特征區(qū)域的信息,通道注意力結(jié)構(gòu)如圖5(a)所示??臻g注意力關(guān)注特征圖中目標(biāo)蠶繭的坐標(biāo)信息,是對通道注意力的補(bǔ)充??臻g注意力經(jīng)最大池化與平均池化處理,在保留通道維度的前提下,匯集相似的特征向量,將其輸入至卷積層,基于特征圖生成描述符對蠶繭的空間位置進(jìn)行編碼,最后通過Sigmoid函數(shù)歸一化得到特征圖,空間注意力結(jié)構(gòu)如圖5(b)所示。
本文對MSRCR算法預(yù)處理得到的高頻細(xì)節(jié)圖像,分別利用YOLOv3算法與改進(jìn)的YOLOv3算法進(jìn)行檢測,如圖6—圖8所示。對比圖7、圖8可知,改進(jìn)算法檢測蠶繭高頻細(xì)節(jié)圖像時(shí),特征圖熱區(qū)得到提升,有效疵點(diǎn)特征權(quán)重增大,可見網(wǎng)絡(luò)提取蠶繭特征的能力增強(qiáng)。
1.2.2 柔性非極大值抑制算法
在后期預(yù)測框處理階段,YOLOv3算法采用非極大值抑制算法(Non-Maximum Suppresion,NMS)篩選一定區(qū)域內(nèi)屬于同一目標(biāo)蠶繭的最高得分預(yù)測框,用于解決目標(biāo)檢測過程中預(yù)測框重疊問題[19]。NMS算法原理如式(4)[20]所示。
Si=Si,iou(M,bi)
式中:Si是每個(gè)框通過分類計(jì)算器得到的分?jǐn)?shù);Nt是重疊區(qū)域比較的閾值,設(shè)定為0.5。
非極大值抑制算法對目標(biāo)蠶繭預(yù)測框的分?jǐn)?shù)進(jìn)行排序,保留最高項(xiàng),刪除與該項(xiàng)重合度大于閾值的其余預(yù)測框。
實(shí)際群體蠶繭識別過程中,由于分?jǐn)?shù)最高的預(yù)測框會將該目標(biāo)蠶繭區(qū)域內(nèi)其余預(yù)測框刪除,而刪除預(yù)測框中恰好包括相鄰蠶繭的預(yù)測框,導(dǎo)致出現(xiàn)預(yù)測框缺失的問題。因此,本文通過對非極大值抑制算法增加線性加權(quán)函數(shù)與高斯加權(quán)函數(shù)的方法,引入柔性非極大值抑制算法Soft-NMS,在原算法基礎(chǔ)上增加一項(xiàng)與相鄰框的重合度計(jì)算。Soft-NMS的原理如式(5)(6)[21]所示。09B613B9-6D44-4542-91B1-A1F0EE71EE1A
Si=Si,iou(M,bi)
Si=Si·exp-iou(M,bi)2σ, biD??? (6)
式中:M為當(dāng)前得分最高框,bi為待處理框,D為所有處理完畢預(yù)測框的集合,σ為一個(gè)極小正數(shù)。
由算法原理可知,bi與M的交并比(Intersection over Union,iou)越高,bi的得分Si就越低。改進(jìn)算法通過降低高得分預(yù)測框內(nèi)重合度大于閾值的預(yù)測框分?jǐn)?shù),優(yōu)化預(yù)測框篩選策略。
NMS算法與Soft-NMS算法在測試集上的對比結(jié)果如表1所示。針對蠶繭相鄰距離過近造成預(yù)測框消失的問題,實(shí)驗(yàn)中所用蠶繭圖像為距離較近擺放拍攝。由表1可見,在相同蠶繭檢測數(shù)量下,Soft-NMS正確率均高于NMS算法,表明YOLOv3算法采用柔性極大值抑制方法處理預(yù)測框可降低蠶繭漏檢率。
2 實(shí)驗(yàn)與分析
實(shí)驗(yàn)硬件環(huán)境:采用型號為AMD Ryzen5 2600X的CPU(超威半導(dǎo)體公司),型號為NVIDIA GTX 1660TiGPU的顯卡(英偉達(dá)公司)。軟件環(huán)境:Ubuntu 18.04操作系統(tǒng),深度學(xué)習(xí)框架為Pytorch,編程語言采用Python。
2.1 數(shù)據(jù)集制作與模型訓(xùn)練
數(shù)據(jù)集制作是深度學(xué)習(xí)訓(xùn)練任務(wù)的基礎(chǔ)環(huán)節(jié)。為驗(yàn)證本文算法對于群體蠶繭種類識別的適用性,將檢測機(jī)構(gòu)及暗箱拍攝的上車?yán)O、黃斑繭、爛繭標(biāo)準(zhǔn)圖像若干,經(jīng)MSRCR圖像預(yù)處理后以PASCAL VOC2007數(shù)據(jù)集格式進(jìn)行存儲,用于測試算法的精度與魯棒性。數(shù)據(jù)集共計(jì)蠶繭圖像1 200張,上述每種蠶繭各占1/3,訓(xùn)練前均縮放至416×416像素。實(shí)驗(yàn)訓(xùn)練過程采用隨機(jī)梯度下降法,初始學(xué)習(xí)率設(shè)定為0.001,權(quán)重衰減系數(shù)為0.000 1。圖9為訓(xùn)練模型所得損失值函數(shù)曲線,橫坐標(biāo)表示訓(xùn)練迭代次數(shù),縱坐標(biāo)為訓(xùn)練過程中的損失值,損失值越低代表模型精度越高,最高迭代6 000次。
2.2 評價(jià)指標(biāo)
實(shí)驗(yàn)采用平均精度(Average Precision,AP)、準(zhǔn)確率(Precision,P)、召回率(Recall,R)、均值平均精度與單張圖像檢測時(shí)間作為衡量群體蠶繭識別算法性能的指標(biāo)。準(zhǔn)確率與召回率的定義如式(7)(8)所示。
Pprecision=TPTP+FP,Rrecall=TPTP+FN??? (7)
MAP=∑Nk=1(R(k+1)-R(k))·max[P(R(k+1)),P(R(k))],MmAP=1C·AP??? (8)
式中:TP為目標(biāo)蠶繭被識別為正確種類的個(gè)數(shù),F(xiàn)P為目標(biāo)蠶繭被識別為錯誤種類的個(gè)數(shù),F(xiàn)N為漏檢蠶繭的個(gè)數(shù),C為數(shù)據(jù)集中蠶繭種類的數(shù)量,N為引用閾值的數(shù)量,k為閾值,P(k)、R(k)分別為準(zhǔn)確率與召回率[14]。
針對數(shù)據(jù)集分別使用目標(biāo)檢測領(lǐng)域常用的YOLOv3-tiny算法、YOLOv3算法與本文提出的群體蠶繭識別算法進(jìn)行比較,平均精度與均值平均精度檢測結(jié)果如圖10所示。對于同
一蠶繭種類,本文算法的平均精度均高于其他兩種算法,說明引入注意力機(jī)制有效提高算法對蠶繭特征的提取能力,同時(shí)采用柔性非極大值抑制算法能降低后期預(yù)測框的漏檢率,兩者結(jié)合可提升算法的檢測精度。對于實(shí)驗(yàn)的三種蠶繭,平均精度均有上升,說明本文算法在滿足有效性的前提下,泛化能力較強(qiáng)。
為進(jìn)一步比較三種算法的各項(xiàng)性能,本文增加準(zhǔn)確率、召回率與對單張圖像的檢測時(shí)間,如表2所示。在精度指標(biāo)上,本文算法對于同種蠶繭的準(zhǔn)確率與召回率均高于YOLOv3-tiny、YOLOv3,在數(shù)據(jù)集上的mAP達(dá)到85.52%,相比YOLOv3-tiny、YOLOv3分別提升19.27%、4.85%,上車?yán)O、黃斑繭和爛繭的AP相比改進(jìn)前YOLOv3算法,分別得到4.30%、4.70%、5.53%的提升。從檢測單張圖像時(shí)間的開銷來看,改進(jìn)YOLOv3算法單張蠶繭圖像的時(shí)間為30.1 ms,略高于YOLOv3,但在實(shí)際應(yīng)用場景中可滿足實(shí)時(shí)性的要求。
本文算法與YOLOv3算法對比效果如圖11所示。圖11(a)中蠶繭圖像未經(jīng)MSRCR圖像預(yù)處理,YOLOv3算法檢測得到的預(yù)測框范圍較大,對于關(guān)鍵特征的識別并不精準(zhǔn),算法經(jīng)改進(jìn)后,實(shí)際效果如圖11(d)所示,預(yù)測框的像素值范圍減小,說明對關(guān)鍵特征識別的定位精度得到提高。YOLOv3算法在圖11(b)中檢測相鄰緊密的蠶繭時(shí)出現(xiàn)漏檢,表明非極大值抑制算法處理重合度較大的預(yù)測框時(shí)存在缺陷,可通過Soft-NMS算法降低目標(biāo)框內(nèi)其余預(yù)測框分?jǐn)?shù)的方式進(jìn)行優(yōu)化,效果如圖11(e)所示。圖11(c)中YOLOv3算法檢測時(shí)將一粒上車?yán)O誤檢為黃斑繭,而圖11(f)中改進(jìn)后的YOLOv3算法除正確識別其他繭外,也正確識別該繭為上車?yán)O。
3 結(jié) 論
為提高YOLOv3算法對群體蠶繭識別的準(zhǔn)確率,本文提出一種基于MSRCR與注意力機(jī)制的群體蠶繭智能識別算法。本文算法首先利用MSRCR預(yù)處理蠶繭原圖得到高頻細(xì)節(jié)圖像,減小光照對算法精度的影響。其次通過修改主干特征提取網(wǎng)絡(luò)的殘差層引入注意力機(jī)制,融合模型訓(xùn)練過程中不同通道間蠶繭的有效疵點(diǎn)特征。最后采用Soft-NMS算法優(yōu)化后期預(yù)測框的篩除策略,降低算法的漏檢率與誤檢率。對比實(shí)驗(yàn)結(jié)果表明,改進(jìn)后的YOLOv3算法在滿足實(shí)時(shí)性的要求下,對群體蠶繭種類識別的精度得到提高。09B613B9-6D44-4542-91B1-A1F0EE71EE1A
參考文獻(xiàn):
[1]王超, 劉文烽, 胡紫東. 并聯(lián)機(jī)器人在蠶繭分揀系統(tǒng)中的應(yīng)用研究[J]. 企業(yè)科技與發(fā)展, 2018(4): 87-90.
WANG Chao, LIU Wenfeng, HU Zidong. Research on the application of parallel robots in cocoon sorting system[J]. Sci-Tech & Development of Enterprise, 2018(4): 87-90.
[2]金君, 邢秋明. 蠶繭質(zhì)量無損檢測方法的探討[J]. 中國纖檢, 2012(9): 64-66.
JIN Jun, XING Qiuming. Discussion onnon-destructive examination of cocoon quality[J]. China Fiber Inspection, 2012(9): 64-66.
[3]陳浩, 楊崢, 劉霞, 等. 基于Matlab的桑蠶繭選繭輔助檢驗(yàn)方法的研究[J]. 絲綢, 2016, 53(3): 32-36.
CHEN Hao, YANG Zheng, LIU Xia, et al. Study on auxiliary testing method for mulberry silkworm cocoon sorting based on Matlab[J]. Journal of Silk, 2016, 53(3): 32-36.
[4]宋亞杰, 謝守勇, 冉瑞龍. 機(jī)器視覺技術(shù)在蠶繭無損檢測中的應(yīng)用研究[J]. 現(xiàn)代農(nóng)業(yè)裝備, 2006(9): 48-51.
SONG Yaljie, XIE Shouyong, RAN Ruilong. Applied research on machine vision technology in non-destructive test of cocoon[J]. Modern Agricultural Equipments, 2006(9): 48-51.
[5]孫衛(wèi)紅, 黃志鵬, 梁曼, 等. 基于顏色特征和支持向量機(jī)的蠶繭分類方法研究[J]. 蠶業(yè)科學(xué), 2020, 46(1): 86-95.
SUN Weihong, HUANG Zhipeng, LIANG Man, et al. Cocoon classification method based on color feature and support vector machine[J]. Acta Sericologica Sinica, 2020, 46(1): 86-95.
[6]曹詩雨, 劉躍虎, 李辛昭. 基于Fast R-CNN的車輛目標(biāo)檢測[J]. 中國圖象圖形學(xué)報(bào), 2017, 22(5): 671-677.
CAO Shiyu, LIU Yuehu, LI Xinzhao. Vehicle detection method based on Fast R-CNN[J]. Journal of Image and Graphics, 2017, 22(5): 671-677.
[7]彭紅星, 黃博, 邵園園, 等. 自然環(huán)境下多類水果采摘目標(biāo)識別的通用改進(jìn)SSD模型[J]. 農(nóng)業(yè)工程學(xué)報(bào), 2018, 34(16): 155-162.
PENG Hongxing, HUANG Bo, SHAO Yuanyuan, et al. General improved SSD model for picking object recognition of multiple fruits in natural environment[J]. Transactions of the Chinese Society of Agricultural Engineering, 2018, 34(16): 155-162.
[8]LOEY M, MANOGARAN G, TAHA M H N, et al. Fighting against COVID-19: A novel deep learning model based on YOLO-v2 with ResNet-50 for medical face mask detection[J]. Sustainable Cities and Society, 2021, 65(2): 102600.
[9]趙德安, 吳任迪, 劉曉洋, 等. 基于YOLO深度卷積神經(jīng)網(wǎng)絡(luò)的復(fù)雜背景下機(jī)器人采摘蘋果定位[J]. 農(nóng)業(yè)工程學(xué)報(bào), 2019, 35(3): 164-173.
ZHAO Dean, WU Rendi, LIU Xiaoyang, et al. Apple positioning based on YOLO deep convolutional neural network for picking robot in complex background[J]. Transactions of the Chinese Society of Agricultural Engineering, 2019, 35(3): 164-173.
[10]熊俊濤, 鄒湘軍, 王紅軍, 等. 基于Retinex圖像增強(qiáng)的不同光照條件下的成熟荔枝識別[J]. 農(nóng)業(yè)工程學(xué)報(bào), 2013, 29(12): 170-178.
XIONG Juntao, ZOU Xiangjun, WANG Hongjun, et al. Recognition of ripe litchi in different illumination conditions based on Retinex image enhancement[J]. Transactions of the Chinese Society of Agricultural Engineering, 2013, 29(12): 170-178.09B613B9-6D44-4542-91B1-A1F0EE71EE1A
[11]LAND E H. An alternative technique for the computation of the designator in the retinex theory of color vision[J]. Proceedings of the National Academy of Sciences of the United States of America, 1986, 83(10): 3078-3080.
[12]JOBSON D J, RAHMAN Z, WOODELL G A. A multiscale retinex for bridging the gap between color images and the human observation of scenes[J]. IEEE Transactions on Image Processing: A Publication of the IEEE Signal Processing Society, 1997, 6(7): 965-976.
[13]HUSSEIN R, HAMODI Y I, SABRI R A. Retinex theory for color image enhancement: A systematic review[J]. International Journal of Electrical and Computer Engineering, 2019, 9(6): 5560-5569.
[14]黎洲, 黃妙華. 基于YOLO_v2模型的車輛實(shí)時(shí)檢測[J]. 中國機(jī)械工程, 2018, 29(15): 1869-1874.
LI Zhou, HUANG Miaohua. Vehicle detections based on YOLO_v2 in real-time[J]. China Mechanical Engineering, 2018, 29(15): 1869-1874.
[15]REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: Unified, real-time object detection[C]//Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE, 2016: 779-788.
[16]蔡逢煌, 張?jiān)丽危?黃捷. 基于YOLOv3與注意力機(jī)制的橋梁表面裂痕檢測算法[J]. 模式識別與人工智能, 2020, 33(10): 926-933.
CAI Fenghuang, ZHANG Yuexin, HUANG Jie. Bridge surface crack detection algorithm based on YOLOv3 and attention mechanism[J]. Pattern Recognition and Artificial Intelligence, 2020, 33(10): 926-933.
[17]FU Huixuan, SONG Guoqing, WANG Yuchao. Improved YOLOv4 marine target detection combined with CBAM[J]. Symmetry, 2021, 13(4): 623-637.
[18]蔣镕圻, 彭月平, 謝文宣, 等. 嵌入scSE模塊的改進(jìn)YOLOv4小目標(biāo)檢測算法[J]. 圖學(xué)學(xué)報(bào), 2021, 42(4): 546-555.
JIANG Rongqi, PENG Yueping, XIE Wenxuan, et al. Improved YOLOv4 small target detection algorithm with embedded scSE module[J]. Journal of Graphics, 2021, 42(4): 546-555.
[19]趙文清, 嚴(yán)海, 邵緒強(qiáng). 改進(jìn)的非極大值抑制算法的目標(biāo)檢測[J]. 中國圖象圖形學(xué)報(bào), 2018, 23(11): 1676-1685.
ZHAO Wenqing, YAN Hai, SHAO Xuqiang. Objection detection based on improved non-maximum suppression algorithm[J]. Journal of Image and Graphics, 2018, 23(11): 1676-1685.
[20]WU G, LI Y. Non-maximum suppression for object detection based on the chaotic whale optimization algorithm[J]. Journal of Visual Communication and Image Representation, 2021, 74(1): 102985.
[21]徐利鋒, 黃海帆, 丁維龍, 等. 基于改進(jìn)DenseNet的水果小目標(biāo)檢測[J]. 浙江大學(xué)學(xué)報(bào)(工學(xué)版), 2021, 55(2): 377-385.
XU Lifeng, HUANG Haifan, DING Weilong, et al. Detection of small fruit target based on improved DenseNet[J]. Journal of Zhejiang University (Engineering Science), 2021, 55(2): 377-385.09B613B9-6D44-4542-91B1-A1F0EE71EE1A
Intelligence recognition algorithm of group cocoons based on MSRCR and CBAM
SUN Weihong1, YANG Chengjie1, SHAO Tiefeng1, LIANG Man1, ZHENG Jian2
(1a.College of Mechanical and Electrical Engineering; 1b.Cocoon and Silk Quality Inspection Technology Institute, China Jiliang University,Hangzhou 310018, China; 2.Jiangxi Market Supervision Management Quality and Safety Inspection Center, Nanchang 330096, China)
Abstract:Silk, as a "national treasure" that has accumulated thousands of years of civilization, is one of the very few advantageous industries in China that can dominate the international market. The silk industry plays an economic, ecological and social role, and has made important contributions to farmers prosperity, employment expansion, ecological protection and export earnings. The quality of silk is closely related to the control of the type of cocoon at the sorting stage. Sensory testing is still the main mode of cocoon sorting in China at this stage, that is, the silk reeling enterprise requires inspectors to classify the raw material cocoon according to national standards by original methods such as eye and hand touch. Cocoon sorting requires a high quality of inspectors who should not only have rich experience in sorting, standardized operation and smooth vision, but also have a deep understanding of the technical standards for cocoon sorting. The high technical requirements are a test for the technical personnel of the enterprise and increase the management and training costs of the enterprise.
In order to solve the problems of high labor cost and low efficiency in the traditional sorting process, this paper implements the intelligent identification of group cocoon species based on multi-scale retinex with color restoration and convolution block attention module. Because the surface of the cocoon collected in the experiment is susceptible to light, some areas are less visible. In this paper, from the perspective of restoring the surface color of the cocoon, multi-scale color recovery of the collected images is carried out. The MSRCR algorithm uses the Gaussian function to perform low-pass filtering on the original map of the cocoon at multiple scales to highlight the defect characteristics of the surface. In order to solve the problem of distortion of cocoon images due to local contrast enhancement, this paper uses color recovery factors to highlight the information of darker areas. Secondly, when the YOLOv3 algorithm is applied to the identification and detection of group silkworm cocoons, the identification of small and medium-sized targets is defective, and it is very easy to have the problem of false detection. This article introduces convolution block attention module by modifying the residual layer. Convolution block attention module includes channel attention module (CAM) and spatial attention module (SAM). The convolution block attention module derives the weights along the two independent dimensions of the channel and space on the cocoon feature map of the middle layer of the network, multiplies the weights with the input feature map, divides the effective defect features and invalid background features in the image, and performs adaptive feature refinement. In the later prediction frame processing stage, the YOLOv3 algorithm uses a non-maximum suppresion (NMS) algorithm to filter the highest score prediction box belonging to the same cocoon in a certain area, which is prone to missed detection. In this paper, the flexible non-maximum suppression algorithm Soft-NMS is introduced by adding a linear weighted function and a Gaussian weighted function to the non-maximum suppression algorithm, and a coincidence calculation with adjacent boxes is added on the basis of the original algorithm to effectively solve the problem of missed detection of silkworm cocoons. On this basis, in this paper, reelable cocoon, yellow spotted cocoon and decay cocoon were used as research objects to make a cocoon species dataset and carry out control experiments. Experimental results show that in terms of accuracy correlation indicators, the accuracy of the proposed algorithm for the same kind of cocoon is better than that of the YOLov3 algorithm. Mean average precision is 4.85% better than the original algorithm. In terms of the detection time of a single image, the proposed algorithm only needs 30.1 ms, which meets the requirements of the real-time accuracy of the algorithm in the actual sorting process.
In order to improve the accuracy of YOLOv3 on the population cocoon detection algorithm, this paper proposes a group cocoon intelligent identification algorithm based on MSRCR and attention mechanism. However, due to the existing equipment conditions, there is a problem of incomplete acquisition in the sample image collection process of this article. How to improve the integrity of the acquisition of defect images on the surface of the cocoon is still worth further research by follow-up researchers.
Key words:cocoon; intelligent recognition; MSRCR algorithm; YOLOv3 algorithm; convolution block attention module; NMS algorithm09B613B9-6D44-4542-91B1-A1F0EE71EE1A