# Improving the Reliability of Scale-Free Image Morphometrics in Applications with Minimally Restrained Livestock Using Projective Geometry and Unsupervised Machine Learning

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Image Acquisition and Annotation

#### 2.2. Morphometric Algorithm Specification

^{2}) with the number of anatomical landmarks selected, with many of the resulting distance measures being geometrically redundant. Dimension reduction techniques may be applied to reduce the overall problem size, but the resulting aggregate biometrics can be difficult to interpret [14,35,36].

#### 2.3. Algorithm Validation

#### 2.3.1. Metric Repeatability

#### 2.3.2. Resilience to Changes in Image Attributes

^{2}calculated using the piecewiseSEM package [18,41]. The two measurement systems were then contrasted via scaled density plots for each anatomical subregion [40]. For each individual biometric, the full model with fixed effects and a reduced model with only a fixed intercept were refit using ML criterion, and a nested model ANOVA test was run to assess the statistical significance of image attribute variables. The resulting chi-squared and p-value estimates are provided in supplemental materials, as are the coefficient values estimated for theses scaled image attribute values.

#### 2.3.3. Error Structure Analysis

#### 2.3.4. Reliability of Dimension Reduction

#### 2.3.5. Reliability of Bias Corrected Biometrics

^{2}, in order to estimate the total proportion of variance in each observed biometric that was attributed to bias correction terms and subsequently and thus excluded from the final BLUP estimates [41]. Results are provided for all biometrics from either measurement system, with bootstrapped confidence intervals, in Supplemental Materials. To compere measurement systems, the ggplot2 package was used to plot the overall repeatability values for each biometrics before and after bias correction for each anatomical subregion of the face, wherein the color of each data point was used to reflect the proportion of total variance attributed to systematic bias in the observed estimate [40].

## 3. Results and Discussion

#### 3.1. Metric Repeatability

#### 3.2. Resilience to Changes in Image Attributes

#### 3.3. Error Structure Analysis

#### 3.4. Reliability of Dimension Reduction

#### 3.5. Reliability of Bias Corrected Biometrics

^{2}values. That the observed values of these biometrics are so heavily influenced by systematic error induced by lurking variables suggests that, for applications where imaging cannot be replicated, these metrics might even be directly employed as bias correction terms using a similar encoding pipeline to allow for nonlinearity in the latent link function. For example, in applications with transient facial expression, repeated images of the target features of analysis might not be easily obtained, but if multiple images are acquired from each animals, structural morphometrics sensitive to variation in camera position might be extracted and this UML pipeline applied to create bias correction terms for projection error, allowing researcher to apply minimally invasive imaging protocols while still minimizing the risk of measurement bias.

## 4. Conclusions

## Supplementary Materials

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Fernandes, A.F.A.; Dórea, J.R.R.; de Magalhães Rosa, G.J. Image Analysis and Computer Vision Applications in Animal Sciences: An Overview. Front. Vet. Sci.
**2020**, 7, 551269. [Google Scholar] [CrossRef] [PubMed] - Nye, J.; Zingaretti, L.M.; Pérez-Enciso, M. Estimating Conformational Traits in Dairy Cattle With DeepAPS: A Two-Step Deep Learning Automated Phenotyping and Segmentation Approach. Front. Genet.
**2020**, 11, 513. [Google Scholar] [CrossRef] [PubMed] - Wurtz, K.; Camerlink, I.; D’Eath, R.B.; Fernández, A.P.; Norton, T.; Steibel, J.; Siegford, J. Recording Behaviour of Indoor-Housed Farm Animals Automatically Using Machine Vision Technology: A Systematic Review. PLoS ONE
**2019**, 14, e0226669. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Brito, L.F.; Oliveira, H.R.; McConn, B.R.; Schinckel, A.P.; Arrazola, A.; Marchant-Forde, J.N.; Johnson, J.S. Large-Scale Phenotyping of Livestock Welfare in Commercial Production Systems: A New Frontier in Animal Breeding. Front. Genet.
**2020**, 11, 793. [Google Scholar] [CrossRef] [PubMed] - Kirby, M. Geometric Data Analysis: An Empirical Approach to Dimensionality Reduction and the Study of Patterns; John Wiley & Sons, Inc.: New York, NY, USA, 2001. [Google Scholar]
- Rashid, M.; Silventoinen, A.; Gleerup, K.B.; Andersen, P.H. Equine Facial Action Coding System for Determination of Pain-Related Facial Responses in Videos of Horses. bioRxiv
**2020**, 14. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Zehender, G.; Cordella, L.P.; Chianese, A.; Ferrara, L.; del Pozzo, A.; Barbera, S.; Bosticco, A.; Negretti, P.; Bianconi, G.; Balestra, G.F.; et al. Image Analysis in Morphological Animal Evaluation: A Group for the Development of New Techniques in Zoometry. Anim. Genet. Resour. Inf.
**1996**, 20, 71–79. [Google Scholar] [CrossRef] - Marchant, J.A.; Schofield, C.P.; White, R.P. Pig Growth and Conformation Monitoring Using Image Analysis. Anim. Sci.
**1999**, 68, 141–150. [Google Scholar] [CrossRef] - Tasdemir, S.; Urkmez, A.; Inal, S. Determination of Body Measurements on the Holstein Cows Using Digital Image Analysis and Estimation of Live Weight with Regression Analysis. Comput. Electron. Agric.
**2011**, 76, 189–197. [Google Scholar] [CrossRef] - Kuzuhara, Y.; Kawamura, K.; Yoshitoshi, R.; Tamaki, T.; Sugai, S.; Ikegami, M.; Kurokawa, Y.; Obitsu, T.; Okita, M.; Sugino, T.; et al. A Preliminarily Study for Predicting Body Weight and Milk Properties in Lactating Holstein Cows Using a Three-Dimensional Camera System. Comput. Electron. Agric.
**2015**, 111, 186–193. [Google Scholar] [CrossRef] - Salau, J.; Haas, J.H.; Junge, W.; Thaller, G. A Multi-Kinect Cow Scanning System: Calculating Linear Traits from Manually Marked Recordings of Holstein-Friesian Dairy Cows. Biosyst. Eng.
**2017**, 157, 92–98. [Google Scholar] [CrossRef] - Pezzuolo, A.; Guarino, M.; Sartori, L.; Marinello, F. A Feasibility Study on the Use of a Structured Light Depth-Camera for Three-Dimensional Body Measurements of Dairy Cows in Free-Stall Barns. Sensors
**2018**, 18, 673. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Song, X.; Bokkers, E.A.M.; van der Tol, P.P.J.; Groot Koerkamp, P.W.G.; van Mourik, S. Automated Body Weight Prediction of Dairy Cows Using 3-Dimensional Vision. J. Dairy Sci.
**2018**, 101, 4448–4459. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Slice, D.E. Modern Morphometrics. In Modern Morphometrics In Physical Anthropology; Kluwer Academic/Plenum Publishers: New York, NY, USA, 2005. [Google Scholar]
- Stock, J.; Calderon Diaz, J.; Abell, C.; Baas, T.; Rothschild, M.; Mote, B.; Stalder, K. Development of an Objective Feet and Leg Conformation Evaluation Method Using Digital Imagery in Swine. J. Anim. Sci. Livest. Prod.
**2017**, 1, 2. [Google Scholar] [CrossRef] - Stock, J.D.; Calderón Díaz, J.A.; Rothschild, M.F.; Mote, B.E.; Stalder, K.J. Objective Evaluation of Female Feet and Leg Joint Conformation at Time of Selection and Post First Parity in Swine1. J. Anim. Sci.
**2018**, 96, 3549–3557. [Google Scholar] [CrossRef] [PubMed] - Kristjansson, T.; Bjornsdottir, S.; Sigurdsson, A.; Crevier-Denoix, N.; Pourcelot, P.; Arnason, T. Objective Quantification of Conformation of the Icelandic Horse Based on 3-D Video Morphometric Measurements. Livest. Sci.
**2013**, 158, 12–23. [Google Scholar] [CrossRef] - Gmel, A.I.; Druml, T.; Portele, K.; von Niederhäusern, R.; Neuditschko, M. Repeatability, Reproducibility and Consistency of Horse Shape Data and Its Association with Linearly Described Conformation Traits in Franches-Montagnes Stallions. PLoS ONE
**2018**, 13, e0202931. [Google Scholar] [CrossRef] [PubMed] - Poursaberi, A.; Bahr, C.; Pluk, A.; Van Nuffel, A.; Berckmans, D. Real-Time Automatic Lameness Detection Based on Back Posture Extraction in Dairy Cattle: Shape Analysis of Cow with Image Processing Techniques. Comput. Electron. Agric.
**2010**, 74, 110–119. [Google Scholar] [CrossRef] - Druml, T.; Baumung, R.; Sölkner, J. Morphological Analysis and Effect of Selection for Conformation in the Noriker Draught Horse Population. Livest. Sci.
**2008**, 115, 118–128. [Google Scholar] [CrossRef] - Druml, T.; Dobretsberger, M.; Brem, G. The Use of Novel Phenotyping Methods for Validation of Equine Conformation Scoring Results. Animal
**2015**, 9, 928–937. [Google Scholar] [CrossRef] [Green Version] - Druml, T.; Horna, M.; Grilz-Seger, G.; Dobretsberger, M.; Brem, G. Association of Body Shape with Amount of Arabian Genetic Contribution in the Lipizzan Horse. Arch. Anim. Breed.
**2018**, 61, 79–85. [Google Scholar] [CrossRef] - Alhajeri, B.H.; Alaqeely, R.; Alhaddad, H. Classifying Camel Breeds Using Geometric Morphometrics: A Case Study in Kuwait. Livest. Sci.
**2019**, 230, 103824. [Google Scholar] [CrossRef] - Azzaro, G.; Caccamo, M.; Ferguson, J.D.; Battiato, S.; Farinella, G.M.; Guarnera, G.C.; Puglisi, G.; Petriglieri, R.; Licitra, G. Objective Estimation of Body Condition Score by Modeling Cow Body Shape from Digital Images. J. Dairy Sci.
**2011**, 94, 2126–2137. [Google Scholar] [CrossRef] [Green Version] - Fischer, A.; Luginbühl, T.; Delattre, L.; Delouard, J.M.; Faverdin, P. Rear Shape in 3 Dimensions Summarized by Principal Component Analysis Is a Good Predictor of Body Condition Score in Holstein Dairy Cows. J. Dairy Sci.
**2015**, 98, 4465–4476. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Lou, M.E.; Porter, S.T.; Massey, J.S.; Ventura, B.; Deen, J.; Li, Y. The Application of 3D Landmark-Based Geometric Morphometrics towards Refinement of the Piglet Grimace Scale. Animals
**2022**, 12, 1944. [Google Scholar] [CrossRef] - McVey, C. Image Analysis for Determining Characteristics of Animals. U.S. Patent 9,104,906, 11 August 2015. [Google Scholar]
- Camerlink, I.; Coulange, E.; Farish, M.; Baxter, E.M.; Turner, S.P. Facial Expression as a Potential Measure of Both Intent and Emotion. Sci. Rep.
**2018**, 8, 17602. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Lansade, L.; Nowak, R.; Lainé, A.-L.; Leterrier, C.; Bonneau, C.; Parias, C.; Bertin, A. Facial Expression and Oxytocin as Possible Markers of Positive Emotions in Horses. Sci. Rep.
**2018**, 8, 14680. [Google Scholar] [CrossRef] [Green Version] - McLennan, K. Why Pain Is Still a Welfare Issue for Farm Animals, and How Facial Expression Could Be the Answer. Agriculture
**2018**, 8, 127. [Google Scholar] [CrossRef] [Green Version] - Schanz, L.; Krueger, K.; Hintze, S. Sex and Age Don’t Matter, but Breed Type Does—Factors Influencing Eye Wrinkle Expression in Horses. Front. Vet. Sci.
**2019**, 6, 154. [Google Scholar] [CrossRef] [Green Version] - Lundblad, J.; Rashid, M.; Rhodin, M.; Andersen, P.H. Facial Expressions of Emotional Stress in Horses. bioRxiv
**2020**. [Google Scholar] [CrossRef] - Navarro, E.; Mainau, E.; Manteca, X. Development of a Facial Expression Scale Using Farrowing as a Model of Pain in Sows. Animals
**2020**, 10, 2113. [Google Scholar] [CrossRef] - Merkies, K.; Paraschou, G.; McGreevy, P.D. Morphometric Characteristics of the Skull in Horses and Donkeys—A Pilot Study. Animals
**2020**, 10, 1002. [Google Scholar] [CrossRef] [PubMed] - Aldridge, K.; George, I.D.; Cole, K.K.; Austin, J.R.; Takahashi, T.N.; Duan, Y.; Miles, J.H. Facial Phenotypes in Subgroups of Prepubertal Boys with Autism Spectrum Disorders Are Correlated with Clinical Phenotypes. Mol. Autism.
**2011**, 2, 15. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Obafemi-Ajayi, T.; Miles, J.H.; Takahashi, T.N.; Qi, W.; Aldridge, K.; Zhang, M.; Xin, S.-Q.; He, Y.; Duan, Y. Facial Structure Analysis Separates Autism Spectrum Disorders into Meaningful Clinical Subgroups. J. Autism. Dev. Disord.
**2015**, 45, 1302–1317. [Google Scholar] [CrossRef] [PubMed] - Tellington-Jones, L. Getting in TTouch with Your Horse; Trafalgar Square Books: North Pomfret, VT, USA, 2009. [Google Scholar]
- R Core Team. R: A Language and Environment for Statistical Computing; R Foundation for Statistical Computing: Vienna, Austria, 2018. [Google Scholar]
- Bates, D.; Machler, M. Fitting Linear Mixed-Effects Models Using. J. Stat. Softw.
**2015**, 67, 1–48. [Google Scholar] [CrossRef] - Wickham, H. Ggplot2: Elegant Graphics for Data Analysis; Springer: New York, NY, USA, 2016. [Google Scholar]
- Lefcheck, J.S. PiecewiseSEM: Piecewise Structural Equation Modeling in R for Ecology, Evolution, and Systematics. Methods Ecol. Evol.
**2016**, 7, 573–579. [Google Scholar] [CrossRef] - Revelle, W. Psych: Procedures for Psychological, Psychometric, and Personality Research. Available online: https://CRAN.R-project.org/package=psych (accessed on 1 October 2022).
- Gharaibeh, W. Correcting for the Effect of Orientation in Geometric Morphometric Studies of Side-View Images of Human Heads. In Modern Morphometrics In Physical Anthropology; Kluwer Academic/Plenum Publishers: New York, NY, USA, 2005. [Google Scholar]
- Le Dien, S.; Pagès, J. Hierarchical Multiple Factor Analysis: Application to the Comparison of Sensory Profiles. Food Qual. Prefer.
**2003**, 14, 397–403. [Google Scholar] [CrossRef] - Le Dien, S.; Josse, J.; Husson, F. FactoMineR: A Package for Multivariate Analysis. J. Stat. Softw.
**2008**, 25, 1–18. [Google Scholar] [CrossRef] [Green Version] - Abdi, H.; Williams, L.J.; Valentin, D. Multiple Factor Analysis: Principal Component Analysis for Multitable and Multiblock Data Sets: Multiple Factor Analysis. WIREs Comp. Stat.
**2013**, 5, 149–179. [Google Scholar] [CrossRef] - Chang, J. Classification on the Grassmannians: Theory and Applications. Master’s Thesis, Colorado State University, Fort Collins, CO, USA, 2008. [Google Scholar]
- Enriquez, S.; Hsieh, F. Categorical Exploratory Data Analysis on Goodness-of-Fit Issues. arXiv
**2020**, arXiv:2011.09682. [Google Scholar] - McVey, C.; Hsieh, F.; Manriquez, D.; Pinedo, P.; Horback, K. Livestock Informatics Toolkit: A Case Study in Visually Characterizing Complex Behavioral Patterns across Multiple Sensor Platforms, Using Novel Unsupervised Machine Learning and Information Theoretic Approaches. Sensors
**2021**, 22, 1. [Google Scholar] [CrossRef] - Hsieh, F.; Liu, S.-Y.; Hsieh, Y.-C.; McCowan, B. From Patterned Response Dependency to Structured Covariate Dependency: Entropy Based Categorical-Pattern-Matching. PLoS ONE
**2018**, 13, e0198253. [Google Scholar] [CrossRef] - Guan, J.; Hsieh, F. Coupling Geometry on Binary Bipartite Networks: Hypotheses Testing on Pattern Geometry and Nestedness. Front. Appl. Math. Stat.
**2018**, 4, 38. [Google Scholar] [CrossRef] - McVey, C.; Hsieh, F.; Manriquez, D.; Pinedo, P.; Horback, K. Mind the Queue: A Case Study in Visualizing Heterogeneous Behavioral Patterns in Livestock Sensor Data Using Unsupervised Machine Learning Techniques. Front. Vet. Sci.
**2020**, 7, 523. [Google Scholar] [CrossRef] [PubMed] - Hartley, R.; Zisserman, A. Multiple View Geometry in Computer Vision; Cambridge University Press: Cambridge UK, 2003. [Google Scholar]
- Pinheiro, J.C.; Bates, D.M. Mixed-Effects Models in S and S-PLUS; Statistics and Computing; Springer: New York, NY, USA, 2000. [Google Scholar]
- Novembre, J.; Stephens, M. Interpreting Principal Component Analyses of Spatial Population Genetic Variation. Nat. Genet.
**2008**, 40, 646–649. [Google Scholar] [CrossRef]

**Figure 1.**Examples of Projective Biometrics. Eye Height Point Proportion (

**upper left**) is an example of an orthogonal projection that is geometrically equivalent to an angle measure via a trigonometric transform. Eye Height Proportion (

**bottom left**) provides a more geometrically intuitive definition of eye height using only a single locally defined normalization term. Nostril-Muzzle Length Ratio (

**right**) is an example of how projections onto a reference line can provide more anatomically intuitive distance measures.

**Figure 3.**Comparison of within-photo repeatability (density plot) and overall repeatability (histogram) for normalized length biometrics (red) and projective biometrics (blue) for the four anatomical subregions (from top: eye, muzzle, topline, forehead).

**Figure 4.**Scaled density plots representing the proportion of variability in normalized length (

**right**) and projective biometrics (

**left**) additively associated with Frame:Face Ratio and Face Angle for the four anatomical subregions of the face.

**Figure 5.**Comparison of correlations between overall, between-photo, and within-photo error estimates for normalized length (red) and projective biometrics (blue) for the four anatomical subregions (from top: eye, muzzle, topline, forehead).

**Figure 6.**A visualization of changes in normalized length (

**right**) and projective biometrics (

**left**) with errors in point annotation along the curve of the lower eye. Top photos represent lateral uncertainty in annotation of the maximal point deviation of the curve from the baseline. Bottom photos represent uncertainty in the curve used to place landmark points. In this exaggerated example, these errors in point annotation are isolated to distinct orthogonal projections, but result in synergistic tradeoffs in the Euclidean distances used in calculating normalized length biometrics.

**Figure 7.**Demonstration of the impact out-of-plane variations in facial angle can have on the relative locations of anatomical landmark points. The change in angle between the 3D object and the 2D plane of the camera on which the image is being rendered can be described by homographic transforms. This geometric operation results in systematic changes in the relative position of landmark points, which would in turn produce correlations in between-photo error terms.

**Figure 8.**Comparison of the relationship between the proportion of total variance explained by each dimension returned by HMFA analysis and the repeatability estimate of the partial scores. For both measurement systems, basis dimensions with intermediate repeatability estimates align with the subspaces generated for systematic error structures, which may indicate they are concentrating variance attributable to lurking variables.

**Figure 9.**Comparison in the repeatability estimates for each biometric calculated with and without bias correction terms. The black line super-imposed on each scatterplot represents no change in repeatability estimates, such that all points that fall above this line represent an improvement in the reliability of the biometric. Each biometric point is colored by their corresponding marginal R

^{2}estimate, which represents the total proportion of observed variance in the biometric attributed to the bias correction terms. An appreciable proportion of biometrics show improvements in repeatability with inclusion of these terms for both measurement systems for all anatomical subregions, but the performance of projective biometrics was more strongly impacted for the eye and forehead subregions.

**Figure 10.**Heatmap visualizations of data mechanics clustering results for between image error for the eye anatomical subregion. Each row represents an image and each column represent a candidate biometric. Each cell is colored to represent the scaled residual estimate for a given image for a given biometric. Results for the projective biometrics (

**A**) not only show greater variability in residual estimates than for normalized length biometrics (

**B**), but there is considerably greater systematic heterogeneity captured by the clustering algorithm, which is visualized as distinctive color patters between clusters as visualized both across the rows and columns of the residual matrix.

**Table 1.**Summary of encodings granularities recovered using data mechanics clustering for projective biometrics and normalized length biometrics for both the annotation and image error bias correction factors. Complete results of data mechanics analyses are provided in Supplemental Materials.

Projective Biometrics | Normalized Length Biometrics | |||||||
---|---|---|---|---|---|---|---|---|

Annotation Error Encoding | Image Error Encoding | Annotation Error Encoding | Image Error Encoding | |||||

Rows | Columns | Rows | Columns | Rows | Columns | Rows | Columns | |

Eye | 8 | 5 | 8 | 4 | 7 | 3 | 6 | 4 |

Muzzle | 7 | 4 | 7 | 4 | 8 | 4 | 8 | 5 |

Topline | 7 | 4 | 8 | 4 | 7 | 4 | 7 | 4 |

Forehead | 5 | 5 | 7 | 5 | 7 | 4 | 8 | 4 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

McVey, C.; Egger, D.; Pinedo, P.
Improving the Reliability of Scale-Free Image Morphometrics in Applications with Minimally Restrained Livestock Using Projective Geometry and Unsupervised Machine Learning. *Sensors* **2022**, *22*, 8347.
https://doi.org/10.3390/s22218347

**AMA Style**

McVey C, Egger D, Pinedo P.
Improving the Reliability of Scale-Free Image Morphometrics in Applications with Minimally Restrained Livestock Using Projective Geometry and Unsupervised Machine Learning. *Sensors*. 2022; 22(21):8347.
https://doi.org/10.3390/s22218347

**Chicago/Turabian Style**

McVey, Catherine, Daniel Egger, and Pablo Pinedo.
2022. "Improving the Reliability of Scale-Free Image Morphometrics in Applications with Minimally Restrained Livestock Using Projective Geometry and Unsupervised Machine Learning" *Sensors* 22, no. 21: 8347.
https://doi.org/10.3390/s22218347