纺织学报 ›› 2021, Vol. 42 ›› Issue (11): 29-38.doi: 10.13475/j.fzxb.20210103610

• 纤维材料 • 上一篇    下一篇

基于模型压缩与感受野增强的下茧实时检测

张印辉, 杨宏宽, 刘强, 何自芬   

  1. 昆明理工大学 机电工程学院, 云南 昆明 650500
  • 收稿日期:2021-01-15 修回日期:2021-06-14 出版日期:2021-11-15 发布日期:2021-11-29
  • 作者简介:张印辉(1977—),男,教授,博士。主要研究方向为图像处理、机器视觉和机器智能。
  • 基金资助:
    国家自然科学基金项目(62061022);国家自然科学基金项目(61761024)

Real-time detection of inferior cocoons through model compression and receptive field enhancement

ZHANG Yinhui, YANG Hongkuan, LIU Qiang, HE Zifen   

  1. Faculty of Mechanical and Electrical Engineering, Kunming University of Science and Technology, Kunming, Yunnan 650500, China
  • Received:2021-01-15 Revised:2021-06-14 Published:2021-11-15 Online:2021-11-29

摘要:

针对目前选茧时下茧检测主要依赖人工目测,工作效率低的问题,提出一种基于锚点框参数预置、通道剪枝和嵌入感受野模块改进的轻量化下茧实时检测模型。首先,通过K-means聚类分析出适用于下茧检测的锚点框以预置YOLOv3模型参数;然后,根据预设的剪枝率对稀疏化训练后的模型进行基于批量正则化层缩放因子的模型剪枝,以此压缩模型的大小;最后,在剪枝后的模型中嵌入感受野模块,使模型的感受野变大,增强模型的辨别能力和鲁棒性。实验结果表明:提出的下茧实时检测模型大小为46.90 M,平均检测速度达到50.18 帧/s,平均检测精度为96.80%,较原YOLOv3模型参数压缩了79.96%,平均检测速度提高了60.63%,平均检测精度提高了3.20%。

关键词: 蚕茧, 下茧检测, YOLOv3模型, 聚类分析, 模型压缩, 感受野模块

Abstract:

The current inferior cocoons detection mainly depends on manual visual inspection, which leads to low work efficiency. Based on anchor parameter presetting, channel pruning and embedding receptive field block, an improved lightweight real time inferior cocoons detection model was proposed.Firstly, the model parameters of YOLOv3 were preset through K-means clustering analysis of the anchor suitable for inferior cocoons detection. Then, according to a preset pruning rate, the sparsely trained model was pruned based on batch normalization layer scaling factor to compress the size of the model. Finally, the receptive field block was embedded the pruned model to enlarge the receptive field of the model and enhance the discriminability and robustness of the model. The experimental results show that the proposed inferior cocoons real-time detection model is 46.90 M in size, and the mean average detection speed and precision reach 50.18 frames/s and 96.80% respectively. Compared with the original YOLOv3 model, the parameters are compressed by 79.96%, the mean average detection speed is increased by 60.63%, and the mean average detection precision is increased by 3.20%.

Key words: cocoons, inferior cocoons detection, YOLOv3 model, clustering analysis, model compression, receptive field block

中图分类号: 

  • TP391

图1

YOLOv3模型结构图"

图2

下茧检测数据集锚点框高宽比可视化结果"

图3

模型通道剪枝示意图"

图4

RFB模块感受野计算推导过程"

图5

YOLOv3-MC-RFB模型结构示意图"

图6

下茧实物图"

表1

实验参数"

参数名称 数值
giou损失的系数(giou) 1.582
分类损失的系数(cls) 27.76
分类损失函数中正样本的权重(cls_pw) 1.446
有无物体损失的系数(obj) 21.35
有无物体损失函数中正样本的权重(obj_pw) 3.941
标签与锚点框的iou阈值(iou_t) 0.263 5
学习率(lr0) 0.002 324
余弦退火超参数(lrf) 0.000 1
学习率动量(momentum) 0.97
权重衰减系数(weight_decay) 0.000 456 9

表2

不同数量锚点框实验结果"

锚点框数量 锚点框尺寸 模型大小/M 平均检测速度/(帧·s-1) mAP/%
3 (38,28),(31,35),(31,41) 234.00 31.14 96.10
6 (26,32),(33,26),(28,42),
(40,30),(33,38),(40,34)
234.00 30.68 96.00
9 (27,29),(24,33),(33,26),
(26,40),(30,35),(42,28,
(38,33),(30,42),(35,39)
234.00 30.46 95.90
12 (28,27),(34,24),(26,33),(27,39),
(35,31),(41,27),(31,37),(26,38),
(44,30),(33,41),(41,34),(37,38)
235.00 30.38 95.20

图7

稀疏化训练前后γ分布情况"

表3

不同剪枝率实验结果"

剪枝率/% 模型大小/M 平均检测速度/
(帧·s-1)
mAP/%
10.00 205.00 30.96 95.99
20.00 177.00 33.82 95.99
30.00 151.00 37.36 95.99
40.00 127.00 39.93 95.99
50.00 104.00 42.23 95.99
60.00 83.60 44.53 95.98
70.00 65.00 47.39 95.97
80.00 46.90 51.05 95.95

表4

嵌入RFB后模型效果"

RFB添加
的位置
模型大
小/M
平均检测速度/
(帧·s-1)
mAP/%
4层后 46.90 47.52 96.70
11层后 46.90 49.87 96.60
36层后 46.90 50.18 96.80
61层后 46.90 50.04 96.20
74层后 46.90 49.57 96.10
86层后 46.90 48.47 96.70
98层后 46.90 48.77 96.10

图8

不同蚕茧数量分布检测效果"

图9

不同拍摄角度检测效果"

表5

不同检测模型对比实验结果"

检测模型 模型大
小/M
平均检测速度/
(帧·s-1)
mAP/%
YOLOv3 234.00 31.24 93.80
YOLOv4 245.00 26.38 96.78
SSD 92.10 41.79 96.64
YOLOv3-MC-RFB 46.90 50.18 96.80

图10

YOLOv3-MC-RFB模型下茧检测效果"

[1] 封槐松, 李建琴. 新中国60年蚕桑业发展历程与特点[J]. 中国蚕业, 2014, 35(3):1-10.
FENG Huaisong, LI Jianqin. New China 60 years sericulture development course and characteristic[J]. Chinese Sericulture, 2014, 35(3):1-10.
[2] 封槐松, 李建琴. 我国蚕桑产业发展“十二五”回顾与“十三五”展望[J]. 中国蚕业, 2016, 37(1):4-10.
FENG Huaisong, LI Jianqin. China sericulture industry development "twelfth five-year" review and "thirteenth five-year" outlook[J]. Chinese Sericulture, 2016, 37(1):4-10.
[3] MUSAYEV E. Optoelectronic nondestructive testing techniquesof cocoons properties and applications[J]. NDT & International, 2005, 38(1):59-68.
[4] PRASOBHKUMAR P P, FRANCIS C R, GORTHI S S. Automated quality assessment of cocoons using a smart camera based system[J]. Engineering in Agriculture, Environment and Food, 2018, 11(4):202-210.
doi: 10.1016/j.eaef.2018.05.002
[5] 周志宇, 刘喜昂, 杨东鹤. 机器视觉在蚕茧表面积测量中的应用[J]. 纺织学报, 2006, 27(12):29-31.
ZHOU Zhiyu, LIU Xi'ang, YANG Donghe. Application of machine vision in measuring cocoons surface area[J]. Journals of Textile Research, 2006, 27(12):29-31.
[6] 甘勇, 孔庆华, 韦荔甫. 基于数字图像处理的蚕茧表面积计算方法[J]. 光学技术, 2007, 33(1):27-28.
GAN Yong, KONG Qinghua, WEI Lifu. A method for calculating cocoons surface area based on digital image processing[J]. Optical Technology, 2007, 33(1):27-28.
[7] 黄凌霞, 吴迪, 金航峰, 等. 基于变量选择的蚕茧茧层量可见-近红外光谱无损检测[J]. 农业工程学报, 2010, 26(2):231-236.
HUANG Lingxia, WU Di, JIN Hangfeng, et al. The cocoons layer quantity based on variable selection can be seen-NIR spectrum nondestructive testing[J]. Journal of Agricultural Engineering, 2010, 26(2):231-236.
[8] 代芬, 吴玲, 叶观燕, 等. 基于近红外漫透射光谱信息的蚕茧雌雄检测[J]. 农业机械学报, 2015, 46(12):280-284.
DAI Fen, WU Ling, YE Guanyan, et al. Sex detection of silkworm cocoons based on near-infrared diffuse transmission spectral information[J]. Journal of Agricultural Machinery, 2015, 46(12):280-284.
[9] 王超. 基于机器视觉的蚕茧图像识别研究[D]. 柳州:广西科技大学, 2019:24-29.
WANG Chao. Research on cocoon image recognition based on machine vision[D]. Liuzhou:Guangxi University of Science and Technology, 2019:24-29.
[10] 刘莫尘, 许荣浩, 闫筱, 等. 基于FCM及HSV模型的方格蔟黄斑茧检测与剔除技术[J]. 农业机械学报, 2018, 49(7):31-38.
LIU Mocheng, XU Ronghao, YAN Xiao, et al. Based on FCM and HSV model, detection and screening technology of grid cluster macular cocoons[J]. Journal of Agricultural Machinery, 2018, 49(7):31-38.
[11] 刘莫尘, 许荣浩, 李法德, 等. 基于颜色与面积特征的方格簇蚕茧分割定位算法与试验[J]. 农业机械学报, 2018, 49(3):43-50.
LIU Mocheng, XU Ronghao, LI Fade, et al. Segmentation and location algorithm of square silkworm cocoons based on color and area characteristics and experiment[J]. Journal of Agricultural Machinery, 2018, 49(3):43-50.
[12] REDMON J FARHADI A, YOLOv3: an incremental improvement[EB/OL]. (2018-04-08)[2021-01-10]https://arXiv:1804.02767 .
[13] REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection[C]// Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition(CVPR). Las Vegas: IEEE, 2016: 779-788.
[14] REDMON J, FARHADI A. YOLO9000: better, faster, stronger[C]// Proceedings of 2017 IEEE Conference on Computer Vision and Pattern Recognition(CVPR). Hawaii: IEEE, 2017: 6517-6525.
[15] HE Kaiming, ZHANG Xiangyu, REN Shaoqing, et al. Deep residual learning for image recognition[C]// Proceedings of 2016 IEEE Conference on Computer Vision and Pattern Recognition(CVPR). Las Vegas: IEEE, 2016: 770-778.
[16] IOFFE S, SZEGEDY C. Batch normalization: accelerating deep network training by reducing internal covariate shift[C]// Proceedings of International Conference on Machine Learning(ICML). Lille: IMIS, 2015: 448-456.
[17] LIN T Y, DOLLAR P, GIRSHICK R, et al. Feature pyramid networks for object detection[C]// Proceedings of 2017 IEEE Conference on Computer Vision and Pattern Recognition(CVPR). Hawaii: IEEE, 2017: 936-944.
[18] LIU Zhuang, LI Jianguo, SHEN Zhiqiang, et al. Learning efficient convolutional networks through network slimming[C]// Proceedings of 2017 IEEE International Conference on Computer Vision(ICCV). Venice: IEEE, 2017: 2755-2736.
[19] LIU Songtao, HUANG Di, WANG Yunhong. Receptive field block net for accurate and fast object detec-tion [C]//Proceedings of European Conference on Computer Vision(ECCV). Munich: Springer, 2018: 404-419.
[20] LIU W, ANGUELOV D, ERHAN D, et al. SSD: single shot multibox detector [C]//Proceedings of European Conference on Computer Vision(ECCV). Amsterdam: Springer, 2016: 21-37.
[21] BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detec-tion[EB/OL]. (2020-04-23)[2021-01-10]https://arxiv.org/abs/2004.10934 .
[1] 薛如晶, 莫晓璇, 刘福娟. 4种家蚕茧壳的结构与性能[J]. 纺织学报, 2021, 42(10): 41-46.
[2] 周捷, 李健, 马秋瑞, 黄晓杰. 基于改进层次分析法的特殊体型样板识别[J]. 纺织学报, 2019, 40(05): 124-130.
[3] 邢丽娟, 刘新金, 苏旭中, 曹秀明. 应用灰色聚类方法评价特种动物纤维综合物理性能[J]. 纺织学报, 2019, 40(01): 26-31.
[4] 杜玉红 杨程午 蒋秀明 刘仁杰 蔡文超. 应用聚类神经网络的异纤检测多类光源优化设计[J]. 纺织学报, 2017, 38(10): 104-112.
[5] 王晓予 向军 潘如如 梁惠娥 高卫东. 服饰刺绣图案的自动提取与色块分割[J]. 纺织学报, 2017, 38(09): 120-126.
[6] 夏凤勤 毋戈 谢昊洋 钟跃崎. 基于人体纵截面特征曲线的体型分类[J]. 纺织学报, 2017, 38(06): 86-91.
[7] 马崇启 蔡薇琦 阚永葭. 酚醛纤维织物热湿舒适性的灰色聚类分析[J]. 纺织学报, 2016, 37(12): 29-32.
[8] 蔡薇琦 马崇启 阚永葭 杨金莲 李君丽 . 灰色聚类分析在织物热学性能评价中的应用[J]. 纺织学报, 2016, 37(11): 64-67.
[9] 金娟凤 庞程方 陈伟杰 叶晓露 邹奉元. 青年男性肩点横截面曲线及其体型细分[J]. 纺织学报, 2016, 37(08): 100-106.
[10] 邓一民 代方银 易世雄 石静 李阳乐. 蚕茧对六价铬的吸附性能[J]. 纺织学报, 2015, 36(04): 82-86.
[11] 周小溪 梁惠娥. 基于感性意象的服装面料设计效果评价[J]. 纺织学报, 2015, 36(04): 60-64.
[12] 周小溪 梁惠娥. 服装面料感性意象的评价与分析[J]. 纺织学报, 2015, 36(03): 99-104.
[13] 祝成炎 姚佳 骆倩倩 李艳清 张红霞. 天然绿色蚕茧的计算机分色方法[J]. 纺织学报, 2014, 35(4): 121-0.
[14] 金娟凤 孙洁 倪世明 邹奉元. 基于三维人体测量的青年女性臀部体型细分[J]. 纺织学报, 2013, 34(9): 108-0.
[15] 荆妙蕾 李金. 基于灰聚类方法的磁性纤维混纺织物湿舒适性评估[J]. 纺织学报, 2013, 34(5): 35-40.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
[1] 曹建达;顾小军;殷联甫. 用BP神经网络预测棉织物的手感[J]. 纺织学报, 2003, 24(06): 35 -36 .
[2] 【作者单位】:中国纺织工程学会秘书处【分类号】:+【DOI】:cnki:ISSN:0-.0.00-0-0【正文快照】:  香港桑麻基金会设立的“桑麻纺织科技奖” 0 0 年提名推荐工作;在纺织方面院士;专家和有关单位的大力支持下;收到了 个单位 (人 )推荐的 位候选人的. 2003年桑麻纺织科技奖获奖名单[J]. 纺织学报, 2003, 24(06): 107 .
[3] 【分类号】:Z【DOI】:cnki:ISSN:0-.0.00-0-0【正文快照】:  一;纺 纱模糊控制纺纱张力的研究周光茜等 ( - )………………原棉含杂与除杂效果评价方法的研究于永玲 ( - )……网络长丝纱免浆免捻功能的结构表征方法李栋高等 ( - )……………. 2003年纺织学报第二十四卷总目次[J]. 纺织学报, 2003, 24(06): 109 -620 .
[4] 张治国;尹红;陈志荣. 纤维前处理用精练助剂研究进展[J]. 纺织学报, 2004, 25(02): 105 -107 .
[5] 秦元春. 纺织工业发展方向初探[J]. 纺织学报, 2004, 25(02): 108 -110 .
[6] 高伟江;魏文斌. 纺织业发展的战略取向——从比较优势到竞争优势[J]. 纺织学报, 2004, 25(02): 111 -113 .
[7] 史途停;陈建勇. 入世后中国纺织业的发展趋势及对策[J]. 纺织学报, 2004, 25(02): 114 -115 .
[8] 姚玉元;陈文兴;张利;潘勇. 催化氧化型消臭蚕丝纤维的研究[J]. 纺织学报, 2004, 25(03): 7 -8 .
[9] 林红;陈宇岳;任煜;仲志锋;王红卫. 经等离子体处理的蚕丝纤维结构与性能[J]. 纺织学报, 2004, 25(03): 9 -10 .
[10] 潘旭伟;顾新建;韩永生;程耀东. 面向协同的服装供应链快速反应机制研究[J]. 纺织学报, 2006, 27(1): 54 -57 .