All work

Embedded computer vision

Pest detection on a Raspberry Pi

A YOLOv5n model with attention that spots crop pests in real time on a Raspberry Pi. I quantized and pruned it so it would run fast enough on the Pi.

  • Python
  • PyTorch
  • Ultralytics
  • Raspberry Pi

Techniques: YOLOv5n, Attention, Quantization, Pruning, Segmentation

View the code
A crop pest detected by the model, with bounding box and confidence
A crop pest detected by the model, with bounding box and confidence
A crop pest detected by the model, with bounding box and confidence
Real predictions from the model, with the boxes and confidence scores it drew.

The problem

Pests are small, often hidden behind leaves, and the hardware in a field is cheap. The model has to be accurate on tiny, occluded objects and still run in real time on a Raspberry Pi.

How I built it

  1. 01Started from YOLOv5n and added attention mechanisms so the model focuses on small, partially hidden pests.
  2. 02Quantized and pruned the network for embedded deployment, cutting the compute load while keeping accuracy.
  3. 03Combined detection with segmentation to handle occluded pests in cluttered scenes.
Next projectBipedal walking agentsOpen