浙江农业学报 ›› 2023, Vol. 35 ›› Issue (1): 215-225.DOI: 10.3969/j.issn.1004-1524.2023.01.23
李斌1(), 刘东阳1, 时国龙1, 慕京生2, 徐浩然1, 辜丽川1, 焦俊1,*(
)
收稿日期:
2021-06-29
出版日期:
2023-01-25
发布日期:
2023-02-21
通讯作者:
*焦俊,E-mail:jiaojun2000@sina.com.cn
作者简介:
李斌(1996—),男,安徽阜阳人,硕士研究生,研究方向为模式识别。E-mail:735438610@qq.com
基金资助:
LI Bin1(), LIU Dongyang1, SHI Guolong1, MU Jingsheng2, XU Haoran1, GU Lichuan1, JIAO Jun1,*(
)
Received:
2021-06-29
Online:
2023-01-25
Published:
2023-02-21
摘要:
为了提升猪舍环境下生猪姿态检测的速度和性能,在YOLOv4模型的基础上提出一种改进的Mini_YOLOv4模型。首先,该模型将YOLOv4的特征提取网络改为轻量级的MobileNetV3网络结构,以降低模型参数量;其次,在检测网络的CBL_block1、CBL_block2模块中使用深度可分离卷积代替传统卷积,避免了复杂模型导致的内存不足和高延迟问题;最后,将原YOLOv4网络每个尺度的最后一层3×3卷积改为Inception网络结构,以提高模型在生猪姿态检测上的准确率。应用上述模型,对生猪的站立、坐立、腹卧、趴卧和侧卧5类姿态进行识别。结果显示, Mini_YOLOv4模型较YOLOv4模型在检测精度上提升了4.01百分点,在检测速度上提升近1倍,在保证识别精度的同时提升了实时性,可为生猪行为识别提供技术参考。
中图分类号:
李斌, 刘东阳, 时国龙, 慕京生, 徐浩然, 辜丽川, 焦俊. 基于改进YOLOv4模型的群养生猪姿态检测[J]. 浙江农业学报, 2023, 35(1): 215-225.
LI Bin, LIU Dongyang, SHI Guolong, MU Jingsheng, XU Haoran, GU Lichuan, JIAO Jun. Pig posture detection based on improved YOLOv4 model[J]. Acta Agriculturae Zhejiangensis, 2023, 35(1): 215-225.
类型 Type | 滤波器 Filters | Exp size | SE | 激活函数 Activation function | 步长 Stride | 输出 Output |
---|---|---|---|---|---|---|
Conv2D | 16 | — | 否No | HS | 2 | 208×208 |
Bneck,3×3 | 16 | 16 | 否No | HS | 1 | 208×208 |
Bneck,3×3 | 24 | 64 | 否No | RE | 2 | 104×104 |
Bneck,3×3 | 24 | 72 | 否No | HS | 1 | 104×104 |
Bneck,5×5 | 40 | 72 | 是Yes | RE | 2 | 52×52 |
Bneck,5×5 | 40 | 120 | 是Yes | RE | 1 | 52×52 |
Bneck,5×5 | 40 | 120 | 是Yes | RE | 1 | 52×52 |
Bneck,3×3 | 80 | 240 | 否No | HS | 2 | 26×26 |
Bneck,3×3 | 80 | 200 | 否No | HS | 1 | 26×26 |
Bneck,3×3 | 80 | 184 | 否No | HS | 1 | 26×26 |
Bneck,3×3 | 80 | 184 | 是Yes | HS | 1 | 26×26 |
Bneck,3×3 | 112 | 480 | 是Yes | HS | 1 | 26×26 |
Bneck,3×3 | 112 | 672 | 是Yes | HS | 1 | 26×26 |
Bneck,5×5 | 160 | 672 | 是Yes | HS | 2 | 13×13 |
Bneck,5×5 | 160 | 960 | 是Yes | HS | 1 | 13×13 |
Bneck,5×5 | 160 | 960 | 否No | HS | 1 | 13×13 |
表1 MobileNetV3的网络结构
Table 1 Structure of MobileNetV3 network
类型 Type | 滤波器 Filters | Exp size | SE | 激活函数 Activation function | 步长 Stride | 输出 Output |
---|---|---|---|---|---|---|
Conv2D | 16 | — | 否No | HS | 2 | 208×208 |
Bneck,3×3 | 16 | 16 | 否No | HS | 1 | 208×208 |
Bneck,3×3 | 24 | 64 | 否No | RE | 2 | 104×104 |
Bneck,3×3 | 24 | 72 | 否No | HS | 1 | 104×104 |
Bneck,5×5 | 40 | 72 | 是Yes | RE | 2 | 52×52 |
Bneck,5×5 | 40 | 120 | 是Yes | RE | 1 | 52×52 |
Bneck,5×5 | 40 | 120 | 是Yes | RE | 1 | 52×52 |
Bneck,3×3 | 80 | 240 | 否No | HS | 2 | 26×26 |
Bneck,3×3 | 80 | 200 | 否No | HS | 1 | 26×26 |
Bneck,3×3 | 80 | 184 | 否No | HS | 1 | 26×26 |
Bneck,3×3 | 80 | 184 | 是Yes | HS | 1 | 26×26 |
Bneck,3×3 | 112 | 480 | 是Yes | HS | 1 | 26×26 |
Bneck,3×3 | 112 | 672 | 是Yes | HS | 1 | 26×26 |
Bneck,5×5 | 160 | 672 | 是Yes | HS | 2 | 13×13 |
Bneck,5×5 | 160 | 960 | 是Yes | HS | 1 | 13×13 |
Bneck,5×5 | 160 | 960 | 否No | HS | 1 | 13×13 |
图6 YOLOv4(a)和Mini_YOLOv4(b)模型的损失值曲线 train-loss,训练损失值;val-loss,验证损失值。
Fig.6 Loss curves of YOLOv4 (a) and mini_YOLOv4 (b) train-loss, Loss in training; val-loss, Loss in validation.
模型 Model | 不同IoU阈值下的mAP mAP under different IoU thresholds | |||
---|---|---|---|---|
0.5 | 0.6 | 0.7 | 0.75 | |
YOLOv4 | 69.66 | 66.71 | 58.34 | 52.94 |
Mini_YOLOv4 | 73.67 | 73.67 | 73.00 | 71.35 |
表2 不同IoU阈值下各模型的均值平均精度(mAP)
Table 2 Mean average precision (mAP) of different models under different IoU thresholds %
模型 Model | 不同IoU阈值下的mAP mAP under different IoU thresholds | |||
---|---|---|---|---|
0.5 | 0.6 | 0.7 | 0.75 | |
YOLOv4 | 69.66 | 66.71 | 58.34 | 52.94 |
Mini_YOLOv4 | 73.67 | 73.67 | 73.00 | 71.35 |
模型 Model | 不同姿态下的检测精度Precision under different postures/% | 检测速度 Speed/(frame·s-1) | ||||
---|---|---|---|---|---|---|
站立Stand | 趴卧Lie | 坐立Sit | 腹卧Ventral | 侧卧Lateral | ||
YOLOv4 | 66.17 | 69.25 | 71.15 | 64.82 | 76.89 | 33.98 |
Mini_YOLOv4 | 68.59 | 70.87 | 74.10 | 71.27 | 83.51 | 65.62 |
表3 不同模型的检测精度与检测速度
Table 3 Detection accuracy and speed of different models
模型 Model | 不同姿态下的检测精度Precision under different postures/% | 检测速度 Speed/(frame·s-1) | ||||
---|---|---|---|---|---|---|
站立Stand | 趴卧Lie | 坐立Sit | 腹卧Ventral | 侧卧Lateral | ||
YOLOv4 | 66.17 | 69.25 | 71.15 | 64.82 | 76.89 | 33.98 |
Mini_YOLOv4 | 68.59 | 70.87 | 74.10 | 71.27 | 83.51 | 65.62 |
模型 Model | 不同姿态下的召回率Recall under different postures/% | 不同姿态下的F1值F1 under different postures/% | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
站立 Stand | 趴卧 Lie | 坐立 Sit | 腹卧 Ventral | 侧卧 Lateral | 站立 Stand | 趴卧 Lie | 坐立 Sit | 腹卧 Ventral | 侧卧 Lateral | |
YOLOv4 | 66.67 | 70.26 | 73.78 | 71.22 | 84.54 | 0.78 | 0.78 | 0.79 | 0.75 | 0.78 |
Mini_YOLOv4 | 69.57 | 71.28 | 74.22 | 72.20 | 83.51 | 0.80 | 0.81 | 0.85 | 0.82 | 0.91 |
表4 不同模型的召回率与F1值
Table 4 Recall and F1 values of different models
模型 Model | 不同姿态下的召回率Recall under different postures/% | 不同姿态下的F1值F1 under different postures/% | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
站立 Stand | 趴卧 Lie | 坐立 Sit | 腹卧 Ventral | 侧卧 Lateral | 站立 Stand | 趴卧 Lie | 坐立 Sit | 腹卧 Ventral | 侧卧 Lateral | |
YOLOv4 | 66.67 | 70.26 | 73.78 | 71.22 | 84.54 | 0.78 | 0.78 | 0.79 | 0.75 | 0.78 |
Mini_YOLOv4 | 69.57 | 71.28 | 74.22 | 72.20 | 83.51 | 0.80 | 0.81 | 0.85 | 0.82 | 0.91 |
[1] | 党亚男, 王芳, 田建艳, 等. 面向猪的姿态识别的特征优选方法研究[J]. 江苏农业科学, 2016, 44(3): 448-451. |
DANG Y N, WANG F, TIAN J Y, et al. Research on feature optimization method for pig pose recognition[J]. Jiangsu Agricultural Sciences, 2016, 44(3): 448-451. (in Chinese) | |
[2] | 杨秋妹, 肖德琴, 张根兴. 猪只饮水行为机器视觉自动识别[J]. 农业机械学报, 2018, 49(6): 232-238. |
YANG Q M, XIAO D Q, ZHANG G X. Automatic pig drinking behavior recognition with machine vision[J]. Transactions of the Chinese Society for Agricultural Machinery, 2018, 49(6): 232-238. (in Chinese with English abstract) | |
[3] | 嵇杨培, 杨颖, 刘刚. 基于可见光光谱和YOLOv2的生猪饮食行为识别[J]. 光谱学与光谱分析, 2020, 40(5): 1588-1594. |
JI Y P, YANG Y, LIU G. Recognition of pig eating and drinking behavior based on visible spectrum and YOLOv2[J]. Spectroscopy and Spectral Analysis, 2020, 40(5): 1588-1594. (in Chinese with English abstract) | |
[4] |
TRAULSEN I, SCHEEL C, AUER W, et al. Using acceleration data to automatically detect the onset of farrowing in sows[J]. Sensors (Basel, Switzerland), 2018, 18(1): 170.
DOI URL |
[5] | 王凯, 刘春红, 段青玲. 基于MFO-LSTM的母猪发情行为识别[J]. 农业工程学报, 2020, 36(14): 211-219. |
WANG K, LIU C H, DUAN Q L. Identification of sow oestrus behavior based on MFO-LSTM[J]. Transactions of the Chinese Society of Agricultural Engineering, 2020, 36(14): 211-219. (in Chinese with English abstract) | |
[6] | 何屿彤, 李斌, 张锋, 等. 基于改进YOLOv3的猪脸识别[J]. 中国农业大学学报, 2021, 26(3): 53-62. |
HE Y T, LI B, ZHANG F, et al. Pig face recognition based on improved YOLOv3[J]. Journal of China Agricultural University, 2021, 26(3): 53-62. (in Chinese with English abstract) | |
[7] | 焦俊, 王文周, 侯金波, 等. 基于改进残差网络的黑毛猪肉新鲜度识别方法[J]. 农业机械学报, 2019, 50(8): 364-371. |
JIAO J, WANG W Z, HOU J B, et al. Freshness identification of iberico pork based on improved residual network[J]. Transactions of the Chinese Society for Agricultural Machinery, 2019, 50(8): 364-371. (in Chinese with English abstract) | |
[8] | 邱洪涛, 孙裴, 侯金波, 等. 基于Caffe的猪肉新鲜度分级的设计与实现[J]. 江苏农业学报, 2019, 35(2): 461-468. |
QIU H T, SUN P, HOU J B, et al. Design and implementation of pork freshness grading based on Caffe[J]. Jiangsu Journal of Agricultural Sciences, 2019, 35(2): 461-468. (in Chinese with English abstract) | |
[9] |
MARSOT M, MEI J Q, SHAN X C, et al. An adaptive pig face recognition approach using convolutional neural networks[J]. Computers and Electronics in Agriculture, 2020, 173: 105386.
DOI URL |
[10] | 甘海明, 薛月菊, 李诗梅, 等. 基于时空信息融合的母猪哺乳行为识别[J]. 农业机械学报, 2020, 51(S1): 357-363. |
GAN H M, XUE Y J, LI S M, et al. Automatic sow nursing behaviour recognition based on spatio-temporal information fusion[J]. Transactions of the Chinese Society for Agricultural Machinery, 2020, 51(S1): 357-363. (in Chinese with English abstract) | |
[11] | 燕红文, 刘振宇, 崔清亮, 等. 基于改进Tiny-YOLO模型的群养生猪脸部姿态检测[J]. 农业工程学报, 2019, 35(18): 169-179. |
YAN H W, LIU Z Y, CUI Q L, et al. Detection of facial gestures of group pigs based on improved Tiny-YOLO[J]. Transactions of the Chinese Society of Agricultural Engineering, 2019, 35(18): 169-179. (in Chinese with English abstract) | |
[12] |
PSOTA E T, MITTEK M, PÉREZ L C, et al. Multi-pig part detection and association with a fully-convolutional network[J]. Sensors (Basel, Switzerland), 2019, 19(4): 852.
DOI URL |
[13] | GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]// 2014 IEEE Conference on Computer Vision and Pattern Recognition.Columbus, OH, USA: IEEE, 2014: 580-587. |
[14] |
REN S Q, HE K M, GIRSHICK R, et al. Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39(6): 1137-1149.
DOI PMID |
[15] | LIU W, ANGUELOV D, ERHAN D, et al. SSD: single shot MultiBox detector[J]. Lecture Notes in Computer Science, 2016, 9905: 21-37. |
[16] | REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection[C]// 2016 IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas, NV, USA: IEEE, 2016: 779-788. |
[17] | REDMON J, FARHADI A. YOLO9000: better, faster, stronger[C]// 2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu, HI, USA: IEEE, 2017: 6517-6525. |
[18] | REDMON J, FARHADI A. YOLOv3: an incremental improvement[EB/OL]. (2018-04-08) [2021-06-29]. https://arxiv.org/abs/1804.02767 |
[19] | BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection[EB/OL]. (2020-04-23) [2021-06-29]. https://arxiv.org/abs/2004.10934 |
[20] | HOWARD A, SANDLER M, CHEN B, et al. Searching for MobileNetV3[C]// 2019 IEEE/CVF International Conference on Computer Vision (ICCV). October 27-November 2, 2019. Seoul:IEEE, 2019: 1314-1324. |
[21] | CHOLLET F. Xception: deep learning with depthwise separable convolutions[C]// 2017 IEEE Conference on Computer Vision and Pattern Recognition. Honolulu, HI, USA: IEEE, 2017: 1800-1807. |
[22] | SZEGEDY C, VANHOUCKE V, IOFFE S, et al. Rethinking the inception architecture for computer vision[C]// 2016 IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas, NV, USA: IEEE, 2016: 2818-2826. |
[23] | WANG C Y, MARK LIAO H Y, WU Y H, et al. CSPNet: a new backbone that can enhance learning capability of CNN[C]// 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW). Seattle, WA, USA: IEEE, 2020: 1571-1580. |
[24] | LIU S, QI L, QIN H F, et al. Path aggregation network for instance segmentation[C]// 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Salt Lake City, UT, USA: IEEE, 2018: 8759-8768. |
[25] | HOWARD A G, ZHU M L, CHEN B, et al. MobileNets: efficient convolutional neural networks for mobile vision applications[EB/OL]. (2017-04-17) [2021-06-29]. https://arxiv.org/abs/1704.04861 |
[26] | SANDLER M, HOWARD A, ZHU M L, et al. MobileNetV2: inverted residuals and linear bottlenecks[C]// 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Salt Lake City, UT, USA. IEEE, 2018: 4510-4520. |
[27] | TAN M X, CHEN B, PANG R M, et al. MnasNet: platform-aware neural architecture search for mobile[C]// 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). Long Beach, CA, USA: IEEE, 2019: 2815-2823. |
[28] | 薛月菊, 朱勋沐, 郑婵, 等. 基于改进Faster R-CNN识别深度视频图像哺乳母猪姿态[J]. 农业工程学报, 2018, 34(9): 189-196. |
XUE Y J, ZHU X M, ZHENG C, et al. Lactating sow postures recognition from depth image of videos based on improved Faster R-CNN[J]. Transactions of the Chinese Society of Agricultural Engineering, 2018, 34(9): 189-196. (in Chinese with English abstract) |
[1] | 闫宁, 张晗, 董宏图, 康凯, 罗斌. 基于透射光和反射光图像同位分割的小麦品种识别方法研究[J]. 浙江农业学报, 2022, 34(3): 590-598. |
[2] | 林孝腾, 孙茜, 郑书河. 基于OpenCV的低能耗植物工厂照明系统设计与试验[J]. 浙江农业学报, 2022, 34(3): 626-635. |
[3] | 肖志云, 王伊凝. 基于RF-VR的紫丁香叶片叶绿素含量高光谱反演[J]. 浙江农业学报, 2021, 33(11): 2164-2173. |
[4] | 钟伟镇, 刘鑫磊, 杨坤龙, 李丰果. 基于Mask-RCNN的复杂背景下多目标叶片的分割和识别[J]. 浙江农业学报, 2020, 32(11): 2059-2066. |
[5] | 闫建伟, 苏小东, 赵源, 刘进平. 基于图像特征的小麦胚芽鞘识别[J]. 浙江农业学报, 2019, 31(2): 326-332. |
[6] | 张满囤, 单新媛, 于洋, 米娜, 阎刚, 郭迎春. 基于小波变换和改进KPCA的奶牛个体识别研究[J]. 浙江农业学报, 2017, 29(12): 2000-2008. |
[7] | 毕立恒. 基于叶片图像算法的植物种类识别方法研究[J]. 浙江农业学报, 2017, 29(12): 2142-2148. |
[8] | 张善文, 黄文准, 尤著宏. 基于物联网和深度卷积神经网络的冬枣病害识别方法[J]. 浙江农业学报, 2017, 29(11): 1868-1874. |
[9] | 李颀, 胡艺聪, 武付闯. 基于图像处理的育苗箱环境控制系统[J]. 浙江农业学报, 2017, 29(11): 1912-1919. |
[10] | 夏永泉, 王兵, 支俊, 黄海鹏, 孙静茹. 基于EM和K-means混合聚类方法的植物叶片病害区域自动提取[J]. 浙江农业学报, 2017, 29(8): 1384-1391. |
[11] | 吴庆岗, 张卫国, 常化文, 金保华, 刘朝霞. 基于梯度Hough变换的遮挡苹果目标定位[J]. 浙江农业学报, 2017, 29(6): 1009-1016. |
[12] | 张善文, 孔韦韦, 王震. 基于稀疏表示字典学习的植物分类方法[J]. 浙江农业学报, 2017, 29(2): 338-344. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||