Table of Contents
Fetching ...

Predicting Dairy Calf Body Weight from Depth Images Using Deep Learning (YOLOv8) and Threshold Segmentation with Cross-Validation and Longitudinal Analysis

Mingsi Liao, Gota Morota, Ye Bi, Rebecca R. Cockrum

TL;DR

It is suggested that body measurements taken at a young age can help predict future weight, which can assist farmers in making better decisions about feeding and managing calves, and can make weight monitoring more efficient and improve animal welfare by reducing handling stress.

Abstract

Monitoring calf body weight (BW) before weaning is essential for assessing growth, feed efficiency, health, and weaning readiness. However, labor, time, and facility constraints limit BW collection. Additionally, Holstein calf coat patterns complicate image-based BW estimation, and few studies have explored non-contact measurements taken at early time points for predicting later BW. The objectives of this study were to (1) develop deep learning-based segmentation models for extracting calf body metrics, (2) compare deep learning segmentation with threshold-based methods, and (3) evaluate BW prediction using single-time-point cross-validation with linear regression (LR) and extreme gradient boosting (XGBoost) and multiple-time-point cross-validation with LR, XGBoost, and a linear mixed model (LMM). Depth images from Holstein (n = 63) and Jersey (n = 5) pre-weaning calves were collected, with 20 Holstein calves being weighed manually. Results showed that You Only Look Once version 8 (YOLOv8) deep learning segmentation (intersection over union = 0.98) outperformed threshold-based methods (0.89). In single-time-point cross-validation, XGBoost achieved the best BW prediction (R^2 = 0.91, mean absolute percentage error (MAPE) = 4.37%), while LMM provided the most accurate longitudinal BW prediction (R^2 = 0.99, MAPE = 2.39%). These findings highlight the potential of deep learning for automated BW prediction, enhancing farm management.

Predicting Dairy Calf Body Weight from Depth Images Using Deep Learning (YOLOv8) and Threshold Segmentation with Cross-Validation and Longitudinal Analysis

TL;DR

It is suggested that body measurements taken at a young age can help predict future weight, which can assist farmers in making better decisions about feeding and managing calves, and can make weight monitoring more efficient and improve animal welfare by reducing handling stress.

Abstract

Monitoring calf body weight (BW) before weaning is essential for assessing growth, feed efficiency, health, and weaning readiness. However, labor, time, and facility constraints limit BW collection. Additionally, Holstein calf coat patterns complicate image-based BW estimation, and few studies have explored non-contact measurements taken at early time points for predicting later BW. The objectives of this study were to (1) develop deep learning-based segmentation models for extracting calf body metrics, (2) compare deep learning segmentation with threshold-based methods, and (3) evaluate BW prediction using single-time-point cross-validation with linear regression (LR) and extreme gradient boosting (XGBoost) and multiple-time-point cross-validation with LR, XGBoost, and a linear mixed model (LMM). Depth images from Holstein (n = 63) and Jersey (n = 5) pre-weaning calves were collected, with 20 Holstein calves being weighed manually. Results showed that You Only Look Once version 8 (YOLOv8) deep learning segmentation (intersection over union = 0.98) outperformed threshold-based methods (0.89). In single-time-point cross-validation, XGBoost achieved the best BW prediction (R^2 = 0.91, mean absolute percentage error (MAPE) = 4.37%), while LMM provided the most accurate longitudinal BW prediction (R^2 = 0.99, MAPE = 2.39%). These findings highlight the potential of deep learning for automated BW prediction, enhancing farm management.

Paper Structure

This paper contains 19 sections, 6 figures, 5 tables.

Figures (6)

  • Figure S1: Flowchart of the dairy calf body weight prediction process.
  • Figure S2: (A) Top-view of the calf pen equipped with an automatic milk feeder and a depth camera. (B) Side-view of a dairy calf during milk feeding, with a depth camera capturing videos.
  • Figure S3: A low-quality depth image scenario and segmentation process. Threshold-based segmentation failed to generate the ideal calf contour due to the low-quality depth image and overexposure on the white pattern of the calf, while the deep learning model successfully segmented the calf contour with higher accuracy. 1 Depth image: an image where pixel values represent the distance between the camera and objects in the scene. 2 Ground truth mask: a manually annotated segmentation mask used as a reference to evaluate the accuracy of segmentation methods. 3 Threshold segmentation process: a rule-based method that involves extracting specific pixel intensity values to differentiate objects from the background. 4 Hue extraction: converts the image into HSV (hue, saturation, value) color space and extracts the hue channel, which represents color information independent of brightness. 5 Binary threshold: converts the grayscale image into a binary image by setting pixel values above a chosen threshold (60) to 255 (white, object) and those below it to 0 (black, background). 6 Morphological closing: a morphological operation that applies dilation followed by erosion to close small holes or gaps within detected objects, ensuring solid contours. 7 Opening: a morphological operation that applies erosion followed by dilation to remove small noise and separate closely positioned objects. 8 Contour selection: identifies object boundaries in the segmented image. The target contour is chosen based on its similarity to a predefined calf shape and constraints on area, width, and length. 9 Deep learning segmented mask: a segmentation mask generated by a trained YOLOv8 model to recognize the calf from the depth image.
  • Figure S4: A good-quality depth image scenario and segmentation process. Threshold-based segmentation and the deep learning model successfully extracted the calf contour from the good-quality depth image, achieving accurate segmentation results. The definitions from 1--9 are the same as described in Figure \ref{['fig3']}.
  • Figure S5: Pearson correlation matrices for body metrics (width, average height, volume, contour area, and length) and actual body weight using (A) YOLOv8m and (B) threshold segmentation. Darker red shades indicate stronger correlations, with YOLOv8m demonstrating increased correlations with body weight.
  • ...and 1 more figures