Research and Implementation of Millet Ear Detection Method Based on Lightweight YOLOv5

Shujin Qiu, Yun Li, Jian Gao, Xiaobin Li, Xiangyang Yuan, Zhenyu Liu, Qingliang Cui, Cuiqing Wu2023 · DOI

TL;DR

This paper tackles the challenge of accurately detecting millet ears in complex agricultural environments, which are often dense, occluded, and small. They propose a lightweight YOLOv5 model by replacing its backbone with MobileNetV3, adding a micro-scale detection layer, and employing a novel Merge-NMS post-processing technique. This optimized model achieves high accuracy (97.78% AP) with a significantly reduced model size (7.56 MB), making it suitable for deployment on edge devices like the Jetson Nano for real-time agricultural monitoring.

What Problem Does This Paper Address?

Millet is a crucial crop, especially in China, but its cultivation and breeding research heavily rely on manual counting of ears, which is labor-intensive, time-consuming, and prone to errors, particularly in dense, occluded, or naturally complex field conditions. Existing target detection models often struggle with the small size, dense distribution, and significant occlusion of millet ears. Furthermore, deploying these models on resource-constrained mobile agricultural machinery requires lightweight solutions that balance accuracy and computational efficiency. This paper aims to bridge this gap by developing a robust and efficient millet ear detection system for such applications.

Methods

The core of this research is the modification and optimization of the YOLOv5s object detection model. The key methodological contributions include:

  • Lightweight Backbone Replacement: The standard YOLOv5s backbone is replaced with MobileNetV3. MobileNetV3 is known for its efficiency, utilizing depthwise separable convolutions and an attention mechanism (SE module) to significantly reduce model size and computational cost while aiming to maintain feature extraction capabilities.
  • Micro-Scale Feature Fusion: To address the loss of information from small targets during down-sampling in the original YOLOv5s architecture, a micro-scale detection layer is introduced. This layer enhances the fusion of low-level and high-level feature maps, improving the detection of small and occluded millet ears.
  • Merge-NMS Algorithm: Standard Non-Maximum Suppression (NMS) can sometimes suppress valuable overlapping bounding boxes. The paper proposes using a "Merge-NMS" algorithm in the post-processing stage. This technique aims to fuse suppressed anchor boxes with the highest-scoring ones to create more accurate predictions, thereby reducing false positives and missed detections caused by blurred boundaries, especially in dense or occluded scenarios.

Datasets

The authors created a custom dataset for millet ear detection.

  • Millet Ear Dataset: Images were collected from the experimental field of Shanxi Agricultural University, covering heading, filling, and mature stages of millet. Initially, 300 images were collected, with resolutions of 4032x3024 pixels, later compressed to 1024x768 for processing. Data augmentation techniques (rotation, flipping, mirroring, brightness adjustment) were applied to expand the dataset to 2100 images. This dataset was then split into training, verification, and test sets in an 8:1:1 ratio.

Key Insights and Ideas

  • Lightweighting Doesn't Always Mean Accuracy Loss: Replacing the YOLOv5s backbone with MobileNetV3 significantly reduces model size (by 46.7%) and computational load, but it can lead to a drop in accuracy. This highlights the trade-off inherent in model compression.
  • Targeted Enhancements are Crucial: The introduction of the micro-scale detection layer and the Merge-NMS algorithm are critical for recovering lost accuracy and improving performance on challenging targets (small, occluded). These additions demonstrate that specific architectural and post-processing modifications can effectively mitigate the downsides of lightweighting.
  • Synergy of Improvements: The combination of MobileNetV3, the micro-scale layer, and Merge-NMS yields the best overall performance, achieving a high AP of 97.78% and an F1-score of 94.20%, while still maintaining a compact model size. This suggests that these improvements work synergistically.
  • Edge Deployment Feasibility: The successful deployment and demonstration on the Jetson Nano platform underscore the practical applicability of the developed model for real-time agricultural machinery.

Key Results

  • Model Size Reduction: The improved model achieved a size of 7.56 MB, which is a 46.72% reduction compared to the standard YOLOv5s model (14.19 MB).
  • Performance Metrics: The proposed model achieved an Average Precision (AP) of 97.78% and an F1-score of 94.20%.
  • Detection Speed: The model demonstrated a good detection speed, with an average detection time of 0.023 seconds per image.
  • Comparison with Other Models: When compared to YOLOv3, YOLOv3-tiny, and YOLOv5-shufflenetv2, the improved model offered a superior balance between detection accuracy, model size, and floating-point operations. For instance, it achieved higher accuracy than YOLOv3-tiny and YOLOv5-shufflenetv2, while being significantly smaller and faster than YOLOv3.
  • Jetson Nano Performance: On the Jetson Nano, the lightweight model achieved a mean Average Precision (mAP) of 91.80% with a detection speed of 6.95 FPS, indicating its suitability for real-time applications on edge devices.

Limitations and Future Work

  • Limitations:
    • While the model size is significantly reduced, the mean average precision (mAP) on the Jetson Nano (91.80%) was slightly lower than the standard YOLOv5s model (96.40%). This indicates a minor trade-off in accuracy for lightweighting, although the overall performance is still very high.
  • The paper notes that the micro-scale detection layer can slightly increase the model's complexity.
  • Future Work:
    • The authors plan to focus on dynamic estimation of millet yield and the improvement and upgrading of intelligent millet harvesting equipment in their future work, building upon the developed detection system.

Summary updated

BibTeX
@misc{qiu2023research,
  author = {Shujin Qiu and Yun Li and Jian Gao and Xiaobin Li and Xiangyang Yuan and Zhenyu Liu and Qingliang Cui and Cuiqing Wu},
  title = {{Research and Implementation of Millet Ear Detection Method Based on Lightweight YOLOv5}},
  year = {2023},
  doi = {10.3390/s23229189},
}
Figure