# Streamlining YOLOv7 for Rapid and Accurate Detection of Rapeseed Varieties on Embedded Device

**Authors:** Siqi Gu, Wei Meng, Guodong Sun

PMC · DOI: 10.3390/s24175585 · Sensors (Basel, Switzerland) · 2024-08-28

## TL;DR

This paper improves the YOLOv7 model for faster and more accurate rapeseed variety detection on embedded devices like Raspberry Pi.

## Contribution

A dual-dimensional pruning method is introduced to optimize YOLOv7 for embedded devices with improved accuracy and efficiency.

## Key findings

- Custom ratio layer-by-layer pruning improved mAP from 96.68% to 96.89%.
- Model parameters were reduced from 36.5 M to 9.19 M with faster inference on Raspberry Pi.
- The optimized model enables real-time detection on embedded devices for agricultural applications.

## Abstract

Real-time seed detection on resource-constrained embedded devices is essential for the agriculture industry and crop yield. However, traditional seed variety detection methods either suffer from low accuracy or cannot directly run on embedded devices with desirable real-time performance. In this paper, we focus on the detection of rapeseed varieties and design a dual-dimensional (spatial and channel) pruning method to lighten the YOLOv7 (a popular object detection model based on deep learning). We design experiments to prove the effectiveness of the spatial dimension pruning strategy. And after evaluating three different channel pruning methods, we select the custom ratio layer-by-layer pruning, which offers the best performance for the model. The results show that using custom ratio layer-by-layer pruning can achieve the best model performance. Compared to the YOLOv7 model, this approach results in mAP increasing from 96.68% to 96.89%, the number of parameters reducing from 36.5 M to 9.19 M, and the inference time per image on the Raspberry Pi 4B reducing from 4.48 s to 1.18 s. Overall, our model is suitable for deployment on embedded devices and can perform real-time detection tasks accurately and efficiently in various application scenarios.

## Full-text entities

- **Diseases:** injury to people or property (MESH:C000719191), Sparse (MESH:C536116)
- **Species:** Phaseolus vulgaris (common bean, species) [taxon 3885], Brassica napus (oilseed rape, species) [taxon 3708], Helianthus annuus (common sunflower, species) [taxon 4232], Homo sapiens (human, species) [taxon 9606]
- **Mutations:** K97A

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/PMC11398177/full.md

## Figures

9 figures with captions in the complete paper: https://tomesphere.com/paper/PMC11398177/full.md

## References

50 references — full list in the complete paper: https://tomesphere.com/paper/PMC11398177/full.md

---
Source: https://tomesphere.com/paper/PMC11398177