About BerryTrackCount

Dependencies

GitHub: https://github.com/GZU-SAMLab/BerryTrackCount

💾 Code and Data

The source code can be downloaded from this link.

You can download the dataset from this link. Download the dataset to the './dataset/' folder.

🧩 Model Weights

The archive provides the detector and ReID weights required by BerryTrackCount, including the YOLO11 baseline models, the trained BerryDet model, and the blueberry-specific OSNet appearance model.

Download the model weights, extract the archive, and place all files directly in the ./weights/ directory.

weights/
├── berrydet_s.pt
├── yolo11s.pt
├── yolo11l.pt
└── osnet_ain_x1_0_blueberry.pt

Get Started

🧠 Training

Detector and ReID training:

detector/BerryDet.py
trackers/boxmot/trackers/mytrack/train_reid_osnet_ain_x1_0.py
📊 Evaluation
python evaluation/1_tracker_eval.py \
  --data_root dataset/blueberry_mot_stitched_walk \
  --yolo_weights weights/berrydet_s.pt \
  --tracker_config_dir configs/trackers \
  --reid_path weights/osnet_ain_x1_0_blueberry.pt \
  --output_dir output/eval/blueberry_mot_stitched_walk
🎬 Visualization
python visualize/berrytracker_count_visu.py \
  --sequence-dir dataset/blueberry_mot_stitched_walk/test/Blueberry-Test-15 \
  --output-dir output/visualize/BerryTracker_Count \
  --trackers mytrack \
  --yolo-weights weights/yolo11l.pt \
  --reid-weights weights/osnet_ain_x1_0_blueberry.pt
🚀 Count Real Videos
python tools/count_apply.py \
  --video-path-json dataset/video_path.json \
  --yolo-weights weights/berrydet_s.pt \
  --reid-weights weights/osnet_ain_x1_0_blueberry.pt \
  --tracker-config configs/trackers/mytrack.yaml \
  --output-dir output/count_apply \
  --device cuda

Field Application Demonstration

To evaluate the field application potential of BerryTrackCount, dynamic counting was conducted along the same blueberry planting row on four dates in April 2025. The camera moved along both the front and rear sides of the canopy to increase visible coverage and reduce counting deviations caused by single-view occlusion. This acquisition strategy enabled continuous monitoring of flowers and fruits across multiple phenological stages.

Field application

Figure 1. Multi-phenological counting results for the same planting row in April 2025. The bar charts show class-specific counts from both sides of the plants on different dates, and the pie charts show the corresponding phenological composition.

The results reveal a clear temporal shift in canopy composition. Green fruits dominated in early April, while the proportion of mature blue fruits gradually increased and a new flowering cohort became prominent later in the month. These stage-specific trends can support crop-load assessment, selective harvesting, flowering protection, fruit-set monitoring, and other time-sensitive orchard management decisions.

Advantages and Disadvantages

Advantages: BerryTrackCount integrates phenological stage recognition, identity-preserving tracking, and category-specific counting within a unified video phenotyping framework. BerryDet improves the observation of small flowers and fruits, BerryTracker reduces identity confusion in dense and visually similar clusters, and PTGC suppresses duplicate counts through spatial tolerance and trajectory-level gating. The resulting stage-specific counts provide practical support for high-throughput phenotyping, crop-load assessment, yield estimation, harvest planning, and precision orchard management.

Disadvantages: Severe occlusion, low illumination, and ambiguous boundaries between transitional fruit colors can still cause missed detections, class oscillations, and short-term trajectory fragmentation. SAHI-based sliced inference and appearance feature extraction also introduce additional computational overhead. Moreover, the generated MOT benchmark cannot fully reproduce non-rigid branch motion, depth-dependent parallax, or abrupt illumination changes in real orchards. Future work should therefore focus on lightweight deployment and evaluation using densely annotated in-field blueberry MOT videos.