Abstract
Pomegranate is an important fruit crop that is usually managed manually through experience. Intelligent management systems for pomegranate orchards can improve yields and address labor shortages. Fast and accurate detection of pomegranates is one of the key technologies of this management system, crucial for yield and scientific management. Currently, most solutions use deep learning to achieve pomegranate detection, but deep learning is not effective in detecting small targets and large parameters, and the computation speed is slow. Based on the improved You Only Look Once version 5 (YOLOv5) algorithm, a lightweight pomegranate growth period detection algorithm YOLO-Granada is proposed. A lightweight ShuffleNetv2 network is used as the backbone to extract pomegranate features. Using grouped convolution reduces the computational effort of ordinary convolution, and using channel shuffle increases the interaction between different channels. In addition, the attention mechanism can help the neural network suppress less significant features in the channels or space, and the Convolutional Block Attention Module (CBAM) attention mechanism can improve the effect of attention and optimize the object detection accuracy by using the contribution factor of weights. The average accuracy of the improved network reaches 0.922. It is only less than 1% lower than the original YOLOv5s model (0.929) but brings a speed increase and a compression of the model size. The parameters, floating-point operations, and model size of this network are compressed to 54.7%, 51.3%, and 56.3% of the original network, respectively. In addition, the algorithm detects 8.66 images per second, achieving real-time results. The method provides a more accurate and lightweight solution for intelligent management devices in pomegranate orchards, which can provide a reference for the design of neural networks in agricultural applications.
Introduction
Precision agriculture relies on automated monitoring to optimize orchard management. For pomegranates, identifying specific growth stages—from bud to ripe—is essential for precise irrigation and harvesting schedules. However, deploying high-performance deep learning models like YOLOv5 in the field is challenging due to their high computational demands and large parameter counts, which are unsuitable for mobile or edge devices. Furthermore, detecting small targets like pomegranate buds remains a significant hurdle for standard architectures.
To address these issues, we introduce YOLO-Granada, a lightweight model optimized for real-time pomegranate detection across five growth stages: Bud, Flower, Early-fruit, Mid-growth, and Ripe. The model was trained on a novel dataset of 5,857 images collected in orchard environments and augmented using techniques like Mosaic augmentation to ensure robustness against varying scales and lighting conditions.
Methodology
The YOLO-Granada architecture modifies the standard YOLOv5s framework through two key innovations: a lightweight backbone and an integrated attention mechanism.
Lightweight Backbone: ShuffleNetv2
We replaced the standard CSPDarknet-53 backbone with ShuffleNetv2. This architecture utilizes grouped convolutions to significantly reduce the number of parameters and floating-point operations (FLOPs). To prevent the loss of information flow between groups, "channel shuffling" is employed, ensuring that each group receives features from all other groups in the preceding layer.
Attention Mechanism: CBAM
To maintain high detection accuracy despite the reduced model size, we integrated the Convolutional Block Attention Module (CBAM). CBAM sequentially applies channel and spatial attention, allowing the network to focus on the most informative features (such as the specific texture and shape of pomegranates) while suppressing background noise like foliage.
As shown in the architecture diagram, CBAM modules are strategically placed within the backbone to refine features before they are passed to the neck and prediction layers. The internal logic of the CBAM module is detailed below:
Experimental Results
YOLO-Granada achieves a balance between efficiency and accuracy. Compared to the baseline YOLOv5s, the proposed model reduced the model size from 13.76 MB to 7.74 MB (a 43.7% reduction) and compressed parameters to 54.7% of the original.
| Metric | YOLOv5s | YOLO-Granada | Improvement |
|---|---|---|---|
| [email protected] | 0.929 | 0.922 | -0.7% |
| Model Size | 13.76 MB | 7.74 MB | -43.7% |
| Inference Speed (CPU) | 7.38 FPS | 8.66 FPS | +17.3% |
The model was particularly effective at identifying "Ripe" fruit (0.987 mAP), though "Buds" (0.872 mAP) remained the most challenging category due to their small size. For real-world deployment, the model was implemented using the NCNN framework on an Android application, achieving approximately 29 FPS for real-time video detection on consumer hardware.
Conclusion
YOLO-Granada provides a lightweight yet accurate solution for pomegranate detection in orchard environments. By combining ShuffleNetv2 with CBAM, the model achieves real-time performance on mobile devices with minimal accuracy loss. Future work will focus on improving detection in complex scenes with dense foliage and extending the methodology to other fruit crops.
Summary updated