Threshold-Based Automated Pest Detection System for Sustainable Agriculture

Tianle Li, Jia Shu, Qinghong Chen, Murad Mehrab Abrar, John RaitiIoTaIS 2024 · DOI

TL;DR

This paper introduces a cost-effective, threshold-based automated system for detecting pea weevils in agricultural settings, leveraging IoT and computer vision. It offers a practical alternative to complex machine learning approaches, especially for resource-constrained environments, by focusing on binary grayscale thresholding and contour detection.

What Problem Does This Paper Address?

Traditional pest management in agriculture, particularly for small-scale farmers, is often labor-intensive and requires constant monitoring, which is impractical. Pea weevils, even in small numbers, can significantly damage pea yields. Existing automated solutions often rely on machine learning, which can be challenging to implement in resource-constrained areas due to the need for large, labeled datasets and computational power. This paper aims to bridge this gap by providing an affordable, accessible, and effective automated system for timely pea weevil detection and reporting, thereby enhancing crop production and promoting sustainable farming practices.

Methods

The core of the system relies on a three-pronged approach:

  • Binary Grayscale Thresholding: Images are converted to grayscale, and a threshold value (T) is empirically determined. Pixels with grayscale values above T are turned black, and those below are turned white. This enhances the contrast between weevils and their background.
  • Image Comparison: The system compares the current image with the previous one using an absolute difference calculation. A similarity threshold (S) is used to determine if significant changes have occurred, which helps differentiate between live and dead weevils.
  • Contour Detection: Computer vision techniques are used to identify and count contours within the image. Contours falling within a specific area range (defined by lower and upper pixel values) are classified as weevils.

The system's hardware includes a Raspberry Pi 4B, an infrared (IR) distance sensor (to trigger the camera), and a camera module. The software stack is deployed on Microsoft Azure for data storage and processing, with the front-end accessible via a user interface.

A novel aspect is the use of two algorithms:

  • Algorithm A (Primary): Counts all qualifying objects after thresholding.
  • Algorithm B (Supplemental): Focuses on detecting new qualifying objects by comparing current and previous images. This algorithm is activated when the similarity threshold (S) is exceeded, effectively ignoring dead weevils that remain in the camera's view.

Datasets

The paper does not explicitly mention the use of pre-existing public datasets for training. Instead, the system's parameters (grayscale threshold T, similarity threshold S, and contour area ranges) were determined through empirical analysis and statistical analysis of approximately 100 images of different weevil species and potential interfering objects. The authors highlight the lack of suitable public datasets for their specific needs as a key motivation for their threshold-based approach.

Key Insights and Ideas

  • Simplicity as a Strength: The paper argues that for resource-constrained environments, a well-tuned threshold-based approach can be more practical and cost-effective than complex machine learning models, especially when suitable datasets are unavailable.
  • Distinguishing Live vs. Dead Weevils: The dual-algorithm approach (Algorithm A and B) is a crucial innovation. By comparing consecutive images and using a similarity threshold, the system can effectively ignore dead weevils that might otherwise lead to false positives and increased maintenance.
  • Empirical Tuning is Key: The success of the system hinges on carefully determined empirical thresholds for grayscale values, image similarity, and contour areas, tailored to the specific pest and environment.
  • IR Sensor Trade-offs: The IR sensor's refresh rate presents a trade-off between sensitivity and power consumption, impacting its ability to detect fast-moving weevils.

Key Results

  • The grayscale threshold T was empirically set to 60, indicating that weevil colors significantly differ from other objects.
  • The similarity threshold S was set at 97.23% (rounded to 97%), calculated based on the maximum weevil size relative to the image area.
  • Algorithm B demonstrated 100% accuracy in detecting dead pea weevils.
  • The system's IR sensor showed high trigger rates for slower-moving weevils (up to 100% for larger weevils at 1.8 mm/s) but struggled with high speeds (peaking at 5% for the largest weevils at 1518.17 mm/s).

Limitations and Future Work

Limitations:

  • Grayscale Limitations: The grayscale differentiation can lead to misidentifications with objects like dry leaves, soil clumps, and stones that share similar grayscale values. Users can adjust the threshold to mitigate this.
  • Algorithm Limitations: Overlapping pests might be recognized as a single entity. The current algorithm is tuned for weevil sizes between 3.5 mm and 18 mm, requiring user adjustment for other pest types.
  • IR Sensor Speed: The IR sensor's refresh rate limits its effectiveness in detecting very fast-moving weevils.

Future Work:

  • Conduct field experiments during the pea weevil infestation season to further validate the system.
  • Refine detection algorithms.
  • Expand the range of detectable pests.
  • Develop a machine learning model for categorizing different pest species.
  • Explore using aggregation pheromones to enhance detection.

Summary updated

BibTeX
@inproceedings{li2024threshold,
  author = {Tianle Li and Jia Shu and Qinghong Chen and Murad Mehrab Abrar and John Raiti},
  title = {{Threshold-Based Automated Pest Detection System for Sustainable Agriculture}},
  booktitle = {IoTaIS},
  year = {2024},
  doi = {10.1109/iotais64014.2024.10799219},
}
Figure