Register      Login
Animal Production Science Animal Production Science Society
Food, fibre and pharmaceuticals from animals
RESEARCH ARTICLE

Deep learning method for rapidly estimating pig body size

Yue Wang A , Gang Sun A , Xiaoyue Seng A , Haibo Zheng A , Hang Zhang https://orcid.org/0000-0002-1108-5236 A * and Tonghai Liu https://orcid.org/0000-0002-7390-7098 A *
+ Author Affiliations
- Author Affiliations

A College of Computer and Information Engineering, Tianjin Agricultural University, Tianjin 300392, China.


Handling Editor: Cormac O’Shea

Animal Production Science 63(9) 909-923 https://doi.org/10.1071/AN22210
Submitted: 5 June 2022  Accepted: 16 February 2023   Published: 27 March 2023

© 2023 The Author(s) (or their employer(s)). Published by CSIRO Publishing

Abstract

Context: During pig breeding, a change in a pig’s body size is an important indicator that reflects its health. However, it is difficult to extract the necessary features from images to estimate pig body size without contact.

Aims: It is crucial to develop a fast and accurate body size estimation algorithm to meet the practical needs of farms, i.e., numerous body size detections.

Methods: This report presents a rapid pig body size estimation technique based on deep learning. The YOLOv5 model is enhanced by integrating MobilenetV3, and a lightweight object detection network is introduced as the feature extraction network. An attention mechanism is also added to this system. Following these improvements, the proposed YOLOv5_Mobilenet_SE model is more suitable for the small-target detection of key parts of live pigs. A depth camera was used at a fixed height to capture the pig’s back information, which enables calculations of the critical height, i.e., the body height, of live pigs. Other key measuring points on the pig are generated according to the detection frame of the key parts located by the model. A gradient boosting regression algorithm is used to establish the body size prediction model based on the Euclidean distance between the key measuring points and the actual body size data.

Key results: The upgraded YOLOv5_Mobilenet_SE model achieves a mean average precision of 3.9%, which is higher than that obtained using the original YOLOv5 model. The model size is reduced from 91.2 to 10.2 M, and the average detection time for each image is 4.4 ms. The mean absolute percent errors in terms of body size, body width, and body height are 2.02%, 1.95%, and 1.84%, respectively, relative to manual measurements.

Conclusions: This method greatly reduces the model size and detection time while ensuring accuracy, and therefore, this method can cut costs for farms performing pig body size measurements.

Implications: The results of this study can provide technical support for automated and digital monitoring in the pig breeding industry.

Keywords: agricultural system, animal welfare, body measurement, deep learning, gradient boosting regression, machine vision, pig, pig breeding.


References

Chen Y, Lin Z, Xing Z, Gang W, Gu Y (2017) Deep learning-based classification of hyperspectral data. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing 7, 2094–2107.
Deep learning-based classification of hyperspectral data.Crossref | GoogleScholarGoogle Scholar |

Chen F, Liang X, Chen L, Liu B, Lan Y (2020) Novel method for real-time detection and tracking of pig body and its different parts. International Journal of Agricultural and Biological Engineering 13, 144–149.
Novel method for real-time detection and tracking of pig body and its different parts.Crossref | GoogleScholarGoogle Scholar |

Chollet F (2017) Xception: deep learning with depthwise separable convolutions. In ‘Proceedings of the 2017 IEEE conference on computer vision and pattern recognition’. (Honolulu, HI, USA)

Gao Y, Guo JL, Li X, Lei MG, Lu J, Tong Y (2019) Instance-Level segmentation method for group pig images based on deep learning. Transactions of the Chinese Society of Agricultural Machinery 50, 179–187.
Instance-Level segmentation method for group pig images based on deep learning.Crossref | GoogleScholarGoogle Scholar |

Guo H, Li Z, Ma Q, Zhu D, Su W, Wang K, Msarinello F (2019) A bilateral symmetry based pose normalization framework applied to livestock body measurement in point clouds. Computers and Electronics in Agriculture 160, 59–70.
A bilateral symmetry based pose normalization framework applied to livestock body measurement in point clouds.Crossref | GoogleScholarGoogle Scholar |

Howard A, Sandler M, Chu G, Chen L-C, Chen B, Tan M, Wang W, Zhu Y, Pang R, Vasudevan V, Quoc V (2019) Searching for mobilenetv3. In ‘Proceedings of the 2019 IEEE/CVF conference on computer vision and pattern recognition’. pp. 1314–1324. (Long Beach, UT, USA)

Hu J, Shen L, Sun G (2018) Squeeze-and-excitation networks. In ‘Proceedings of the 2018 IEEE/CVF conference on computer vision and pattern recognition’. pp. 7132–7141. (Salt Lake City, UT, USA).

Huang L, Li S, Zhu A, Fan X, Zhang C, Wang H (2018) Non-contact body measurement for qinchuan cattle with LiDAR sensor. Sensors 18, 3014
Non-contact body measurement for qinchuan cattle with LiDAR sensor.Crossref | GoogleScholarGoogle Scholar |

Jia N, Kootstra G, Koerkamp P G, Shi Z, Du S (2021) Segmentation of body parts of cows in RGB-depth images based on template matching. Computers and Electronics in Agriculture 180, 105897
Segmentation of body parts of cows in RGB-depth images based on template matching.Crossref | GoogleScholarGoogle Scholar |

Jiang J, Zhou LN, Li G (2014) Measurement of sheep body size based on machine vision. Journal of Computer Applications 34, 846–850.

Jonguk L, Jin L, Daihee P, Yongwha C (2016) Automatic recognition of aggressive behavior in pigs using a kinect depth sensor. Sensors 16, 631
Automatic recognition of aggressive behavior in pigs using a kinect depth sensor.Crossref | GoogleScholarGoogle Scholar |

Kim J, Chung Y, Choi Y, Sa J, Kim H, Chung Y, Park D, Kim H (2017) Depth-based detection of standing-pigs in moving noise environments. Sensors 17, 2757
Depth-based detection of standing-pigs in moving noise environments.Crossref | GoogleScholarGoogle Scholar |

Le Cozler Y, Allain C, Xavier C, Depuille L, Caillot A, Delouard JM, Delattre L, Luginbuhl T, Faverdin P (2019) Volume and surface area of Holstein dairy cows calculated from complete 3D shapes acquired using a high-precision scanning system: interest for body weight estimation. Computers and Electronics in Agriculture 165, 104977
Volume and surface area of Holstein dairy cows calculated from complete 3D shapes acquired using a high-precision scanning system: interest for body weight estimation.Crossref | GoogleScholarGoogle Scholar |

Li D, Li Z (2020) System analysis and development prospect of unmanned farming. Transactions of the Chinese Society of Agricultural Machinery 51, 1–12.

Li K, Teng G (2022) Study on body size measurement method of goat and cattle under different background based on deep learning. Electronics 11, 993
Study on body size measurement method of goat and cattle under different background based on deep learning.Crossref | GoogleScholarGoogle Scholar |

Li Z, Du XD, Mao TT, Teng GH (2016) Depth image-based pig body scale detection system. Transactions of the Chinese Society of Agricultural Machinery 47, 311–318.

Lin TY, Maire M, Belongie S, Bourdev L, Girshick R, Hays J, Perona P, Ramanan D, Zitnick CL, Dollár P (2014) Microsoft COCO: common objects in context. In ‘Proceedings of the European conference on computer vision’. pp. 740–755. (Zurich, Switzerland)

Liu TH, Teng GH, Zhang SN, Li Z, Guo P (2014) Reconstruction and application of 3D pig body model based on point cloud data. Transactions of the Chinese Society of Agricultural Machinery 45, 291–295.
Reconstruction and application of 3D pig body model based on point cloud data.Crossref | GoogleScholarGoogle Scholar |

Liu W, Anguelov D, Erhan D, Szegedy C, Reed S, Fu CY, Berg AC (2016) SSD: single shot multibox detector. In ‘Proceedings of the conference on European conference on computer vision’. pp. 21–37. (Amsterdam IAPTC: Amsterdam)

Matthews SG, Miller AL, Clapp J, Plötz T, Kyriazakis I (2016) Early detection of health and welfare compromises through automated detection of behavioural changes in pigs. The Veterinary Journal 217, 43–51.
Early detection of health and welfare compromises through automated detection of behavioural changes in pigs.Crossref | GoogleScholarGoogle Scholar |

Moran J, Haibo L, Zhongbo W, Miao H, Zheng C, Bin H (2019) Improved YOLO V3 algorithm and its application in small target detection. Acta Optica Sinica 39, 0715004
Improved YOLO V3 algorithm and its application in small target detection.Crossref | GoogleScholarGoogle Scholar |

Shi C, Zhang J, Teng G (2019) Mobile measuring system based on LabVIEW for pig body components estimation in a large-scale farm. Computers and Electronics in Agriculture 156, 399–405.
Mobile measuring system based on LabVIEW for pig body components estimation in a large-scale farm.Crossref | GoogleScholarGoogle Scholar |

Shuai S, Ling Y, Shi L, Xuhong T, Caixing L, Aidong S, Hanxing L (2020) Research on 3D surface reconstruction and body size measurement of pigs based on multi-view RGB-D cameras. Computers and Electronics in Agriculture 175, 105543
Research on 3D surface reconstruction and body size measurement of pigs based on multi-view RGB-D cameras.Crossref | GoogleScholarGoogle Scholar |

Si YS, An LL, Liu G, Li B (2019) Ideal posture detection and body size measurement of pig body based on Kinect camera. Transactions of the Chinese Society of Agricultural Machinery 50, 58–65.

Tu S, Yuan W, Liang Y, Wang F, Wan H (2021) Automatic detection and segmentation for group-housed pigs based on PigMS R-CNN. Sensors 21, 3251
Automatic detection and segmentation for group-housed pigs based on PigMS R-CNN.Crossref | GoogleScholarGoogle Scholar |

Wang CY, Liao HYM, Wu YH, Chen PY, Hsieh JW, Yeh IH (2020) CSPNet: a new backbone that can enhance learning capability of CNN. In ‘Proceedings of the 2020 IEEE/CVF conference on computer vision and pattern recognition’. pp. 390–391. (IEEE Computer Society, Seattle, WA, USA)

Xue YJ, Zhu XM, Zheng C, Mao L, Yang AQ, Tu SQ, Huang N, Yang XF, Chen PF, Zhang NF (2018) Recognition of lactating sow pose from deep video images based on improved Faster R-CNN. Transactions of the Chinese Society of Agricultural Engineering 34, 189–196.

Xue YJ, Yang XF, Zheng C, Chen CX, Gan HM, Li SM (2019) High-risk action recognition of lactating sows in deep video based on hidden Markov model. Transactions of the Chinese Society of Agricultural Engineering 35, 184–190.

Yang AQ, Xue YJ, Huang HS, Tong XX, Zhu XM, Yang XF, Mao L, Zheng C (2017) Image segmentation of lactating sows based on fully convolutional networks. Transactions of the Chinese Society of Agricultural Engineering 33, 219–225.

Zhang ALN, Wu BP, Jiang CXH, Xuan DCZ, Ma EYH, Zhang FYA (2018) Development and validation of a visual image analysis for monitoring the body size of sheep. Journal of Applied Animal Research 46, 1004–1015.
Development and validation of a visual image analysis for monitoring the body size of sheep.Crossref | GoogleScholarGoogle Scholar |

Zhang J, Zhuang Y, Ji H, Teng G (2021a) Pig weight and body size estimation using a multiple output regression convolutional neural network: a fast and fully automatic method. Sensors 21, 3218
Pig weight and body size estimation using a multiple output regression convolutional neural network: a fast and fully automatic method.Crossref | GoogleScholarGoogle Scholar |

Zhang Z, Wang H, Liu T, Wang Y, Zhang H, Yuan F, Yang X, Xu S, Meng Y (2021b) Accurate detection method of pig’s temperature based on non-point source thermal infrared image. CAAI Transactions on Intelligence Technology 6, 312–323.
Accurate detection method of pig’s temperature based on non-point source thermal infrared image.Crossref | GoogleScholarGoogle Scholar |

Zhang JL, Zhou K, Zhuang YR, Teng GH (2021c) Influence of facial changes on the accuracy of recognition models during the growth of fattening pigs. Journal of South China Agricultural University 26, 180–186.

Zhao KX, He DJ (2015) Dairy cow individual identification method based on convolutional neural network. Transactions of the Chinese Society of Agricultural Engineering 31, 181–187.

Zhu ZY, Li MX, Zhang XB (2019) Analysis of the impact of African swine fever on China’s pig market and industrial development. Transactions of the Chinese Society of Agricultural Engineering 35, 205–210.