基于改进YOLOv5s的河蟹与饵料检测方法

    Detecting river crab and bait using improved YOLOv5s

    • 摘要: 针对目前在水下复杂环境中池塘养殖河蟹与饵料的检测算法存在检测精度低、速度慢等问题,该研究提出了基于改进YOLOv5s(you only look once version 5 small)的河蟹与饵料检测方法。首先,采用轻量化卷积Ghost替换普通卷积,同时利用GhostBottleneck结构替换原主干网络中的残差结构快速提取网络特征,减少模型计算量,满足安卓端的应用要求。其次,为了弥补因网络参数量减少造成网络检测精度稍有降低的问题,借鉴BiFPN(bidirectional feature pyramid network)的思想改进原始YOLOv5s的双向融合骨干网络,以较低的计算成本提高网络对小目标的检测精度。此外,为了帮助网络进一步更好地识别目标,加入了CA(coordinate attention)注意力机制,使得图像中感兴趣的区域能够更准确地被捕获。试验结果表明:该研究改进模型平均精度均值为96.9%,计算量为8.5GFLOPs,与当前主流的单阶段有锚框目标检测算法SSD(single shot multibox detector)和YOLOv3相比,具有更高的检测精度以及更少的计算量。相比于原始YOLOv5s模型,本文改进模型平均精度均值提高了2.2个百分点,计算量和模型内存都降低了40%以上。最后,将改进前后的模型部署到安卓设备上测试。测试结果表明:改进后模型的平均检测速度为148 ms/帧,相较于原始模型检测速度提高了20.9%,并且保持了较好的检测效果,平衡了安卓设备对模型检测精度以及速度的性能需求,能够为河蟹养殖投饵量的精准确定提供参考。

       

      Abstract: An accurate and rapid detection is a high demand to identify the river crab and bait in underwater complex environments. In this study, an improved YOLOv5s was proposed to detect the river crab and bait for the high precision, speed and simple modeling. GhostNet and GhostBottleneck structure were used to rapidly extract the network features of the model. The inference and detection speed were improved with the less complexity and amount of model computation. The model was deployed on the Android, in order to meet the needs of mobile application scenarios for river crab detection. The BiFPN structure was applied in the neck network of YOLOv5s. The fusion ability of the model was enhanced for different scale targets, the robustness of the model, and especially the detection performance of the network for small targets. A lightweight attention mechanism was used in the backbone feature extraction of the YOLOv5s network. The CA attention mechanism module was employed to improve the detection probability of the target region. The relevant feature information was matched with the target channel. The invalid information was suppressed to strengthen the network attention to river crab and bait. The lightweight YOLOv5s-GhostNet model was compared with the YOLOv5s, ShuffleNetv2-YOLOv5s, and MobileNetV3-YOLOv5s models. The results showed that the target average precision of YOLOv5s-GhostNet model was reduced by only 4.6 percentage points, compared with YOLOv5s. The lightweight network was effectively maintained the detection precision of the model for the higher detection speed of river crabs and bait. Ablation experiments were carried out to verify the backbone feature extraction network, feature fusion network BiFPN, and CA attention mechanism. The computational amount was reduced by 48.7%, whereas, the detection speed increased by 27.2%, after improving the backbone feature extraction network with GhostNet. The model complexity was reduced to elevate the detection speed. The BiFPN structure was used to compensate for the loss of mAP that caused by the lightweight network, particularly for the detection rate of river crabs and bait. The addition of CA attention mechanism was improved the anti-interference and feature extraction, while the mAP also increased. River crab and bait datasets were established using laboratory and actual crab pond environments. The improved model was achieved in an average precision of 96.9% and a computational volume of 8.5 GFLOPs, which was higher in the detection precision and smaller in computational volume, compared with the current mainstream single-level target detection algorithms for anchor boxes (e.g., SSD and YOLOv3). The average precision of the model was improved by 2.2 percentage points, while the computation and model memory were reduced by more than 40%, compared with YOLOv5s. The model before and after improvement was deployed to Android phone for testing. It was found that the improved model shared the average detection speed of 148ms/frame on Android phone, which increased by 20.9%, and maintained the better detection, compared with the original. The detection rates of river crabs and bait in the improved model increased by 4.6 and 5.8 percentage points, respectively, which was effectively improved the detection rates than before. Therefore, the improved model can be expected to balance the performance requirements of Android phone for model detection precision and speed. The finding can provide the guidance for the precise determination of baiting amount in river crab culture.

       

    /

    返回文章
    返回