Bee Detection and Tracking at Hive Entrance using YOLO11 and ByteTrack
Authors: Thi Thu Thao Nguyen, Johannes Reschke
Organizations: IoT Engineering Savonia University of Applied Sciences Finland · Electrical and Information Engineering Ostbayerische Technische Hochschule Regensburg Germany
This work presents an automatic bee entrance monitoring system based on YOLO11 transfer learning and the ByteTrack tracking algorithm. The study investigates the influence of data augmentation, backbone freezing, and tracker parameter optimization on the detection and counting of small, fast-moving bees. The detector with progressive backbone unfreezing strategy achieved about 97.0% precision and 98.7% mAP50, while providing more stable convergence than full fine-tuning. Experiments also showed that light augmentation outperformed heavy augmentation. For tracking, ByteTrack parameters were optimized to improve trajectory continuity under low-confidence detections. On an independent 25 FPS side-view video, the optimized YOLO11-ByteTrack system correctly counted 43 of 47 incoming bees (91.5%) and 7 of 30 outgoing bees (23.3%). Error analysis showed that most counting errors were caused by missed detections due to rapid bee motion and motion blur, while tracking failures became less frequent after parameter optimization. Overall, the results indicate that moderate augmentation, progressive backbone unfreezing, and ByteTrack tuning improve the reliability of automatic bee entrance monitoring under realistic recording conditions.
Figures & tables
Fig. 1: Example image of bees at a hive entrance, adapted from the Mendeley dataset [ 5 ] .
Fig. 2: Example image of bees at a hive entrance, adapted from the Mendeley dataset [ 5 ] .
Fig. 3: Example image of bees at a hive entrance, adapted from Dataset Ninja [ 6 ] .
Fig. 4: A frame extracted from the evaluation video by Ella Gronewold on Pexels [ 7 ] .
Fig. 5: ByteTrack pipeline.
Fig. 6: Counting logic graph.
Fig. 7: Box loss and class loss between light and heavy augmented models.
Fig. 8: mAP50 and mAP50–95 between light and heavy augmented models.
Fig. 9: Recall between light and heavy augmented models.
Model
Precision
Recall
Unfreeze all
∼ 0.969–0.973
∼ 0.960–0.964
Freeze backbone 30 epochs
∼ 0.971–0.974
∼ 0.958–0.963
Freeze backbone all epochs
∼ 0.964–0.968
∼ 0.958–0.961
TABLE I: Precision and Recall Comparison
Model
mAP50
mAP50–95
Unfreeze all
∼ 0.984
∼ 0.752–0.754
Freeze backbone 30 epochs
∼ 0.987
∼ 0.783–0.784
Freeze backbone all epochs
∼ 0.986
∼ 0.783–0.784
TABLE II: mAP50 and mAP50–95 Comparison
Model
box loss
cls loss
dfl loss
Unfreeze all
∼ 0.875
∼ 0.345
∼ 1.018
Freeze backbone 30 epochs
∼ 0.862
∼ 0.360
∼ 0.955
Freeze backbone all epochs
∼ 0.933
∼ 0.380
∼ 0.960
TABLE III: Validation Losses Comparison
Model
Epochs
Unfreeze all
81
Freeze backbone 30 epochs
93 (highest)
Freeze backbone all epochs
75
TABLE IV: Training Duration
Fig. 10: Training and validation DFL loss between fine-tune-all and progressive backbone unfreezing.
Parameter
Selected value
Rationale
track_high_thresh
0.15, lower than default 0.25
Detection confidence fluctuates because of small size and fast motion. Lowering the threshold allows more valid detections to participate in the first association stage.
track_low_thresh
0.03, lower than default 0.10
A very low threshold enables recovery of weak detections during the second association stage instead of terminating the track.
new_track_thresh
0.15, lower than default 0.25
Allows newly appearing bees to be initialized more quickly, reducing missed bee entries.
track_buffer
50, higher than default 30
Keeps lost tracks alive longer, enabling successful re-association after temporary occlusion and reducing fragmented trajectories.
match_thresh
0.85, higher than default 0.80
Requires stronger spatial consistency before assigning an existing ID, reducing incorrect ID switches between nearby bees.
fuse_score
True (default)
Combines detection confidence with motion similarity during association, improving matching robustness.
TABLE V: Optimized ByteTrack Tracking Parameters and Their Rationale
Fig. 11: Bee counting IN versus ground truth.
Fig. 12: Bee counting OUT versus ground truth.
Fig. 13: Example of a fast-moving bee exiting the hive, demonstrating motion blur and an oblique viewing angle.