Muzzle-Based Livestock Identification via Siamese Deep Metric Learning
Broader goal
Can non-invasive, tamper-proof biometric identification — using only a photograph of an animal's muzzle — replace painful and invasive livestock marking techniques such as ear-tagging and hot-iron branding, at scale and under real-world agricultural conditions?
Current milestone
Can Siamese networks using shared-weight Convolutional (ResNet, VGG) and self-attention (Vision Transformer) encoders optimized via Contrastive Loss verify individual livestock identity reliably under varying lighting, environment, and post-mortem muzzle conditions?
Experiment plan
Contributed to a Plantsat initiative in collaboration with the United Nations Development Programme (UNDP) in Nepal, aimed at scalable livestock identification for farmers and agricultural programs.
Designed and compared Siamese Network architectures with VGG16, ResNet50, ResNet152, ViT-Base, and ViT-Large backbones; twin branches share weights to generate high-dimensional image embeddings for identity verification.
Conducted multi-environment field testing across multiple farms in Nepal, discovering that single-condition muzzle datasets are insufficient — the model required images from diverse lighting, angles, and environmental contexts to generalize well.
Collaborated with a slaughterhouse to collect muzzle images at controlled post-mortem intervals (12 hr before, 2 hr before, immediately before, immediately after, and 2 hr after slaughter), capturing how muzzle shape compresses and changes over time, enabling the model to adapt to deformation conditions.
Built and deployed a dedicated mobile data-collection application to capture muzzle images across all farm sites and time intervals, enabling structured large-scale annotation.
Optimized embedding representations in a 128-dimensional latent space via Contrastive Loss (margin = 2.0), minimizing distance for same-identity pairs and pushing different-identity pairs beyond threshold.
Integrated Gradient-weighted Class Activation Mapping (Grad-CAM) to visually confirm that network attention focuses on anatomical muzzle groove patterns rather than background noise — a critical step for model trustworthiness and academic validity.
Evaluated binary classification performance using accuracy, precision, recall, F1-score, and confusion matrices by tuning Euclidean distance decision boundaries.