Farrowing remains one of the highest risk stages in the sow’s production cycle, yet staff cannot always be in the room when labour starts or when a sow runs into trouble. With larger herds, tight labour and pressure to improve welfare and piglet survival, there is growing interest in tools that can quietly watch the farrowing area and flag problems before they become losses. Researchers at Prairie Swine Centre are developing a barn friendly artificial intelligence (AI) system designed to do exactly that – using existing surveillance cameras to monitor sow behaviour, detect the onset of farrowing and help identify sows in distress in real time.
Using AI to watch the farrowing room
The project uses images and video from cameras already installed in a group housed sow system, turning routine barn footage into a powerful dataset for training AI models. More than 1,000 annotated and labelled images were collected and used to train several variants of the YOLOv5 object detection model, a leading AI technology for recognizing behaviours in video.
For this first phase, the team focused on three key behaviour classes – standing/walking, lying and sitting – as indicators of sow activity and posture. These basic behaviours will form the foundation for detecting abnormal patterns that can signal farrowing onset, stalled labour, or distress.
How the system works
Each YOLOv5 model variant was evaluated using mean average precision (mAP), a standard measure of how accurately the system detects the behaviours it has been trained to recognize, as well as by the number of parameters (and thus computing power) required. Among the tested versions, the YOLOv5S model stood out, achieving a mAP of 83 percent while remaining more efficient than the larger YOLOv5 variants.
This balance of accuracy and efficiency matters on farm: a lighter, more efficient model is easier to run on modest hardware and makes continuous, 24/7 monitoring more realistic for commercial barns without high end IT infrastructure.
Refining behaviour detection
One limitation identified in the study was weaker performance in detecting sitting behaviour compared with standing/walking and lying. The researchers traced this to a large imbalance in the training images – there were simply far fewer sitting examples available, making it harder for the AI to learn that posture accurately. To correct this, the team is now expanding the dataset with more equal representation of standing/walking, sitting and lying behaviours, and adjusting hyperparameter combinations to determine the best weights for the final object detection model. These refinements will make the system more reliable in tracking posture changes, a key requirement for spotting sows whose behaviour deviates from normal.
Value to producers
Previous studies have shown that Al-based technology through machine vision has great potential to address current challenges in swine production (e.g., labour shortages, production inefficiencies). However further research is needed before they can be implemented in swine barns. Development of reliable Al detection technologies will not only increase profits but will also improve animal health and welfare. The generated data stream can also help guide new facility designs and genetic improvement. •
— By Ken Engele
Prairie Swine Centre



