Lightweight deep learning enhances sow farrowing supervision

26-06-2023 | |
Lightweight deep learning
35 sows in the perinatal period and their piglets were selected for this trial. Foto: Bert Jansen

Researchers from China evaluated a lightweight deep learning-based approach for supervision of sow behaviour preceding and during farrowing.

Sow farrowing requires supervision to accurately detect issues such as dystocia, piglet suffocation, and excessively low temperatures. Early detection of farrowing problems and proper interventions increase the average number of live born piglets per sow per year. They also the improve piglets’ health and performance. Manual inspection is time-consuming, labour-intensive, and highly subjective. Therefore, there is an increasing need for automatic supervision. Computer-vision technology based on lightweight deep learning is a persistent, non-invasive method that allows rapid processing of sow farrowing video data.

Data collection

The team selected 35 sows in the perinatal period and their piglets for this trial. They installed cameras in the farrowing rooms above the farrowing crates and recorded the pigs for 24 hours. The researchers used the YOLOv5s-6.0 network structure to build a model to detect 4 sow postures including lateral lying, sternal lying, standing, and sitting and the newborn piglets.

The algorithm was deployed on the embedded artificial-intelligence computing platform of the Jetson Nano series. The team used indices such as the precision, recall rate, and detection speed to assess the performance of different algorithms. In addition, they assessed the generalisation ability and the anti-interference ability of the model in 4scenarios: complex light, the time of the first piglet’s birth, different colours of heat lamps, and turning on heat lamp at night.

Detection performance of algorithms

Deep learning is a subset of machine learning. It is a neural network with 3 or more layers attempting to simulate the behaviour of the human brain and allowing it 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 enhancement lowered the loss function of the model, and increased the precision rate and the recall rate. It thus improved the algorithm’s ability to detect sow postures and the newborn piglets.

Missed and false detection of the model

The change of light influenced the missed and false detection of sow posture. The heat lamp made it difficult for the model to detect piglets, and the time of the first piglet’s birth and different colours of heat lamps.

Model deployment

The model was successfully deployed with a precision of 93.5%, and a recall rate of 92.2% on the embedded development board. It accurately detected sow postures and newborn piglets. Although the model exhibited a minor loss of precision after optimisation, its detection speed was increased by a factor larger than 8. Therefore, this model can be applied to different production scenarios.

Sow farrowing behaviour pattern

Sows exhibited normal activities from 48 to 24 hours before farrowing. From 24 hours to 1 hour before farrowing the posture transition frequency increased and then decreased. 1 to 24 hours after farrowing, the posture transition frequency approached 0 and then increased slightly.

Early-warning strategies

The early warning was sent when the sows’ posture transition frequency exceeded the upper threshold of 17.5 times per hour and when it fell below the lower threshold of 10 times per hour. The early warnings could be sent 5 hours prior to the onset of farrowing, with an average error of 1.02 hour between the early-warning time and the actual farrowing time. The detection time of each image using the model on the embedded development board was 67.2-80.3 milliseconds. However, when the detection speed was excessively high, piglets tended to be falsely detected, and the alarms were generated earlier than necessary.

The authors concluded that deep learning is a low-cost approach with low latency, high efficiency, and easy implementation that accelerates the transition to intelligent pig breeding.

Samaneh Azarpajouh Author, veterinarian
More about