Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods

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 us...

Full description

Bibliographic Details
Main Authors: Franziska Hakansson, Dan Børge Jensen
Format: Article
Language:English
Published: Frontiers Media S.A. 2023-01-01
Series:Frontiers in Veterinary Science
Subjects:
Online Access:https://www.frontiersin.org/articles/10.3389/fvets.2022.1099347/full
_version_ 1797954253998784512
author Franziska Hakansson
Dan Børge Jensen
author_facet Franziska Hakansson
Dan Børge Jensen
author_sort Franziska Hakansson
collection DOAJ
description 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.
first_indexed 2024-04-10T23:14:46Z
format Article
id doaj.art-bfccf16db6b0493198b050d80fe58354
institution Directory Open Access Journal
issn 2297-1769
language English
last_indexed 2024-04-10T23:14:46Z
publishDate 2023-01-01
publisher Frontiers Media S.A.
record_format Article
series Frontiers in Veterinary Science
spelling doaj.art-bfccf16db6b0493198b050d80fe583542023-01-12T21:01:45ZengFrontiers Media S.A.Frontiers in Veterinary Science2297-17692023-01-01910.3389/fvets.2022.10993471099347Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methodsFranziska HakanssonDan Børge JensenAutomated 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.https://www.frontiersin.org/articles/10.3389/fvets.2022.1099347/fullconvolutional neural network (CNN)long short-term memory (LSTM)tail-biting behaviorpigscomputer visionanimal welfare
spellingShingle Franziska Hakansson
Dan Børge Jensen
Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods
Frontiers in Veterinary Science
convolutional neural network (CNN)
long short-term memory (LSTM)
tail-biting behavior
pigs
computer vision
animal welfare
title Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods
title_full Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods
title_fullStr Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods
title_full_unstemmed Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods
title_short Automatic monitoring and detection of tail-biting behavior in groups of pigs using video-based deep learning methods
title_sort automatic monitoring and detection of tail biting behavior in groups of pigs using video based deep learning methods
topic convolutional neural network (CNN)
long short-term memory (LSTM)
tail-biting behavior
pigs
computer vision
animal welfare
url https://www.frontiersin.org/articles/10.3389/fvets.2022.1099347/full
work_keys_str_mv AT franziskahakansson automaticmonitoringanddetectionoftailbitingbehavioringroupsofpigsusingvideobaseddeeplearningmethods
AT danbørgejensen automaticmonitoringanddetectionoftailbitingbehavioringroupsofpigsusingvideobaseddeeplearningmethods