SheepFormers: vision transformer-based sheep breed classification on small datasets for smart farming
Galib Muhammad Shahriar Himel, Md. Masudul Islam, Mijanur Rahaman
American International University-Bangladesh · Bangladesh University of Business and Technology
Key points
From the paper's conclusion- These findings demonstrate that Vision Transformers can achieve state-of-the-art performance even with limited agricultural datasets, marking a significant advancement in smart farming technologies and precision livestock management.
Abstract
Abstract Accurate sheep breed classification is critical for modern livestock management, supporting decisions on breeding, productivity, and profitability in the farming industry. Traditional methods based on visual inspection or body measurements are often subjective, time-consuming, and unsuitable for large-scale operations. To address these challenges, this study proposes SheepFormers, a Vision Transformer (ViT)-based framework for automatic sheep breed identification, specifically designed to operate effectively even with small datasets. A balanced dataset of 1,680 sheep face images representing four breeds was preprocessed and used to evaluate multiple transformer variants, including ViT-Google, ViT-MAE, ViT-VAN, BEiT, ViT-ResNet50, and DiT. Through systematic hyperparameter optimization and ablation studies covering epochs, batch size, learning rate, positional encoding, patch size, data augmentation, and 5-fold cross-validation, the ViT-Google model achieved the best performance with 98.21% validation accuracy and an Area Under the Curve (AUC) of 0.9987, outperforming both traditional CNN architectures and ensemble baselines reported in previous studies. Despite these strong results, the study is limited by the relatively small dataset size and controlled image acquisition conditions, which may affect generalization under diverse real-world farm environments. To ensure practical applicability, the trained model was deployed into a user-friendly mobile application, enabling farmers, buyers, and sellers to classify breeds in real time. These findings demonstrate that Vision Transformers can achieve state-of-the-art performance even with limited agricultural datasets, marking a significant advancement in smart farming technologies and precision livestock management.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Estimation of Ewe Live Weight and Carcass Traits Using Advanced Hybrid Deep Learning and Multimodal Feature FusionBiology · 2026
- Sheep Pulmonary Image Recognition (SPIRO): an explainable deep learning framework for macroscopic assessment of ovine pulmonary lesions.Veterinary journal (London, England : 1997) · 2026
- BoviShift: A Six-Year Multi-Attribute Audit of Visual Cattle Phenotyping Across Animals and TimearXiv · 2026
- Vision transformers in precision agriculture: A comprehensive surveyIntelligent Systems with Applications · 2025
- Comparative evaluation of vision transformers and convolutional networks for breast ultrasound image classificationExploration of Medicine · 2026
- Evaluating transfer learning strategies for improving dairy cattle body weight prediction in a small farm using depth-image and point-cloud data.Journal of dairy science · 2026