Quantifying mammary gland tissue composition is crucial for understanding growth patterns and future lactation potential in dairy heifers, yet conventional histological analysis is labor-intensive and time-consuming. This study developed an automated phenotyping framework using deep learning-based semantic segmentation to classify tissues in mammary gland biopsies collected from Holstein heifers at 10, 26, 39, and 52 weeks of age. A data set of 130 histological images was manually annotated and divided into 383,650 patches of 448 × 448 pixels to accommodate the architecture requirements of pre-trained models. U-Net and U-Net++ models with ResNet34 encoders were trained using focal loss and evaluated through Intersection over Union (IoU) metrics. The best-performing model was a U-Net++ without attention module, achieving high IoU values across validation and test sets. Mean average percentage error remained below 5% for most tissue-time combinations, with ducts demonstrating the highest prediction accuracy despite their limited presence in early developmental stages. Adipose tissue showed the most dynamic growth pattern, increasing from approximately 2.5% of whole tissue at 10 weeks of age to over 30% at 26 and 39 weeks of age before declining to below 25% at 52 weeks of age. Strong correlations between predicted and observed pixel counts confirmed model reliability across tissues and time points. This automated approach provides a scalable, reproducible solution for histological phenotyping, enabling high-throughput quantification of mammary tissue development that was previously impractical with manual methods. The framework successfully bridges the gap between detailed tissue characterization and the demands of large-scale phenotyping studies in dairy science.
Casella et al. (2026) studied this question.