The Bradley Department of Electrical Engineering, Virginia Polytechnic Institute and State University, Blacksburg, VA 24061, USA.
School of Animal Sciences, Virginia Polytechnic Institute and State University, Blacksburg, VA 24061, USA.
J Anim Sci. 2022 Nov 1;100(11). doi: 10.1093/jas/skac293.
This paper presents the application of machine learning algorithms to identify pigs' behaviors from data collected using the wireless sensor nodes mounted on pigs. The sensor node attached to a pig's back senses the acceleration and angular velocity in three axes, and the sensed data are transmitted to a host computer wirelessly. Two video cameras, one attached to the ceiling of the pigpen and the other one to a fence, provided ground truth for data annotations. The data were collected from pigs for 131 h over 2 mo. As the typical behavior period depends on the behavior type, we segmented the acceleration data with different window sizes (WS) and step sizes (SS), and tested how the classification performance of different activities varied with different WS and SS. After exploring the possible combinations, we selected the optimum WS and SS. To compare performance, we used five machine learning algorithms, specifically support vector machine, k-nearest neighbors, decision trees, naive Bayes, and random forest (RF). Among the five algorithms, RF achieved the highest F1 score for four major behaviors consisting of 92.36% in total. The F1 scores of the algorithm were 0.98 for "eating," 0.99 for "lying," 0.93 for "walking," and 0.91 for "standing" behaviors. The optimal WS was 7 s for "eating" and "lying," and 3 s for "walking" and "standing." The proposed work demonstrates that, based on the length of behavior, the adaptive window and step sizes increase the classification performance.
本文提出了一种使用安装在猪身上的无线传感器节点采集数据,通过机器学习算法识别猪行为的方法。附着在猪背上的传感器节点感知三个轴上的加速度和角速度,感知到的数据通过无线传输到主机计算机。两个摄像机,一个安装在猪圈的天花板上,另一个安装在围栏上,为数据注释提供了地面实况。数据是在两个月内从猪身上采集的,持续了 131 小时。由于典型的行为周期取决于行为类型,我们使用不同的窗口大小(WS)和步长大小(SS)对加速度数据进行分段,并测试了不同活动的分类性能随不同 WS 和 SS 的变化情况。在探索了可能的组合之后,我们选择了最佳的 WS 和 SS。为了进行比较,我们使用了五种机器学习算法,分别是支持向量机、k-近邻、决策树、朴素贝叶斯和随机森林(RF)。在这五种算法中,RF 对由四种主要行为组成的数据集的 F1 得分最高,达到了 92.36%。算法的 F1 得分分别为“进食”行为的 0.98、“躺卧”行为的 0.99、“行走”行为的 0.93 和“站立”行为的 0.91。最佳的 WS 分别为“进食”和“躺卧”行为的 7 秒,以及“行走”和“站立”行为的 3 秒。这项工作表明,基于行为的长度,自适应窗口和步长大小可以提高分类性能。