Estimation of Weight and Body Measurement Model for Pigs Based on Back Point Cloud Data

Yao Liu, Jie Zhou, Yifan Bian, Taishan Wang, Hongxiang Xue, Longshen Liu

TL;DR

This paper introduces a non-contact system for estimating pig weight and body dimensions using 3D point cloud data captured from their backs. By employing a deep learning model with multi-head attention and incorporating RGB information, the system achieves accurate predictions, offering a more efficient and less stressful alternative to traditional manual measurements.

What Problem Does This Paper Address?

Accurate monitoring of pig weight and body dimensions is crucial for assessing growth, optimizing feeding, and ensuring animal welfare in modern pig farming. However, current manual measurement methods are labor-intensive, time-consuming, and can induce stress in pigs, potentially leading to health issues and increased susceptibility to diseases. Furthermore, manual methods can be challenging in large-scale operations and pose risks for zoonotic disease transmission. This paper aims to overcome these limitations by developing an automated, non-contact system for precise pig measurement.

Methods

The core of this research lies in a multi-stage approach:

  • Data Acquisition: A depth camera (Intel RealSense D435i) was used to capture 3D point cloud data of pig backs as they passed over a weighing scale.
  • Point Cloud Preprocessing:
    • Voxel Filtering: This technique reduces the volume and noise in the point cloud data by dividing the space into cubic voxels and averaging points within each voxel. The study explored different voxel sizes, settling on an edgelength of 0.03 for optimal feature preservation.
  • K-Means Clustering: An unsupervised learning algorithm was used to segment the pig's back from the background, with K=3 identified as the optimal number of clusters for effective separation.
  • Head and Tail Removal: A novel method based on local density analysis and DBSCAN clustering was developed to automatically identify and remove the head and tail regions, which are more dynamic and can introduce errors.
  • Posture Correction: The pig's back point cloud was oriented horizontally using a minimum bounding rectangle to standardize posture for accurate body dimension extraction.
  • Body Dimension Extraction: The corrected pig back point cloud was sliced into three sections (shoulder, abdomen, hip) to measure corresponding widths.
  • Weight and Dimension Estimation Model: A Convolutional Neural Network (CNN) with a multi-head attention mechanism (MACNN) was developed. This model takes the processed 3D point cloud data (coordinates) as input. Crucially, the study explored the impact of incorporating RGB information from the depth camera as an additional feature to enhance prediction accuracy.

Datasets

The study utilized data collected from 258 Yorkshire-Landrace crossbred sows at a pig farm in China.

  • Training and Validation: 200 pigs were used, with 50 point cloud files per pig, split into training (80%) and validation (20%) sets, totaling 10,000 training/validation point cloud files.
  • Testing: A separate set of 58 pigs was used for testing, with 10 point cloud files per pig, resulting in 580 test point cloud files.

Key Insights and Ideas

  • The Power of 3D Data: Moving beyond 2D images, 3D point cloud data provides richer structural information, enabling more robust body measurements and weight estimations.
  • Intelligent Preprocessing is Key: Effective noise reduction, segmentation, and posture correction are critical steps before feeding data into the deep learning model. The novel head/tail removal method is a significant contribution here.
  • Multi-Head Attention for Spatial Relationships: The MACNN architecture, with its multi-head attention mechanism, is adept at capturing complex spatial relationships within the point cloud data, leading to improved feature representation.
  • RGB Information as a Performance Booster: While 3D coordinates are primary, incorporating RGB data as an auxiliary feature demonstrably improves the accuracy of both standard CNNs and the MACNN model, suggesting that surface texture and color provide valuable complementary information.
  • Practicality Matters: The focus on extracting dimensions like shoulder, abdominal, and hip width, alongside weight, provides more comprehensive insights into the animal's condition, directly applicable to farming practices.

Key Results

  • Weight Estimation Accuracy: The MACNN model incorporating RGB information achieved an average absolute error of 11.552 kg, an average relative error of 4.812%, and an RMSE of 11.181 kg on the test set.
  • Impact of RGB: Adding RGB information to the MACNN model reduced RMSE by 2.469 kg, MAPE by 0.8%, and MAE by 1.032 kg compared to using only 3D coordinates.
  • Body Measurement Accuracy: Average relative errors for shoulder width, abdominal width, and hip width were 3.144%, 3.798%, and 3.820%, respectively.
  • Timeliness: The system demonstrated high timeliness, with an average prediction time of 0.151 seconds per pig, making it suitable for real-time applications in pig driving aisles.

Limitations and Future Work

  • Automation Level: While automated, the system still requires some degree of manual intervention, particularly in data preprocessing.
  • Object Shape Limitations: The model may struggle with highly curved or angular objects, potentially leading to significant errors.
  • Reconstruction Challenges: Reconstructing accurate point clouds for pig legs and heads remains challenging, and while these parts contribute less to overall weight, they can still impact accuracy.
  • Future Directions: The authors plan to acquire more diverse point cloud data to further improve accuracy. Future work will focus on effectively utilizing data from legs and heads to enhance the model's performance. They also aim to explore more robust methods for handling objects with complex shapes and curvatures.

Summary updated

Abstract

Pig farming is a crucial sector in global animal husbandry. The weight and body dimension data of pigs reflect their growth and development status, serving as vital metrics for assessing their progress. Presently, pig weight and body dimensions are predominantly measured manually, which poses challenges such as difficulties in herding, stress responses in pigs, and the control of zoonotic diseases. To address these issues, this study proposes a non-contact weight estimation and body measurement model based on point cloud data from pig backs. A depth camera was installed above a weighbridge to acquire 3D point cloud data from 258 Yorkshire-Landrace crossbred sows. We selected 200 Yorkshire-Landrace sows as the research subjects and applied point cloud filtering and denoising techniques to their three-dimensional point cloud data. Subsequently, a K-means clustering segmentation algorithm was employed to extract the point cloud corresponding to the pigs' backs. A convolutional neural network with a multi-head attention was established for pig weight prediction and added RGB information as an additional feature. During the data processing process, we also measured the back body size information of the pigs. During the model evaluation, 58 Yorkshire-Landrace sows were specifically selected for experimental assessment. Compared to manual measurements, the weight estimation exhibited an average absolute error of 11.552 kg, average relative error of 4.812%, and root mean square error of 11.181 kg. Specifically, for the MACNN, incorporating RGB information as an additional feature resulted in a decrease of 2.469 kg in the RMSE, a decrease of 0.8% in the MAPE, and a decrease of 1.032 kg in the MAE. Measurements of shoulder width, abdominal width, and hip width yielded corresponding average relative errors of 3.144%, 3.798%, and 3.820%. In conclusion, a convolutional neural network with a multi-head attention was established for pig weight prediction, and incorporating RGB information as an additional feature method demonstrated accuracy and reliability for weight estimation and body dimension measurement.
BibTeX
@inproceedings{liu2024estimation,
  author = {Yao Liu and Jie Zhou and Yifan Bian and Taishan Wang and Hongxiang Xue and Longshen Liu},
  title = {{Estimation of Weight and Body Measurement Model for Pigs Based on Back Point Cloud Data}},
  booktitle = {Animals},
  year = {2024},
  doi = {10.3390/ani14071046},
}
Figure