Abstract:In large-scale sheep farming operations, the behavioral characteristics of livestock serve as effective indicators of their health status and environmental adaptability. Aiming to address the challenges of low monitoring efficiency and insufficient recognition accuracy inherent in traditional methods for housed sheep behavior recognition, particularly under varying flock densities, a novel behavior recognition method was proposed based on an improved YOLO 11n model. Initially, 2D cameras were installed diagonally above the sheep enclosures to capture video data of the flock, from which a housed sheep behavior dataset was constructed, comprising four distinct behaviors: standing, feeding, drinking, and resting. Subsequently, the YOLO 11n model was enhanced by integrating the content-aware reassembly of features (CARAFE) upsampling structure, the efficient multi-scale attention (EMA) mechanism, and the dynamic head (DyHead) framework, resulting in the proposed YOLO-CFED model. This was designed to improve the feature extraction and recognition capabilities for sheep behavior detection. The experimental results showed that the improved YOLO-CFED model significantly improved its performance on self built datasets: the recognition precision reached 95.6%, the recall reached 93%, an mAP@0.5 reached 94%, an mAP@0.5:0.95 reached 82.4% and an F1 score of 93.4%, all indicators were superior to that of the original YOLO 11n model. The proposed method effectively identified the four primary behaviors of sheep, thereby offering robust technical support for the implementation of intelligent behavioral monitoring and health management in sheep farming.