Cattle verification with YOLO and cross-attention encoder-based pairwise triplet loss
Loading...
Date
Journal Title
Journal ISSN
Volume Title
Publisher
Abstract
Cattle identification through biometrics has increasingly relied on non-invasive methods, where facial and muzzle images are commonly used. While facial images alone offer valuable features, they can be sensitive to variations in lighting, pose, and occlusion, leading to inconsistent results. Similarly, relying solely on muzzle images, though distinct, may not provide sufficient discriminatory power for accurate identification in all cases. Combining both facial and muzzle features offers a more comprehensive solution, overcoming the limitations of using either feature independently. Recent advancements in deep neural networks have significantly influenced this field, but achieving an optimal balance between model accuracy and computational efficiency remains a challenge. In this paper, we present a novel approach by introducing a Cross-Attention Encoder in combination with a Pairwise Triplet Loss function for cattle verification. This method processes face and muzzle images in parallel, enhancing the integration of features from both inputs. The cross-attention mechanism enables the model to focus on the most relevant regions, improving feature alignment and discrimination. With a compact architecture of only 0.6 million parameters, the encoder effectively captures essential features from both the face and muzzle, ensuring precise cattle verification without excessive computational demands. Our approach achieved a testing accuracy of 93.67%, with an average inference time of 35ms per sample, demonstrating the model's efficiency. These findings highlight the strength of our attention-based method in delivering high accuracy and computational performance for cattle verification tasks. © 2025 Elsevier B.V.