Livestock management plays a pivotal role in ensuring food security and sustainable agricultural practices worldwide. Among various farm activities, individual tracking of each animal is effective in achieving improved disease control, breeding management and producing high quality meat and milk. Conventional methods of animal identification, especially bovines, include ear tagging with visual tags, bar coded ear tags, quick response (QR) coded tags and radio frequency identification (RFID) tags. However, the maintenance of these tags over a longer period with different handling, rearing and weather conditions compromises the efficacy of identification methods (Girish et al., Reference Girish, Santhosh, Kartikeya, Palekar, Harikrishna and Rathod2020). Although RFID tags are cost-effective identification systems their working is often affected by electromagnetic environments such as iron fences and cooling fans, as well as tag power and circuit quality (Smink et al., Reference Smink, Liu, Döpfer and Lee2024). RFID application is also limited by its low average reading distance of less than 20 cm, making managemental operations difficult (Ruiz-Garcia and Lunadei, Reference Ruiz-Garcia and Lunadei2011). The distorted tags, colour, lighting, dirt, and cattle movement also makes it difficult to read these ear tags using optical character recognition (OCR) algorithms. Similarly, molecular techniques based on microsatellite genotyping and SNP genotyping are cumbersome and expensive (Jiang et al., Reference Jiang, Li, Ma, Bai, Dahmer, Linacre and Xu2020). The field applicability of these identification methods is also challenged by geographical location of the animal farms, especially those in remote areas.
Thus, among these obvious challenges and with the advent of artificial intelligence (AI), biometric facial recognition for dairy cows can serve as a ground-breaking tool, offering high precision, enabling the dairy farmers to monitor, track, and manage individual animals while enhancing both productivity and animal welfare (Mahato and Neethirajan, Reference Mahato and Neethirajan2024). Such recognition systems can also play a vital role in the verification of insurance claims and to stop illegal border transfer of livestock to slaughterhouses (Kumar et al., Reference Kumar, Pandey, Satwik, Kumar, Singh, Singh and Mohan2018). Biometric-based animal recognition includes efficient and intelligent approaches such as retinal scanning (Saygılı et al., Reference Saygılı, Cihan, Ermutlu, Aydın and Aksoy2024), iris patterns (Roy et al., Reference Roy, Mukherjee, Nath Mandal, Hajra, Banik and Naskar2021), facial recognition (Hitelman et al., Reference Hitelman, Edan, Godo, Berenstein, Lepar and Halachmi2022) and muzzle point image pattern (Kumar et al., Reference Kumar, Pandey, Satwik, Kumar, Singh, Singh and Mohan2018), offering non-invasive identification.
The muzzle point image patterns are unique animal biometric features similar to human fingerprints to identify individual cattle. It comprises of dense texture patterns of grooves known as beads and river-like structures known as ridges, distributed all over the muzzle skin of bovines. The muzzle points also consist of different colour attributes acknowledged as white skin grooves and black convex sector, which aid in classifying the cattle breeds (Kumar et al., Reference Kumar, Pandey, Satwik, Kumar, Singh, Singh and Mohan2018; Kumar and Singh, Reference Kumar and Singh2020). In former studies, muzzle patterns were recorded by the inked muzzle print method, which was quite inconvenient, inefficient and hazardous to cattle (Minagawa et al., Reference Minagawa, Fujimura, Ichiyanagi and Tanaka2002). To overcome such inherent issues, animal identification methods by muzzle imaging have been suggested by researchers (Kumar and Singh, Reference Kumar and Singh2016; Girish et al., Reference Girish, Santhosh, Kartikeya, Palekar, Harikrishna and Rathod2020).
The integration of muzzle imaging with deep learning approaches particularly CNN efficiently applies biometrics to map facial features from an image. Deep neural networks analyse muzzle point images and create a unique facial signature for that muzzle, adding it to a database of registered cattle images. Whenever the same muzzle image is added for verification, the facial signature compares the information to find a match. This process involves four key stages involving: (i) muzzle detection with a bounding box; (ii) face alignment, which normalizes the geometry and photometrics of the face; (iii) feature extraction of shape and intricate muzzle patterns; (iv) pattern recognition, where the muzzle is matched against a prepared database (Girish et al., Reference Girish, Santhosh, Kartikeya, Palekar, Harikrishna and Rathod2020; Mahato and Neethirajan, Reference Mahato and Neethirajan2024; Bara et al., Reference Bara, Singh, Pandey, Chauhan, Gaur, Pandey and Das2024).
Earlier investigations
Earlier investigation employed strategies involving Local Binary Pattern (LBP) for feature extraction, Nearest Neighbour, Naive Bayes, Support Vector Machine (SVM) and K-Nearest Neighbour (K-NN) as muzzle classifiers. Tharwat et al. (2014) collected 7 muzzle print images each from 31 cattle and proposed a Texture Feature Approach for cattle identification and achieved an accuracy of 99.50%, even when the images were rotated at different angles. Kumar and co-workers proposed a hybrid feature extraction and classification paradigm including K-NN and Fuzzy-K-NN classification techniques to achieve higher recognition accuracies of 94.50% and 96.74%, respectively (Kumar et al., Reference Kumar, Singh and Singh2017). Similarly, Kusakunniran and co-workers suggested another automatic cattle identification method with a histogram of multi-channel Local Binary Pattern (LBP) on muzzle images. They evaluated a dataset of 31 cattle, each with 7 images using SVM as the main classifier (Kusakunniran and Chaiviroonjaroen, Reference Kusakunniran and Chaiviroonjaroen2018). Singh and co-workers combined other texture analysis techniques such as Generative Adversarial Networks (GAN) with the current features to form a stronger classifier (Singh et al., Reference Singh, Devi and Varish2021). In this study, GAN was used for image enhancement and Scale Invariant Feature Transform (SIFT) to detect the key points of muzzle print texture, and was combined with Random Sampling Consistency (RANSAC) for robust feature extraction and matching. SIFT extracts and matches feature while RANSAC improves the matching process. This resulted in an accuracy rate of 98.86% with the least amount of processing time. An effective novel hybrid multistage optimal framework Augmentation-Denoising-Enhancement-Extraction-Classification (ADEEC) for addressing missing and swapped cattle and false insurance claims was suggested by Kosana and team (Kosana et al., Reference Kosana, Gunda and Kosana2022). A dataset of 90 images (9 individual × 10 image each) was created for pre-processing resulting in a new dataset with 32 images for each class of cow increasing the dataset to 2880 (9x10x32). The multi-stage framework was developed by hybridizing Denoising Autoencoders (DAE), Super-Resolution Generative Adversarial Network (SRGAN), InceptionResnetV2 feature extractor and multilayer perceptron Network (MLP). The proposed framework in the study achieved an accuracy of 98.21%.
It is evident from these investigations that muzzle-based features may be used successfully for identification of cattle using numerous algorithms. In light of the above, this study aims to identify new crossbred cattle – Vrindavani, developed at ICAR-IVRI (India) using its muzzle images employing a deep learning algorithm.
Materials and methods
Data collection and pre-processing
A database consisting of muzzle images from 264 Vrindavani cattle with age ranging from 6 months to 10 years was collected from the Cattle and Buffalo Farm, ICAR-IVRI, Izatnagar, UP (India). Cattle head images were captured in an unconstrained environment using a 64 MP phone camera. Ten images per cattle was collected resulting in a total of 2,640 muzzle images. Images were pre-processed in MATLAB v.2021b running on a Asus laptop with AMD Ryzen 3, 8GB RAM with Microsoft Window 11 64-bit operating system. The pre-processing was essential for feature extraction, and to mitigate the noises, and other artifacts. The muzzle region from the images were annotated for its identification and the annotated images were used for training the deep neural network. Representative images of muzzles along with the study protocol has been shown in Fig. 1.
Protocol for image capture and model training with representative muzzle images (developed using MS powerpoint, biorender and animal images collected at farm).

Image classification using convolutional neural network
Convolutional neural networks have the ability to identify patterns in an image for desired classification leading to numerous applications. SqueezeNet is a CNN designed for image classification on devices with the minimum possible resources. It achieves accuracy comparable to AlexNet (another CNN model), but with 50 times fewer parameters. This efficiency is due to its use of ‘fire modules’, which combine smaller and larger filters to learn complex features while reducing computational demands. SqueezeNet's compact size makes it ideal for real time applications on mobile devices and embedded systems.
SqueezeNet's fire module comprises of two key layers:
a. Squeeze layer – Employs 1 × 1 filters to drastically reduce the number of channels in the feature map, efficiency compressing information and lowering computational needs.
b. Expand layer – Expands the reduced channels using a combination of 1 × 1 and 3 × 3 filters. The 1 × 1 filters learn simple features efficiently, while the 3 × 3 filters capture spatial information.
By strategically staking these fire modules, SqueezeNet achieves high accuracy with minimal parameters. After model development, image datasets are trained based on the model architecture.
Training and testing of the CNN model
The network's image input size was resized to 227 × 227 pixels for uniformity. The pre-processed dataset was used as input to the SqueezeNet network. Of the total dataset of 2,640 muzzle images, all images were used for training and validation, while 30% images were used for testing. All operations were performed in MATLAB v. 2021a. Based on the initial trials of the CNN architecture training results, the network parameters such as the minibatch size and epochs were varied to determine the corresponding outputs in terms of accuracy and runtime. Second-order models between the input-output parameters of the model were developed and optimized using genetic algorithm and the most suitable model based on highest accuracy and lowest runtime was selected.
Results and discussion
In recent years, studies on animal identification and recognition using biometric markers have increased rapidly (Cihan et al., Reference Cihan, Saygili, Ozmen and Akyuzlu2023). The SqueezeNet architecture with 68 layers was prepared with specified features and was trained on 1848 images collected from 264 animals. Initially, as a preliminary run, the model was run with 20 epochs, 100 validation frequency and a mini-batch size of 16 with a learning rate of 4 × 10−4. Fig. 2 shows the performance of the model training and validation runs, which shows that the accuracy and loss function of the model starts to flatline around 10 epochs and becomes constant beyond 14 epochs.
(A) accuracy and (B) loss function during training (blue and Orange line) and validation (black line) of squeezenet with muzzle images.

A decreasing trend observed in the loss function signified the network's successful learning process during training while an increase in the model accuracy was observed as the training progressed. Considering the positive results observed in the preliminary runs, an experiment was devised wherein the number of epochs was varied from 8 to 14 and the mini batch was varied from 8 to 128. Corresponding to these experiments, the validation runs were calculated using the equations shown below:
\begin{equation}{\text{Iteration per epoch }}\left( {{I_E}} \right) = \frac{{{\text{Number of images used in training}}}}{{{\text{Mini batch size}}}}\,\end{equation}A factor of 5 was taken for the calculation of validation frequency considering that at least 5 points are required to understand the model dynamics with respect to the number of iterations, accuracy and loss function. The results showed that when the minibatch size was increased from 8 to 128, the accuracy dropped from >91.90% to <23.70%. A relatively linear increase in the accuracy and corresponding decrease in the loss function was observed when the minibatch size was reduced from 128 to 16 followed by either a constant or slightly lower accuracy. For 10 epochs, a mini batch size of 8 gave the highest accuracy of 95.33%, which was contradictory to the results observed at other epochs. The model demonstrated a high average identification accuracy of 97.22% (considering results from all epochs). The highest accuracy, however, was observed at 14 epochs with a minibatch size of 16 while the lowest accuracy was observed at 8 epochs with minibatch size of 128 (Table 1). This shows that while choosing CNN model training parameters, higher number of epochs and lower minibatch size is recommended. The time of run of the models under consideration varied from 96.17 to 277.38 min. The model with the highest accuracy showed a training runtime of 136.43 min while the model with the lowest runtime showed an accuracy of 34.34%. This indicates that lower runtime does not necessarily bring higher model accuracy. Therefore, it is important to optimize the time and accuracy parameters for concluding an efficient CNN model for any specified application. Similar findings have been reported in deep learning-based biometric applications, where balancing model complexity and computational efficiency remains a challenge (Byeon et al., Reference Byeon, Raina, Sandhu, Shabaz, Keshta, Soni and Matrouk2024).
Summary of the accuracy of experimental runs

Training Time (min): Time taken for model training in minutes; Testing Time (min): Time taken for model evaluation in minutes; Validation Accuracy (%): Accuracy on the validation dataset during training; Testing Accuracy (%): Final accuracy on the independent test dataset.
To further enhance the understanding of model performance, the results of the CNN experimental runs were modeled using a second-order equation and subsequently optimized using a genetic algorithm (GA).
The second order model for the accuracy and training runtime are shown below:
\begin{align}Accuracy &=\, 37.76.E + 0.14.Mb - 1.42.{E^2} - 4.4{\text{ \times }}\,{10^{( - 3)}}.M{b^2}\nonumber\\&\quad - 0.01. E.Mb - 149.77;p \lt 0.01,{R^2} = 0.762,adj\nonumber\\&\quad - {R^2} = 0.677\end{align}
\begin{align}Runtime &= - 16.70.E - 2.02.Mb + 1.06.{E^2} + 0.02.M{b^2}\nonumber\\&\quad + 0.06.E.Mb + 194.45;p \lt 0.01,\,{R^2} = 0.953,\,adj\nonumber\\&\quad - {R^2} = 0.937\end{align}Multiobjective genetic algorithm (MOGA) was applied using the second order equations as objective function. The target of the MOGA was to increase accuracy while reducing the model runtime. Since GA is a minimization algorithm by default, the equation of accuracy was supplemented with a negative sign to ensure maximization. The final result of accuracy was multiplied with ‘ − 1’ to get the true values. The upper and lower bounds of the objective function were set as (8, 8) and (8, 128), respectively. Tournament based population section method with a size of 2 was used. A heuristic crossover function with a crossover fraction of 0.8 was used. The maximum number of generations was set as 1000, however, the MOGA terminated after 489 generations indicating convergence of the pareto set. Fig. 3 shows the pareto front and the average spread of the solutions obtained. The average spread became relatively constant after 250 generations with a final value of 0.082.
Average pareto front and pareto spread of the multiobjective genetic algorithm.

The optimization resulted in 18 solution sets as shown in Table 2. It can be observed from Table 1 that the accuracy can reach > 90% in 116 min runtime. However, solution no. 3 is more desirable considering lower runtime (135.9 min) and reasonably higher accuracy (98.7%) corresponding to 12.55 (∼13) epochs and 16 minibatch size.
Moga generated solution sets for possible CNN architectures

A trial was conducted, employing 16 minibatches and running for 13 epochs, to assess the effectiveness of a CNN architecture. The outcome revealed an accuracy of 95.83% achieved within a duration of 136.38 minutes (Fig. 4).
(A) accuracy and (B) loss function during training.

The results of this investigation are similar to those reported by the research teams led by Tharwat, Kumar, Singh and Kosana (Tharwat et al., Reference Tharwat, Gaber, Hassanien, Hassanien and Tolba2014; Kumar and Singh, Reference Kumar and Singh2016; Singh et al., Reference Singh, Devi and Varish2021; Kosana et al., Reference Kosana, Gunda and Kosana2022) using different algorithms and approached mentioned earlier. The size of the model developed in the current investigation was < 4 MB in size and the training runtime was ∼ 1.5 h utilizing 2,640 muzzle images under consideration.
Kimani and his coworkers also conducted research on cattle identification using muzzle images with deep learning techniques. In their experiment, they employed two different deep learning classification models: ResNet50 and VGG16_BN. They achieved accuracy rates of 99.40% and 98.70%, respectively (Kimani et al., Reference Kimani, Oluwadara, Fashingabo, Busogi, Luhanga, Sowon and Chacha2023). Similarly, Hitelman and his coworkers developed a biometric identification system for sheep based on facial images, using machine vision and deep learning techniques. They employed the Faster R-CNN algorithm for face detection and tested seven classification models, achieving an accuracy of 95%, which improved to 97% with transfer learning methods (Hitelman et al., Reference Hitelman, Edan, Godo, Berenstein, Lepar and Halachmi2022). In comparison, our model attained the best results in just 16 epochs, whereas they achieved their best results in 36 and 30 epochs. Moreover, the file size they utilized was only 45 MB, significantly smaller than our 2.85 GB. Despite a larger file size, the current study achieved superior results in fewer epochs, with reduced processing time. SqueezeNet's architecture yields a remarkably small model size < 4 MB. This compact size makes it significantly advantageous compared to other models.
Recent studies have suggested that biometric markers can also aid in disease diagnosis in animals. For instance, Cihan et al. (Reference Cihan, Saygılı, Ermutlu, Aydın and Aksoy2024) found that deep learning models, particularly ResNet101, significantly enhance cardiovascular disease diagnosis in cattle using retinal images, achieving high accuracy (96.1%) and sensitivity (97.3%). This paves the way for future work to explore hybrid identification systems that integrate health diagnostics alongside biometric recognition.
While the results of this study demonstrate the efficacy of SqueezeNet for muzzle-based identification in Vrindavani cattle, it is important to acknowledge certain limitations. The study primarily focused on a single breed and the absence of a comparative analysis with other breeds or identification methods may limit the generalizability of the findings. Future research should aim to include a broader range of cattle breeds and compare the performance of SqueezeNet with other deep learning models to validate its robustness across diverse populations. Additionally, integrating other biometric features, such as iris patterns or ear shapes, could further enhance the accuracy and reliability of identification systems.
Conclusion
This study demonstrates the potential of SqueezeNet architecture for high-accuracy muzzle-image-based identification for cattle, especially for Vrindavani. Although the results observed are encouraging, further research is necessary to enhance generalizability and robustness, ultimately paving the way for reliable and efficient applications in the field of animal husbandry. The adoption of muzzle-based biometrics in cattle holds immense promise for revolutionizing livestock management and traceability practices. By providing accurate, reliable, and efficient means of individual identification, biometrics empower farmers, veterinarians, and policymakers to make informed decisions, thereby promoting the sustainability, safety, and productivity of the livestock industry.
Acknowledgements
The authors are extending their gratitude to the Director of the Indian Veterinary Research Institute, Izatnagar, Bareilly, for providing the necessary facilities to carry out the research program.
Funding statements
Not applicable
Competing interest
The authors declare that they have no competing interests related to this research paper.
Ethical standards
The animals were managed under routine standard farm management conditions of the institute. There is no collection of samples and all images collected are non-invasive in nature. Therefore, no special ethical approval for this study was deemed necessary.
Author contribution
Swarnalata Bara: Conceptualization, collection of data, interpretation, writing – original manuscript, reviewing and editing, Ajoy Das: Supervision, data curation, reviewing and editing, Mukesh Singh: Supervision, data curation, reviewing and editing, Hari Om Pandey: Supervision, data curation, reviewing and editing, Gyanendra Kumar Gaur: Supervision, data curation, reviewing and editing, Ashwni Kumar Pandey: Supervision, data curation, reviewing and editing, Shubham Narwal: Data curation, reviewing, Ayon Tarafdar: Conceptualization, collection of data, interpretation, writing – original manuscript, reviewing and editing.
Data availability
Data can be made available on request however; the dataset cannot be shared.