نوع مقاله : مقاله پژوهشی
نویسندگان
1 محقق، بخش تحقیقات فنی و مهندسی کشاورزی، مرکز تحقیقات و آموزش کشاورزی و منابع طبیعی استان اصفهان، سازمان تحقیقات، آموزش و ترویج
2 استادیار پژوهش، بخش تحقیقات فنی و مهندسی کشاورزی، مرکز تحقیقات و آموزش کشاورزی و منابع طبیعی استان اصفهان، سازمان تحقیقات، آموزش
3 دانشیار پژوهش، بخش تحقیقات فنی و مهندسی کشاورزی، مرکز تحقیقات و آموزش کشاورزی و منابع طبیعی استان اصفهان، سازمان تحقیقات، آموزش
چکیده
کلیدواژهها
موضوعات
عنوان مقاله [English]
نویسندگان [English]
In dairy farms, machine learning operations can be used to identify and classify cow types based on body condition scoring (BCS) using features extracted from images. In particular, machine learning algorithms can analyze the curvature of the spine, often by identifying key points and fitting a line or curve, to distinguish between different breeds of cattle and assess their condition. In this study, machine learning models that have been frequently used in computer science in recent years, including SVM, KNN, and CNN, were used in conjunction with a pre-trained deep learning network Resnet50 to enhance the success of the architectures. In each of the algorithms, image features were extracted, registered, and merged to identify the type of cows, and finally, the pre-trained CNN algorithm based on deep learning was able to correctly identify the type of cow with the highest accuracy (93 percent). Therefore, by combining this processing system with the imaging mechanism, it is possible to identify and classify cows based on various states and physical characteristics in cattle environments in a shorter, simpler, and more user-friendly time. This approach eliminates the need for manual extraction of livestock features, reduces the use of human resources, and achieves improved recognition accuracy.
کلیدواژهها [English]
EXTENDED ABSTRACT
Dairy cow body condition scoring (BCS) is a vital management practice used to assess nutritional status, health, and productivity potential. Traditionally, BCS is performed manually by experienced evaluators who rely on visual and tactile cues. However, manual scoring is subjective, time-consuming, and prone to variability and human error, making it impractical for large-scale operations. Advances in computer vision and machine learning have enabled automated BCS systems, offering consistent and objective evaluations. A critical visual marker for BCS estimation is the curvature or deviation of the rump area (the terminal part of the spine). This morphological feature is closely related to body fat reserves and musculoskeletal health. Prior research has used 2D and 3D imaging with regression analysis to automate BCS. Yet many approaches require expensive 3D equipment or involve complex manual feature engineering. Recent developments in convolutional neural networks (CNNs), transfer learning, and pre-trained architectures such as ResNet50 have shown promise in automating feature extraction and classification tasks with high accuracy. The present study aims to design and evaluate a practical, image-based, automated system for intelligent detection and classification of cow types based on rump deviation using machine learning algorithms. The ultimate goal is to provide dairy farms with a low-cost, user-friendly, and real-time tool for BCS-related phenotyping to improve herd management efficiency.
The study employed three machine learning algorithms—Support Vector Machine (SVM), K-Nearest Neighbors (KNN), and a Convolutional Neural Network (CNN) leveraging the ResNet50 architecture—for classifying cows into three types based on rump curvature: upward deviation (A type), downward deviation (B type), and horizontal (C type). A dataset of 150 images was collected from various farms, with 50 images per type, captured using standard digital cameras and smartphones. Images were preprocessed by cropping to isolate the rump area and were labeled and sorted into folders by type. The dataset was split into training, validation, and test sets in an 8:1:1 ratio. Feature extraction for SVM and KNN was performed using ResNet50 as a fixed feature extractor. CNN training used ResNet50 with fine-tuned layers for classification. Experiments were implemented in MATLAB R2021b. Evaluation metrics included accuracy, precision, recall (sensitivity), F1 score, confusion matrices, intersection over union (IoU), and mean average precision (mAP). For each algorithm, predictions on the test set were compared to ground-truth labels to compute performance metrics.
The KNN classifier achieved an overall accuracy of 82%, with an F1 score averaging 81% across classes. Its confusion matrix revealed relatively high false positives, especially between A and C types, resulting in lower overlap scores (mean IoU ~67%). The SVM model showed improved performance, achieving 86% accuracy and an average F1 score of 85%, with better precision-recall balance and higher IoU (~75%). The CNN model using fine-tuned ResNet50 outperformed the others, achieving 91% accuracy, 93% precision, 90% recall, and an F1 score of 90%, with the highest mean IoU (~82%). Confusion matrices demonstrated that CNN produced the lowest misclassification rates among the three algorithms. CNN's high overlap values indicated strong alignment between predicted and actual classes, and its superior F1 score reflected balanced precision and recall. These results underscore the model's ability to extract subtle image features relevant to rump curvature and BCS-related phenotypes. Compared to prior studies reporting accuracies in the 82–97% range (using depth cameras, attention mechanisms, or multimodal data), this approach demonstrated comparable or better performance with simple 2D imaging and transfer learning. The system reduces manual feature engineering, enables real-time classification, and supports scalable deployment in dairy farms.
This study demonstrates the feasibility and effectiveness of using machine learning—particularly CNN with ResNet50—for automated classification of cow types based on rump curvature, serving as a proxy for body condition scoring. Among the tested methods, CNN–ResNet50 achieved the highest accuracy (91%) and F1 score (90%), outperforming KNN and SVM classifiers. The proposed system offers a practical, low-cost solution that eliminates the need for manual scoring, reduces labor, minimizes subjective error, and facilitates real-time herd management. Such tools can help dairy farmers make timely decisions on feeding and health interventions, ultimately improving productivity and animal welfare. Future work could expand the dataset, incorporate multimodal imaging, and deploy the model in field conditions to validate robustness and generalizability. Overall, the study confirms that deep learning with transfer learning on 2D RGB images can reliably support precision livestock farming by automating BCS estimation from visually salient anatomical markers like rump curvature.
Conceptualization, M.D.V. and A.I.; methodology, M.D.V., A.I. and M.H; software, M.D.V. and A.I; validation, M.D.V., A.I. and M.H; investigation, M.D.V and A.I.; resources, M.H; data curation, A.I; writing—original draft preparation, M.D.V. and A.I; writing—review and editing, A.I.; visualization, M.D.V.; supervision, A.I.; project administration, A.I.; funding acquisition, A.I., All authors have read and agreed to the published version of the manuscript.
Data available on request from the authors.
The authors gratefully acknowledge the technical support from Isfahan Agricultural and Natural Resources Research and Education Center.
The authors avoided data fabrication, falsification, plagiarism, and misconduct.
The author declares no conflict of interest.