A Measurement Method for Body Parameters of Mongolian Horses Based on Deep Learning and Machine Vision
Abstract
:1. Introduction
2. Materials and Methods
Algorithm 1. Custom Methods |
Input: A total of 30 Mongolian horse videos |
Output: Stored images from videos every 120 frames |
1. SET number_of_videos = 30 |
2. SET total_duration = 2 h |
3. SET frame_rate = 30 fps |
4. SET frame_interval = 120 frames |
5. FOR each video_index from 1 to number_of_videos: |
6. OPEN video file corresponding to video_index |
7. SET frame_counter = 0 |
8. WHILE video has more frames: |
9. READ current_frame |
10. IF frame_counter % frame_interval == 0: |
11. STORE current_frame as an image |
12. INCREMENT frame_counter by 1 |
13. CLOSE video file |
2.1. Mongolian Horse Training Dataset Construction
2.2. Flow Chart of the Experiment
- (1)
- Mongolian horse videos were shot, processed, and filtered by frames, and horse images were labeled using Labelme software, yielding the training set;
- (2)
- Walking videos of individual Mongolian horses were used, and key frames were extracted as a test set;
- (3)
- The Mongolian horse image segmentation model was trained, and the test set was segmented using the trained model;
- (4)
- The center of mass of the segmented image was determined, and the contour was intervalized;
- (5)
- The point of maximum curvature in the contour was counted and marked using the improved Harris algorithm and the polynomial fitting method based on the edge contour so as to determine the specific location of the measurement point;
- (6)
- We calculated the scale parameters and related them to the pixel distances in the figure to calculate the true values of the Mongolian horses’ body parameters.
2.3. Improved Mask R-CNN
2.4. Measurement of Physical Parameters of a Mongolian Horses
2.4.1. Body Measurement Point Extraction Based on Improved Harris Algorithm
Algorithm 2. Adaptive iterative thresholding method |
Input: Contour points of the Mongolian horse extracted using Canny edge detection, denoted as ContourPoints. |
Output: Threshold T used for contour feature point extraction |
1. Set initial parameters: |
K = 1 |
Rmax = max(R_matrix) |
Rmin = min(R_matrix) |
T0 = (Rmax + Rmin)/2 |
2. Divide elements in R_matrix by T0: |
G1 = [element for element in R_matrix if element > T0] |
G2 = [element for element in R_matrix if element ≤ T0] |
3. Calculate arithmetic mean of G1 and G2: |
µ1 = sum(G1)/len(G1) |
µ2 = sum(G2)/len(G2) |
4. Compute mean µ and difference t: |
µ = (µ1 + µ2)/2 |
t = (µ1 − µ2)/2 |
5. Iterate until the threshold criteria are met: |
While abs(µ − t) > K: |
t = µ |
G1 = [element for element in R_matrix if element > t] |
G2 = [element for element in R_matrix if element ≤ t] |
µ1 = sum(G1)/len(G1) |
µ2 = sum(G2)/len(G2) |
µ = (µ1 + µ2)/2 |
t = (µ1 − µ2)/2 |
End While |
6. The final threshold value T is |
T = t |
7. Use T for contour feature point extraction; |
2.4.2. Body Measurement Point Extraction Based on Edge Contours
2.4.3. Calculation of Body Parameters
3. Experiments and Results
3.1. Experimental Design
3.2. Comparison of Segmentation Results for the Mongolian Horse Test Set
3.3. Validity Analysis of Body Parameter Measurements
4. Conclusions and Discussion
- (1)
- Our method can ensure that the somatic parameters of a Mongolian horse’s athletic performance ability are acquired when the horse is in its natural state; in addition, the method proposed in this paper enhanced the ability to obtain the Mongolian horses’ somatic measurement parameters, not only acquiring the horses’ growth information in a contactless way but also being able to be used in selection and breeding programs for improving the Mongolian horse’s athletic performance ability.
- (2)
- Utilizing the improved Mask R-CNN model for contour extraction of the captured images of horses in a natural walking state can effectively solve the problem of the occurrence of rough edge contours caused by the original Mask R-CNN model because it has a lower feature space resolution and a smaller proportion of boundary pixels, thus improving the target Mongolian horse contour segmentation accuracy. The model in this paper was compared with the Mask R-CNN model, the YOLACT model, Chu et al.’s model [32], the SOLO model, and Li et al.’s model [47]: the PA yielded by our model was 7.26, 6.39, 8.57, 5.28, and 0.46 percentage points higher, and the MIoU was 10.64, 9.85, 9.99, 8.90, and 0.39 percentage points higher, respectively.
- (3)
- Using the improved Harris-based algorithm, the optimal threshold size was obtained through iteration, and then the feature points in Mongolian horse contour images were detected according to this threshold, effectively solving the problem of the inaccuracy of the detected feature points due to the irrational threshold setting of the original Harris algorithm, and the obtained feature points were used as the location of the measurement points. The contours were divided based on the center of mass of a horse in an image, a fitting operation was performed on the curves in each interval, and the point of maximum curvature in the curves was calculated as the measurement point position. The average relative errors of the linear and angular parameters calculated in connection with the scale parameters are 3.58% and 5.06%, respectively, allowing for a more accurate estimation of body parameters.
- (4)
- The method proposed in this paper is computationally intensive and relies on multiple algorithms. While the approach proposed in this paper emphasizes 2D body size measurements, critical values such as withers height, body height, chest depth, body length, hip height, shoulder angle, and hip angle can be effectively gauged using just a single RGB camera. Despite a marginally increased processing time in contrast to that reported in other studies, expenditure was minimized in this study due to the usage of a single RGB camera. Future research will focus on making this algorithm simpler and more integrated.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Gibson, M.J.; Legg, K.A.; Gee, E.K.; Chin, Y.Y.; Rogers, C.W. Career profile and pattern of racing for Thoroughbred jumps-racing horses in New Zealand. Anim. Prod. Sci. 2024, 64, AN23422. [Google Scholar] [CrossRef]
- Luke, K.L.; Rawluk, A.; McAdie, T.; Smith, B.P.; Warren-Smith, A.K. How equestrians conceptualise horse welfare: Does it facilitate or hinder change? Anim. Welf. 2023, 32, e59. [Google Scholar] [CrossRef]
- Li, X.H.; Zhu, X.Y.; Liu, R.J. Inner Mongolia Horse Industry Development Path Analysis. Mod. Anim. Husb. Sci. Technol. 2022, 12, 126–128. [Google Scholar]
- Singh, A.; Pal, Y.; Kumar, R.; Kumar, S.; Bhardwaj, A.; Rani, K.; Ana, R. Equine husbandry based agri-entrepreneurship-an overview. J. Community Mobilization Sustain. Dev. 2022, 3, 697–704. [Google Scholar]
- Mang, L.; Bai, D.Y. Analysis of the current situation of the horse industry in Inner Mongolia autonomous region. North. Econ. 2019, 11, 20–25. [Google Scholar]
- Zhu, Y. Research on the Integrated Development of Horse Tourism Industry in Inner Mongolia. J. Jining Norm. Univ. 2024, 46, 18–22. [Google Scholar]
- Sun, P.; Li, Y.; Zeng, H. Multidimensional Value and Path Exploration of Digital Transformation of China’s Horse Industry in the Context of Digital Economy. In Proceedings of the First Hubei Sports Science Conference, Huanggang, China, 9 December 2023; Volume 2. [Google Scholar]
- Tanaka, A.; Ohshima, H.; Tanezaki, T.; Muko, R.; Oikawa, M.; Matsuda, H. Development of a New IoT Device to Acquire and Analyze Gait Information of Horses in Training. Preprints 2024, 2024060507. [Google Scholar] [CrossRef]
- Ghezelsoflou, H.; Hamidi, P.; Gharahveysi, S. Study of factors affecting the body conformation traits of Iranian Turkoman horses. J. Equine Sci. 2018, 29, 91–96. [Google Scholar] [CrossRef]
- Paksoy, Y.; Ünal, N. Multivariate analysis of morphometry effect on race performance in Thoroughbred horses. Rev. Bras. Zootec. 2019, 48, e20180030. [Google Scholar] [CrossRef]
- Janczarek, I.; Wilk, I.; Dtrzelec, K. Correlations between body dimensions of young trotters and motion parameters and racing performance. Pferdeheilkunde 2017, 33, 139–145. [Google Scholar] [CrossRef]
- Yildirim, F. The differences in arabian horse body measurements used in different horse sports (racing and jereed). AgroLife Sci. J. 2023, 12, 248–252. [Google Scholar] [CrossRef]
- Li, C.; Mellbin, Y.; Krogager, J.; Polikovsky, S.; Holmberg, M.; Ghorbani, N.; Black, M.J.; Kjellström, H.; Zuffi, S.; Hernlund, E. The Poses for Equine Research Dataset (PFERD). Sci. Data 2024, 11, 497. [Google Scholar] [CrossRef]
- Rhodin, M.; Smit, I.H.; Persson-Sjodin, E. Timing of Vertical Head, Withers and Pelvis Movements Relative to the Footfalls in Different Equine Gaits and Breeds. Animals 2022, 12, 3053. [Google Scholar] [CrossRef]
- Starke, S.D.; May, S.A. Robustness of five different visual assessment methods for the evaluation of hindlimb lameness based on tubera coxarum movement in horses at the trot on a straight line. Equine Vet. J. 2022, 54, 1103–1113. [Google Scholar] [CrossRef]
- Todd, E.T.; Fromentier, A.; Sutcliffe, R.; Collin, Y.R.H.; Perdereau, A.; Aury, J.-M.; Èche, C.; Bouchez, O.; Donnadieu, C.; Wincker, P.; et al. Imputed genomes of historical horses provide insights into modern breeding. iScience 2023, 26, 107104. [Google Scholar] [CrossRef]
- Mariz, T.M.A.; Santos, W.K.; Mota, L.F.M.; Martins, R.B.; Lima, C.B.; Escodro, P.B.; Lima, D.M., Jr.; Oliveira, L.P.; Sousa, M.F.; Ribeiro, J.S. Evaluation morphostructural measures in horses of the Quarter horse Breed using image analysis. Acta Vet. Bras. 2015, 9, 362–370. [Google Scholar]
- Santos, M.R.; Freiberger, G.; Bottin, F.; Chiocca, M.; Zampar, A.; Cucco, D.C. Evaluation of methodologies for equine biometry. Livest. Sci. 2017, 206, 24–31. [Google Scholar] [CrossRef]
- Pérez-Ruiz, M.; Tarrat-Martín, D.; Sánchez-Guerrero, M.J.; Valera, M. Advances in horse morphometric measurements using LiDAR. Comput. Electron. Agric. 2020, 174, 105510. [Google Scholar] [CrossRef]
- Freitag, G.P.; De Lima, L.G.F.; Jacomini, J.A.; Kozicki, L.E.; Ribeiro, L.B. An accurate image analysis method for estimating body measurements in horses. J. Equine Vet. Sci. 2021, 101, 103418. [Google Scholar] [CrossRef]
- Rhodin, M.; Persson-Sjodin, E.; Egenvall, A. Vertical movement symmetry of the withers in horses with induced forelimb and hindlimb lameness at trot. Equine Vet. J. 2018, 50, 818–824. [Google Scholar] [CrossRef]
- Zhao, Y.; Xiao, Q.; Li, J.; Tian, K.; Yang, L.; Shan, P.; Lv, X.; Li, L.; Zhan, Z. Review on image-based animals weight weighing. Comput. Electron. Agric. 2023, 215, 108456. [Google Scholar] [CrossRef]
- Yang, G.; Xu, X.; Song, L.; Zhang, Q.; Duan, Y.; Song, H. Automated measurement of dairy cows body size via 3D point cloud data analysis. Comput. Electron. Agric. 2022, 200, 107218. [Google Scholar] [CrossRef]
- Matsuura, A.; Torii, S.; Ojima, Y.; Kiku, Y. 3D imaging and body measurement of riding horses using four scanners simultaneously. J. Jining Norm. Univ. 2024, 35, 1–7. [Google Scholar] [CrossRef]
- Le, C.Y.; Allain, C.; Caillot, A.; Delouard, J.; Delattre, L.; Luginbuhl, T.; Faverdin, P. High-precision scanning system for complete 3D cow body shape imaging and analysis of morphological traits. Comput. Electron. Agric. 2019, 157, 447–453. [Google Scholar]
- Du, A.; Guo, H.; Lu, J. Automatic livestock body measurement based on keypoint detection with multiple depth cameras. Comput. Electron. Agric. 2022, 198, 107059. [Google Scholar] [CrossRef]
- Martin-Cirera, A.; Nowak, M.; Norton, T.; Auer, U.; Oczak, M. Comparison of Transformers with LSTM for classification of the behavioural time budget in horses based on video data. Biosyst. Eng. 2024, 242, 154–168. [Google Scholar] [CrossRef]
- Li, X.; Gao, R.; Li, Q.; Wang, R.; Liu, S.; Huang, W.; Yang, L.; Zhuo, Z. Multi-Target Feeding-Behavior Recognition Method for Cows Based on Improved RefineMask. Sensors 2024, 24, 2975. [Google Scholar] [CrossRef]
- Patel, M.; Gu, Y.; Carstensen, L.C.; Hasselmo, M.E.; Betke, M. Animal pose tracking: 3d multimodal dataset and token-based pose optimization. Int. J. Comput. Vis. 2022, 131, 514–530. [Google Scholar] [CrossRef]
- Gosztolai, A.; Günel, S.; Lobato-Ríos, V.; Pietro Abrate, M.; Daniel, M.; Helge, R.; Pascal, F.; Pavan, R. Liftpose3d, a deep learning-based approach for transforming two-dimensional to three-dimensional poses in laboratory animals. Nat. Methods 2021, 18, 975–981. [Google Scholar] [CrossRef]
- Joska, D.; Clark, L.; Muramatsu, N. Acinoset: A 3d pose estimation dataset and baseline models for cheetahs in the wild. In Proceedings of the IEEE International Conference on Robotics and Automation, Xi’an, China, 30 May–5 June 2021; pp. 13901–13908. [Google Scholar]
- Chu, M.Y.; Li, M.F.; Li, Q.; Liu, G. Method of Cows Body Size Measurement Based on Key Frame Extraction and Head and Neck Removal. Trans. Chin. Soc. Agric. Mach. 2022, 53, 226–233+259. [Google Scholar]
- Geng, Y.L.; Ji, Y.K.; Yue, X.D.; Fu, Y.F. Pigs Body Size Measurement Based on Point Cloud Semantic Segmentation. Trans. Chin. Soc. Agric. Mach. 2023, 54, 332–338+380. [Google Scholar]
- Li, K.; Teng, G. Study on body size measurement method of goat and cattle under different background based on deep learning. Electronics 2022, 11, 993. [Google Scholar] [CrossRef]
- Song, H.B.; Hua, Z.X.; Ma, B.L.; Wen, Y.C.; Kong, X.F.; Xu, X.S. Lightweight Keypoint Detection Method of Dairy Cow Based on SimCC-ShuffleNetV2. Trans. Chin. Soc. Agric. Mach. 2023, 54, 275–281+363. [Google Scholar]
- Russell, B.C.; Torralba, A.; Murphy, K.P.; Freeman, W.T. LabelMe: A database and web-based tool for image annotation. Int. J. Comput. Vis. 2008, 77, 157–173. [Google Scholar] [CrossRef]
- He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision, Venice, Italy, 22–29 October 2017; pp. 2961–2969. [Google Scholar]
- Vedaldi, A.; Zisserman, A. Vgg Convolutional Neural Networks Practical; Department of Engineering Science, University of Oxford: Oxford, UK, 2016; Volume 66. [Google Scholar]
- Targ, S.; Almeida, D.; Lyman, K. Resnet in resnet: Generalizing residual architectures. arXiv 2016, arXiv:1603.08029. [Google Scholar]
- Long, J.; Shelhamer, E.; Darrell, T. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 3431–3440. [Google Scholar]
- Anantharaman, R.; Velazquez, M.; Lee, Y. Utilizing mask R-CNN for detection and segmentation of oral diseases. In Proceedings of the 2018 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), Madrid, Spain, 3–6 December 2018; pp. 2197–2204. [Google Scholar]
- Liu, Z.; Lin, Y.; Cao, Y.; Hu, H.; Wei, Y.; Zhang, Z.; Lin, S.; Guo, B. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, BC, Canada, 11–17 October 2021; pp. 10012–10022. [Google Scholar]
- Wu, C.; Zheng, J.; Feng, Z.; Zhang, H.; Zhang, L.; Cao, J.; Yan, H. Fuzzy SLIC: Fuzzy simple linear iterative clustering. In Proceedings of the 2024 34th International Conference Radioelektronika (RADIOELEKTRONIKA), Zilina, Slovakia, 17–18 April 2024; pp. 1–5. [Google Scholar]
- Gibril, M.; Ruzouq, R.; Bolcek, J.; Shanableh, A.; Jena, R. Building Extraction from Satellite Images Using Mask R-CNN and Swin Transformer. IEEE Trans. Circuits Syst. Video Technol. 2020, 31, 2114–2124. [Google Scholar]
- Meira, C.T.; Curi, R.A.; Silva, J.A.I.V.; Corrêa, M.J.M.; de Oliveira, H.N.; da Mota, M.D.S. Morphological and genomic differences between cutting and racing lines of Quarter Horses. J. Equine Vet. Sci. 2013, 33, 244–249. [Google Scholar] [CrossRef]
- Li, Y.; Li, J. Harris corner detection algorithm based on improved contourlet transform. Procedia Eng. 2011, 15, 2239–2243. [Google Scholar]
- Li, M.; Su, L.; Zhang, Y.; Zong, Z.; Zhang, S. Automatic Measurement of Mongolian Horse Body Based on Improved YOLOv8n-pose and Point Cloud Analysis. Smart Agric. 2024. [Google Scholar] [CrossRef]
- Zhang, J.; Cheng, Y. Design of Horse Size Measurement System Based on Image Segmentation. Comput. Technol. Dev. 2020, 30, 177–180. [Google Scholar]
- Bello, R.W.; Ikeremo, E.S.; Otobo, F.N.; Olubummo, D.A.; Enuma, O.C. Cattle Segmentation and Contour Detection Based on Solo for Precision Livestock Husbandry. J. Appl. Sci. Environ. Manag. 2022, 26, 1713–1720. [Google Scholar] [CrossRef]
Origin | Mirror | Rotate | Brightness | Noise |
---|---|---|---|---|
1380 | 345 | 345 | 345 | 345 |
Network Model | Pixel Accuracy PA (%) | Intersection over Union MIoU (%) | Average DetectionTime (s) |
---|---|---|---|
Mask R-CNN [37] | 91.46 | 84.72 | 0.76 |
YOLACT | 92.33 | 85.51 | 0.57 |
SOLO | 93.44 | 86.46 | 0.48 |
Chu et al. [32] | 90.15 | 85.37 | - |
Li et al. [47] | 98.26 | 94.97 | 0.96 |
Our research | 98.72 | 95.36 | 2.97 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 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
Su, L.; Li, M.; Zhang, Y.; Zong, Z. A Measurement Method for Body Parameters of Mongolian Horses Based on Deep Learning and Machine Vision. Appl. Sci. 2024, 14, 5655. https://doi.org/10.3390/app14135655
Su L, Li M, Zhang Y, Zong Z. A Measurement Method for Body Parameters of Mongolian Horses Based on Deep Learning and Machine Vision. Applied Sciences. 2024; 14(13):5655. https://doi.org/10.3390/app14135655
Chicago/Turabian StyleSu, Lide, Minghuang Li, Yong Zhang, and Zheying Zong. 2024. "A Measurement Method for Body Parameters of Mongolian Horses Based on Deep Learning and Machine Vision" Applied Sciences 14, no. 13: 5655. https://doi.org/10.3390/app14135655
APA StyleSu, L., Li, M., Zhang, Y., & Zong, Z. (2024). A Measurement Method for Body Parameters of Mongolian Horses Based on Deep Learning and Machine Vision. Applied Sciences, 14(13), 5655. https://doi.org/10.3390/app14135655