The Development of a Lightweight DE-YOLO Model for Detecting Impurities and Broken Rice Grains

Zhenwei Liang, Xiuquan Xu, Deyong Yang, Yanbin LiuAgriculture 2025 · DOI

TL;DR

This paper introduces DE-YOLO, a lightweight deep learning model for detecting impurities and broken rice grains on combine harvesters. By optimizing the YOLOX architecture with depthwise separable convolutions, Focal Loss, and an ECANet attention mechanism, DE-YOLO achieves a remarkable 97.55% mAP while significantly reducing model size and computational cost, making it ideal for real-time agricultural applications.

What Problem Does This Paper Address?

The mechanization of rice harvesting in China is high, with combine harvesters playing a crucial role. However, current systems often lack real-time monitoring for grain quality factors like impurity and breakage rates. These issues are critical because high impurity rates affect unloading efficiency, and broken grains degrade quality, leading to storage problems and reduced germination. Existing detection methods are often manual, offline, or rely on bulky, expensive multispectral technology. Furthermore, the visual similarity between rice impurities, broken grains, and intact grains, especially in complex field environments, poses a significant challenge for accurate automated detection. This paper aims to bridge this gap by developing an efficient and accurate machine vision system for real-time impurity and breakage detection directly on combine harvesters.

Methods

The core of this work is an improved YOLOX-s model, dubbed DE-YOLO. The key modifications are:

  • Lightweighting with DSConv: The standard convolutional blocks (CBS) in YOLOX are replaced with a new DBS module that utilizes Depthwise Separable Convolutions (DSConv). DSConv breaks down standard convolutions into depthwise and pointwise operations, drastically reducing the number of parameters and computational load without significant accuracy loss.
  • Attention Mechanism (ECANet): To compensate for potential information loss from DSConv and to better focus on subtle features of impurities and broken grains, the ECANet attention module is integrated into the backbone. ECANet adaptively weights feature channels, enhancing the model's focus on relevant regions.
  • Loss Function Optimization (Focal Loss): To address the class imbalance issue common in impurity detection (where impurities are often less frequent than intact grains), the standard binary cross-entropy loss is replaced with Focal Loss. Focal Loss down-weights the contribution of easy-to-classify samples, allowing the model to concentrate on harder, misclassified examples.

These modifications are applied sequentially to evaluate their individual and combined impact on the YOLOX-s baseline.

Datasets

The study utilized a self-made rice dataset.

  • Data Collection: 2458 images were collected from the grain tank of a combine harvester using a color CMOS camera.
  • Annotation: Images were annotated using LabelImg software, with red boxes for broken grains and blue boxes for impurity stalks.
  • Data Augmentation: To prevent overfitting and improve generalization, the dataset was expanded through contrast enhancement, mirror inversion, vertical flipping, and Gaussian blur. The original 2458 images were augmented to 9832 images.
  • Splitting: The dataset was split into training, testing, and validation sets in a 7:1:2 ratio.

Key Insights and Ideas

  • DSConv is a Double-Edged Sword: While DSConv significantly reduces model size and computation, it can lead to a slight decrease in accuracy due to reduced cross-channel feature interaction. This highlights the need for complementary techniques to maintain performance.
  • Attention and Loss Functions are Crucial for Lightweight Models: The ECANet attention mechanism and Focal Loss function are not just add-ons; they are essential for restoring and enhancing the performance of lightweight models like DE-YOLO, especially when dealing with challenging visual characteristics like color similarity and class imbalance.
  • Synergy is Key: The best performance was achieved when all proposed improvements (DSConv, Focal Loss, ECANet) were combined in the DE-YOLO model, demonstrating that these components work synergistically to overcome the limitations of individual modifications.
  • Real-World Applicability: The significant reduction in parameters and GFLOPS makes DE-YOLO highly suitable for deployment on resource-constrained embedded systems, such as those found on combine harvesters, enabling real-time, on-site quality monitoring.

Key Results

  • Accuracy Improvement: DE-YOLO achieved a mean average precision (mAP) of 97.55%, which is 2.9% higher than the original YOLOX model (94.65%).
  • Lightweight Design: The model's parameter count was reduced by 48.89% (from 9.0 M to 4.6 M), and GFLOPS were reduced by 46.33% (from 13.08 to 7.02).
  • Performance Metrics: DE-YOLO achieved a recall rate (R) of 94.46% and an F1-score of 0.96.
  • Comparison: DE-YOLO outperformed traditional YOLO models (YOLOv3, YOLOv5, YOLOX) and even the newer YOLOv8 in terms of precision, recall, and mAP, while being significantly more lightweight than YOLOv8 and Faster R-CNN.
  • Qualitative Results: Visualizations showed DE-YOLO successfully detecting small impurities and broken grains that were missed by the original YOLOX model.

Limitations and Future Work

  • Limitations:
    • The paper acknowledges that while DSConv reduces parameters, it can slightly impair feature extraction effectiveness, requiring careful consideration.
  • The study was conducted using a self-made dataset, and its generalizability to diverse rice varieties and harvesting conditions might need further validation.
  • Future Work:
    • The authors suggest that DE-YOLO's lightweight design makes it particularly suitable for deployment on resource-constrained devices like unmanned combine harvesters, implying future work in hardware integration and real-world field testing.
  • Further research could explore other attention mechanisms or loss functions to potentially achieve even greater accuracy or efficiency.

Summary updated

Abstract

A rice impurity detection algorithm model, DE-YOLO, based on YOLOX-s improvement is proposed to address the issues of small crop target recognition and the similarity of impurities in rice impurity detection. This model achieves correct recognition, classification, and detection of rice target crops with similar colors in complex environments. Firstly, changing the CBS module to the DBS module in the entire network model and replacing the standard convolution with Depthwise Separable Convolution (DSConv) can effectively reduce the number of parameters and the computational complexity, making the model lightweight. The ECANet module is introduced into the backbone feature extraction network, utilizing the weighted selection feature to cluster the network in the region of interest, enhancing attention to rice impurities and broken grains, and compensating for the reduced accuracy caused by model light weighting. The loss problem of class imbalance is optimized using the Focal Loss function. The experimental results demonstrate that the DE-YOLO model has an average accuracy (mAP) of 97.55% for detecting rice impurity crushing targets, which is 2.9% higher than the average accuracy of the original YOLOX algorithm. The recall rate (R) is 94.46%, the F1 value is 0.96, the parameter count is reduced by 48.89%, and the GFLOPS is reduced by 46.33%. This lightweight model can effectively detect rice impurity/broken targets and provide technical support for monitoring the rice impurity/ broken rate.
BibTeX
@inproceedings{liang2025development,
  author = {Zhenwei Liang and Xiuquan Xu and Deyong Yang and Yanbin Liu},
  title = {{The Development of a Lightweight DE-YOLO Model for Detecting Impurities and Broken Rice Grains}},
  booktitle = {Agriculture},
  year = {2025},
  doi = {10.3390/agriculture15080848},
}
Figure