Next Article in Journal
Post-Mortem Computed Tomography Pulmonary Findings in Harbor Porpoises (Phocoena phocoena)
Next Article in Special Issue
Using Pruning-Based YOLOv3 Deep Learning Algorithm for Accurate Detection of Sheep Face
Previous Article in Journal
Nose-Flap Devices Used for Two-Stage Weaning Produce Wounds in the Nostrils of Beef Calves: Case Report
Previous Article in Special Issue
Precision Feeding in Ecological Pig-Raising Systems with Maize Silage
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Individual Beef Cattle Identification Using Muzzle Images and Deep Learning Techniques

1
Department of Agricultural and Biosystems Engineering, Iowa State University, Ames, IA 50011, USA
2
Department of Animal Science, University of Nebraska-Lincoln, Lincoln, NE 68583, USA
3
Department of Biological Systems Engineering, University of Nebraska-Lincoln, Lincoln, NE 68583, USA
*
Author to whom correspondence should be addressed.
Animals 2022, 12(11), 1453; https://doi.org/10.3390/ani12111453
Submission received: 21 April 2022 / Revised: 31 May 2022 / Accepted: 1 June 2022 / Published: 4 June 2022

Abstract

:

Simple Summary

The ability to identify individual animals has gained great interest in beef feedlots to allow for animal tracking and all applications for precision management of individuals. This study assessed the feasibility and performance of a total of 59 deep learning models in identifying individual cattle with muzzle images. The best identification accuracy was 98.7%, and the fastest processing speed was 28.3 ms/image. A dataset containing 268 US feedlot cattle and 4923 muzzle images was published along with this article. This study demonstrates the great potential of using deep learning techniques to identify individual cattle using muzzle images and to support precision beef cattle management.

Abstract

Individual feedlot beef cattle identification represents a critical component in cattle traceability in the supply food chain. It also provides insights into tracking disease trajectories, ascertaining ownership, and managing cattle production and distribution. Animal biometric solutions, e.g., identifying cattle muzzle patterns (unique features comparable to human fingerprints), may offer noninvasive and unique methods for cattle identification and tracking, but need validation with advancement in machine learning modeling. The objectives of this research were to (1) collect and publish a high-quality dataset for beef cattle muzzle images, and (2) evaluate and benchmark the performance of recognizing individual beef cattle with a variety of deep learning models. A total of 4923 muzzle images for 268 US feedlot finishing cattle (>12 images per animal on average) were taken with a mirrorless digital camera and processed to form the dataset. A total of 59 deep learning image classification models were comparatively evaluated for identifying individual cattle. The best accuracy for identifying the 268 cattle was 98.7%, and the fastest processing speed was 28.3 ms/image. Weighted cross-entropy loss function and data augmentation can increase the identification accuracy of individual cattle with fewer muzzle images for model development. In conclusion, this study demonstrates the great potential of deep learning applications for individual cattle identification and is favorable for precision livestock management. Scholars are encouraged to utilize the published dataset to develop better models tailored for the beef cattle industry.

1. Introduction

Beef products are among the most consumed animal protein, and the beef cattle industry is critical for many rural communities. Numerous challenges face the beef industry including needs for improved nutrition and production efficiency to feed a growing human population [1,2]. The US is the largest beef producer, the second-largest importer, and the third-largest exporter by volume, and it has the largest total consumption globally [3]. During 2021, the total US cattle inventory (including all cattle and calf operations) was 93.6 million heads with an annual cash receipt of 66.0 billion USD, accounting for 16.9% of the 391 billion USD in total cash receipts from all agricultural commodities [3,4]. As a proportion of total beef produced, feedlots contribute approximately 77% of the cattle marketed in the US [5,6,7], with the remainder as beef slaughtered from culled cows/bulls. US feedlots with a capacity of more than 1000 heads market 80–85% of all fed cattle [3]. Maintaining and inspecting the intensive production systems daily to the individual animal level is a continual challenge for feedlot producers [8,9]. The value of individual cattle can vary but is significant, with prices of feeder cattle at 700–1000 USD per 227 kg calf [10] and 1500–2000 USD for mature cattle at market. Identifying individual cattle accurately and efficiently will increase the producer’s viability in establishing ownership, developing methods for individual tracking for health management and disease tracking, and providing individual traceability throughout the production chain [11,12].
Cattle identification can be performed using contact and noncontact methods [11], with branding commonly used to establish ownership. Common contact methods include ear notching, ear marking, ear tagging, and branding. While these methods display clear identification of individual cattle, human efforts are always required to recognize and locate the cattle, which is laborious and time-consuming. Another commonly used method, radiofrequency identification (RFID) systems, may overcome the drawback. To use an RFID system, an RFID transponder needs to be attached to each cattle and is read automatically and continuously by a reader. In some countries, RFID tags are extensively and mandatorily used in modern beef production systems (e.g., Australia). However, like other contact methods, in practice, such systems may cause cattle stress and are prone to damage once attached to the animals. The sensors (e.g., tags, transponders) with animal identification can fade, be damaged, and be lost due to cattle interference, movement, and environmental exposure [13]. Contact methods may also lead to short- and long-term complications in the integrity of cattle ears or other anatomical body parts [12].
Alternatively, contactless identification methods may eliminate human disturbance to the animals and use unique animal biometric features. Means of identifying livestock biometric markers include DNA pairing, autoimmune antibody matching, iris scanning, retinal imaging, coat pattern recognition, muzzle identification, and facial recognition [14]. These biometric markers or modalities have phenome and genome characteristics that are unique to the individual animal, tamperproof over time, invariant to transformation, and welfare-friendly to animals [15]. Among them, muzzle identification is a relatively low-cost and simple method and has recently received increasing research interest. Muzzle pattern is a cattle dermatoglyphic trait equivalent to human fingerprints. The little round-, oval-, or irregular-shaped protuberances on the nose area are defined as beads, while the elongated grooves and valleys arranged in a particular manner are defined as ridges (Figure 1). These uneven and distinct features make the muzzle identification for individual cattle possible.
A reference summary of previous cattle muzzle identification studies was thoroughly conducted to investigate the method development progress and determine the current research gaps (Table 1). Petersen [16] was the first to explore the muzzle pattern recognition for dairy cattle. During the early stages [16,17,18], investigators manually observed imprinted muzzle patterns and explored the muzzle uniqueness of healthy and ill cattle. These studies contributed significantly to examining the possibility of muzzle recognition; however, manual observation was laborious and not suitable for large-scale application. Then, conventional digital image processing algorithms (e.g., scale-invariant feature transform and box-counting fractal dimension models) were used to identify individual cattle automatically [15,19]. These methods typically matched features, including color, texture, shape, and edge, among different muzzle images and achieved high identification accuracy (e.g., 98.3% [20] and 100% [21]) with small image sets and controlled conditions. However, the method performance may be challenged by inconsistent illumination and background, variable muzzle shapes and sizes, similar appearances of the same animal at different times, missing parts or occlusions on a muzzle, and low resolution [22]. Machine learning classification models (e.g., support vector machine, K-nearest neighbor, and decision tree) were embedded with image processing-based feature extractors (e.g., Weber local descriptor) to further boost the performance of muzzle identification [23,24,25]. Despite promising results with an over 95% accuracy for beef cattle muzzle classification, the approaches require sophisticated hand-crafted features and may be difficult to develop and optimize for researchers from non-computer science backgrounds.
Deep learning is a data-driven method and has been researched for computer vision applications in animal production [22]. Deep learning models can capture spatial and temporal dependencies of images/videos through the use of shared-weight filters and can be trained end-to-end without strenuous hand-crafted design of feature extractors [26], empowering the models to adaptively discover the underlying class-specific patterns and the most discriminative features automatically. Kumar et al. [27], Bello et al. [28], and Shojaeipour et al. [29] tried deep learning models (e.g., convolutional neural network, deep belief neural network, You Only Look Once, and residual network) in large sets (over 2900 images in total) of dairy and beef cattle muzzle images and obtained great accuracies of over 98.9%. The US beef cattle industry is quite unique from the dairy sector, in terms of both animal genetics and housing environment [3], which may result in different bioinformatic markers between dairy and beef cattle that influence model classification performance. Shojaeipour et al. [29] investigated the muzzle pattern of beef cattle, but the cattle were constrained in a crush restraint (i.e., hydraulic squeeze chute) with their heads placed in head scoops for data collection, which may cause extra distress to the cattle. Moreover, except for the study of Shojaeipour et al. [29], the muzzle image datasets were not publicly available in most studies, limiting the progress of developing models tailored for beef cattle applications.
Model processing speed was only reported in a limited number of publications [15,23,30] but not reported in the three recent deep learning studies mentioned above (Table 1). Processing speed is a critical metric to estimate the overall identification duration in a farm when classification models are incorporated into computer platforms or robots for use. During conventional data collection [16], cattle were constrained with ropes or other tools, snot and grass on the nose was wiped clean with tissues, thin ink was smeared on the nose area, the paper was rolled upward or downward to obtain the printed muzzle pattern, and the imprinted muzzle was scanned or photographed to digitalize the muzzle pattern for further data analysis. Such procedures may acquire clear muzzle patterns but are also complicated and inefficient to apply in modern feedlots. Grayscale images were applied in some studies but only provided one-channel information, whereas RGB (red, green, and blue) images contain richer information for processing and were applied more frequently, as indicated in Table 1.
Table 1. Reference summary from previous cattle muzzle identification studies.
Table 1. Reference summary from previous cattle muzzle identification studies.
Cattle TypeImage Size (Pixels)Image TypeRestrainedCattle CountsImages per CattleTotal Images Identification MethodAccuracy (%)Processing Time (ms/Image)Reference
Dairy PrintedY 6Manual [16]
PrintedY 200Manual [17]
PrintedY65 Manual [18]
Beef256 × 256GrayscaleY 43DIP46.5 [31]
Beef320 × 240PrintedY2910290ML98.9 [12]
Beef200 × 200Grayscale 81080DIP90.0 [32]
Grayscale157105DIP93.337–879[15]
Beef PrintedY208160DIP98.3 [20]
Grayscale 53201060DIP [19]
Beef300 × 400Grayscale317217ML99.5 [33]
RGB2820560ML100.0[25]
RGB52201040ML96.0 [24]
Beef RGBN14570DIP100.0 [21]
Beef300 × 400Grayscale 317217ML99.5 [34]
Beef300 × 400Grayscale317217ML99.548–1362[23]
Beef RGB 526312ML96.4[35]
Dairy400 × 400RGB 500105000DIP93.9 [36]
Dairy200 × 200RGB 500105000ML94.9 [37]
Dairy200 × 200RGB 500105000DL98.9 [27]
Dairy200 × 200RGB500105000ML93.9 [38]
Dairy RGBN157105ML93.0368–1193[30]
Beef RGBY605–10460DIP98.1 [39]
BeefRGB 4520900ML96.5 [40]
Beef RGBY431 1600ML95.0[41]
Dairy200 × 200RGB 400104000DL98.9 [28]
Beef1024 × 1024RGBY300 2900DL99.1[29]
Dairy64 × 64RGB 1865930ML83.4[13]
Note: ‘ ’ indicates that information was not provided. DIP, digital image processing; ML, machine learning; DL, deep learning. Cattle species include beef cattle and dairy cattle. Image type is categorized as printed (samples are obtained from a direct compress with cattle noses and then scanned or photographed to form electronic images), grayscale with one-channel data captured directly from cameras, and RGB with three-channel (red, green, and blue) data. ‘Y’ indicates that the animal was restrained during data collection, while ‘N’ indicates that it was not.
The objectives of this study were to (1) collect high-resolution RGB muzzle images of feedlot cattle without any restraint or contact with the animals to develop a high-quality dataset to train deep learning models for individual cattle identification, and (2) benchmark classification performance and processing speed of muzzle identification optimized with various deep learning techniques.

2. Materials and Methods

2.1. Image Collection and Dataset Curation

This research was conducted at the University of Nebraska-Lincoln (UNL) Eastern Nebraska Research Extension and Education Center (ENREEC) research farm located near Mead, NE, USA. All animals were cared for under approval of the UNL Institution of Animal Care and Use Committee protocol 1785 (approved 4 December 2019), and no direct contact with animals was made throughout the course of data collection.
The RGB images of beef cattle were collected using a mirrorless digital camera (X-T4, FUJIFILM, Tokyo, Japan) and a 70–300 mm F4-5.6 focal lens (XF70-300 mm F4-5.6 R LM OIS WR, FUJINON, Tokyo, Japan), from 11 March to 31 July 2021. All images were collected from various distances outside the pens, while cattle were free to express their natural behaviors. A total of 4531 raw images from 400 US mixed-breed finishing cattle (Angus, Angus × Hereford, and Continental × British cross) were collected, of which the muzzle areas were the focus of the images. The ear tag information of each animal was recorded for verifying individual beef cattle. Because all images were taken under natural outdoor feedlot conditions, these images were presented with different angles of view and lighting conditions.
Raw images contained unnecessary anatomical parts (e.g., face, eye, and body), particularly for classification purposes. To reduce classification interference and highlight muzzle visual features, the cattle face area was rotated so that the muzzle area aligned horizontally, after which the muzzle area was manually cropped. Extremely blurry, incomplete, or feed-covered muzzle images were removed to maintain dataset quality. Small sets of images per animal (≤3) were also discarded to obtain sufficient data for model training, validation, and testing. At the end, a total of 4923 muzzle images (multiple muzzles could be cropped from a single raw image) from 268 beef cattle were selected to form the dataset. Nine sample images from nine cattle are presented in Figure 2. Although colors and textures could be similar among individuals, the patterns of beads, grooves, and ridges were visually different, which were favorable to individual identification. The cropped muzzle images are published in an open-access science community [42].
A frequency distribution of the normalized width/length of cropped images is depicted in Figure 3. Inconsistent image sizes may lead to biased detection performance, while high-resolution (large-size) images can downgrade the processing efficiency [43]. Therefore, the cropped images were resized to the same dimensions before being supplied into classification models. The dimensions should be determined on the basis of the following criteria: (1) with similar dimensions to those reported in the previous studies (Table 1); (2) with greater frequency of normalized width/length of the cropped muzzle images in the dataset, as indicated in Figure 3; (3) compliance with the input size requirement of most deep learning image classification models. In the end, dimensions of 300 × 300 pixels were selected in this study to normalize the cropped images.

2.2. Deep Learning Image Classification Models

A total of 59 deep learning image classification models were comparatively evaluated to determine the optimal models for identifying individual beef cattle with the cropped and resized muzzle images (Table 2). These models came from 14 major image classification model families, which were AlexNet [44], DenseNet [45], DPN [46], EfficientNet [47], Inception [48,49,50,51], MnasNet [52], MobileNet [53,54], RegNet [55], ResNet [56], ResNeXt [57], ShuffleNet [58], SqueezeNet [59], VGG [60], and Wide ResNet [61]. Total parameters and model sizes of these models ranged from 1.2 to 145 million and from 2.5 to 543.7 MB, respectively. These models were from the PyTorch (a popular deep learning platform accelerating big data analytics)-based libraries, TORCHVISION (https://pytorch.org/vision/stable/models.html, accessed on 10 March 2022), and PRETRAINEDMODELS (https://pypi.org/project/pretrainedmodels, accessed on 10 March 2022). Other models, if available or newer, were either incompatible with the PyTorch operation environment or unsuitable for the resized muzzle images (300 × 300 pixels). All models were expected to be evaluated with the same operation environment to reduce environment interference; therefore, these models were not considered in this study.

2.3. General Model Evaluation and Development Strategies

Transfer learning was deployed during training, with which models were pre-trained with a large dataset, ImageNet [62], whereas only the fully connected layers of the models were fine-tuned with the current dataset for custom classification. This strategy improves training efficiency without compromising inference performance. The cattle muzzle dataset was randomly partitioned and reshuffled into three subsets: 65% for training, 15% for validation, and 20% for testing. Image pixel intensities per color channel were normalized to the range of [0,1] for enhanced image recognition performance [63]. Each model was trained with five replications assigned the same random seeds, and the mean accuracy on the testing dataset was computed to evaluate model performance and reduce the random effects resulting from data reshuffling. All models were trained for 50 epochs (in which training typically converged for muzzle data), using a stochastic gradient descent optimizer and momentum of 0.9. The learning rate was initially set to 0.001 and dynamically decayed by a factor of 0.1 every seven epochs for stabilizing the model training. Models were trained and validated in a cloud-based service, Google Colab Pro, allocated with a Tesla P100-PCIE-16GB GPU, 12.69 GB of RAM, and a disk space of 166.83 GB. The working space and ethernet speed of cloud services can vary, resulting in inconsistent processing speeds among different models. Therefore, a local machine with an Intel® Core™ i7-8700K CPU @ 3.70 GHz processor, 16.0 GB of RAM, and Windows 10® 64 bit operation system was also used for model testing. Utilization of multiple machines allowed accelerating training speed with the cloud-allocated GPU and examining standard model performance without the GPU for mobile applications.
The cross-entropy (CE) loss function was used to evaluate the training and validating model performance during the training process (Equation (1)).
C E l o s s = i = 1 C w t i log ( p i ) ,
where p i   268 ( 268 indicates a 268-dimensional vector) is the vector of a Softmax output layer and indicates the probability of predicting the 268 individual cattle, C is the number of cattle (=268), w (=1) indicates that equal weights were assigned to all cattle, and t i denotes the true probability for the i-th cattle, is defined as follows:
t i = { 1 , i f   i = t r u e 0 , o t h e r w i s e .
Accuracy was calculated for each model during each epoch of training using the validation dataset and after training using the testing dataset to determine model performance for overall classification. It was also calculated for each class to determine individual identification performance. Processing speed was computed using the reported time in Python divided by total number of processed images. Higher values suggest better model accuracy but lower processing speed. We proposed a comprehensive index (CI, Equation (3)) to balance the two opposite evaluation metrics to determine comprehensive performance for each model. The accuracy and processing speed computed from the testing dataset was firstly ranked, where high accuracy values and low processing speeds had high orders. Because accuracy was considered more important than processing speed in this study, 80% of the ranked results were weighed for accuracy while 20% were weighed for the processing speed. The proportion can be changed on the basis of the specific metric importance determined by developers. Overall, a lower CI indicates that the model provides better comprehensive performance.
C I = 80 % × O r d e r   a c c u r a c y + 20 % × O r d e r p r o e s s i n g   s p e e d ,
where the variable O r d e r i represents integers ranging from 1 to 59, and the subscripts refer to the appropriate metric of interest.
Pearson’s correlation analysis was conducted to understand the correlation effects among model total parameters, model size, accuracy, and processing speed. Larger absolute values of the Pearson correlation coefficient (R) indicate a higher correlation between parameters.

2.4. Optimization for Class Imbalance

Class imbalance was observed in the cropped muzzle image dataset with a range of images per cattle from four to 70 (Table 3). Because fewer images were fed to the dataset, a minority class (cattle with fewer images) may be prone to misidentification. Two commonly used deep learning strategies, weighted cross-entropy (WCE) loss function [64] and data augmentation [22], were adopted to mitigate this issue during model training. Both optimization strategies were evaluated by 20 models, which were determined using the optimal accuracy, processing speed, and CI among the 59 models. Accuracy was the primary metric to optimize class imbalance.
The WCE loss function assigned heavier weights for cattle with fewer cropped muzzle images, as defined in Equation (4).
W C E loss = i = 1 C w i t i log ( p i )
where w i is the individualized weight assigned to the i-th cattle, which can be calculated as follows:
w i = N m a x N i ,
where N i denotes the image number for the i-th cattle, and N m a x is the maximum image counts per head (=70 in this case). The assigned weight in the WCE loss function for each cattle is provided in Table A1 in Appendix A.
Data augmentation is a technique to create synthesized images and increase limited datasets for training deep learning models. The augmentation was implemented as a preprocessing step in an end-to-end training or interference process. Four augmentation strategies were adopted on the basis of raw image limitations, namely, horizontal flipping, brightness modification, randomized rotation, and blurring. The horizontal flipping was to mimic events when cattle were photographed in different locations due to their natural behaviors. The brightness modification was to mimic varying outdoor lighting conditions, and the brightness factor was set from 0.2 to 0.5 (minimum = 0, maximum = 1). Rotation was randomized from −15° to 15°, simulating natural cattle head movements. Blurring was applied to simulate the cases of overexposure and motion blur, and a Gaussian function with kernel sizes of 1–5 was used to create blurred muzzle images.

3. Results and Discussion

3.1. Examples of Validation Performance

Figure 4 provides representative results of the validation accuracy of the 59 deep learning image classification models assessed. Most models converged before the 50th epoch, and various models achieved the best validation accuracy at an epoch between 13 to 49. Each model took 20 to 302 min to finish the training of 50 epochs, using the cloud service. MnasNet_0.5, ShuffleNetV2_×0.5, and ShuffleNetV2_×1.0 consistently showed a low validation accuracy (<5%) across all training epochs. Valley points were observed for validation accuracy curves of RegNetY_16GF and RegNetX_800MF, probably because of data randomness after data reshuffling. In sum, the 50 epochs were reasonable configurations for model training, and validation accuracy was observed for all model training, including the training of 20 selected models for optimizing the accuracy of individual identification.

3.2. Testing Performance of the Selected Deep Learning Image Classification Models

Table 3 shows the testing accuracies and processing speeds of the 59 deep learning image classification models. Accuracy ranged from 1.2% to 98.4% with ShuffleNetV2_×0.5 being the worst and VGG16_BN being the best. Each model took 32.3 to 678.2 ms to process a muzzle image, with the ShuffleNetV2_×0.5 being the fastest model and EfficientNet_b7 being the slowest model. Twenty models were selected and organized on the basis of the CI ranking, namely, VGG11_BN, AlexNet, VGG16_BN, VGG13, SqueezeNet_1.1, VGG11, VGG13_BN, MobileNetV3_Large, VGG19_BN, VGG16, SqueezeNet_1.0, VGG19, MobileNetV3_Small, ResNeXt101_32×8 d, ResNet34, DenseNet169, DPN68, DenseNet161, DenseNet201, and RegNetY_32GF. The 20 models were further used to evaluate the optimization of class imbalance.
The processing speed was computed by Google Colab (with GPU) for all 59 models, and the average ± standard deviation was 60.5 ± 93.4 ms/image, much lower than the speed 197.8 ± 145.1 ms/image computed by the local computer with CPU only (Table 3), presumably due to the cloud-based service. For example, the processing speed using the cloud was 103.6 ms/image for DenseNet121 but 20.9 ms/image for DenseNet161, 182.4 ms/image for EfficientNet_b3 but 12.4 ms/image for EfficientNet_b4, 379.0 ms/image for MnasNet_0.5 but 10.0 ms/image for MnasNet_1.0, and 186.2 ms/image for VGG13 but 18.8 ms/image for VGG16. The internet speed inconsistency may have led to the abnormal data trends where simpler architectures in the same model family processed images more slowly. Therefore, although the current processing speed provided with CPU only was not optimal, it was at least reliable for building the benchmark performance for some mobile computing machines without GPU.
Table 4 presents a Pearson correlation coefficient (R) matrix to better understand the relationships among model performance parameters. Accuracy had a low and positive correlation with model parameters (total parameter and size), while processing speed was moderately and positively correlated with model parameters. This result matched with our original hypothesis of correlation direction (a complicated model with more model parameters should have greater accuracy but longer processing time), although we expected greater correlation magnitudes. More factors may also affect model performance, such as connection schemes and network depth. For example, both ShuffleNet [58] and SqueezeNet [59] were lightweight models with 1.2–2.3 million total parameters, a 2.5–6.0 MB model size, and a fast processing speed of 32.3–62.1 ms/image. However, SqueezeNet achieved much better accuracies (95.0–95.9%) than that of ShuffleNet (1.2–1.3%). SqueezeNet introduced the Fire module (a squeezed convolution filters) to build CNN architecture and achieved AlexNet-level accuracy with fewer total parameters and smaller model sizes [59]. ShuffleNet used a direct measure of processing speed rather than an indirect measure of FLOPs to efficiently design and optimize CNN architecture, although the method was not beneficial in improving accuracy (the top-1 error rate was up to 39.7% [58]).
Interestingly, a few earlier models, such as AlexNet [44] and VGG [60], outperformed some newer models (e.g., EfficientNet [47], MnasNet [52], and RegNet [55]). One plausible explanation is that the connection scheme greatly impacted the model performance for this muzzle image dataset. AlexNet and VGG were operated in a feed-forward manner and could improve model performance by increasing architecture depth, while other models increased architecture width, introduced shortcut connection, and scaled up architecture width and depth. Our results indicate that a simple and feed-forward network architecture is sufficient in identifying individual beef cattle using muzzle images.

3.3. Optimization Peformance for Class Imbalance

The highest accuracy of the 20 selected models increased by 0.1% with the weighted cross-entropy loss function and 0.3% with data augmentation, compared with that of the development without any class imbalance optimization (98.4%, Table 5). The average accuracy increased by 0.6% with weighted cross-entropy but decreased by 0.2% with data augmentation, compared with the development without any class imbalance optimization (96.1%, Table 5). It turned out that the accuracy was not consistently improved for every model by the class imbalance optimization (e.g., AlexNet, MobileNetV3_Small, SqueezeNet_1.0, SqueezeNet_1.1, and VGG13). Therefore, only the models that performed best in both strategies, VGG16_BN (with cross-entropy loss function and data augmentation) and VGG19_BN (with weighted cross-entropy loss function), were selected to evaluate the accuracy of individual cattle identification.
There was no significant difference in processing speed between the developments conducted with cross-entropy and with weighted cross-entropy. However, the processing speeds of the 20 models with data augmentation were faster compared to those without any class imbalance optimization. The processing time was the sum of model loading time and total image processing time divided by the total number of processed images (Equation (6)). The model loading time was the duration of loading models to the CPU machine and ranged from 95.7 to 3554.4 ms. The terms ‘   T o t a l   i m a g e   p r o c e s s i n g   t i m e   T o t a l   n u m b e r   o f   p r o c e s s e d   i m a g e s ’ and model loading time in Equation (6) were constant for the same model, whereas the term ‘ M o d e l   l o a d i n g   t i m e   T o t a l   n u m b e r   o f   p r o c e s s e d   i m a g e s ’ was smaller with more images generated by the data augmentation, resulting in a faster processing speed with data augmentation. The model loading time should be part of model processing and cannot be excluded when processing speed evaluation.
P r o c e s s i n g   s p e e d = M o d e l   l o a d i n g   t i m e + T o t a l   i m a g e   p r o c e s s i n g   t i m e T o t a l   n u m b e r   o f   p r o c e s s e d   i m a g e s = M o d e l   l o a d i n g   t i m e   T o t a l   n u m b e r   o f   p r o c e s s e d   i m a g e s +   T o t a l   i m a g e   p r o c e s s i n g   t i m e   T o t a l   n u m b e r   o f   p r o c e s s e d   i m a g e s .
A best model classification accuracy of 98.7% was achieved in this study (Table 3 and Table 5) and was comparable to that of other deep learning studies for cattle muzzle recognition, in which the accuracy was 98.9% [27,28] and 99.1% [29]. Despite the discrepancies of cattle breeds, rearing environments, data acquisition conditions, and network architecture, all these studies achieved the desired accuracy (>90%), which again proves the empowering object recognition ability of deep learning and suggests a suitable application of the deep learning technique for individual cattle identification.
The processing speed ranged from 28.3 to 678.2 ms/image (Table 3 and Table 5) and was also comparable to or faster than some previous studies: 32.0–738.0 ms/image [15], 77.5–1361.9 ms/image [23], and 368.3–1193.3 ms/image [30]. Interestingly, these studies used machine learning or digital image processing algorithms as indicated in Table 1, and these models were supposed to be relatively lightweight compared to the deep learning models, with a faster processing speed, but our study suggested the opposite. In addition to programming language and platform, computing hardware explained the processing speed performance, particularly for configurations that were less advanced than those listed in Section 2.3.

3.4. Identification Accuracy of Each Cattle

A probability chart demonstrating the identification accuracy of individual cattle is presented in Figure 5 and summarized in Table 6. In general, 92.5–95.1% cattle were 100% accurately identified, suggesting a great potential of using deep learning techniques to identify individual cattle. The results are also in agreement with Table 5. Despite different models, the development with weighted cross-entropy and data augmentation indeed outperformed that with cross-entropy loss function only. Worst-case scenarios (with 0% identification accuracy) developed from models without class imbalance optimization were reduced from four to three with data augmentation. Best-case scenarios (100% identified) increased by 6–7 after class imbalance optimization. Accuracy, excluding best-case or worst-case scenarios, was improved by 1.3–1.5% after class imbalance optimization.
The ID numbers of cattle with 0% identification accuracy were 2100, 4549, 5355, and 5925, with only four cropped images per head (Table A1). Although more images per cattle may result in higher accuracy for identifying individual cattle [22], multiple factors should be considered for data collection, such as access to animals, resource availability, and labeling workload. An optimal threshold of images per head is favorable in balancing identification accuracy and difficulties associated with data collection. The commonly used per head image rate is 5–20, as suggested in Table 1. Our results also indicated that an animal with over four muzzle images for model development could be identified successfully (with over 90% accuracy) by deep learning models. These data suggest that five images per animal could be an appropriate threshold.
This project aims to initiate the very first step of an individual cattle identification system. Coupled with computer engineer and software development capacity, the optimal model, VGG16_BN, can be installed into a computer vision system to livestream cattle muzzles. In the future, such computer vision systems have the potential to be integrated into commercial beef cattle feedlot facilities via other facilities or technologies (e.g., hydraulic chute, mobile robot systems, drones, smartphones) that allow for individual cattle muzzle capture and maintain the consistency of data collection.

4. Conclusions

Individual beef cattle were identified with muzzle images and deep learning techniques. A dataset containing 268 US feedlot cattle and 4923 muzzle images was published along with this article, forming the largest dataset for beef cattle to date. A total of 59 deep learning models were comparatively evaluated for identifying muzzle patterns of individual cattle. The best identification accuracy was 98.7%, and the fastest processing speed was 28.3 ms/image. The VGG models performed better in terms of accuracy and processing speed. Weighted cross-entropy loss function and data augmentation could improve the identification accuracy for the cattle with fewer muzzle images. This study demonstrates the great potential of using deep learning techniques to identify individual cattle using muzzle images and to support precision beef cattle management.

Author Contributions

Conceptualization, G.L. and Y.X.; methodology, G.L.; software, G.L.; validation, G.L.; formal analysis, G.L.; investigation, G.L. and Y.X.; resources, G.L., Y.X. and G.E.E.; data curation, Y.X.; writing—original draft preparation, G.L.; writing—review and editing, Y.X. and G.E.E.; visualization, G.L.; supervision, G.L. and Y.X.; project administration, Y.X.; funding acquisition, Y.X. All authors have read and agreed to the published version of the manuscript.

Funding

This work was partially supported by faculty start-up funds provided internally by the Institution of Agriculture and Natural Resources at University of Nebraska-Lincoln and the College of Agriculture and Life Sciences, Iowa State University. This work was also a product of the Nebraska Agricultural Experiment Station (NEAES) Project Number 29448, sponsored by the Agriculture and Natural Resources Hatch Multistate Enhanced Program.

Institutional Review Board Statement

The animal study protocol was approved by the Institution of Animal Care and Use Committee of the University of Nebraska-Lincoln (protocol 1785; approval date: 4 December 2019).

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are publicly available in Zenodo.org at http://doi.10.5281/zenodo.6324360.

Acknowledgments

The authors appreciate the enormous efforts of the staff and graduate students at University of Nebraska-Lincoln’s ENREEC research facilities without whom this project would not have been possible.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

Table A1. Image counts and assigned weight in weighted cross-entropy loss function for each cattle.
Table A1. Image counts and assigned weight in weighted cross-entropy loss function for each cattle.
Cattle IDImage CountsWeightCattle IDImage CountsWeightCattle IDImage CountsWeightCattle IDImage CountsWeight
010088.753812125.834680193.68514397.78
0200107.003814135.384685116.365153514.00
0300174.123819193.684686312.265164322.19
0400710.003832421.674716164.385165107.00
0500145.003842145.004717514.005170401.75
0600193.683844154.674733292.415171203.50
0700164.383847213.334739262.695197145.00
0800183.893852292.414748154.675207183.89
0900125.833856164.384770116.365208417.50
1000125.834208183.894775154.675215481.46
1100116.364259611.674776252.805224282.50
1200116.364323193.684804154.67523488.75
1300125.834326107.004819183.895235242.92
1400135.384330282.504820381.845249242.92
1500611.674339203.504833262.695273183.89
1600145.004347193.684839262.695275145.00
1700125.834363213.334840164.385282611.67
1800223.184369164.384895242.925283145.00
190088.754381242.924915302.335297322.19
2000145.004385233.044921145.005298252.80
2100417.504399710.004947154.675307107.00
2200611.674421322.194951391.795314135.38
2220611.674422223.184969125.835325361.94
2300223.184451710.004971116.365355417.50
2320145.004454262.694984242.925359107.00
2400233.044456292.414985116.365360352.00
2500332.124479252.804986262.695362183.89
2510107.004488116.364995611.675373272.59
2600272.594499292.415009174.125374272.59
2700174.124537125.835026233.045403262.69
2710154.674539183.895028213.335404223.18
274088.754545292.415066145.005407401.75
2800242.924549417.505073145.005408183.89
2900154.674551282.505077164.385410203.50
2930611.674568233.045083292.415411312.26
3000154.674607342.065090183.895425262.69
3100135.384613701.005097252.805427135.38
3200164.384614252.80510088.755432193.68
3300135.384649342.065112145.00547797.78
3400710.004668213.335132302.335507252.80
3420417.504678193.685133125.835508252.80
380288.754679164.385138116.365509223.18
5519252.805781272.596124107.006295107.00
5529292.415784164.386161183.896313342.06
5537371.895803154.676167213.336331322.19
555688.755804262.696171125.836333541.30
5559213.335806145.006184164.386442135.38
5581292.415809242.926189125.83644688.75
5604145.005815145.006191183.896458107.00
5605145.00581697.786196174.126479154.67
5620125.835836223.186197125.83649997.78
5630417.505844302.336199145.006505145.00
5633135.385886252.806210107.006506183.89
5634135.385925417.506213125.836530107.00
5639125.835932381.846216183.896606125.83
5654531.325953302.336220125.838050417.50
5658125.835971451.566226154.678094107.00
5670164.385986514.006237611.67809588.75
5677125.836011322.19625388.759021107.00
5695203.506012193.686266107.009029292.41
5697312.266017125.836276154.679634312.26
5717164.38602288.756277125.83963588.75
5745154.676038223.186278135.389736183.89
5761107.006066501.406282125.839742193.68
5762710.006071262.696283514.009773107.00
5774164.386084361.946287145.009798421.67
5777125.836098203.506294107.009801107.00

References

  1. Tilman, D.; Balzer, C.; Hill, J.; Befort, B.L. Global food demand and the sustainable intensification of agriculture. Proc. Natl. Acad. Sci. USA 2011, 108, 20260–20264. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. Terry, S.A.; Basarab, J.A.; Guan, L.L.; McAllister, T.A. Strategies to improve the efficiency of beef cattle production. Can. J. Anim. Sci. 2020, 101, 1–19. [Google Scholar] [CrossRef]
  3. USDA Economic Research Service. Sector at a Glance. Available online: https://www.ers.usda.gov/topics/animal-products/cattle-beef/sector-at-a-glance/ (accessed on 15 January 2022).
  4. National Cattlemen’s Beef Association. Industry Statistics. Available online: https://www.ncba.org/producers/industry-statistics (accessed on 15 January 2022).
  5. Wagner, J.J.; Archibeque, S.L.; Feuz, D.M. The modern feedlot for finishing cattle. Annu. Rev. Anim. Biosci. 2014, 2, 535–554. [Google Scholar] [CrossRef] [PubMed]
  6. USDA. Census of Agriculture, c2017. Report; AC-17-A-51; USDA, National Agricultural Statistics Service: Washington, DC, USA, 2019.
  7. Drouillard, J.S. Current situation and future trends for beef production in the United States of America—A review. Asian-Australas. J. Anim. Sci. 2018, 31, 1007. [Google Scholar] [CrossRef] [Green Version]
  8. Poudel, P.B.; Poudel, M.R.; Gautam, A.; Phuyal, S.; Tiwari, C.K.; Bashyal, N.; Bashyal, S. COVID-19 and its global impact on food and agriculture. J. Biol. Today’s World 2020, 9, 221–225. [Google Scholar]
  9. Beaver, A.; Proudfoot, K.L.; von Keyserlingk, M.A.G. Symposium review: Considerations for the future of dairy cattle housing: An animal welfare perspective. J. Dairy Sci. 2020, 103, 5746–5758. [Google Scholar] [CrossRef]
  10. USDA. Livestock, Dairy, and Poultry Outlook, January 2021. Report; LDP-M-319; USDA, Economic Research Service: Washington, DC, USA, 2021.
  11. Awad, A.I. From classical methods to animal biometrics: A review on cattle identification and tracking. Comput. Electron. Agric. 2016, 123, 423–435. [Google Scholar] [CrossRef]
  12. Barry, B.; Gonzales-Barron, U.A.; McDonnell, K.; Butler, F.; Ward, S. Using muzzle pattern recognition as a biometric approach for cattle identification. Trans. ASABE 2007, 50, 1073–1080. [Google Scholar] [CrossRef]
  13. Kaur, A.; Kumar, M.; Jindal, M.K. Shi-Tomasi corner detector for cattle identification from muzzle print image pattern. Ecol. Inform. 2022, 68, 101549. [Google Scholar] [CrossRef]
  14. Smith, G.C.; Tatum, J.D.; Belk, K.E.; Scanga, J.A.; Grandin, T.; Sofos, J.N. Traceability from a US perspective. Meat Sci. 2005, 71, 174–193. [Google Scholar] [CrossRef]
  15. Awad, A.I.; Zawbaa, H.M.; Mahmoud, H.A.; Nabi, E.H.H.A.; Fayed, R.H.; Hassanien, A.E. A robust cattle identification scheme using muzzle print images. In Proceedings of the Federated Conference on Computer Science and Information Systems, Kraków, Poland, 8–11 September 2013; pp. 529–534. [Google Scholar]
  16. Petersen, W. The identification of the bovine by means of nose-prints. J. Dairy Sci. 1922, 5, 249–258. [Google Scholar] [CrossRef]
  17. Hirsch, M.; Graham, E.F.; Dracy, A.E. A Classification for the Identification of Bovine Noseprints1. J. Dairy Sci. 1952, 35, 314–319. [Google Scholar] [CrossRef]
  18. Dracy, A.E.; Graham, E.F.; Hirsch, M. Some Similarities of Monozygotic Cattle Noseprints1. J. Dairy Sci. 1953, 36, 11–13. [Google Scholar] [CrossRef]
  19. El-Bakry, H.M.; El-Hennawy, I.; El Hadad, H.M. Bovines muzzle identification using box-counting. Int. J. Comput. Sci. Inf. Secur. 2014, 12, 29. [Google Scholar]
  20. Noviyanto, A.; Arymurthy, A.M. Beef cattle identification based on muzzle pattern using a matching refinement technique in the SIFT method. Comput. Electron. Agric. 2013, 99, 77–84. [Google Scholar] [CrossRef]
  21. Monteiro, M.; Cadavez, V.; Monteiro, F.C. Cattle identification based in biometric features of the muzzle. In Proceedings of the In RECPAD 2015–21St Edition of the Portuguese Conference on Pattern Recognition, Faro, Portugal, 9 September 2015; pp. 34–35. [Google Scholar]
  22. Li, G.; Huang, Y.; Chen, Z.; Chesser, G.D.; Purswell, J.L.; Linhoss, J.; Zhao, Y. Practices and Applications of Convolutional Neural Network-Based Computer Vision Systems in Animal Farming: A Review. Sensors 2021, 21, 1492. [Google Scholar] [CrossRef]
  23. Gaber, T.; Tharwat, A.; Hassanien, A.E.; Snasel, V. Biometric cattle identification approach based on weber’s local descriptor and adaboost classifier. Comput. Electron. Agric. 2016, 122, 55–66. [Google Scholar] [CrossRef] [Green Version]
  24. Mahmoud, H.A.; Hadad, H.M.R.E. Automatic cattle muzzle print classification system using multiclass support vector machine. Int. J. Image Min. 2015, 1, 126–140. [Google Scholar] [CrossRef]
  25. Mahmoud, H.A.; Hadad, H.M.E.; Mousa, F.A.; Hassanien, A.E. Cattle classifications system using Fuzzy K- Nearest Neighbor Classifier. In Proceedings of the 2015 International Conference on Informatics, Electronics & Vision (ICIEV), Fukuoka, Japan, 15–18 June 2015; pp. 1–5. [Google Scholar]
  26. O’Shea, K.; Nash, R. An introduction to convolutional neural networks. arXiv 2015, arXiv:1511.08458v2. [Google Scholar]
  27. Kumar, S.; Pandey, A.; Satwik, K.S.R.; Kumar, S.; Singh, S.K.; Singh, A.K.; Mohan, A. Deep learning framework for recognition of cattle using muzzle point image pattern. Measurement 2018, 116, 1–17. [Google Scholar] [CrossRef]
  28. Bello, R.-W.; Talib, A.Z.H.; Mohamed, A.S.A.B. Deep Belief Network Approach for Recognition of Cow using Cow Nose Image Pattern. Walailak J. Sci. Technol. (WJST) 2021, 18, 8984. [Google Scholar] [CrossRef]
  29. Shojaeipour, A.; Falzon, G.; Kwan, P.; Hadavi, N.; Cowley, F.C.; Paul, D. Automated Muzzle Detection and Biometric Identification via Few-Shot Deep Transfer Learning of Mixed Breed Cattle. Agronomy 2021, 11, 2365. [Google Scholar] [CrossRef]
  30. Awad, A.I.; Hassaballah, M. Bag-of-visual-words for cattle identification from muzzle print images. Appl. Sci. 2019, 9, 4914. [Google Scholar] [CrossRef] [Green Version]
  31. Minagawa, H.; Fujimura, T.; Ichiyanagi, M.; Tanaka, K. Identification of beef cattle by analyzing images of their muzzle patterns lifted on paper. In AFITA 2002: Asian Agricultural Information Technology & Management, Proceedings of the Third Asian Conference for Information Technology in Agriculture, Beijing, China, 26–28 October 2002; China Agricultural Scientech Press: Beijing, China, 2002; pp. 596–600. [Google Scholar]
  32. Noviyanto, A.; Arymurthy, A.M. Automatic cattle identification based on muzzle photo using speed-up robust features approach. In Proceedings of the 3rd European Conference of Computer Science, ECCS, Paris, France, 2–4 December 2012; p. 114. [Google Scholar]
  33. Tharwat, A.; Gaber, T.; Hassanien, A.E.; Hassanien, H.A.; Tolba, M.F. Cattle identification using muzzle print images based on texture features approach. In Proceedings of the Fifth International Conference on Innovations in Bio-Inspired Computing and Applications IBICA, Ostrava, Czech Republic, 23–25 June 2014. [Google Scholar]
  34. Tharwat, A.; Gaber, T.; Hassanien, A.E. Two biometric approaches for cattle identification based on features and classifiers fusion. Int. J. Image Min. 2015, 1, 342–365. [Google Scholar] [CrossRef]
  35. El-Henawy, I.; El Bakry, H.M.; El Hadad, H.M. A new muzzle classification model using decision tree classifier. Int. J. Electron. Inf. Eng. 2017, 6, 12–24. [Google Scholar]
  36. Kumar, S.; Singh, S.K.; Singh, A.K. Muzzle point pattern based techniques for individual cattle identification. IET Image Process. 2017, 11, 805–814. [Google Scholar] [CrossRef]
  37. Kumar, S.; Singh, S.K. Automatic identification of cattle using muzzle point pattern: A hybrid feature extraction and classification paradigm. Multimed. Tools Appl. 2017, 76, 26551–26580. [Google Scholar] [CrossRef]
  38. Kumar, S.; Singh, S.K.; Abidi, A.I.; Datta, D.; Sangaiah, A.K. Group Sparse Representation Approach for Recognition of Cattle on Muzzle Point Images. Int. J. Parallel Program. 2018, 46, 812–837. [Google Scholar] [CrossRef]
  39. Nurtanio, I.; Areni, I.S.; Bugiwati, S.R.; Bustamin, A.; Rahmatullah, M. A Portable Cattle Tagging Based on Muzzle Pattern. Int. J. Interact. Mob. Technol. 2020, 14, 134–149. [Google Scholar] [CrossRef]
  40. Sian, C.; Jiye, W.; Ru, Z.; Lizhi, Z. Cattle identification using muzzle print images based on feature fusion. IOP Conf. Ser. Mater. Sci. Eng. 2020, 853, 012051. [Google Scholar] [CrossRef]
  41. Kusakunniran, W.; Wiratsudakul, A.; Chuachan, U.; Kanchanapreechakorn, S.; Imaromkul, T.; Suksriupatham, N.; Thongkanchorn, K. Biometric for Cattle Identification Using Muzzle Patterns. Int. J. Pattern Recognit. Artif. Intell. 2019, 34, 2056007. [Google Scholar] [CrossRef]
  42. Xiong, Y.; Li, G.; Erickson, G.E. Beef Cattle Muzzle/Noseprint database for individual identification. March 3, 2022 ed.; 2022; Available online: https://zenodo.org/record/6324361 (accessed on 3 March 2022).
  43. Li, G.; Hui, X.; Lin, F.; Zhao, Y. Developing and evaluating poultry preening behavior detectors via mask region-based convolutional neural network. Animals 2020, 10, 1762. [Google Scholar] [CrossRef] [PubMed]
  44. Krizhevsky, A. One weird trick for parallelizing convolutional neural networks. arXiv 2014, arXiv:1404.5997. [Google Scholar]
  45. Huang, G.; Liu, Z.; Van Der Maaten, L.; Weinberger, K.Q. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 4700–4708. [Google Scholar]
  46. Chen, Y.; Li, J.; Xiao, H.; Jin, X.; Yan, S.; Feng, J. Dual path networks. arXiv 2017, arXiv:1707.01629. [Google Scholar]
  47. Tan, M.; Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. In Proceedings of the International Conference on Machine Learning, Long Beach, CA, USA, 10–15 June 2019; pp. 6105–6114. [Google Scholar]
  48. Szegedy, C.; Liu, W.; Jia, Y.; Sermanet, P.; Reed, S.; Anguelov, D.; Erhan, D.; Vanhoucke, V.; Rabinovich, A. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Boston, MA, USA, 7–12 June 2015; pp. 1–9. [Google Scholar]
  49. Szegedy, C.; Vanhoucke, V.; Ioffe, S.; Shlens, J.; Wojna, Z. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 2818–2826. [Google Scholar]
  50. Szegedy, C.; Ioffe, S.; Vanhoucke, V.; Alemi, A.A. Inception-v4, inception-resnet and the impact of residual connections on learning. In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, San Francisco, CA, USA, 4–9 February 2017; pp. 4278–4284. [Google Scholar]
  51. Chollet, F. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2016; pp. 1251–1258. [Google Scholar]
  52. Tan, M.; Chen, B.; Pang, R.; Vasudevan, V.; Sandler, M.; Howard, A.; Le, Q.V. Mnasnet: Platform-aware neural architecture search for mobile. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 16–20 June 2019; pp. 2820–2828. [Google Scholar]
  53. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.-C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–23 June 2018; pp. 4510–4520. [Google Scholar]
  54. Howard, A.; Sandler, M.; Chu, G.; Chen, L.-C.; Chen, B.; Tan, M.; Wang, W.; Zhu, Y.; Pang, R.; Vasudevan, V. Searching for mobilenetv3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Korea, 27 October–2 November 2019; pp. 1314–1324. [Google Scholar]
  55. Radosavovic, I.; Kosaraju, R.P.; Girshick, R.; He, K.; Dollár, P. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Virtual, 14–19 June 2020; pp. 10428–10436. [Google Scholar]
  56. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2015; pp. 770–778. [Google Scholar]
  57. Xie, S.; Girshick, R.; Dollár, P.; Tu, Z.; He, K. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, Honolulu, HI, USA, 21–26 July 2016; pp. 1492–1500. [Google Scholar]
  58. Ma, N.; Zhang, X.; Zheng, H.-T.; Sun, J. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany; 2018; pp. 116–131. [Google Scholar]
  59. Iandola, F.N.; Han, S.; Moskewicz, M.W.; Ashraf, K.; Dally, W.J.; Keutzer, K.J.A.P.A. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5 MB model size. arXiv 2016, arXiv:1602.07360. [Google Scholar]
  60. Simonyan, K.; Zisserman, A. Very deep convolutional networks for large-scale image recognition. arXiv 2014, arXiv:1409.1556. [Google Scholar]
  61. Zagoruyko, S.; Komodakis, N. Wide residual networks. arXiv 2016, arXiv:1605.07146. [Google Scholar]
  62. Deng, J.; Dong, W.; Socher, R.; Li, L.J.; Kai, L.; Li, F.-F. ImageNet: A large-scale hierarchical image database. In Proceedings of the 2009 IEEE Conference on Computer Vision and Pattern Recognition, 20–25 June 2009; pp. 248–255. [Google Scholar]
  63. Koo, K.-M.; Cha, E.-Y. Image recognition performance enhancements using image normalization. Hum. -Cent. Comput. Inf. Sci. 2017, 7, 33. [Google Scholar] [CrossRef] [Green Version]
  64. Phan, T.H.; Yamamoto, K. Resolving class imbalance in object detection with weighted cross entropy losses. arXiv 2020, arXiv:2006.01413. [Google Scholar]
Figure 1. The illustration and terminologies of a beef cattle muzzle pattern.
Figure 1. The illustration and terminologies of a beef cattle muzzle pattern.
Animals 12 01453 g001
Figure 2. Sample muzzle images of nine individual mixed-breed beef cattle.
Figure 2. Sample muzzle images of nine individual mixed-breed beef cattle.
Animals 12 01453 g002
Figure 3. Frequency distribution of normalized width/length of a cropped image.
Figure 3. Frequency distribution of normalized width/length of a cropped image.
Animals 12 01453 g003
Figure 4. Validation accuracy of the 59 deep learning image classification models. Descriptions of the models are provided in Table 2.
Figure 4. Validation accuracy of the 59 deep learning image classification models. Descriptions of the models are provided in Table 2.
Animals 12 01453 g004aAnimals 12 01453 g004b
Figure 5. A ridgeline chart illustrating the probabilities of identification accuracy for individual cattle using (top) VGG16_BN without class imbalance optimization, (middle) VGG19_BN with weighted cross-entropy loss function, and (bottom) VGG16_BN with data augmentation.
Figure 5. A ridgeline chart illustrating the probabilities of identification accuracy for individual cattle using (top) VGG16_BN without class imbalance optimization, (middle) VGG19_BN with weighted cross-entropy loss function, and (bottom) VGG16_BN with data augmentation.
Animals 12 01453 g005
Table 2. Summary of deep learning image classification models evaluated in this study.
Table 2. Summary of deep learning image classification models evaluated in this study.
Model Name and ReferenceModel Version Highlighted Features Total Parameters (Million)Model Size (MB)
AlexNet [44]AlexNetFirst parallelization and distributed training with multiple GPUs.61.1221.6
DenseNet [45]DenseNet121Connections between each layer and every other layer in a feed-forward fashion. Numbers indicate that the model contains 121, 161, 169, and 201 layers in the networks.8.128.2
DenseNet16129.0104.4
DenseNet16914.350.3
DenseNet20120.272.3
DPN [46]DPN68Dual-path architecture; feature re-usage; new feature exploration; contains 68 layers.13.046.2
EfficientNet [47]EfficientNet_b0Model scaling and balancing network depth, width, and resolution; neural architecture search; b0 to b7 correspond to input sizes of (256, 224), (256, 240), (288, 288), (320, 300), (384, 380), (489, 456), (561, 528), and (633, 600) pixels, respectively. 5.316.9
EfficientNet_b17.826.6
EfficientNet_b29.131.3
EfficientNet_b312.242.9
EfficientNet_b419.369.5
EfficientNet_b530.4111.2
EfficientNet_b643.0159.0
EfficientNet_b766.3247.6
Inception
[48,49,50,51]
GoogleNetIncreasing the depth and width of the network while keeping the computational budget constant.13.022.6
InceptionV3Factorized convolutions and aggressive regularization.27.296.1
InceptionV4Combination of Inception architectures with residual connections.42.7159.1
InceptionResNetV255.8209.5
XceptionDepth-wise separable convolutions; dubbed Xception.22.981.8
MnasNet [52]MnasNet_0.5Automated mobile neural architecture search approach, model latency, mobile phones, and factorized hierarchical search space; 0.5 and 1.0 indicate the network with depth multipliers of 0.5 and 1.0.2.25.1
MnasNet_1.04.413.4
MobileNet [53,54]MobileNetV2Inverted residual structure, lightweight depth-wise convolutions, and maintaining representational power.3.510.0
MobileNetV3_LargeHardware-aware network architecture search complemented by the NetAdapt algorithm. MobileNetV3-Large and MobileNetV3-Small target high- and low-resource use cases.2.517.6
MobileNetV3_Small5.57.0
RegNet [55]RegNetY_400MFParametrizing populations of networks, elevated design space level, quantized linear function, and a wide range of flop regimes; RegNetX indicates the network with the X block (a standard residual bottleneck block), and RegNetY indicates the network with the X block and Squeeze-and-Excitation networks; 400MF, 800MF, 1.6GF, 3.2GF, 8.0GF, 16GF, and 32GF represent networks with flop regimes of 400 MB, 800 MB, 1.6 GB, 3.2 GB, 8.0 GB, 16 GB, and 32 GB, respectively.4.315.6
RegNetY_800MF6.422.6
RegNetY_1.6GF11.240.7
RegNetY_3.2GF19.470.4
RegNetY_8.0GF39.4145.1
RegNetY_16GF83.6311.1
RegNetY_32GF145.0543.7
RegNetX_400MF5.520.2
RegNetX_800MF7.326.1
RegNetX_1.6GF9.232.8
RegNetX_3.2GF15.356.0
RegNetX_8.0GF39.6146.1
RegNetX_16GF54.3201.9
RegNetX_32GF107.8405
ResNet [56]ResNet18Residual learning framework, shortcut connections, avoiding feature vanishing, and achieving decent accuracy in deeper neural networks; 18, 34, 50, 101, and 152 indicate networks with 18, 34, 50, 101, and 152 layers, respectively.11.743.2
ResNet3421.881.9
ResNet5025.692.1
ResNet10144.5164.8
ResNet15260.2224.8
ResNeXt [57]ResNeXt50_32×4dHighly modularized network architecture, aggregating a set of transformations with the same topology, and cardinality; 50 and 101 refer to networks with 50 and 101 layers, respectively; 32 refers to networks with 32 paths/cardinalities in the widthwise direction; 4d and 8d refer to networks with 4 and 8 stages/depths of residual blocks.25.090.1
ResNeXt101_32×8d88.8334
ShuffleNet [58]ShuffleNetV2_×0.5Direct metric of computation complexity on the target platform, FLOPs; ×0.5 and ×1.0 refer to networks with 0.5× and 1.0× output channels, respectively.1.42.5
ShuffleNetV2_×1.02.36.0
SqueezeNet [59]SqueezeNet_1.050× fewer parameters, and <0.5 MB model sizes; SqueezeNet_1.0 is the original network, while SqueezeNet_1.1 has 2.4× less computation and slightly fewer parameters than the original version.1.23.4
SqueezeNet_1.11.23.3
VGG [60]VGG11Increasing depth using an architecture with very small (3 × 3) convolution filters; 11, 13, 16, and 19 indicate networks with 11, 13, 16, and 19 layers, respectively; BN represents networks with batch normalization.132.9495.4
VGG11_BN132.9495.5
VGG13133.0496.1
VGG13_BN133.0496.2
VGG16138.4516.4
VGG16_BN138.4516.5
VGG19143.7536.6
VGG19_BN143.7536.7
Wide ResNet [61]Wide_ResNet50_2Decreasing depth and increasing width of residual networks, and bottleneck network; 50 and 101 refer to networks with 50 and 101 layers, respectively; 2 is used to differentiate the network from ResNet.68.9257.4
Wide_ResNet101_2126.9479.1
Note: GPU, graphical processing unit; DenseNet, densely connected network; DPN, dual-path network; EfficientNet, efficient network; MnasNet, mobile neural architecture search network; MobileNet, mobile network; RegNet, regular network; ResNet, residual network; ResNeXt, combination of residual network and next dimension; ShuffleNet, a highly efficient architecture with a novel channel shuffle operation; SqueezeNet, squeezed network; VGG very deep convolutional network developed by the Visual Geometry Group.
Table 3. Model performance parameters (testing accuracy, processing speed, and comprehensive index (Equation (3))) of individual beef cattle classification. The outperformed models for each parameter were highlighted in bold fonts.
Table 3. Model performance parameters (testing accuracy, processing speed, and comprehensive index (Equation (3))) of individual beef cattle classification. The outperformed models for each parameter were highlighted in bold fonts.
ModelAccuracy (%)Processing Speed (ms/Image)CIModelAccuracy (%)Processing Speed (ms/Image)CI
AlexNet96.536.07.8RegNetY_32GF94.7564.022.6
DenseNet12193.0153.525.6RegNetX_400MF86.653.132.6
DenseNet16194.7278.621.6RegNetX_800MF84.670.036.2
DenseNet16994.7183.819.4RegNetX_1.6GF84.899.536.4
DenseNet20194.6224.421.6RegNetX_3.2GF86.6142.035.2
DPN6894.4153.119.8RegNetX_8.0GF88.0208.637.0
EfficientNet_b049.4122.448.2RegNetX_16GF89.8360.437.4
EfficientNet_b155.1159.345.8RegNetX_32GF92.3574.332.4
EfficientNet_b254.7171.346.8ResNet1890.560.327.6
EfficientNet_b360.0221.344.6ResNet3493.786.219.4
EfficientNet_b451.2283.152.2ResNet5091.3153.029.2
EfficientNet_b551.0425.654.2ResNet10194.2228.723.4
EfficientNet_b647.3468.256.0ResNet15293.7319.126.8
EfficientNet_b754.1678.253.4ResNeXt50_32×4d93.0180.425.6
GoogleNet59.478.340.8ResNeXt101_32×8d96.1419.618.8
InceptionV381.7112.938.4ShuffleNetV2_×0.51.232.347.4
InceptionV480.6187.042.0ShuffleNetV2_×1.01.343.347.2
InceptionResNetV266.9244.744.8SqueezeNet_1.095.062.112.6
Xception58.3207.045.6SqueezeNet_1.195.945.39.8
MnasNet_0.52.946.246.8VGG1196.7127.010.8
MnasNet_1.057.666.141.6VGG11_BN98.1141.06.2
MobileNetV291.377.426.2VGG1398.0175.99.4
MobileNetV3_Large95.960.211.4VGG13_BN97.7196.011.0
MobileNetV3_Small93.235.618.8VGG1697.7211.012.4
RegNetY_400MF90.759.626.4VGG16_BN98.4239.19.2
RegNetY_800MF86.575.234.8VGG1997.1248.014.6
RegNetY_1.6GF88.8103.832.6VGG19_BN98.1276.611.8
RegNetY_3.2GF91.6150.527.4Wide_ResNet50_289.6243.736.6
RegNetY_8.0GF92.1269.830.8Wide_ResNet101_290.4404.437.0
RegNetY_16GF93.6370.328.0
Note: CI, comprehensive index. Descriptions of the models are provided in Table 2.
Table 4. Pearson correlation coefficient (R) matrix among model total parameter and size, accuracy, and processing speed.
Table 4. Pearson correlation coefficient (R) matrix among model total parameter and size, accuracy, and processing speed.
AccuracyProcessing Speed
Total parameter0.3890.517
Model size0.3910.521
Table 5. Accuracy and processing speed for the 20 selected models before and after optimization for class imbalance. The outperformed models for each parameter were highlighted in bold fonts.
Table 5. Accuracy and processing speed for the 20 selected models before and after optimization for class imbalance. The outperformed models for each parameter were highlighted in bold fonts.
ModelCross EntropyWeighted cross EntropyData AugmentationModel Loading Time (ms)
Accuracy (%)Processing Speed (ms/Image)Accuracy (%)Processing Speed (ms/Image)Accuracy (%)Processing Speed (ms/Image)
AlexNet96.536.095.836.395.729.795.7
DenseNet16193.0153.597.3286.298.3139.1133.0
DenseNet16994.7278.697.6176.197.990.2807.2
DenseNet20194.7183.897.1221.598.2110.5963.3
DPN6894.6224.497.8151.898.680.51183.2
MobileNetV3_Large94.4153.197.461.695.239.8261.2
MobileNetV3_Small96.536.095.835.986.628.3186.3
RegNetY_32GF94.7564.097.1553.795.1297.5244.3
ResNet3493.786.297.088.397.654.7767.4
ResNeXt101_32×8d96.1419.698.0419.198.5210.72539.9
SqueezeNet_1.095.062.192.662.078.339.6120.0
SqueezeNet_1.195.945.394.144.793.932.4127.7
VGG1196.7127.096.5128.297.277.83391.3
VGG11_BN98.1141.098.2141.898.083.33237.8
VGG1398.0175.995.6176.298.299.33227.4
VGG13_BN97.7196.097.9199.698.5109.53279.0
VGG1697.7211.096.9213.497.4117.93435.4
VGG16_BN98.4239.197.7238.598.7125.23414.0
VGG1997.1248.095.7249.597.8137.33525.2
VGG19_BN98.1276.698.5274.897.8159.63554.4
Average ± SD96.1 ± 1.6192.9 ± 129.896.7 ± 1.5188.0 ± 131.595.9 ± 5.0103.2 ± 66.51724.7 ± 1494.2
Note: ‘Cross-entropy’ indicates models developed with the cross-entropy loss function and without any class imbalance optimization. Descriptions of the models are provided in Table 2.
Table 6. Accuracy and processing speed before and after optimization for class imbalance.
Table 6. Accuracy and processing speed before and after optimization for class imbalance.
Development StrategyNumber of Cattle with 0% Identification AccuracyNumber of Cattle 100% Accurately Identified Accuracy (%, Excluding 100% and 0%)
Cross-entropy424896.2 ± 15.1
Weighted cross-entropy425497.5 ± 13.3
Data augmentation325597.7 ± 12.3
Note: The model used was VGG16_BN for cross-entropy and data augmentation and VGG19_BN for weighted cross-entropy.
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Li, G.; Erickson, G.E.; Xiong, Y. Individual Beef Cattle Identification Using Muzzle Images and Deep Learning Techniques. Animals 2022, 12, 1453. https://doi.org/10.3390/ani12111453

AMA Style

Li G, Erickson GE, Xiong Y. Individual Beef Cattle Identification Using Muzzle Images and Deep Learning Techniques. Animals. 2022; 12(11):1453. https://doi.org/10.3390/ani12111453

Chicago/Turabian Style

Li, Guoming, Galen E. Erickson, and Yijie Xiong. 2022. "Individual Beef Cattle Identification Using Muzzle Images and Deep Learning Techniques" Animals 12, no. 11: 1453. https://doi.org/10.3390/ani12111453

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop