1 引 言
2 材料与方法
2.1 试验数据获取
2.2 数据集准备
2.3 数据集扩充
3 识别网络模型构建
3.1 YOLOX网络模型
3.1.1 网络结构
3.1.2 损失函数
3.1.3 激活函数
3.1.4 无锚框方法
3.2 改进的YOLOX网络模型设计
3.2.1 通道注意力机制
3.2.2 空间注意力机制
3.3 模型的训练与测试
3.3.1 试验平台
3.3.2 网络训练
表1 数据集的分布Table 1 Distribution of the dataset |
数据集 | 图片总数量/张 | 目标个数/个 |
---|---|---|
训练集 | 4237 | 11,865 |
验证集 | 471 | 1340 |
测试集 | 524 | 1396 |
总数 | 5232 | 14,601 |
3.4 模型评价指标
4 结果与分析
4.1 不同分辨率输入的比较
4.2 不同模型大小的结果分析
表2 不同模型大小的YOLOX-Nano检测结果对比Table 2 Comparison of YOLOX test results of different model sizes |
模型 | 大小/MB | F | AP0.5:0.95/% | AP0.5/% |
---|---|---|---|---|
YOLOX-Nano | 3.7 | 0.98 | 70.2 | 98.0 |
YOLOX-Tiny | 19.4 | 0.97 | 66.3 | 95.7 |
YOLOX-S | 34.3 | 0.97 | 67.6 | 96.4 |
4.3 改进后YOLO网络模型的结果分析
图5 YOLOX-Nano改进前后火龙果检测结果对比Fig. 5 Comparison of test results of YOLOX-Nano before and after improvement |
图6 YOLOX-Nano改进前后火龙果检测结果对比Fig. 6 Test results comparison of YOLOX-Nano before and after the improvement |
表3 改进的YOLOX-Nano网络火龙果检测结果对比Table 3 Comparison of dragon fruit detection results of improved YOLOX-Nano network |
改进的网络模型 | 模型大小/MB | 平均时间/ms | F | AP0.5/% | AP0.5:0.95/% | APS/% | APM/% | APL/% |
---|---|---|---|---|---|---|---|---|
YOLOX-Nano | 3.70 | 18.46 | 0.98 | 98.0 | 70.2 | 55.4 | 60.8 | 76.2 |
YOLOX-Nano+CBAM | 3.76 | 21.72 | 0.99 | 98.9 | 72.4 | 56.2 | 63.3 | 78.0 |
4.4 不同YOLO网络模型的结果分析
表4 不同网络火龙果检测结果对比Table 4 Comparison of dragon fruit detection results of different networks |
网络模型 | 模型大小/MB | 帧率/(f·s-1) | 平均时间/ms | F | AP0.5/% | AP0.5:0.95/% | APS/% | APM/% | APL/% |
---|---|---|---|---|---|---|---|---|---|
YOLOX-Nano+CBAM | 3.76 | 46 | 21.72 | 0.99 | 98.9 | 72.4 | 56.2 | 63.3 | 78.0 |
YOLOv5-S | 27.10 | 59 | 16.87 | 0.93 | 91.0 | 59.5 | 29.0 | 49.8 | 66.5 |
MobileNetV3-YOLOv4 | 53.70 | 44 | 22.66 | 0.94 | 91.8 | 55.4 | 38.8 | 44.8 | 62.6 |
YOLOv4-Tiny | 22.40 | 145 | 6.88 | 0.91 | 89.1 | 54.4 | 25.5 | 42.6 | 62.2 |
YOLOv3 | 235.00 | 51 | 19.38 | 0.83 | 72.7 | 41.4 | 1.7 | 31.0 | 49.7 |
图7 顺光时不同网络火龙果检测效果Fig. 7 Dragon fruit detection effect of different networks during lighting |
图8 遮阴时不同网络火龙果检测效果Fig. 8 Dragon fruit detection effect of different networks during shading |
4.5 不同视频分辨率输入的结果分析
表5 不同分辨率视频火龙果检测结果Table 5 Comparison of dragon fruit detection frame rates in different resolutions |
分辨率 | 相机帧率/(f·s-1) | 平均检测帧率/(f·s-1) |
---|---|---|
4416×1242 | 15 | 5.77 |
3840×1080 | 30 | 6.89 |
2560×720 | 60 | 12.34 |
1340×376 | 100 | 20.94 |