基于YOLOv5s的农田垃圾轻量化检测方法

    Lightweight detection method for farmland waste based on YOLOv5s

    • 摘要: 针对目前垃圾检测算法在农田复杂环境下检测精度不高、检测效率低,模型复杂等问题,该研究提出了基于YOLOv5s的农田垃圾轻量化检测方法。首先,使用轻量级分类网络ShuffleNetV2的构建单元作为特征提取网络,降低模型的计算量和参数量,提高运行速度,以满足移动端的应用要求;其次,为应对模型轻量化后带来的检测精度降低,该文相继对ShuffleNetV2的构建单元进行了卷积核扩大化改进和激活函数优化,在增加部分计算量的前提下提高了模型精度;此外,为增强模型在田间环境下对目标的精准定位能力,该研究针对边界框损失函数进行了优化,将CIoU边界框损失函数高宽纵横比的损失项拆分为预测框的高宽分别与最小外接框高宽的差值,然后通过不断迭代减小差值,提高模型的收敛速度和回归精度。试验结果显示,最终的改进模型检测精度达到了90.9%,此时检测速度为74 ms/帧,计算量仅为3.6 GFLOPs,与当前主流的目标检测算法SSD、YOLOv3等相比,不仅具有更优越的检测精度和推理速度,同时还大幅减少了计算量;最后,将改进前后的模型部署到Jetson TX1和Raspberry 4B 两种边缘计算设备上进行测试,测试结果表明,改进后的YOLOv5s模型在边缘计算设备上的检测速度相对原模型提高了至少20%,同时保持了较好的检测效果,平衡了边缘计算设备对精度和速度的性能需求,为田间垃圾检测任务提供了参考。

       

      Abstract: Farmland waste has been one of the most important influencing factors on the soil environment. It is very necessary to realize an intelligent and efficient picking of farmland wastes, particularly for the high accuracy and efficiency of recognition with the simple models under complex field environments. In this study, a lightweight detection was proposed for the farmland waste under the actual field situation of the equipment using the improved yolov5s, according to the target detection and edge computing. More importantly, Artificial Intelligence (AI) was promoted in the field of smart agriculture. Firstly, some images of common wastes were collected under the complex actual field environment in the farmland. The data enhancement was then performed on the image data for the large-scale farmland wastes datasets without the over-fitting during model training. Secondly, the network unit of the classification network ShuffleNetv2 was selected to reconstruct the feature extraction network of yolov5s. The calculation and parameter amount of the model were significantly reduced to improve the running speed for the cost saving in the chip cache space. Thirdly, the convolution kernel expansion and activation function optimization were performed on the introduced lightweight network unit module, in order to effectively restore the detection accuracy of the model with less amount of model computation and parameters. Finally, the efficient intersection over union (EIoU) bounding box was introduced to reduce the target positioning error of the model in the complex environment. The reason was that there were many interference factors in the process of motion detection under the complex field environment, thus easily leading to the positioning accuracy of the target in the image. In the case of the aspect ratio for the predicted and the real frame in the loss function of complete intersection over union (CIoU), the loss item was divided into the difference between the height/width of the predicted frame and the minimum bounding frame. At the same time, the difference was gradually reduced to speed up the convergence speed and regression accuracy using the proper iteration. The experimental results show that the detection accuracy of the improved model reached 90.9% with a detection speed of 74ms/frame. Higher detection accuracy and speed of the improved model were achieved to better balance the calculation and parameter amount, compared with the current target detection of SSD and yolov3. A tradeoff was made on the performance requirements of edge computing devices for accuracy and speed. The mobile terminal was selected to verify the application of the improved model. The models before and after the improvement were deployed on the two edge computing devices (JetsonTX1 and Raspberry4B). Compared with the original, the detection speed of the improved model increased by at least 20% on the edge computing devices, indicating an excellent detection performance. The finding can provide a lightweight solution to the detection tasks of field wastes.

       

    /

    返回文章
    返回