Department of Animal Biosciences, Ontario Agricultural College, University of Guelph, 50 Stone Road East, Guelph, ON, CanadaN1G2W1.
Department of Biomedical Sciences, Ontario Veterinary College, University of Guelph, 50 Stone Road East, Guelph, ON, CanadaN1G2W1.
J Anim Sci. 2023 Jan 3;101. doi: 10.1093/jas/skad347.
Pig aggression is a major problem facing the industry as it negatively affects both the welfare and the productivity of group-housed pigs. This study aimed to use a supervised deep learning (DL) approach based on a convolutional neural network (CNN) and image differential to automatically detect aggressive behaviors in pairs of pigs. Different pairs of unfamiliar piglets (N = 32) were placed into one of the two observation pens for 3 d, where they were video recorded each day for 1 h following mixing, resulting in 16 h of video recordings of which 1.25 h were selected for modeling. Four different approaches based on the number of frames skipped (1, 5, or 10 for Diff1, Diff5, and Diff10, respectively) and the amalgamation of multiple image differences into one (blended) were used to create four different datasets. Two CNN models were tested, with architectures based on the Visual Geometry Group (VGG) VGG-16 model architecture, consisting of convolutional layers, max-pooling layers, dense layers, and dropout layers. While both models had similar architectures, the second CNN model included stacked convolutional layers. Nine different sigmoid activation function thresholds between 0.1 and 1.0 were evaluated and a 0.5 threshold was selected to be used for testing. The stacked CNN model correctly predicted aggressive behaviors with the highest testing accuracy (0.79), precision (0.81), recall (0.77), and area under the curve (0.86) values. When analyzing the model recall for behavior subtypes prediction, mounting and mobile non-aggressive behaviors were the hardest to classify (recall = 0.63 and 0.75), while head biting, immobile, and parallel pressing were easy to classify (recall = 0.95, 0.94, and 0.91). Runtimes were also analyzed with the blended dataset, taking four times less time to train and validate than the Diff1, Diff5, and Diff10 datasets. Preprocessing time was reduced by up to 2.3 times in the blended dataset compared to the other datasets and, when combined with testing runtimes, it satisfied the requirements for real-time systems capable of detecting aggressive behavior in pairs of pigs. Overall, these results show that using a CNN and image differential-based deep learning approach can be an effective and computationally efficient technique to automatically detect aggressive behaviors in pigs.
猪的攻击性是该行业面临的一个主要问题,因为它会对群体饲养的猪的福利和生产力产生负面影响。本研究旨在使用基于卷积神经网络(CNN)和图像差分的监督深度学习(DL)方法自动检测成对猪的攻击行为。将不同的陌生仔猪对(N=32)放入两个观察围栏中的一个中,在混合后每天对其进行 1 小时的视频记录,共记录 16 小时的视频,其中选择 1.25 小时进行建模。基于跳过的帧数(分别为 Diff1、Diff5 和 Diff10 的 1、5 或 10 个)和将多个图像差异合并为一个(混合)的四种不同方法,创建了四个不同的数据集。测试了两种 CNN 模型,其架构基于视觉几何组(VGG)VGG-16 模型架构,包括卷积层、最大池化层、密集层和 dropout 层。虽然两个模型的架构相似,但第二个 CNN 模型包括堆叠卷积层。评估了 0.1 到 1.0 之间的 9 个不同的 sigmoid 激活函数阈值,并选择 0.5 阈值用于测试。堆叠 CNN 模型以最高的测试准确性(0.79)、精度(0.81)、召回率(0.77)和曲线下面积(0.86)值正确预测了攻击行为。当分析模型对行为亚型预测的召回率时,交配和移动的非攻击行为最难分类(召回率=0.63 和 0.75),而头部咬伤、静止和并行按压则很容易分类(召回率=0.95、0.94 和 0.91)。还分析了具有混合数据集的运行时,与 Diff1、Diff5 和 Diff10 数据集相比,训练和验证时间减少了四倍。与其他数据集相比,混合数据集的预处理时间减少了高达 2.3 倍,当与测试运行时间结合使用时,它满足了能够检测成对猪攻击行为的实时系统的要求。总的来说,这些结果表明,使用基于 CNN 和图像差分的深度学习方法可以是一种有效且计算高效的技术,可以自动检测猪的攻击行为。