Hakansson Franziska, Jensen Dan Børge
Department for Veterinary and Animal Science, Faculty of Health and Medical Science, University of Copenhagen, Copenhagen, Denmark.
Front Vet Sci. 2023 Jan 11;9:1099347. doi: 10.3389/fvets.2022.1099347. eCollection 2022.
Automated monitoring of pigs for timely detection of changes in behavior and the onset of tail biting might enable farmers to take immediate management actions, and thus decrease health and welfare issues on-farm. Our goal was to develop computer vision-based methods to detect tail biting in pigs using a convolutional neural network (CNN) to extract spatial information, combined with secondary networks accounting for temporal information. Two secondary frameworks were utilized, being a long short-term memory (LSTM) network applied to sequences of image features (CNN-LSTM), and a CNN applied to image representations of sequences (CNN-CNN). To achieve our goal, this study aimed to answer the following questions: (a) Can the methods detect tail biting from video recordings of entire pens? (b) Can we utilize principal component analyses (PCA) to reduce the dimensionality of the feature vector and only use relevant principal components (PC)? (c) Is there potential to increase performance in optimizing the threshold for class separation of the predicted probabilities of the outcome? (d) What is the performance of the methods with respect to each other? The study utilized one-hour video recordings of 10 pens with pigs prior to weaning, containing a total of 208 tail-biting events of varying lengths. The pre-trained VGG-16 was used to extract spatial features from the data, which were subsequently pre-processed and divided into train/test sets before input to the LSTM/CNN. The performance of the methods regarding data pre-processing and model building was systematically compared using cross-validation. Final models were run with optimal settings and evaluated on an independent test-set. The proposed methods detected tail biting with a major-mean accuracy (MMA) of 71.3 and 64.7% for the CNN-LSTM and the CNN-CNN network, respectively. Applying PCA and using a limited number of PCs significantly increased the performance of both methods, while optimizing the threshold for class separation did result in a consistent but not significant increase of the performance. Both methods can detect tail biting from video data, but the CNN-LSTM was superior in generalizing when evaluated on new data, i.e., data not used for training the models, compared to the CNN-CNN method.
对猪进行自动监测以便及时发现行为变化和咬尾行为的开始,这可能使养殖户能够立即采取管理措施,从而减少农场中的健康和福利问题。我们的目标是开发基于计算机视觉的方法,利用卷积神经网络(CNN)提取空间信息,并结合考虑时间信息的二级网络来检测猪的咬尾行为。使用了两个二级框架,一个是应用于图像特征序列的长短期记忆(LSTM)网络(CNN-LSTM),另一个是应用于序列图像表示的CNN(CNN-CNN)。为实现我们的目标,本研究旨在回答以下问题:(a)这些方法能否从整个猪圈的视频记录中检测出咬尾行为?(b)我们能否利用主成分分析(PCA)来降低特征向量的维度,只使用相关的主成分(PC)?(c)在优化结果预测概率的类分离阈值时,是否有提高性能的潜力?(d)这些方法相互之间的性能如何?该研究使用了10个猪圈断奶前猪的1小时视频记录,其中包含总共208个不同长度的咬尾事件。使用预训练的VGG-16从数据中提取空间特征,随后对其进行预处理并在输入到LSTM/CNN之前分为训练/测试集。使用交叉验证系统地比较了这些方法在数据预处理和模型构建方面的性能。最终模型在最佳设置下运行,并在独立测试集上进行评估。所提出的方法检测咬尾行为的主要平均准确率(MMA),对于CNN-LSTM和CNN-CNN网络分别为71.3%和64.7%。应用PCA并使用有限数量的主成分显著提高了两种方法的性能,而优化类分离阈值确实导致性能有一致但不显著的提高。两种方法都可以从视频数据中检测出咬尾行为,但与CNN-CNN方法相比,CNN-LSTM在对新数据(即未用于训练模型的数据)进行评估时,在泛化方面表现更优。