Deep Learning-Based Automated Approach for Determination of Pig Carcass Traits

Jiacheng Wei, Yan Wu, Xi Tang, Jinxiu Liu, Yani Huang, Zhenfang Wu, Xinyun Li, Zhiyan ZhangAnimals 2024 · DOI

TL;DR

This paper introduces a deep learning system using YOLOv8 to automate the measurement of key pig carcass traits (length and backfat thickness) from images. This approach significantly speeds up data acquisition and improves consistency compared to manual methods, paving the way for more efficient genetic selection and improved pig breeding programs.

What Problem Does This Paper Address?

Accurate and efficient measurement of pig carcass traits is vital for genetic selection in breeding and optimizing economic efficiency in pork production. Traditionally, these measurements are taken manually, which is time-consuming, labor-intensive, and prone to subjective errors. This limits the scale at which such data can be collected, hindering the identification of genetic factors influencing desirable traits. While advanced imaging techniques exist, they are often costly or not suitable for real-time slaughterhouse environments. The paper aims to bridge this gap by developing an automated, cost-effective system using computer vision for rapid and consistent carcass phenotyping.

Methods

The study leverages deep learning, specifically the YOLOv8 algorithm, for two primary tasks:

  • Carcass Length Determination: YOLOv8, a state-of-the-art object detection model, was employed to identify key anatomical landmarks on the pig carcass (pubic symphysis, first rib, first cervical vertebra, and an internal reference). By extracting the coordinates of these landmarks, the model can automatically calculate both the carcass straight length and the carcass oblique length.
  • Backfat Segmentation: A variant of YOLOv8, YOLOv8n-seg, was utilized for semantic segmentation of the backfat region on the carcass images. This model identifies and delineates the exact pixels corresponding to the backfat. The average backfat thickness is then derived by dividing the segmented backfat area by the previously determined carcass straight length.

The researchers trained and validated these models using a dataset of 3912 pig carcasses. They also implemented an image filtering step to address outliers caused by extreme camera angles or manual measurement inconsistencies, which improved the model's performance.

Datasets

The study utilized a dataset comprising images from 3912 pig carcasses.

  • For carcass length determination, images from 3912 pigs were used. A subset of 501 pigs was designated for the test set, with their corresponding manual measurements serving as the ground truth.
  • For backfat segmentation, images from 777 pigs were used. A subset of 159 pigs was selected for the test set, with manual five-point backfat thickness measurements (ribs, back, shoulder, loin, rump) as the ground truth.

The paper does not explicitly state the creation of a new benchmark dataset but rather uses a collected dataset for training and evaluation.

Key Insights and Ideas

  • YOLOv8's Versatility: The study highlights YOLOv8's effectiveness not only for object detection (carcass length landmarks) but also for segmentation (backfat region) through its seg variant, demonstrating its adaptability to different computer vision tasks.
  • Impact of Image Acquisition: The research underscores the critical role of consistent image acquisition. Initial results showed significant discrepancies, but a filtering process to remove images with extreme angles or potential manual measurement errors substantially improved the model's accuracy. This emphasizes the need for standardized camera positioning in real-world applications.
  • Automated Phenotyping for GWAS: The ability to rapidly and accurately collect large-scale phenotypic data is crucial for genome-wide association studies (GWAS). This automated approach can uncover micro-effect variant loci that might be missed in smaller-scale studies.
  • Efficiency Gains: The automated method drastically reduces measurement time from approximately 30 seconds per pig manually to just a few seconds for image acquisition and near-instantaneous model processing, making it highly scalable for slaughterhouse operations.

Key Results

  • Carcass Length:
    • The YOLOv8 model achieved high accuracy in determining carcass length, with coefficients of determination (R²) of 0.9164 for straight length and 0.9325 for oblique length after image filtering.
  • The differences between model and manual measurements for straight length were primarily within -2 cm to 4 cm, and for diagonal length, within -3 cm to 2 cm.
  • Backfat Thickness:
    • The YOLOv8n-seg model demonstrated robust backfat segmentation with a Mean IoU of 89.10%.
  • The coefficient of determination (R²) between the model-predicted average backfat thickness and manual measurements was 0.7137.
  • Model Performance: YOLOv8n achieved superior Mean Average Precision (mAP) compared to other tested object detection models like SSD and Faster R-CNN for carcass length landmark detection. YOLOv8n-seg also outperformed other segmentation models like U-Net and DeepLab for backfat segmentation.

Limitations and Future Work

  • Backfat Dataset Size: The authors acknowledge that the backfat segmentation dataset used has a limited sample size and lacks direct comparison with all five manual measurement points.
  • Image Acquisition Standardization: While filtering improved results, the paper emphasizes the need for careful consideration of camera positioning and engineering design in actual automated slaughter lines to minimize errors.
  • Future Work:
    • Enhance the backfat segmentation method on a larger scale with more refined data.
  • Integrate this system into actual slaughterhouses by installing low-cost high-definition cameras.
  • Utilize the collected phenotypic data for genome-wide association studies to identify trait genes and further validate the method.
  • Extend the approach to other phenotypic traits in pigs.

Summary updated

Abstract

Pig carcass traits are among the most economically significant characteristics and are crucial for genetic selection in breeding and enhancing the economic efficiency. Standardized and automated carcass phenotyping can greatly enhance the measurement efficiency and accuracy, thereby facilitating the selection and breeding of superior pig carcasses. In this study, we utilized phenotypic images and data from 3912 pigs to propose a deep learning-based approach for the automated determination of pig carcass phenotypic traits. Using the YOLOv8 algorithm, our carcass length determination model achieves an average accuracy of 99% on the test set. Additionally, our backfat segmentation model, YOLOV8n-seg, demonstrates robust segmentation performance, with a Mean IoU of 89.10. An analysis of the data distribution comparing manual and model-derived measurements revealed that differences in the carcass straight length are primarily concentrated between -2 cm and 4 cm, while differences in the carcass diagonal length are concentrated between -3 cm and 2 cm. To validate the method, we compared model measurements with manually obtained data, achieving coefficients of determination (R<sup>2</sup>) of 0.9164 for the carcass straight length, 0.9325 for the carcass diagonal length, and 0.7137 for the backfat thickness, indicating high reliability. Our findings provide valuable insights into automating carcass phenotype determination and grading in pig production.
BibTeX
@inproceedings{wei2024deep,
  author = {Jiacheng Wei and Yan Wu and Xi Tang and Jinxiu Liu and Yani Huang and Zhenfang Wu and Xinyun Li and Zhiyan Zhang},
  title = {{Deep Learning-Based Automated Approach for Determination of Pig Carcass Traits}},
  booktitle = {Animals},
  year = {2024},
  doi = {10.3390/ani14162421},
}
Figure