Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Journal Pre-proof

Vision Intelligence for Smart Sheep Farming: Applying Ensemble


Learning to Detect Sheep Breeds

Galib Muhammad Shahriar Himel, Md. Masudul Islam, Mijanur


Rahaman

PII: S2589-7217(23)00048-X
DOI: https://doi.org/10.1016/j.aiia.2023.11.002
Reference: AIIA 130

To appear in: Artificial Intelligence in Agriculture

Received date: 10 June 2023


Revised date: 16 November 2023
Accepted date: 24 November 2023

Please cite this article as: G.M.S. Himel, M.M. Islam and M. Rahaman, Vision Intelligence
for Smart Sheep Farming: Applying Ensemble Learning to Detect Sheep Breeds, Artificial
Intelligence in Agriculture (2023), https://doi.org/10.1016/j.aiia.2023.11.002

This is a PDF file of an article that has undergone enhancements after acceptance, such
as the addition of a cover page and metadata, and formatting for readability, but it is
not yet the definitive version of record. This version will undergo additional copyediting,
typesetting and review before it is published in its final form, but we are providing this
version to give early visibility of the article. Please note that, during the production
process, errors may be discovered which could affect the content, and all legal disclaimers
that apply to the journal pertain.

© 2023 . Production and hosting by Elsevier B.V. on behalf of KeAi Communications Co.,
Ltd.
Journal Pre-proof

Vision Intelligence for Smart Sheep Farming: Applying Ensemble


Learning to Detect Sheep Breeds

Galib Muhammad Shahriar Himel 1 (Corresponding Author)


Bangladesh University of Business and Technology, Dhaka, Bangladesh
galib.muhammad.shahriar@gmail.com
ORCID: 0000-0002-2257-6751
Address: House-21, Road-s4, Block-F, Eastern Housing 2nd Phase, Pallabi, Dhaka-1216,
Bangladesh
Contact: +8801756110234

of
Md. Masudul Islam 2
Bangladesh University of Business and Technology, Dhaka, Bangladesh

ro
masudulislam11@gmail.com
ORCID: 0000-0001-7643-5420 -p
Mijanur Rahaman 3
Bangladesh University of Business and Technology, Dhaka, Bangladesh
re
riponcse.it@bubt.edu.bd
lP
na
ur
Jo
Journal Pre-proof

Abstract
The ability to automatically recognize sheep breeds holds significant value for the sheep industry. Sheep farmers
often require breed identification to assess the commercial worth of their flocks. However, many farmers
specifically the novice one encounter difficulties in accurately identifying sheep breeds without experts in the
field. Therefore, there is a need for autonomous approaches that can effectively and precisely replicate the breed
identification skills of a sheep breed expert while functioning within a farm environment, thus providing
considerable benefits the industry-specific to the novice farmers in the industry. To achieve this objective, we
suggest utilizing a model based on convolutional neural networks (CNNs) which can rapidly and efficiently
identify the type of sheep based on their facial features. This approach offers a cost-effective solution. To
conduct our experiment, we utilized a dataset consisting of 1680 facial images which represented four distinct
sheep breeds. This paper proposes an ensemble method that combines Xception, VGG16, InceptionV3,
InceptionResNetV2, and DenseNet121 models. During the transfer learning using this pre-trained model, we
applied several optimizers and loss functions and chose the best combinations out of them. This classification
model has the potential to aid sheep farmers in precisely and efficiently distinguishing between various breeds,
enabling more precise assessments of sector-specific classification for different businesses.

of
Keywords

ro
Computer vision, Sheep breed classification, image processing, transfer learning, ensemble learning, meta
learner.
-p
re
lP
na
ur
Jo
Journal Pre-proof

Introduction
Sheep breeders depend on the commercial worth of their flocks to determine profitability, with meat weight
being a crucial determinant in any sheep business (MLA, 2017). However, much research has exposed that only
80% of the flock contributes to production and profitability (Rowe et al., 2007). To maximize revenues, it is
important to increase the performance of the remaining 20% of the flock. Farmers are now assessing sheep
productivity based on their live weight, although factors such as wool weight have a problematic outcome
during the weighting process (Ah et al., 1984).
Sheep farming can be also done for wool production, as well as fancy breed production, in addition to meat
production. Various sheep breeds are important in a variety of farming areas. Individuals considering a career in
sheep production must have a thorough awareness of domain-specific breeds. However, detecting the subtle
differences between sheep breeds can be difficult, especially for inexperienced farmers. Sheep breeds can be
distinguished by a variety of facial features. The presence and distribution of wool on the face can vary
significantly among breeds. Some breeds have extensive wool covering their faces, while others have relatively
bare faces. The shape and size of the muzzle (nose area) can differ. Some breeds have broader muzzles, while
others have narrower ones. Eye size, shape, and the spacing between the eyes can vary. Some breeds have
larger, more expressive eyes, while others may have smaller eyes. Ear shape and positioning can be distinctive.

of
Some breeds have upright ears, while others have drooping or horizontal ears. The prominence of the forehead
and the presence or absence of wool on the forehead can be distinguishing features. Some breeds have unique

ro
facial markings, such as spots or patches of a different color on their faces. The color of the face can vary
greatly between breeds. Some breeds have white faces, while others might have black, brown, or other colors.
While many sheep breeds are naturally polled (without horns), some breeds have distinct horn formations.
-p
Certain breeds might have distinctive wrinkles or folds on their faces, contributing to their unique appearance.
The shape and color of the lips and mouth can also be used for identification. It’s important to note that these
characteristics can vary widely within each breed due to factors like age, genetics, and environmental
re
conditions. Additionally, breed standards can differ based on the region or organization, so consulting specific
breed standards or experts in sheep husbandry can provide more accurate information for breed identification.
Although methods for identifying sheep breeds by analyzing these features are possible, there is a knowledge
lP

gap in automatic sheep breed identification. While there is significant literature on the identification of
numerous animal breeds such as dogs, cats, and birds, there has been little research on the automatic
classification of sheep breeds. This paper focuses on developing an autonomous sheep breed identification
system to provide valuable insights to farmers and increase productivity through the use of intelligent
na

agricultural technologies (Agrawal et al., 2021) (Salama et al., 2019) (Diego André Sant’Ana et al., 2022).
Traditional methods of identifying sheep breeds necessitate substantial experience or DNA-based detection
which is not very cost-effective (Abu Jwade et al., 2019). As a result, there is a demand for systems that can
automatically identify sheep breeds within a herd that are quick, effective, and cost-effective. Computer vision
ur

and artificial intelligence approaches hold great promise for animal identification and categorization in a variety
of applications (Noor et al., 2020).
Figure 1. describes an automated sheep farm that has a computer vision-based sheep breed identification
Jo

system. In a standard sheep farm, it is a must to maintain a proper environment (temperature, humidity, etc.),
especially, if the farm accommodates different types of sheep, then every breed should have a suitable
environment. To be able to ensure that separate spaces or rooms should be reserved for each breed. In the
outdoor environment, when sheep can freely move neither it is possible to control the environment nor it is
necessary. It is essential to control the internal environment of any blocked room to suit the needs of a specific
breed. And there comes the machine learning-based sheep breed identification system into play. It is difficult to
monitor the sheep when they are entering their respective room using a human observer. To make the situation
easier a CC camera can be set up in front of the entrance of every room. Each CC camera will be connected to
different threads of a computer where each thread gives a green signal to a specific breed but gives a red signal
and triggers an alarm in case of the other breeds. The whole system works via a cloud-based system where the
machine learning model is placed. Additionally, an integrated farm monitoring system and e-commerce
application will be linked to the cloud-based system. This allows farms to showcase their sheep images to
potential customers. Both farmers and customers can utilize the machine learning models within the system to
accurately identify sheep breeds. Moreover, the cloud system provides access to essential information
concerning food supplements and medicines specific to each breed.
Journal Pre-proof

of
ro
-p
re
lP
na
ur

Figure 1. Automated Sheep Farm


Jo

Our proposed machine learning model will be integrated with the cloud system for the cameras to access.
Previously, some machine learning models for sheep classification were developed using VGG16 (by tuning it),
InceptionV3, ResNet, etc. pre-trained models. But primarily focused on the Ensemble method to develop our
model. For this purpose, we have used transfer learning using various pre-trained models like VGG16,
Xception, InceptionV3, DenseNet121, and InceptionResNetV2. To get the best output we tried different
optimizers and loss functions. Finally, to ensemble the model we used multiple meta-learners which will be
described in detail in the methodology section. In the result section, the findings are represented in both tabular
and graphical forms from multiple perspectives. We have discussed the evaluation of the experimental results
and other verdicts related to our experiments and the experiments of others.

Related Works
Computer vision and artificial intelligence (AI) systems have a wide range of applications, which include
identification, classification, and prediction in many fields. These technologies offer valuable benefits in
identifying farmhouse animals precisely (Noor et al., 2020). Extensive research has focused on applying
computer vision (CV) techniques to classify and manage livestock based on various features. Several studies
have developed these applications and methods. Spoliansky et. Al. (Spoliansky et al., 2016) used a clustered
polynomial regression model, and the Convolutional Neural Network achieved good accuracy levels in
cleanliness (Corporation, 2018), Van et. Al. (Hertem et al., 2014) developed a computer vision-based algorithm
for automated lameness scoring, and Lu et. Al. used support vector machines (SVM). The implementation of
Journal Pre-proof

computer vision (CV) techniques for sheep farms has been constrained by challenges such as accurately
segmenting individual sheep from a uniform-colored flock (Lu et al., 2017), predicting the naturally deformable
body shape of sheep (Kassler, 2001), and extracting relevant body features in the presence of wool (Burke et al.,
2004).
There is some significant research in image classifications especially on the Sheep breed dataset. Sheep
producers often face challenges in identifying sheep breeds, particularly those without extensive experience in
the field. Different breeds of sheep are in many cases phenotypically diverse.
Carneiro et al. (Carneiro et al., 2010) were able to effectively differentiate eleven breeds by employing a
minimal set of three body measurements, including shoulder height, head width, and length. Asamoah Boaheng
et al. (Asamoah-Boaheng and Sam, 2016) employed a mathematical model to categorize three African sheep
breeds based on six body measurements, resulting in an accuracy rate of 86.2% in classification. In another
study conducted by Searle et al. (Searle et al., 1989), they observed that one breed exhibited longer legs and
smaller shoulders compared to the other breed, even when considering the same live weight. The industry can
derive advantages from the utilization of computer vision (CV) and machine learning (ML) approaches, as they
can leverage subtle variations in appearance among different breeds. Moreover, alternative approaches such as
DNA detection for identifying breeds can incur high costs (Abu Jwade et al., 2019). Various research studies
have utilized artificial intelligence techniques in a range of domains, such as sheep breed identification

of
(Agrawal et al., 2021) (Salama et al., 2019) (Diego André Sant’Ana et al., 2022), classifying facial expressions
(Noor et al., 2020), analyzing voice patterns (Papadaki et al., 2021), studying foraging behaviors (Singh et al.,
2022), and identifying male and female breeds (Diego André Sant’Ana et al., 2022). Koklu et al. (Koklu et al.,

ro
2022) obtained a classification accuracy of 92.3% by employing the InceptionV3 CNN model as input for KNN,
SVM, and ANN classifiers. Agrawal et al. (Agrawal et al., 2021) utilized ensemble learning and conducted a
-p
comparative analysis with five advanced transfer learning models, namely ResNet50, VGG16, VGG19,
InceptionV3, and Xception. The evaluation was based on multiple metrics including accuracy, log loss, recall
score, F1 score, and precision rate. Hitelman et al. (Hitelman et al., 2022) created a system for identifying sheep
re
based on facial images in 2022. They evaluated different transfer learning techniques and found that the
ResNet50V2 model combined with the ArcFace loss function yielded the best outcomes. The system achieved
an average accuracy of 95% for the two groups tested, but when transfer learning methods were applied, the
lP

average identification accuracy improved to 97%. The objective of the current study is to develop an Ensemble
method that will combine multiple CNN models developed by applying transfer learning techniques using
various pre-trained models to achieve even higher accuracy. Pan et al. (Pan et al., 2023) introduced a
methodology that utilizes self-activated enhanced convolutional neural networks (CNN) along with self-transfer
na

learning. They assessed this approach on a pair of buffalo varieties, specifically Neli-Ravi and Khundi, and an
additional category comprising various buffalo breeds referred to as Mix. The study achieved a peak accuracy of
93% using SVM and achieved an accuracy exceeding 85% with the application of recent variations. Table 1.
shows the comparison study of various models used in previous sheep identification experiments.
ur

Table 1: Comparison table of different models of similar studies


Jo

Year Authors Dataset Class Methodology Result


Abu Jwade et
2019 1642 4 Fine Tuned VGG-16 95%
al.
KOKLU et.
2021 1680 4 ANN Model: InceptionV3 92.3%
al.
2022 Agrawal et al. 1680 4 Ensemble: VGG16 & ResNet50 97.32%
Hitelman et
2022 81 2 ResNet50V2 95%
al.
Proposed Stacked Ensemble: (Xception, VGG16, InceptionV3, InceptionResNetV2,
2023 1680 4 97.92%
Model DenseNet121) using Random Forest

Methodology and Implementation


Dataset
We used the Sheep Breed dataset which contains 1680 images. The dataset was downloaded from the Kaggle
Website which was originally collected by S. Abu Jwade, A. Guzzomi, and A. Mian (Abu Jwade et al., 2019)
from Kingston Rest, a commercial sheep-producing farm in the South-West of Western Australia. We split the
dataset into three portions: train images (1392), validation images (144), and test images (144) of the total data
which is shown in Table 2. These images have no diversity in terms of quality and size.

Table 2. Dataset Description


Journal Pre-proof

Total images Train images Val images Test images

Marino 348 36 36
Poll Dorset 348 36 36
Suffolk 348 36 36
White Suffolk 348 36 36
Grand Total 1392 144 144
System Architecture
This section provides a concise overview of several pre-trained models chosen for their emphasis on efficiency,
performance, or both. The selected models include Xception (Team, 2017a), VGG16 (Team, 2017b),
InceptionV3 (Team, 2017c), InceptionResNetV2 (Team, 2017d), and DenseNet121 (Huang et al., 2016).
Xception utilizes depth-wise separable convolutions to enhance efficiency and performance, trained on the
ImageNet (Yang et al., 2020) dataset. It has a model size of 88 MB, 22.9M parameters, and a depth of 81.
VGG16, also trained on ImageNet, comprises 16 layers with a size of 528 MB, 138.4M parameters, and a depth
of 16. InceptionV3 employs a combination of different convolutions and pooling layers for efficient image
processing, with a size of 92 MB, 23.9M parameters, and a depth of 189. InceptionResNetV2 merges Inception
and ResNet architectures, achieving outstanding results in image classification challenges, with a size of 215

of
MB, 55.9M parameters, and a depth of 449. DenseNet121 adopts a unique dense block architecture, connecting
each layer to all others to promote feature reuse and reduce parameters, with a size of 33 MB, 8.1M parameters,

ro
and a depth of 242.
In our experiment, we utilized these 5 machine learning models and tested 3 optimizers (Adam, Adamax, and
RMSprop) along with 2 loss functions (categorical cross-entropy and Kullback Leibler Divergence). For each
-p
model, we conducted 6 experiments to identify optimal hyperparameter settings. Based on their accuracy, we
selected the best-performing models to apply the ensemble technique. Among the models, one was chosen from
each, except for Xception, which had two models selected from different combinations. Ensemble techniques
re
involve combining the predictions of multiple individual models to improve overall performance. Various
machine-learning ensemble techniques exist, including voting (Opitz and Maclin, 1999), bagging (Breiman,
1996), boosting (Freund and Schapire, 1996), and stacking (Wolpert, 1992), among others. In this study, we
lP

have employed a stacking-based ensemble classification method, which is widely recognized for enhancing
predictive performance. This approach involves training multiple individual models, also known as base
learners, on the training data. Their predictions were then combined using a meta-model, which can range from
a simple linear regression or decision tree to a more intricate model like another neural network. Stacking is
na

particularly advantageous as it can capture intricate data patterns and yield superior predictions compared to a
single-base learner. However, it is important to note that stacking can be computationally intensive and
necessitates careful tuning to prevent overfitting.
In the 2nd phase, meta-learners were used for the ensemble. In this particular experiment, we have applied the
ur

following 10 algorithms as meta-learners.


Logistic Regression (Berkson, 1944) is a statistical method that examines the relationship between a binary
outcome variable and one or more independent variables. It calculates the likelihood of an event occurring by
Jo

using input variables and a logistic function to describe the association between the dependent and independent
variables. This model is commonly used for binary classification tasks and offers interpretability, speed, and
efficiency, especially for large datasets.
K Nearest Neighbor (KNN) (Cover and Hart, 1967) is a supervised machine learning technique used for
classification and regression. It works by identifying the K nearest data points in the training set to a new data
point and assigning a class based on the majority class among its neighbors. While KNN is straightforward and
powerful, it can be computationally expensive for large datasets and requires careful selection of the K value.
Support Vector Machine (SVM) (Cortes and Vapnik, 1995) is a well-known machine-learning technique
suitable for classification and regression. It aims to find the optimal hyperplane that separates data points into
distinct classes while maximizing the margin between the hyperplane and the closest data points. SVM can
handle high-dimensional data and is effective in scenarios requiring complex and non-linear decision
boundaries. It finds applications in various domains, including image classification, bioinformatics, and natural
language processing.
A decision Tree (Freund and Schapire, 1997) is a popular machine-learning algorithm used for classification and
regression tasks. It recursively partitions the data based on significant attributes, creating a tree-like structure
where internal nodes represent decisions based on attributes and leaf nodes represent classification or regression
predictions. The algorithm is simple, interpretable, and can handle both categorical and numerical data.
However, it can suffer from overfitting and sensitivity to small data variations.
Journal Pre-proof

Random Forest (Breiman, 2001) is a widely used machine learning algorithm for classification and regression
tasks. It operates by iteratively dividing the data based on important attributes, creating a tree structure where
internal nodes make decisions and leaf nodes provide predictions. Random Forest is straightforward,
interpretable, and capable of handling categorical and numerical data. However, it may face challenges like
overfitting and sensitivity to minor data variations.
AdaBoost Classifier (Freund and Schapire, 1997) is an ensemble machine learning algorithm that combines
multiple "weak" classifiers to create a powerful "strong" classifier. It gives higher importance to misclassified
samples from previous iterations and updates the model accordingly in each round. By aggregating the
predictions of the weak learners, the final model generates robust predictions. AdaBoost Classifier applies to
both binary and multi-class classification tasks.
XGBoost (Chen and Guestrin, 2016), or Extreme Gradient Boosting, is an ensemble machine learning algorithm
based on decision trees. It is widely used in classification and regression tasks and employs a gradient-boosting
framework to enhance the performance of weak models. XGBoost is known for its scalability, speed, and
accuracy. It constructs a sequence of decision trees, with each tree correcting the errors made by its predecessor.
By combining the predictions of these trees, the algorithm generates the final prediction. XGBoost offers a
range of hyperparameters that can be adjusted to customize and fine-tune the model's behavior.
The Gradient Boost Regressor (scikit-learn, 2023) is a machine-learning algorithm used for regression tasks. It

of
is a variant of the gradient boosting method that combines multiple weak regression models to create a stronger
predictive model. The algorithm iteratively fits new models to the residual errors of the previous models,

ro
gradually reducing the overall prediction error. It optimizes the model's hyperparameters using gradient descent
and utilizes boosting techniques to improve its performance. The Gradient Boost Regressor is recognized for its
ability to handle complex data and deliver accurate predictions in regression problems.
-p
The Gradient Boost Classifier (Friedman, 2001) is a machine learning technique that constructs a predictive
model by sequentially combining multiple weak models. Each new model is trained to correct the mistakes
made by the previous models. This algorithm minimizes a loss function using gradient descent and fine-tunes
re
the model's hyperparameters through a process called boosting. Widely used for classification tasks, the
Gradient Boost Classifier is known for its exceptional accuracy and ability to handle complex datasets.
Gaussian Naive Bayes (Duda, 2012) is a classification algorithm based on Bayes' theorem and the assumption of
lP

feature independence. It is suitable for continuous or numeric data that follows a Gaussian distribution. In this
algorithm, each feature is assumed to be independent and normally distributed within each class. The model
calculates the probability of a data point belonging to each class using Bayes' theorem and selects the class with
the highest probability as the predicted class. Gaussian Naive Bayes is simple, efficient, and effective in
na

handling high-dimensional data. However, it may not perform well if the assumption of feature independence or
Gaussian distribution is violated.
In our experiments, among the 4 meta-learners random forest outperforms the others. Therefore, our proposal
involves utilizing the random forest as a meta-learner in the stacking process to achieve the most optimal
ur

outcome from the base models. The general architecture of our experiment is given in Figure 2.
Random Forest is good for finding the global maxima. Random Forest creates a collection of decision trees
during training. In our case, we have used six different transfer learning approaches which are used in different
Jo

decision trees within the Random Forest ensemble method. Within each decision tree, the random forest
algorithm tries to find the global maxima several times starting from different nodes. In the final step, the
algorithm again tries to find the maximum value from each maximum values from every decision tree. The
whole stacking process is done by following this method.
Journal Pre-proof

of
ro
-p
re
Figure 2. System Architecture of our proposed model

Experimental Setup
lP

In the initial stage to generate the base model using the transfer learning the data augmentation technique is
applied within the runtime to get better results from the training phase Table 3 presents the optimization of data
augmentation parameters, while Table 4 describes the process of hyperparameter optimization. We conducted
experiments using various combinations of epochs (5, 10, 15, 20, 25, and 30) and batch sizes (8, 16, and 32) to
na

evaluate the results. Based on our findings, the experiment yielded the best results when using 25 epochs and a
batch size of 32. Additionally, we explored different learning rates, including 0.001, 0.0001, and 0.00001.
Setting the learning rate to 0.001 resulted in unstable outcomes. However, reducing the learning rate improved
ur

result stability at the expense of increased training time. Further decreasing the learning rate below 0.0001 only
prolonged training time without additional improvements. Consequently, we set the learning rate to 0.0001 as it
provided the optimal balance between stability and training time.
Jo

Table 3. Data Augmentation


Table 4. Hyperparameter Hyperparameter Optimization Space
Epoch 25
Optimization
Batch size 32
Parameter Value
Learning rate 0.0001
Rescale 1./255
Optimizer ‘Adam’, ‘Adamax’, ‘RMSprop’
Zoom range 0.3
Loss function [Categorical cross entropy],
Rotation range 15
[Kullback Leibler Divergence]
Horizontal flip TRUE

After conducting the aforementioned optimizations, we performed multiple Transfer Learning processes
utilizing various optimizers and loss functions. The experimental combinations implemented in this research,
resulting in the base model for the ensemble method, are presented in Table 5.

Table 5. Transfer Learning Combination


Pretrained Model Optimizer Loss function Calculation Total combination
5 3 2 5×3×2 30
Results
Accuracy
Journal Pre-proof

In Table 6, a comprehensive breakdown is shown regarding loss, accuracy, and ROC scores for each
combination of transfer learning utilized in these experiments. The selected base models are indicated as
highlighted entries in the table. For most pre-trained models, the best results obtained from each of them were
selected, except for Xception, from which two models were selected. In Figure 3. the loss and accuracy curves
for the selected models are demonstrated.

Table 6. Accuracy details for Transfer Learning


Model Optimizer Loss Learning Train Train Valid Valid Test ROC
Function Rate Loss Accuracy Loss Accuracy Accuracy
Adam CCE 0.0001 0.16 0.9447 0.4525 0.8335 0.8333 0.96457
Adam KLD 0.0001 0.1748 0.9368 0.5259 0.7996 0.7986 0.95203
Xception

Adamax CCE 0.0001 0.2465 0.9173 0.5401 0.7849 0.7639 0.94322


Adamax KLD 0.0001 0.227 0.9342 0.538 0.758 0.7569 0.94212
RMSprop CCE 0.0001 0.2538 0.903 0.4002 0.8512 0.8472 0.96842
RMSprop KLD 0.0001 0.2176 0.9206 0.5453 0.8556 0.8056 0.9573
Adam CCE 0.0001 0.4398 0.8737 0.6548 0.7092 0.7292 0.92984
Adam KLD 0.0001 0.4464 0.8685 0.6587 0.7451 0.7431 0.93383
VGG16

Adamax CCE 0.0001 0.6658 0.7852 0.8393 0.6856 0.6806 0.89924


Adamax KLD 0.0001 0.6651 0.7975 0.839 0.6906 0.6806 0.89017

of
RMSprop CCE 0.0001 0.434 0.8724 0.7367 0.6788 0.6458 0.93132
RMSprop KLD 0.0001 0.4204 0.8698 0.6774 0.7093 0.7083 0.93634
Adam CCE 0.0001 0.2005 0.931 0.5007 0.7679 0.7639 0.94508
InceptionV3

ro
Adam KLD 0.0001 0.2352 0.9141 0.5185 0.7799 0.7778 0.9447
Adamax CCE 0.0001 0.277 0.903 0.7007 0.7253 0.7222 0.91134
Adamax KLD 0.0001 0.3042 0.8958 0.5778 0.7988 0.7917 0.93209
RMSprop CCE 0.0001 0.3426 0.8835 0.6258 0.7565 0.75 0.93737
RMSprop KLD 0.0001 0.3758
-p 0.8717 1.2137 0.6799 0.6389 0.98782
DenseNet121 InceptionResNet

Adam CCE 0.0001 0.1978 0.9382 0.6899 0.7578 0.7569 0.92438


Adam KLD 0.0001 0.1869 0.9375 0.6069 0.8148 0.8125 0.93679
Adamax CCE 0.0001 0.2864 0.9043 0.5807 0.7647 0.7639 0.92348
re
V2

Adamax KLD 0.0001 0.3104 0.8965 0.6579 0.7091 0.7083 0.8993


RMSprop CCE 0.0001 0.2831 0.8958 0.6509 0.7951 0.7917 0.94495
RMSprop KLD 0.0001 0.3164 0.8854 0.8544 0.745 0.7222 0.89821
lP

Adam CCE 0.0001 0.0966 0.9707 0.6158 0.7788 0.7778 0.94341


Adam KLD 0.0001 0.129 0.9564 0.7891 0.7461 0.7431 0.94772
Adamax CCE 0.0001 0.2322 0.9199 0.6419 0.7721 0.7708 0.93788
Adamax KLD 0.0001 0.2177 0.9368 0.6039 0.7821 0.75 0.93692
RMSprop CCE 0.0001 0.1787 0.9349 0.5078 0.8077 0.8056 0.9528
na

RMSprop KLD 0.0001 0.1879 0.931 0.9609 0.7449 0.7431 0.93589


ur
Jo

Figure 3. Accuracy Curve for Selected Base Models

Classification Report
Journal Pre-proof

The F-1 score is a metric commonly used in classification reports to assess the overall performance of a model
in binary or multi-class classification tasks. It is a harmonic mean of precision and recall, providing a balanced
measure of a model's accuracy. Precision measures the proportion of true positive predictions out of all positive
predictions made by the model. It evaluates the model's ability to correctly identify positive instances. Recall,
also known as sensitivity or true positive rate, measures the proportion of true positive predictions out of all
actual positive instances in the dataset. It assesses the model's ability to correctly capture all positive instances.
The F-1 score combines precision and recall into a single metric, providing a balanced evaluation of a model's
performance. It is particularly useful when dealing with imbalanced datasets or when both precision and recall
are equally important. The F-1 score ranges from 0 to 1, where 1 represents perfect precision and recall, and 0
represents the worst performance. Equations (1), (2), (3), and (4) show the formula of precision, recall, F1 score,
and accuracy respectively. Table 7. Represents the classification report of the transfer learning models.

𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = … … … (1)
𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒+𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒

𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒
𝑅𝑎𝑐𝑎𝑙𝑙 = … … … (2)
𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒+𝐹𝑎𝑙𝑠𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒

of
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛∗𝑅𝑒𝑐𝑎𝑙𝑙
𝐹1 𝑆𝑐𝑜𝑟𝑒 = 2 ∗ … … … (3)
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛+𝑅𝑒𝑐𝑎𝑙𝑙

ro
𝑇𝑟𝑢𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒+𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒
𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 = … … … (4)
𝑇𝑟𝑢𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒+𝐹𝑎𝑙𝑠𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒+𝑇𝑟𝑢𝑒 𝑃𝑜𝑠𝑖𝑡𝑖𝑣𝑒+𝐹𝑎𝑙𝑠𝑒 𝑁𝑒𝑔𝑎𝑡𝑖𝑣𝑒
-p
Table 7. Classification Report of the best combination for each transfer learning model
Model Precision Recall f1-score
Marino 0.6818 0.8333 0.75
re
Poll Dorset 0.8929 0.6944 0.7813
Suffolk 1 0.9444 0.9714
Xception White Suffolk 0.8684 0.9167 0.8919
lP

Accuracy 0.8472
Macro-F1 0.8486
Weighted-F1 0.8486
Marino 0.5614 0.8889 0.6882
Poll Dorset 0.6786 0.5278 0.5937
na

Suffolk 1 0.9167 0.9565


VGG16 White Suffolk 0.8846 0.6389 0.7419
Accuracy 0.7431
Macro-F1 0.7451
ur

Weighted-F1 0.7451
Marino 0.6 0.75 0.6667
Poll Dorset 0.7097 0.6111 0.6567
Suffolk 0.973 1 0.9863
Jo

InceptionV3 White Suffolk 0.9355 0.8056 0.8657


Accuracy 0.7917
Macro-F1 0.7938
Weighted-F1 0.7938
Marino 0.6327 0.8611 0.7294
Poll Dorset 0.8421 0.4444 0.5818
Suffolk 0.973 1 0.9863
InceptionResNetV2 White Suffolk 0.8718 0.9444 0.9067
Accuracy 0.8125
Macro-F1 0.801
Weighted-F1 0.801
Marino 0.6842 0.7222 0.7027
Poll Dorset 0.6944 0.6944 0.6944
Suffolk 1 0.9444 0.9714
DenseNet121 White Suffolk 0.8611 0.8611 0.8611
Accuracy 0.8056
Macro-F1 0.8074
Weighted-F1 0.8074
Confusion Matrix
Based on Figure 4. the confusion matrices of the ensemble learning's top 6 base models are displayed. It is
evident that the majority of misclassifications occur with Poll Dorset, denoted as P (1) in the confusion matrices.
Interestingly, Poll Dorset is frequently misidentified as Marino, while the misclassification rates for other breeds
remain quite low.
Journal Pre-proof

of
ro
-p
re

Figure 4. Confusion Matrices of Top 6 Base Models


lP

ROC Curve
In Figure 5. the ROC (Receiver Operating Characteristic) curves are shown which represent a graphical
illustration of a binary classifier's performance. It showcases the trade-off between the true positive rate (TPR)
na

and the false positive rate (FPR) at various classification thresholds. In evaluating the overall performance of a
classifier, the area under the ROC curve (AUC-ROC) is a widely used metric. It ranges from 0 to 1, where a
value of 0.5 signifies a random guess and a value of 1 indicates a perfect classifier. A higher AUC-ROC value
ur

indicates a superior classifier. Only the ROC curves for the selected top 6 base models are presented for
convenience.
Jo
Journal Pre-proof

of
ro
-p
Figure 5. ROC Curve for Top 6 Base Models

Ensemble Classification
re
From the transfer learning-based approaches, we have selected the top 6 base models that have the highest
accuracy and ROC score. Table 8. represents those models along with their respective optimizers and loss
functions. In the model evaluation presented in Table 9. & Figure 6. random forest demonstrated superior
lP

performance compared to other meta-classifiers when combined with different base models. Consequently, we
have opted to recommend an ensemble design for the proposed system, where the top six models are utilized as
base models and random forest serves as the meta-classifier. The proposed method achieved a classification
accuracy of 97.92%. Figure 7. illustrates the average accuracy, accuracy for each class individually, and the rate
na

of misclassification.

Table 8. The selected base model for ensemble learning


Model name Combination Accuracy ROC
ur

Pretrained Model Optimizer Loss function


Model 1 Xception RMSprop CCE 0.8472 0.96842
Model 2 Xception Adam CCE 0.8333 0.96457
Jo

Model 3 VGG16 Adam KLD 0.7431 0.93383


Model 4 InceptionV3 Adamax KLD 0.7917 0.93209
Model 5 InceptionResNetV2 Adam KLD 0.8125 0.93679
Model 6 DenseNet121 RMSprop CCE 0.8056 0.9528
Table 9. Test accuracy comparison of ensemble approaches using different meta-learners
Accuracy (%)
Model Combinatio Logistic AdaBoos XGB GB GB Gaussia
Decisio Random
s n Regressio KNN SVM t Classifie Regresso Classifie n
n Tree Forest
n Classifier r r r NB
Model 0.9090 0.9032 0.91743
Top 2 0.90047 0.81999 0.84897 0.8899 0.87782 0.88038 0.89201
(1,5) 9 2 1
Model 0.9023 0.8796
Top 3 0.91818 0.88262 0.92592 0.82142 0.91588 0.92376 0.90825 0.88392
(1,5,6) 2 2
Model 0.9056
Top 4 0.90825 0.9266 0.88479 0.91588 0.85308 0.91162 0.92444 0.89908 0.88571
(1,5,6,4) 6
Model 0.9259 0.9158
Top 5 0.92093 0.90582 0.91818 0.74725 0.93636 0.92982 0.93859 0.8909
(1,5,6,4,3) 2 8
Model 0.9252 0.9230
Top 6 0.91079 0.9074 0.9792 0.88235 0.92233 0.92307 0.93457 0.88584
(1,5,6,4,3,2) 3 7
Journal Pre-proof

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

of
Logistic KNN SVM Decision Random AdaBoost XGB GB GB Gaussian
Regression Tree Forest Classifier Classifier Regressor Classifier NB

ro
Top 2 Top 3 Top 4 Top 5 Top 6

Figure 6. Selected neural networks as the base model for ensemble learning
-p
re
lP
na
ur
Jo

Figure 7. Confusion matrix for ensemble method using SVM on top 6 models

Table 10, demonstrate the test accuracy comparison similar to Table 9 but on our self-collected dataset. We
have collected 400 pictures (100 pictures for each category) from various online and offline sources other than
the actual dataset to compare the models in terms of real-world applicability. To our amazement we have found
that our models demonstrate significant performance on completely new test dataset also. Figure 8, shows some
example images of self-collected dataset.

Table 10. Test accuracy comparison of ensemble approaches on self-collected dataset


Accuracy (%)
Models Combination Logistic Decision Random AdaBoost XGB GB GB Gaussian
KNN SVM
Regression Tree Forest Classifier Classifier Regressor Classifier NB
Model
Top 2 0.8760 0.8525 0.8875 0.9030 0.9583 0.9205 0.8986 0.8834 0.9175 0.8888
(1,5)
Model
Top 3 0.8878 0.8355 0.8998 0.8876 0.9216 0.8033 0.9265 0.9291 0.9133 0.8639
(1,5,6)
Model
Top 4 0.9206 0.8558 0.9140 0.8358 0.9439 0.8212 0.8880 0.8856 0.9231 0.9064
(1,5,6,4)
Top 5 Model 0.9260 0.8548 0.9514 0.8382 0.9003 0.7642 0.8644 0.8708 0.9015 0.9213
Journal Pre-proof

(1,5,6,4,3)
Model
Top 6 0.9280 0.8700 0.9298 0.9116 0.9226 0.8990 0.9211 0.9101 0.8957 0.8880
(1,5,6,4,3,2)

of
Figure 8. Example of self-collected dataset

ro
Gradient-weighted Class Activation Mapping
GradCAM (Gradient-weighted Class Activation Mapping) (Selvaraju et al., 2020) is a technique that elucidates
-p
the distinguishing characteristics of an image for its ultimate classification. Within a model, the final activation
layer, positioned just before the output layer, highlights the key features that are depicted in the heatmap. Figure
9 displays four instances of GradCAM images, demonstrating that the region of interest (ROI), which signifies
re
the distinctive characteristics of a specific sheep breed, is relatively similar among the pre-trained models.
However, the ensemble classifier distinctly distinguishes the ROI.
From the study done by Pan et. al. (Pan et al., 2023) it is seen that various features from the whole body of a pig
lP

are identified and used for sorting. In our research, we have only focused on the facial features of the various
sheep breeds. Visual differences in facial features among sheep breeds can help in their differentiation. The face
of a “Marino” sheep usually has a distinctive wrinkled appearance, particularly around the forehead and nose.
Their ears are usually medium-sized and may droop slightly. The face of a “Poll Dorset” sheep is usually clean
na

and free of wool, often white or light in color. Their ears are usually medium to large and can be erect or slightly
drooping. The face of a “Suffolk” sheep is entirely black, including the muzzle, and is free of wool. Their ears
are usually medium-sized and erect. “White Suffolks” have a white face, but they might have some wool
ur

covering parts of the face, especially around the eyes. Some White Suffolks could have a small amount of wool
on the top of their head. As for the eyes, Marino often has large, expressive eyes. Poll Dorsets tend to have
medium-sized, bright eyes. Suffolk usually has relatively large, alert eyes. These might be surrounded by a bit of
Jo

wool, but it's usually not as extensive as in some other breeds. White Suffolk generally has bright and well-
spaced eyes. Their eyes might be more noticeable due to the contrast between their white face and their eyes.
Table 11 are summarizing these features.
Table 11. Various Facial Features of Sheep Breeds
Breeds Wool Color Ears Horns Others
Fine wool Thin-tailed, and a distinctive
Often have spiral
Marino covering the White face. No Significant Feature facial appearance due to the fine
horns
face wool
Poll Medium-sized, Usually polled, Compact and smooth body,
White face No Significant Feature
Dorset thin, and silky. meaning no horns suitable for meat production
No Significant Long and pointed, No Significant Usually polled (no horns), but
Suffolk Black face
Feature with no wool Feature may have scurs in some males
White Generally, no wool Medium-sized, thin, Developed for meat production,
White face Usually polled
Suffolk on the face. and well-positioned known for good carcass quality.
From the GradCAM experiment, we can observe that the above-mentioned features are identified effectively
using a heatmap.
Journal Pre-proof

of
ro
-p
Figure 9. Gradient-weighted Class Activation Mapping using different models using example images
re
Discussion
lP

Our research article focuses on the key findings and the implications, providing a comprehensive analysis of the
results obtained. The primary objective of our study was to develop an automatic sheep breed identification
system using ensemble learning and convolutional neural networks (CNNs) for smart agriculture. Our results
demonstrate the effectiveness of the proposed approach in accurately identifying sheep breeds based on their
na

facial features.
In previous research, a singular pre-trained model was used for the classification. Those models are fine-tuned
to increase the accuracy. However, fine-tuning a singular model can only increase the accuracy to a certain
extent. Stacking different models has the benefit of extracting the features using different architectures. For this
ur

reason, we have implemented the ensemble classifier which outperformed individual pre-trained models, as
evident from the clear distinction of the region of interest (ROI) in the GradCAM images. This suggests that
combining multiple models enhances the classification accuracy significantly and improves the interpretability
Jo

of the results.
The ability to automatically recognize sheep breeds holds significant value for the sheep industry, as it enables
farmers to assess the commercial worth of their flocks more accurately. By differentiating between breeds,
farmers can make informed decisions regarding meat yield estimation and cost management. The automatic
breed identification system provides valuable insights that can aid farmers in optimizing their flock's
productivity and profitability. However, there are some limitations to consider. The accuracy of breed
identification may be influenced by various factors, such as image quality, lighting conditions, and variations in
facial features among individual sheep. Further research and refinement of the system can address these
limitations, potentially enhancing its robustness and accuracy.
When a specific machine learning model is crafted using a particular dataset, it inherits a bias since its features
are derived from a specific set of images. In our scenario, we employed a dataset comprising four categories,
each with a limited image count. Consequently, when subjecting a new image to this model, accurate
classification is only achievable if the pre-extracted features align with the new image's pattern. However, when
the new test image embodies a novel pattern unfamiliar to the model, erroneous outcomes could arise. For
instance, Rambouillet bears a striking resemblance to Marino. Consequently, if we introduce test images of
Rambouillet, the model is prone to frequently misclassifying them as Marino. This can be also be the case for
hybrid breeds which also resemble Marino. To mitigate this, the model must be trained on an extensive array of
images. Nonetheless, there will always be certain images within a specific category exhibiting fresh patterns,
Journal Pre-proof

distinct from those previously encountered. Thus, a predictive bias will persist, albeit one that can be diminished
through the utilization of a larger dataset.
In terms of new research directions, we might consider integrating other data sources, such as sound or sensor
data, which could provide additional cues for breed identification and make our system more robust. Exploring
techniques for making our model’s decision-making process more transparent and understandable to end-users,
especially farmers who may not be familiar with deep learning, is crucial. Investigating the feasibility of
deploying our model on edge devices for real-time, on-farm use to reduce the need for constant internet
connectivity is another avenue to explore. Additionally, considering privacy implications and methods for
anonymizing or securing the data, given that our system deals with images of animals, is important.
Collaborating with farmers to understand their specific needs and challenges, and ensuring that our solution
aligns with practical, on-farm requirements, is essential. Lastly, conducting long-term studies to assess how well
our system performs in real-world farming scenarios over extended periods would provide valuable insights for
future improvements. For continuous training of the model with the help of the farmer federated learning can be
implemented in the future.

Conclusion
Our research demonstrates the feasibility and effectiveness of using ensemble learning approaches for automatic

of
sheep breed identification in smart agriculture. The developed system offers a cost-effective solution for
farmers, enabling them to make informed decisions and optimize their flock management. The integration of

ro
farm monitoring and e-commerce capabilities further enhances the value of the system for both farmers and
customers. Continued advancements in this field have the potential to revolutionize sheep farming practices,
improving productivity and profitability in the industry. Without any intervention of an experienced breeder,
-p
any novice farmer can benefit from the model while the potential customers can also easily identify any sheep
breed without any hassle. Some of the previous research also attempted to develop sheep breed identification
models where the classification accuracy was lower than that of ours. We were able to achieve 97.92% accuracy
re
which is so far the highest accuracy gained up to this day. In the future, this model can be improved even further
by adding new data to the training process.
lP

Funding
This research did not receive any specific grant from funding agencies in the public, commercial, or
not-for-profit sectors.
na

Reference

Abu Jwade, S., Guzzomi, A., Mian, A., 2019. On farm automatic sheep breed classification using deep learning.
Computers and Electronics in Agriculture 167, 105055. https://doi.org/10.1016/j.compag.2019.105055
ur

Agrawal, D., Minocha, S., Namasudra, S., Kumar, S., 2021. Ensemble Algorithm using Transfer Learning for
Sheep Breed Classification [WWW Document]. IEEE Xplore. https://doi.org/10.1109/SACI51354.2021.9465609
Ah, K., Ah, C., Jn, C., Dm, D., 1984. Dressing percentages of lambs. Proceedings of the New Zealand Society of
Jo

Animal Production 44, 231–234.


Asamoah-Boaheng, M., Sam, E.K., 2016. Morphological characterization of breeds of sheep: a discriminant
analysis approach. SpringerPlus 5. https://doi.org/10.1186/s40064-016-1669-8
Berkson, J., 1944. Application to the Logistic Function to Bio-Assay. Journal of the American Statistical
Association 39, 357. https://doi.org/10.2307/2280041
Breiman, L., 2001. Random Forests. Machine Learning 45, 5–32. https://doi.org/10.1023/a:1010933404324
Breiman, L., 1996. Bagging predictors. Machine Learning 24, 123–140.
Burke, J.A., Nuthall, P.L., McKinnon, A.E., 2004. An analysis of the feasibility of using image processing to
estimate the live weight of sheep. researcharchive.lincoln.ac.nz.
Carneiro, H., Louvandini, H., Paiva, S.R., Macedo, F., Mernies, B., McManus, C., 2010. Morphological
characterization of sheep breeds in Brazil, Uruguay and Colombia. Small Ruminant Research 94, 58–65.
https://doi.org/10.1016/j.smallrumres.2010.07.001
Chen, T., Guestrin, C., 2016. XGBoost: A Scalable Tree Boosting System. Proceedings of the 22nd ACM
SIGKDD International Conference on Knowledge Discovery and Data Mining - KDD ’16 785–794.
https://doi.org/10.1145/2939672.2939785
Corporation, A.M.P., 2018. Automated Visual Inspection and Preparation of Live Animals for Meat Processing.
Cortes, C., Vapnik, V., 1995. Support-vector networks. Machine Learning 20, 273–297.
https://doi.org/10.1007/bf00994018
Journal Pre-proof

Cover, T., Hart, P., 1967. Nearest neighbor pattern classification. IEEE Transactions on Information Theory 13,
21–27. https://doi.org/10.1109/tit.1967.1053964
Diego André Sant’Ana, Carneiro, M., Augusto, J., Astolfi, G., Wellington Pereira Soares, Neves, L., Heimbach,
S., Weber, V., Rodrigo Gonçalves Mateus, Hemerson Pistori, 2022. Computer vision system for superpixel classification and
segmentation of sheep. Ecological Informatics 68, 101551–101551. https://doi.org/10.1016/j.ecoinf.2021.101551
Duda, R.O., 2012. Pattern Classification, 2nd Edition | Wiley [WWW Document]. Wiley.com. URL
https://www.wiley.com/en-us/Pattern+Classification%2C+2nd+Edition-p-9780471056690 (accessed 2.27.23).
Freund, Y., Schapire, R., 1996. Experiments with a New Boosting Algorithm.
Freund, Y., Schapire, R.E., 1997. A Decision-Theoretic Generalization of On-Line Learning and an Application to
Boosting. Journal of Computer and System Sciences 55, 119–139. https://doi.org/10.1006/jcss.1997.1504
Friedman, J.H., 2001. Greedy Function Approximation: A Gradient Boosting Machine. The Annals of Statistics
29, 1189–1232.
Hertem, T.V., Viazzi, S., Steensels, M., Alchanatis, V., Schlageter-Tello, A.A., Lokhorst, K., Romanini, E.C.B.,
Bahr, C., Berckmans, D., Halachmi, I., 2014. Automatic lameness detection based on consecutive 3D-video recordings.
Biosystems Engineering 119, 108–116. https://doi.org/10.1016/j.biosystemseng.2014.01.009
Hitelman, A., Edan, Y., Godo, A., Berenstein, R., Lepar, J., Halachmi, I., 2022. Biometric identification of sheep
via a machine-vision system. Computers and Electronics in Agriculture 194, 106713.

of
https://doi.org/10.1016/j.compag.2022.106713
Huang, G., Liu, Z., Weinberger, Kilian Q, 2016. Densely Connected Convolutional Networks [WWW Document].
arXiv.org. URL https://arxiv.org/abs/1608.06993

ro
Kassler, M., 2001. Automatic Counting of Sheep | Meat & Livestock Australia [WWW Document]. MLA
Corporate. URL https://www.mla.com.au/research-and-development/reports/2001/automatic-counting-of-sheep/ (accessed
11.16.23).
-p
Koklu, M., Cinar, I., Taspinar, Y.S., Kursun, R., 2022. Identification of Sheep Breeds by CNN- Based Pre-Trained
Inceptionv3 Model [WWW Document]. IEEE Xplore. https://doi.org/10.1109/MECO55406.2022.9797214
Lu, Y., Mahmoud, M., Robinson, P., 2017. Estimating Sheep Pain Level Using Facial Action Unit Detection. 2017
re
12th IEEE International Conference on Automatic Face & Gesture Recognition (FG 2017).
https://doi.org/10.1109/fg.2017.56
lP

MLA, 2017. Market Information Services SHEEP ASSESSMENT MANUAL.


Noor, A., Zhao, Y., Koubaa, A., Wu, L., Khan, R., Abdalla, F.Y.O., 2020. Automated sheep facial expression
classification using deep transfer learning. Computers and Electronics in Agriculture 175, 105528.
https://doi.org/10.1016/j.compag.2020.105528
na

Opitz, D., Maclin, R., 1999. Popular Ensemble Methods: An Empirical Study. Journal of Artificial Intelligence
Research 11, 169–198. https://doi.org/10.1613/jair.614
Pan, Y., Jin, H., Gao, J., Rauf, H.T., 2022. Identification of Buffalo Breeds Using Self-Activated-Based Improved
Convolutional Neural Networks. Agriculture 12, 1386. https://doi.org/10.3390/agriculture12091386
ur

Pan, Y., Zhang, Y., Wang, X., Gao, X., Hou, Z., 2023. Low-cost livestock sorting information management system
based on deep learning. Artificial Intelligence in Agriculture 9, 110–126. https://doi.org/10.1016/j.aiia.2023.08.007
Papadaki, K., Laliotis, G.P., Bizelis, I., 2021. Acoustic variables of high-pitched vocalizations in dairy sheep
Jo

breeds. Applied Animal Behaviour Science 241, 105398. https://doi.org/10.1016/j.applanim.2021.105398


Quinlan, J.R., 1986. Induction of decision trees. Machine Learning 1, 81–106. https://doi.org/10.1007/bf00116251
Rowe, J., Atkins, K., Pope, C., 2007. Precision sheep production - pipedream or reality? [WWW Document].
Semantic Scholar. URL https://www.semanticscholar.org/paper/Precision-sheep-production-pipedream-or-reality-Rowe-
Atkins/b309e518d29079f90d4feeb9fd3345b8e9f2ae3c (accessed 11.16.23).
Salama, A., Hassanien, A.E., Fahmy, A., 2019. Sheep Identification Using a Hybrid Deep Learning and Bayesian
Optimization Approach. IEEE Access 7, 31681–31687. https://doi.org/10.1109/access.2019.2902724
Sarwar, F., Griffin, A., Periasamy, P., Portas, K., Law, J., 2018. Detecting and Counting Sheep with a
Convolutional Neural Network [WWW Document]. IEEE Xplore. https://doi.org/10.1109/AVSS.2018.8639306
scikit-learn, 2023. Gradient Boosting regression [WWW Document]. scikit-learn. URL https://scikit-
learn.org/stable/auto_examples/ensemble/plot_gradient_boosting_regression.html
Searle, T., N. McC. Graham, Donnelly, J.B., Margan, D., 1989. Breed and sex differences in skeletal dimensions
of sheep in the first year of life. The Journal of Agricultural Science 113, 349–354.
https://doi.org/10.1017/s0021859600070039
Selvaraju, R.R., Cogswell, M., Das, A., Vedantam, R., Parikh, D., Batra, D., 2020. Grad-CAM: Visual
Explanations from Deep Networks via Gradient-based Localization. International Journal of Computer Vision 128, 336–359.
https://doi.org/10.1007/s11263-019-01228-7
Journal Pre-proof

Singh, D., Taspinar, Y.S., Kursun, R., Cinar, I., Koklu, M., Ozkan, I.A., Lee, H.-N., 2022. Classification and
Analysis of Pistachio Species with Pre-Trained Deep Learning Models. Electronics 11, 981.
https://doi.org/10.3390/electronics11070981
Spoliansky, R., Edan, Y., Parmet, Y., Halachmi, I., 2016. Development of automatic body condition scoring using
a low-cost 3-dimensional Kinect camera. Journal of Dairy Science 99, 7714–7725. https://doi.org/10.3168/jds.2015-10607
Team, K., 2017a. Keras documentation: Xception [WWW Document]. Keras.io. URL
https://keras.io/api/applications/xception (accessed 11.16.23).
Team, K., 2017b. Keras documentation: VGG16 and VGG19 [WWW Document]. keras.io. URL
https://keras.io/api/applications/vgg/#vgg16-function
Team, K., 2017c. Keras documentation: InceptionV3 [WWW Document]. keras.io. URL
https://keras.io/api/applications/inceptionv3/
Team, K., 2017d. Keras documentation: InceptionResNetV2 [WWW Document]. keras.io. URL
https://keras.io/api/applications/inceptionresnetv2/
Wolpert, D.H., 1992. Stacked generalization. Neural Networks 5, 241–259. https://doi.org/10.1016/s0893-
6080(05)80023-1
Yang, K., Qinami, K., Fei-Fei, L., Deng, J., Russakovsky, O., 2020. Towards fairer datasets. Proceedings of the
2020 Conference on Fairness, Accountability, and Transparency. https://doi.org/10.1145/3351095.3375709

of
ro
-p
re
lP
na
ur
Jo
Journal Pre-proof

Declaration of interests

☒ The authors declare that they have no known competing financial interests or personal relationships that
could have appeared to influence the work reported in this paper.

☐The authors declare the following financial interests/personal relationships which may be
considered as potential competing interests:

of
ro
-p
re
lP
na
ur
Jo
Journal Pre-proof

Highlights

1. A novel AI vision method accurately classifies sheep breeds.


2. Our study applies computer vision to manage livestock, considering various factors.
3. We tackle challenges in detecting individual sheep within a uniform-colored flock.
4. The study uses ensemble techniques to enhance breed identification accuracy.
5. Our findings advance sheep breed identification with computer vision and ML.

of
ro
-p
re
lP
na
ur
Jo

You might also like