Article
Detecting Animal Contacts—A Deep Learning-Based Pig
Detection and Tracking Approach for the Quantification of
Social Contacts
Martin Wutke
1,2,
* , Felix Heinrich
1
, Pronaya Prosun Das
3
, Anita Lange
2
, Maria Gentz
2
,
Imke Traulsen
2
, Friederike K. Warns
4
, Armin Otto Schmitt
1,5
and Mehmet Gültas
5,6,
*
Citation: Wutke, M.; Heinrich, F.;
Das, P.P.; Lange, A.; Gentz, M.;
Traulsen, I.; Warns, F.K.; Schmitt,
A.O.; Gültas, M. Detecting Animal
Contacts—A Deep Learning-Based
Pig Detection and Tracking Approach
for the Quantification of Social
Contacts. Sensors 2021, 21, 7512.
https://doi.org/10.3390/s21227512
Academic Editors: Dionysis Bochtis
and Aristotelis C. Tagarakis
Received: 18 October 2021
Accepted: 10 November 2021
Published: 12 November 2021
Publisher’s Note: MDPI stays neutral
with regard to jurisdictional claims in
published maps and institutional affil-
iations.
Copyright: © 2021 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article
distributed under the terms and
conditions of the Creative Commons
Attribution (CC BY) license (https://
creativecommons.org/licenses/by/
4.0/).
1
Breeding Informatics Group, Department of Animal Sciences, Georg-August University,
Margarethe von Wrangell-Weg 7, 37075 Göttingen, Germany; felix.heinrich@uni-goettingen.de (F.H.);
armin.schmitt@uni-goettingen.de (A.O.S.)
2
Livestock Systems, Department of Animal Sciences, Georg-August University, Albrecht-Thaer-Weg 3,
37075 Göttingen, Germany; anita.lange@agr.uni-goettingen.de (A.L.); maria.gentz@thuenen.de (M.G.);
imke.traulsen@uni-goettingen.de (I.T.)
3
Bioinformatics Group, Fraunhofer Institute for Toxicology and Experimental Medicine (Fraunhofer ITEM),
Nikolai-Fuchs-Str. 1, 30625 Hannover, Germany; pronaya.prosun.das@item.fraunhofer.de
4
Agricultural Test and Education Centre House Düsse, Chamber of Agriculture North Rhine-Westphalia,
Haus Düsse 2, 59505 Bad Sassendorf, Germany; Friederike.Warns@LWK.NRW.DE
5
Center for Integrated Breeding Research (CiBreed), Georg-August University, Albrecht-Thaer-Weg 3,
37075 Göttingen, Germany
6
Statistics and Data Science, Faculty of Agriculture, South Westphalia University of Applied Sciences,
59494 Soest, Germany
* Correspondence: martin.wutke@uni-goettingen.de (M.W.); gueltas.mehmet@fh-swf.de (M.G.)
Abstract:
The identification of social interactions is of fundamental importance for animal behavioral
studies, addressing numerous problems like investigating the influence of social hierarchical struc-
tures or the drivers of agonistic behavioral disorders. However, the majority of previous studies often
rely on manual determination of the number and types of social encounters by direct observation
which requires a large amount of personnel and economical efforts. To overcome this limitation and
increase research efficiency and, thus, contribute to animal welfare in the long term, we propose in
this study a framework for the automated identification of social contacts. In this framework, we
apply a convolutional neural network (CNN) to detect the location and orientation of pigs within a
video and track their movement trajectories over a period of time using a Kalman filter (KF) algorithm.
Based on the tracking information, we automatically identify social contacts in the form of head–head
and head–tail contacts. Moreover, by using the individual animal IDs, we construct a network of
social contacts as the final output. We evaluated the performance of our framework based on two
distinct test sets for pig detection and tracking. Consequently, we achieved a Sensitivity, Precision,
and F1-score of 94.2%, 95.4%, and 95.1%, respectively, and a
MOTA
score of 94.4%. The findings of
this study demonstrate the effectiveness of our keypoint-based tracking-by-detection strategy and
can be applied to enhance animal monitoring systems.
Keywords:
pig detection; pig tracking; convolutional neural network; Kalman filter; precision
livestock farming
1. Introduction
Today, it is well known that domestic pigs are highly social animals, maintaining
hierarchical structures and socially organized groups. In commercial farming systems,
the established social orders are frequently disrupted due to mixing groups as they are
transferred between different housing and production stages [
1
,
2
]. Mixing of unaquainted
animals leads to the establishment of a new social hierarchy going along with agonistic
interactions which may result in reduced animal welfare and health [3–5].
Sensors 2021, 21, 7512. https://doi.org/10.3390/s21227512 https://www.mdpi.com/journal/sensors