Detection–Tracking–Counting Pipeline

Enhanced YOLO11 detector

The enhanced YOLO11 detector recognizes coexisting blueberry flowers and fruits from flowering, greening, coloring, and ripening stages within the same field views. Because many targets occupy only a small fraction of a high-resolution frame, it combines MSSC with Slicing Aided Hyper Inference (SAHI). SAHI divides high-resolution orchard images into smaller overlapping slices for inference and merges the resulting detections, improving the visibility and localization of small targets.

Micro-target Spatial–Semantic Coupling Module (MSSC): Small blueberry targets require fine spatial cues for accurate localization and strong semantic responses for reliable phenological classification. However, repeated downsampling and feature compression can weaken local texture, contour, and positional information. To address this issue, MSSC splits the input features into semantic and spatial branches, estimates complementary channel and spatial weights, and then aggregates the two branches. This design preserves position-sensitive semantic representations and improves the detection of small flowers and fruits in complex orchard scenes.

Enhanced YOLO11 detector

Figure 1. Architecture of the enhanced YOLO11 detector and the Micro-target Spatial--Semantic Coupling Module (MSSC). (a) The detector embeds MSSC into the backbone to enhance small-object representation while retaining the feature-fusion neck and decoupled detection head. (b) MSSC splits input features into semantic and spatial branches, estimates channel and spatial weights, and aggregates the two branches to preserve position-sensitive semantic representations.

BerryTracker

BerryTracker extends Deep OC-SORT for dense and visually homogeneous blueberry targets. Its first association stage fuses VCM-CIoU geometric similarity, Velocity Direction Consistency (VDC), and CARM appearance similarity for global Hungarian matching. A second Observation-Centric Recovery stage matches unmatched tracks and detections using their last valid observations and VCM-CIoU, reducing fragmentation after short occlusions.

BerryTracker

Figure 2. Tracking framework of BerryTracker. The first-stage association fuses VCM-CIoU geometric similarity, VDC motion consistency, and CARM-based appearance similarity for global matching. The second-stage Observation-Centric Recovery (OCR) matching uses the last valid observations of unmatched tracks and constructs the cost matrix using only VCM-CIoU to reduce short-term trajectory fragmentation.

Vertical-Consistency Modulated Complete IoU (VCM-CIoU): Dense blueberry clusters can produce similar IoU scores for different track–detection pairs, particularly when adjacent fruits are vertically stacked or partially occluded. Although CIoU considers overlap, center distance, and aspect-ratio consistency, it does not explicitly model vertical consistency. VCM-CIoU introduces a one-dimensional vertical-overlap constraint into the normalized CIoU similarity. By jointly considering overlap area, center deviation, aspect ratio, and height consistency, it improves geometric separability and suppresses erroneous associations in dense fruit clusters.

Cross-Attention Appearance Reconstruction Module (CARM): Conventional ReID features may be weakly identity-specific when nearby blueberries share color, shape, and texture. CARM reconstructs tracklet and detection embeddings through bidirectional cross-attention to obtain enhanced appearance embedding representations. This module increases the similarity of appearance embeddings for the same target across frames while suppressing similarity between different targets across frames.

CARM

Figure 3. Cross-Attention Appearance Reconstruction Module (CARM). CARM reconstructs tracklet and detection embeddings through bidirectional cross-attention and computes enhanced appearance similarity for identity association.

Phenology-specific Trajectory-Gated Counting (PTGC)

Direct ID accumulation overcounts fragmented trajectories, while a single counting line is sensitive to bounding-box jitter. PTGC places a narrow vertical region near the frame center and counts each trajectory only on its first entry. The 8% region used in the experiments provides spatial tolerance while trajectory-level gating suppresses repeated triggers.

Results

On the 20 programmatically generated blueberry MOT test sequences, BerryTracker combined with PTGC achieved 93.48% total counting accuracy, with a GEH of 1.22, an RMSE of 30.11, and an R2 of 0.966. On manually annotated real-world MOT sequences, PTGC achieved 85.75% total accuracy and an RMSE of 96.71.

Table 1. Accuracy and RMSE for three counting strategies on manually annotated real-world blueberry MOT sequences. Higher accuracy and lower RMSE are preferred.
Mode Flower
Accuracy / RMSE
Green
Accuracy / RMSE
Light Purple
Accuracy / RMSE
Blue
Accuracy / RMSE
Total
Accuracy / RMSE
ID-based 40.27% / 23.85 57.89% / 212.01 52.04% / 19.28 64.58% / 38.82 57.39% / 287.41
Line-based 81.86% / 9.01 85.46% / 80.23 50.32% / 38.23 43.48% / 61.81 75.55% / 177.22
PTGC 72.73% / 11.07 85.73% / 78.07 68.77% / 12.14 89.88% / 16.53 85.75% / 96.71
counting performance

Figure 4. Overall counting performance of different tracking algorithms under the PTGC strategy. (a) GEH. (b) RMSE. (c) Regression results between predicted and ground-truth counts.

PTGC achieved class-specific R2 values of 0.978, 0.968, 0.991, and 0.981 for Flower, Green, Light Purple, and Blue, respectively. The corresponding RMSE values were 8.72, 19.30, 4.01, and 7.21.

Regression

Figure 5. Regression analysis of BerryTracker counting results across phenological categories and counting strategies. Each subplot compares predicted counts with ground-truth counts for Flower, Green, Light Purple, and Blue; the solid line denotes the fitted regression line, and the dashed line denotes the ideal agreement line y=x.

Visual

Figure 6. Visual counting results of the blueberry video counting framework on test sequences 01 and 15. Red circles indicate representative counting errors, including missed counts near frame boundaries and cross-frame class changes.