Ear biting in pigs - a welfare challenge

Citation Author(s):
Queen’s University Belfast, Northern Ireland, United Kingdom.
Agri-Food and Biosciences Institute, Belfast, Northern Ireland, United Kingdom.
Teagasc, Pig Development Department, Animal & Grassland Research and Innovation Centre, Moorepark, Fermoy Co., Cork.
Queen’s University Belfast, Northern Ireland, United Kingdom.
Submitted by:
Anicetus Odo
Last updated:
Thu, 12/01/2022 - 09:57
Data Format:
0 ratings - Please login to submit your rating.


Ear biting is a welfare challenge in commercial pig farming. Pigs sustain injuries at the site of bite paving the way for bacterial infections. Early detection and management of this behaviour is important to enhance animal health and welfare, increase productivity whilst minimising inputs from medication. Pig management using physical observation is not practical due to the scale of modern pig production systems. The same applies to the manual analysis of captured videos from pig houses. Therefore, a method of automated detection is desirable. We introduce an automatic  approach based on deep learning for the detection and quantification of ear biting episodes. The dataset described here is from an experimental farm where the farmer previously reported ear biting.


Download and unzip the dataset. Within the main directory are two folders namely images and labels. The directory structure is as shown below:

main folder

  • Images – folders containing images (.jpg files)
    • training
    • validation
  • Labels – folder containing labels (.txt files corresponding to each image)
    • training
    • validation

This data structure is compatible with Yolov7 without modification. To train a Yolov4, move the text files in the training labels folder into the training image folders and also move the text files in the validation labels folder into validation images folder. There are 5197 and 5608 images and bounding boxes, respectively, in the AFBI dataset. For each image file, there is an annotation text file. There are 4672 images and 5087 annotations for training. The validation folder contains 525 and 524 images and annotations, respectively.

Funding Agency: 
The European Union H2020 Research and Innovation Programme
Grant Number: