Automated Monitoring of Ear Biting in Pigs by Tracking Individuals and Events

Anicetus Odo, Niall McLaughlin, Ilias KyriazakisWACV 2024

TL;DR

This paper introduces an automated system for monitoring ear-biting in pigs, a significant welfare issue in intensive farming. By leveraging computer vision to detect and track individual pigs and ear-biting events, the system provides real-time alerts for targeted interventions, improving animal welfare without the need for physical tags.

What Problem Does This Paper Address?

Intensive pig farming, while efficient, can lead to stress and aggression among animals, manifesting as vices like tail and ear-biting. Ear-biting, in particular, causes painful injuries and infections, impacting animal welfare and potentially leading to economic losses. Manually monitoring large herds for these subtle but harmful behaviors is incredibly challenging, time-consuming, and prone to human error. Existing automated systems often monitor these behaviors at a group level, making it difficult to identify individual "offenders" or affected animals for precise intervention. The paper aims to bridge this gap by enabling the identification of individual pigs involved in ear-biting incidents.

Methods

The core of the proposed system is a multi-stage approach combining object detection and multi-object tracking.

  • Oriented Bounding Boxes for Pig Detection: Traditional object detectors use axis-aligned bounding boxes, which can include a lot of background, especially when pigs are viewed from above and are not aligned with the camera. This paper proposes using oriented bounding boxes that better fit the pig's actual shape and orientation. To create a dataset for training these detectors, they leverage the Segment Anything Model (SAM) to generate segmentation masks from existing axis-aligned annotations, which are then processed to derive oriented bounding boxes. This significantly reduces manual labeling effort.
  • Multi-Object Tracking (MOT): A two-stage tracking system is employed. The first stage links detections within short time windows into "tracklets," while the second stage links these tracklets to form longer, more confident tracks. This approach allows for the use of both past and future information to improve tracking accuracy, though it introduces a small latency. The tracker is designed to handle the challenges of pig identification, such as random movement and close proximity.
  • Ear-Biting Detection and Association: An initial ear-biting detector identifies potential close-contact events between pig snouts and ears. This raw output, prone to false positives, is then filtered and tracked using a modified version of the pig tracker. Crucially, the system associates these ear-biting event tracks with the identified pig tracks. This pig-to-event association is achieved by calculating the intersection over union (IoU) between pig and event tracks and solving a linear assignment problem (LAP) to identify the pigs involved.

Datasets

  • Training Data for Pig and Ear-Biting Detectors: A dataset of 6,466 training images and 803 validation images, annotated with axis-aligned bounding boxes for individual pigs and ear-biting events.
  • Pig Detection Dataset: A combined dataset of 4,672 images from existing sources, augmented with an additional 1,794 images from another experiment, manually annotated with pig bounding boxes.
  • Tracking and Ear Biting Dataset: Three videos recorded from overhead cameras on real farms, totaling 1,045, 1,830, and 1,000 frames. These were manually annotated with pig locations, track numbers, and ear-biting event instances.

Key Insights and Ideas

  • Oriented Bounding Boxes are Key for Tracking: The paper strongly suggests that using oriented bounding boxes for pig detection significantly improves tracking performance by reducing background noise and better representing the target's orientation. This is particularly relevant for overhead camera views common in pig farming.
  • SAM for Efficient Data Labeling: Leveraging the Segment Anything Model (SAM) for automated segmentation and subsequent oriented bounding box generation is a clever way to overcome the laborious task of manual annotation, making the development of specialized datasets more feasible.
  • Two-Stage Tracking for Robustness: The two-stage tracking approach, linking detections into tracklets first and then tracklets into longer tracks, provides a robust mechanism for maintaining identity over time, crucial for identifying consistent offenders or victims.
  • Ear-Biting Event Tracking and Association: Tracking ear-biting events themselves, rather than just relying on static detections, helps filter out false positives and provides a temporal context for these incidents. The subsequent association with individual pigs is the critical step for actionable insights.

Key Results

  • Pig Detection: Oriented bounding box detection achieved higher precision and recall (e.g., [email protected]:.95 of 0.438, 0.733, 0.466 for the three videos) compared to axis-aligned boxes (0.715, 0.719, 0.696), with a slight trade-off in [email protected]. The oriented boxes captured significantly less background.
  • Multi-Object Tracking: The proposed tracker, especially with oriented bounding boxes, demonstrated superior performance over DeepSORT in terms of ID switches (7 vs. 52) and false positives (127 vs. 400), leading to a better IDF1 score (89.35% vs. 81.70%) and MOTA (92.81% vs. 87.80%). The system runs faster than real-time (183 fps with oriented boxes).
  • Ear-Biting Detection: The complete system achieved significantly better performance than an existing method [17], with substantially fewer false positives (74 vs. 605) and false negatives (219 vs. 524), and higher precision (83.80% vs. 60.70%).

Limitations and Future Work

  • Latency: The two-stage tracking approach introduces a small latency (around 1 second), which is deemed acceptable for this application but might be a limitation in scenarios requiring instantaneous alerts.
  • Appearance Information: The current tracker does not use appearance information for association, relying on spatial overlap. The authors suggest exploring more advanced appearance models for future work, especially for re-identification after longer periods of occlusion.
  • Generalization: While the system was evaluated on real farm data, further testing across a wider variety of farm settings, lighting conditions, and pig breeds would be beneficial.
  • Intervention Strategies: The paper focuses on detection and association. Future work could explore how to best integrate these insights into automated intervention strategies or decision support systems for farmers.

Summary updated

BibTeX
@inproceedings{odo2024automated,
  author = {Anicetus Odo and Niall McLaughlin and Ilias Kyriazakis},
  title = {{Automated Monitoring of Ear Biting in Pigs by Tracking Individuals and Events}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
}
Figure