Chuanyi Guo, Emma Ternman, Xinjie Zhao, Kai Liu, Mutian Niu
Sleep is essential for the health and welfare of dairy cattle, yet accurate monitoring remains challenging. While Polysomnography (PSG) serves as the gold standard for sleep assessment, its reliance on labor-intensive manual scoring of physiological signals constrains on-farm application, underscoring the need for accessible sensor systems such as the RumiWatch System (RWS). This study proposed DairySleepNet, a deep learning framework based on a selective state space model, for automated classification of wakefulness, sleep, and rumination states using PSG and RWS data, with the aim of supporting scalable annotations and on-farm deployment. The proposed framework adopted a 2-stage encoding architecture that effectively processed time-frequency representations converted from raw multichannel signals through the short-time Fourier transform, capturing both within-channel temporal features and cross-channel interactions. The method was evaluated using 77.13 h of usable PSG and RWS recordings from 7 cows, with approximately one 12-h segment retained for each cow. Animal-level cross-validation and a soft weighted sampling strategy were implemented to ensure robust evaluation. Experimental results demonstrated that DairySleepNet achieved a macro F1 of 86.37% and an accuracy of 90.80% when using PSG data, markedly outperforming both Transformer-based and machine learning baselines. These results supported the feasibility of automated sleep annotation from PSG recordings. Although combining PSG and RWS data reduced cross-fold variability, it did not improve the overall system performance. By contrast, classification based solely on RWS data remained unsatisfactory, underscoring the need for further methodological development before reliable on-farm sleep monitoring can be achieved. Future work should prioritize fine-grained sleep staging, currently limited by scarce stage-specific labeled data, and broader data collection across diverse farm environments to enable robust and practical on-farm application.