Sow farrowing requires monitoring to accurately detect problems such as dystocia, piglet suffocation, and excessive cold temperatures. Early detection of calving problems and appropriate intervention increases the average number of live piglets per year per sow. It also improves piglet health and performance. Manual inspection is time consuming, labor intensive and highly subjective. Therefore, the need for automated monitoring is increasing. A lightweight deep learning-based computer vision technology is a persistent, non-invasive method that enables rapid processing of sow farrowing video data.
Data collection
The research team selected 35 perinatal sows and their piglets for this study. They set up a camera in the farrowing room above the farrowing crates and recorded the pigs 24 hours a day. The researchers used the YOLOv5s-6.0 network structure to build a model to detect her four sow postures, including lateral, chest, standing and sitting, and newborn piglets .
This algorithm was introduced in the Jetson Nano series of embedded artificial intelligence computing platforms. The team evaluated the performance of various algorithms using metrics such as accuracy, recall, and speed of detection. In addition, he evaluated the generalization and anti-interference abilities of the model in his four scenarios: complex light, time of first piglet birth, heat lamps with different colors, and heat lamp lighting at night.
Algorithm detection performance
Deep learning is a subset of machine learning. It is a neural network with three or more layers that simulates the behavior of the human brain and allows the brain to “learn” from large amounts of data. The difference between the true value and the value predicted by the model is defined as the loss function of the model. In this trial, model training and data enrichment lowered the model loss function and improved precision and recall. This improved the algorithm’s ability to detect sow posture and newborn piglets.
Model misses and false positives
Changes in light affected sow posture misses and false detections. The heat lamp made the model difficult to detect the piglets, the birth time of the first piglet, and the different colors of the heat lamp.
Model deployment
This model was successfully deployed on an embedded development board with 93.5% accuracy and 92.2% recall. Accurate detection of sow postures and newborn piglets. After optimization, the accuracy of the model decreased slightly, but the detection speed improved by more than 8 times. Therefore, this model can be applied to various production scenarios.
Parturition behavior patterns of sows
Sows showed normal activity from 48 hours to 24 hours before parturition. From 24 hours before her delivery to 1 hour before her delivery, postural transition frequency increased and then decreased. From 1 to 24 hours postpartum, postural transition frequency approached 0 and increased slightly thereafter.
early warning strategy
An early warning was sent when the sow’s postural transition frequency exceeded the upper threshold of 17.5 per hour and fell below the lower threshold of 10 per hour. An early warning could be sent 5 hours before her delivery started, with a mean error of 1.02 hours between the early warning time and the actual time of delivery. Detection times for each image using the model on the embedded development board ranged from 67.2 to 80.3 ms. However, if the detection speed is too fast, piglets are more likely to be falsely detected, causing more alarms than necessary.
The authors conclude that deep learning is a low-latency, high-efficiency, easy-to-implement, low-cost approach that facilitates the transition to intelligent pig breeding.
