Abstract:With the rapid development of animal husbandry in China, the transition from farmers-dispersed cattle breeding to precision husbandry has become increasingly important. Efficient management of breeding, behavior monitoring, disease prevention, and health assurance pose significant challenges. Traditionally, farmers have struggled to provide adequate attention to each cow. To address these challenges, a comprehensive approach was developed that accurately identified and tracked cattle behavior by analyzing behavior patterns and visual characteristics. Firstly, the improved YOLO v8 algorithm was employed for cattle target detection. The model’s feature extraction capabilities were enhanced by incorporating the C2f-faster structure into the Backbone and Neck. The upsampling operator CARAFE was introduced to expand the perception field for data feature fusion. To identify small area characteristics of young cattle, the BiFormer attention mechanism was integrated into the detection process, replacing the dynamic target detection head DyHead. This allowed to effectively integrate scale, space, and task perception. Furthermore, the issue of the uneven distribution of positive and negative samples and the limitations of CIoU was addressed by utilizing the Focal SIoU function. Finally, the behavior category information detected by YOLO v8 was incorporated into the BoTSORT algorithm to enable multi-target behavior recognition and tracking in complicated situations. The experiments demonstrated significant performance improvements. The proposed FBCD-YOLO v8n model outperformed both the YOLO v5n, YOLO v7tiny, and the original YOLO v8n models, with an increase of 3.4 percentage points, 3.1 percentage points, and 2.4 percentage points in mAP@0.5, respectively, on the bovine behavior dataset. Notably, the accuracy of bovine back licking behavior recognition was increased by 7.4 percentage points. Regarding tracking, the BoTSORT algorithm achieved an MOTA of 96.1%, MOTP of 78.6%, HOTA of 78.9%, and IDF1 of 98.0%. Compared with ByteTrack and StrongSORT algorithms, the proposed method of MOTA and IDF1 scores demonstrated significant tracking improvements. This research demonstrated that the multi-objective cattle behavior recognition and tracking system developed can provide effective assistance to farmers in monitoring cattle behavior within the cattle barn environment. It offered crucial technical support for automated and precise cattle breeding.