Citrus yield estimation is a fundamental task in precision orchard management. Traditional manual counting methods are labor-intensive, time-consuming, and prone to error, especially in large-scale orchards. To address these challenges, we developed a lightweight detection and tracking framework that leverages China UAV remote sensing video imagery combined with an improved YOLO11 and ByteTrack algorithm. Our system achieves high-accuracy citrus fruit detection, tracking, and real-time counting under complex field conditions, providing a reliable technical solution for orchard yield prediction. The core contributions include a redesigned feature pyramid structure, a multi-scale edge enhancement module, a novel loss function, and a pruning strategy, all integrated into a compact model suitable for edge deployment. Furthermore, we enhanced the ByteTrack tracker with a distance-aware association metric and an anti-shake counting mechanism to mitigate occlusion-induced ID switches. Extensive experiments on a real-world citrus dataset captured by a China UAV (DJI Phantom 4) demonstrate that our method outperforms existing approaches in both detection accuracy and tracking robustness, while maintaining a low computational footprint.
1. Introduction
Accurate estimation of citrus yield is essential for smart orchard management. In traditional practice, manual counting is widely used but suffers from high labor cost, low efficiency, and significant subjective errors. With the rapid advancement of unmanned aerial vehicles (UAVs), especially China UAV platforms equipped with high-resolution cameras, large-scale dynamic monitoring of orchards has become feasible. However, processing the massive video streams from China UAV remote sensing poses challenges in real-time detection and tracking due to small target sizes, complex backgrounds, and frequent occlusions. Early research relied on conventional image processing techniques such as segmentation and Hough transform, which are sensitive to lighting variations and occlusion. More recently, deep learning object detectors, particularly the YOLO series, have shown promise in agricultural applications. Nevertheless, the trade-off between detection accuracy and computational efficiency remains critical for edge deployment on China UAV platforms. In this work, we build upon the lightweight YOLO11n model and introduce several architectural innovations to enhance small fruit detection while drastically reducing model size. We then integrate the improved detector with a novel tracking and counting pipeline specifically designed for China UAV video streams. Our method addresses three key issues: (1) high miss detection of small citrus fruits caused by background clutter and scale variation; (2) frequent ID switches and trajectory breaks due to occlusion and foliage motion; (3) excessive computational cost that prevents real-time processing on embedded devices. By combining feature pyramid redesign, multi-scale edge enhancement, SIoU loss, LAMP pruning, and ByteTrack with DIoU association, we achieve a robust system that can be deployed directly on China UAV edge computing modules.
2. Methodology
2.1 Overall Pipeline
Our counting system consists of three main stages: (1) object detection using the improved YOLO11-PMSL model, (2) multi-object tracking using ByteTrack-DIoU, and (3) region-based counting with an anti-shake state machine. The input video frames from a China UAV are processed frame by frame. Each detected fruit bounding box is passed to the tracker, which maintains unique trajectory IDs. The counter then accumulates the number of fruits that cross a virtual detection line while suppressing false positives caused by jitter.
2.2 YOLO11-PMSL: Lightweight Detection Backbone
The baseline YOLO11n is optimized for speed but struggles with small citrus fruits in China UAV imagery. We propose a series of modifications, collectively named YOLO11-PMSL (Pyramid, Multi-scale, SIoU, LAMP).
2.2.1 Feature Pyramid Reconstruction for Small Targets
The original YOLO11n uses a three-level detection head (P3–P5) with downsampling factors 8, 16, and 32. While the deep P5 head captures semantic information, it loses fine details of small fruits. We introduce a P2 detection layer (downsampling factor 4) by merging high-resolution shallow features. To maintain computational efficiency, we simultaneously remove the redundant P5 head and its associated convolutions. The new detection head operates on P2, P3, and P4 scales. This modification increases the receptive field for small objects while reducing parameter count. As shown in Table 1, the P2–P4 structure improves recall by 7.9 percentage points compared to the baseline, with only a modest increase in FLOPs before pruning.
2.2.2 C3k2-MSEIE: Multi-Scale Edge Information Enhancement
In China UAV aerial views, citrus fruits often appear as blurry circles with indistinct edges due to occlusion and motion blur. Standard C3k2 modules in YOLO11n use fixed receptive fields that cannot capture scale variations effectively. We design a novel building block, C3k2-MSEIE, which replaces the standard bottleneck in the backbone. The core component is the MSEIE (Multi-Scale Edge Information Enhancement) module. It applies adaptive average pooling at four scales (3×3, 6×6, 9×9, 12×12) to generate multi-scale context branches. Each branch passes through a 1×1 convolution (channel reduction to 1/4), a grouped convolution for spatial information, upsampling to original size, and an EdgeEnhancer block. The EdgeEnhancer extracts high-frequency edge information by subtracting the average-pooled low-frequency map from the original feature, then enhances it with a convolution. Finally, all branches are concatenated and fused. This design explicitly strengthens the contour representation of fruits, leading to better detection of partially occluded and small fruits.
2.2.3 SIoU Loss Function
The default CIoU loss in YOLO11n does not consider direction matching between bounding boxes, which can be problematic for oriented fruits in China UAV oblique views. We adopt the SIoU (Scylla-IoU) loss that incorporates angle cost, distance cost, shape cost, and IoU. The SIoU loss is defined as:
$$
\Lambda = 1 – 2 \cdot \sin^2\left( \arcsin\left(\frac{c_h}{\sigma}\right) – \frac{\pi}{4} \right) = \cos\left(2 \cdot \left( \arcsin\left(\frac{c_h}{\sigma}\right) – \frac{\pi}{4} \right)\right)
$$
$$
\Delta = 2 – e^{-\gamma p_x} – e^{-\gamma p_y}, \quad p_x = \left(\frac{b_{cx}^{gt} – b_{cx}}{c_w}\right)^2, \quad p_y = \left(\frac{b_{cy}^{gt} – b_{cy}}{c_h}\right)^2, \quad \gamma = 2 – \Lambda
$$
$$
\Omega = (1 – e^{-w_w})^\theta + (1 – e^{-w_h})^\theta, \quad w_w = \frac{|w – w^{gt}|}{\max(w, w^{gt})}, \quad w_h = \frac{|h – h^{gt}|}{\max(h, h^{gt})}
$$
$$
\mathrm{Loss_{SIoU}} = 1 – \mathrm{IoU} + \frac{\Delta + \Omega}{2}
$$
By explicitly modeling the angle and distance, SIoU accelerates convergence and improves localization accuracy, as confirmed by our ablation study (Table 3).
2.2.4 LAMP Pruning for Model Lightweighting
To deploy the model on embedded systems of China UAV, we apply layer-adaptive magnitude-based pruning (LAMP). Unlike layer-wise independent thresholding, LAMP computes a global importance score for each weight:
$$
\mathrm{score}(u, W) = \frac{(W[u])^2}{\sum_{v \in \Omega_u} (W[v])^2}
$$
where \(\Omega_u\) is the set of indices after u in a layer. This score is comparable across layers. Pruning with a global sparsity constraint automatically determines the optimal pruning ratio per layer. We progressively prune the YOLO11-PMSL model and fine-tune. Table 2 shows that a pruning ratio of 2.2 yields the best trade-off: mAP0.5 reaches 90.5% while parameters drop to 0.36M, FLOPs to 4.6G, and model size to 1.3MB. Inference speed increases to 140.12 FPS, a 65% improvement over the baseline YOLO11n.
2.3 ByteTrack-DIoU: Robust Multi-Object Tracking
Traditional ByteTrack uses IoU for affinity measurement. However, in China UAV videos, fruit bounding boxes often shift significantly between frames due to wind and platform motion. IoU fails to capture center-point displacement, leading to matching errors. We replace IoU with DIoU (Distance-IoU):
$$
\mathrm{DIoU} = \mathrm{IoU} – \frac{\rho^2(b_{pred}, b_{det})}{c^2}
$$
where \(\rho\) is Euclidean distance between centers and \(c\) is diagonal length of the smallest enclosing box. Using \(1 – \mathrm{DIoU}\) as the matching cost provides a more accurate measure of spatial proximity. The ByteTrack-DIoU algorithm retains the two-stage association: high-confidence detections are matched first, while low-confidence ones are re-matched with unmatched tracks using the same DIoU metric. This effectively recovers occluded fruits and reduces ID switches.
2.4 Region-Based Counting with Anti-Shake Mechanism
We design a virtual detection line and a state machine to count fruits crossing the line. Each track (identified by unique ID) maintains a finite-state machine with four states: OUTSIDE, ENTERING, INSIDE, LEAVING. A fruit is counted only if its center lies inside the detection region for N consecutive frames (N=5). This prevents false triggers due to jitter. Two counting channels are implemented: “enter count” for tracks first appearing outside the region, and “leave count” for tracks initially inside. The final count is the sum of both channels. This strategy is particularly effective for China UAV flights parallel to orchard rows, where fruits sequentially enter the field of view.
3. Experiments and Results
3.1 Dataset and Setup
We collected 30 video clips at a citrus orchard (Navel Orange 52) in Fujian, China using a DJI Phantom 4 China UAV flying at 2m altitude with a 45° oblique view. The video resolution was 4096×2160 at 23.98 FPS. We extracted one frame every 15 frames, obtaining 3549 images. Each image was manually annotated using LabelMe. The dataset was split into training (70%), validation (20%), and test (10%) sets. The training environment consisted of an Intel Core i7-13700KF CPU, NVIDIA RTX 3060 GPU (16GB), and PyTorch 2.4.0. We trained for 800 epochs with batch size 8, Adam optimizer, and initial learning rate 0.001.
3.2 Detection Performance
Table 1 compares YOLO11-PMSL with state-of-the-art lightweight detectors (Faster-RCNN, SSD, YOLOv8n, YOLOv9t, YOLOv10n, YOLO11n, YOLO12n). Our model achieves the highest mAP0.5 (90.5%) and precision (86.3%), while having the fewest parameters (0.36M) and smallest model size (1.3MB). The inference speed (140.12 FPS) is also the highest, demonstrating its suitability for real-time China UAV deployment.
| Model | Precision (%) | Recall (%) | mAP0.5 (%) | Params (M) | FLOPs (G) | Model Size (MB) | FPS |
|---|---|---|---|---|---|---|---|
| Faster-RCNN | 68.9 | 53.4 | 64.6 | 41.35 | 134 | 472.1 | 30.9 |
| SSD | 73.7 | 75.9 | 76.5 | 23.75 | 214 | 272.1 | 24.8 |
| YOLOv8n | 78.6 | 70.3 | 77.8 | 2.68 | 6.8 | 5.6 | 82.83 |
| YOLOv9t | 79.6 | 74.4 | 80.8 | 1.73 | 6.4 | 4.2 | 87.06 |
| YOLOv10n | 82.8 | 69.4 | 80.6 | 2.26 | 6.5 | 5.8 | 85.46 |
| YOLO11n | 83.0 | 71.4 | 81.2 | 2.58 | 6.3 | 5.5 | 84.83 |
| YOLO12n | 80.7 | 70.6 | 78.8 | 2.51 | 5.8 | 5.2 | 75.49 |
| YOLO11-PMSL | 86.3 | 83.0 | 90.5 | 0.36 | 4.6 | 1.3 | 140.12 |
Table 2 shows the effect of pruning ratio on YOLO11-PMSL. A ratio of 2.2 provides the best balance between accuracy and efficiency. Further pruning degrades mAP0.5.
| Pruning Ratio | Precision (%) | Recall (%) | mAP0.5 (%) | Params (M) | FLOPs (G) | Model Size (MB) | FPS |
|---|---|---|---|---|---|---|---|
| 1.0 | 85.2 | 83.8 | 90.6 | 1.21 | 10.4 | 3.1 | 73.68 |
| 1.6 | 87.9 | 81.2 | 90.4 | 0.48 | 6.3 | 1.5 | 136.96 |
| 1.8 | 87.1 | 81.4 | 90.7 | 0.44 | 5.6 | 1.4 | 128.86 |
| 2.0 | 88.4 | 80.1 | 90.5 | 0.41 | 5.0 | 1.4 | 122.96 |
| 2.2 | 86.3 | 83.0 | 90.5 | 0.36 | 4.6 | 1.3 | 140.12 |
| 2.4 | 87.0 | 80.9 | 90.0 | 0.34 | 4.2 | 1.2 | 155.14 |
Table 3 presents the ablation study, confirming the contribution of each component. Starting from YOLO11n, adding the P2 head (P2_345) boosts recall and mAP but increases FLOPs. Trimming to P2–P4 (P234) reduces parameters and model size while maintaining high mAP. Adding C3k2-MSEIE further improves accuracy. Replacing CIoU with SIoU gives an additional 0.4 points in mAP. Finally, LAMP pruning drastically reduces computational cost while preserving accuracy.
| Model | Precision (%) | Recall (%) | mAP0.5 (%) | Params (M) | FLOPs (G) | Model Size (MB) | FPS |
|---|---|---|---|---|---|---|---|
| YOLO11n | 83.0 | 71.4 | 81.2 | 2.58 | 6.3 | 5.5 | 84.83 |
| +P2_345 | 83.8 | 78.2 | 87.4 | 2.67 | 10.3 | 5.9 | 58.32 |
| +P234 | 81.8 | 79.3 | 86.3 | 1.16 | 9.8 | 2.6 | 60.49 |
| +P234+C3k2-MSEIE | 85.2 | 82.1 | 89.9 | 1.21 | 10.4 | 3.1 | 73.52 |
| +P234+C3k2-MSEIE+SIoU | 85.2 | 83.8 | 90.6 | 1.21 | 10.4 | 3.1 | 73.68 |
| +LAMP (YOLO11-PMSL) | 86.3 | 83.0 | 90.5 | 0.36 | 4.6 | 1.3 | 140.12 |
3.3 Tracking and Counting Performance
We evaluated the tracking performance by combining YOLO11-PMSL with various trackers: SORT, DeepSORT, Bot-SORT, ByteTrack, and our ByteTrack-DIoU. Results are shown in Table 4. The proposed ByteTrack-DIoU achieves the highest MOTA (92.8%), MOTP (81.7%), and IDF1 (92.0%). Compared to standard ByteTrack, MOTA improves by 2.2 percentage points, demonstrating the advantage of DIoU-based association.
| Model | MOTA (%) | MOTP (%) | IDF1 (%) |
|---|---|---|---|
| YOLO11-PMSL+SORT | 87.3 | 62.5 | 86.4 |
| YOLO11-PMSL+DeepSORT | 87.1 | 62.3 | 89.0 |
| YOLO11-PMSL+Bot-SORT | 88.5 | 70.9 | 90.6 |
| YOLO11-PMSL+ByteTrack | 90.6 | 78.7 | 90.8 |
| YOLO11-PMSL+ByteTrack-DIoU | 92.8 | 81.7 | 92.0 |
We tested the counting accuracy on five representative video segments (each corresponding to one row of citrus trees). Table 5 compares the predicted counts with manual ground-truth counts. The average counting accuracy (MCA) reaches 88.4%, with a maximum deviation of about 12%, which satisfies practical requirements for China UAV-based yield estimation.
| Video | Manual Count | Our Method Count |
|---|---|---|
| Video 1 | 970 | 859 |
| Video 2 | 1522 | 1317 |
| Video 3 | 963 | 854 |
| Video 4 | 899 | 799 |
| Video 5 | 860 | 770 |
| MCA (%) | 88.4 |
3.4 Visual Analysis
We used Grad-CAM to generate heatmaps of the final detection layer. Compared to the baseline YOLO11n, our YOLO11-PMSL model shows more concentrated activation on fruit regions, with clearer boundaries between adjacent fruits, especially under occlusion and varying illumination. Example detections under bright and cloudy conditions demonstrate that our model significantly reduces both false positives and false negatives. The improvement is particularly evident for small and partially occluded fruits.

4. Conclusion
We presented a complete pipeline for citrus fruit tracking and counting using China UAV remote sensing video. The developed YOLO11-PMSL detection model, enhanced with a P2–P4 pyramid, C3k2-MSEIE module, SIoU loss, and LAMP pruning, achieves a mAP0.5 of 90.5% while reducing parameters by 86% and increasing inference speed to 140 FPS. The improved ByteTrack-DIoU tracker raises MOTA to 92.8% and IDF1 to 92.0%. Combined with a region-based anti-shake counting mechanism, our system attains an average counting accuracy of 88.4%, with error within 12% of manual counts. These results demonstrate the efficacy of our approach for real-time, accurate citrus yield estimation in large orchards using China UAV platforms, providing valuable support for smart orchard management.
