Livestock management and preventive care with AI and video analytics

Ioanna Psylla
3 min readJul 24, 2022

Health compromises is a challenge to the sustainability of livestock systems and indicators of changes in a pig’s behavior help in the early detection of a disease which allows timely and effective intervention and mitigates unnecessary losses. Traditional agriculture methods rely on manual inspection by a human which is time consuming and error-prone. Discovering illness is done manually today and when the farmer suspects illness.

Each day a disease is stayed unnoticed, a week of recovery is added. Late treatment and interventions lead to annual losses of 680 million DKK on pig deaths and 2 trillion DKK on food waste in the Danish slaughtering market.

Pig counting and tracking is essential for monitoring individual pig’s health and managing them properly. An automated solution for pig monitoring can ease the burden on caregivers, enhance individual pig care and increase production performance.

In collaboration with the Technical University of Denmark, we developed an Intelligent Video Analytics Solution that connects to cameras and can localize and track individual pigs at any time. From this data meaningful behavioral metrics can be extracted and visualised, such as time spent at the feeding trough, movement speed, idle time etc.

We trained a deep learning model on annotated images of pigs from a pigpen in Scotland, UK to detect and track pigs on video footage. Here is a sample of detections on unseen data:

The trained model is deployed on a NVIDIA Jetson device for real-time inference. This device connects to the CCTV cameras in the farm and sends the model detection metadata such as timestamps, bounding boxes, pig IDs to Azure Cloud for storage, analysis and visualisations. Compressed videos of pigs classified as sick are also sent to the cloud for inspection and enablement of model retraining.

End-users have access to a web dashboard with a historical overview of their pigs’ behavior, notifications for unhealthy pigs and livestreaming of their farm. Areas of interest in the farm can be configured for increased precision and enhanced insights.

By using cameras installed at the production site, our intelligent system detects abnormal behavior — indicating illness or harmful behavior. The farmer at the production site is notified on time and can inspect the pig of concern, preventing further spread or damages. Our intelligent solution for preventive care in pig farms has been estimated to save 221K DKK on food cost (the largest cost in the industry) annually.