(3.1 GB)
Download file

Automated detection and quantification of contact behaviour in pigs using deep learning

Download (3.1 GB)
posted on 19.10.2022, 07:11 authored by Ali AlameerAli Alameer
  • Detection of Pig Parts (csv, coco, tfrecord and voc formats)

The annotated dataset is provided with different formats for easy deployment: this include, coco, tfrecord, csv and voc. Furthermore, an augmented version of the dataset is provided with many more annotated images. The augmented dataset (recommended) is also provided with annotations using the above formats. 

The collected image dataset was annotated by two trained individuals with an animal behaviour background. It encompassed a variety of scenarios, for example, pigs in close contact with one another and under various lighting conditions. We configured a set of pre-processing stages to augment the dataset, applying arbitrary scaling and horizontal flipping. We also manipulated the colour of the pixels and randomly altered the brightness and contrast using the hue, saturation, value (HSV) colour space. The detection dataset comprised a total of 51193 instances (26533 AFBI + 24660 AUF) across 2781 images (1556 AFBI + 1225 AUF); each pig within an image was manually annotated into two parts: head and rear. A bounding box1 was applied manually on the head and rear of all pigs in a pen. The bounding box denotes the location and size of each pig part.

  • Contact Between Pigs (csv format)

An additional dataset was annotated to validate the interaction method, i.e., the processing stage that feeds from the detection method. This dataset consisted of images from both farms used in this framework.

The total number of images of this dataset was 670 images; with sets of 376 and 294 images to represent AFBI and AUF datasets, respectively. A similar procedure was followed for selecting the image samples to diversify the dataset. This new dataset was annotated by an animal behaviour scientist who scanned all images to score interactions using a predefined ethogram. Any contact between one pig head and another pig rear was scored in a csv file. The entirety of the dataset comprised four classes (per image) as the following: no contact, 1 contact; 2 contacts; 3 or more contacts. Very few images (of the AUF dataset) included more than three contacts; therefore, these were combined in one class to achieve a more balanced class distribution.

  • Code
  1. Code for the detection method, i.e., detecting heads and rears of individual pigs. 
  2. Code for the interaction method, using the above detector to index interactions between head and rear of pigs. 


Please see paper acknowledgement section