Neural network-based visual identification of animals has significant potential for livestock farming and herd management. Real farm environments rarely provide controlled visual conditions for high-quality dataset collection, which often leads to reduced model performance on out-of-distribution inputs and makes confidence estimation essential for reliable application. This work introduces a conformal prediction framework for animal identification based on pretrained neural network embeddings (ResNet-50 and Swin Transformer), enabling the generation of prediction sets with formal confidence guarantees. By calibrating a nonconformity score derived from cosine distances in the embedding space, the method ensures that the true identity is included in the prediction set at a user-defined confidence level. Three nonconformity scoring functions are evaluated to determine which produces the most compact prediction sets. Experiments on cow and goat datasets demonstrate that the framework achieves empirical coverage close to the target confidence levels across different embedding models. The ratio-based nonconformity measure consistently outperforms others, reducing mean set sizes by up to 79% compared to alternative measures. Swin-T embeddings outperform ResNet-50 by up to 14 percentage points in singleton prediction rate. The proposed framework preserves formal validity guarantees, improving robustness and interpretability in practical livestock applications where standard identification methods return only the nearest match without reliability estimates.
Marazov et al. (Thu,) studied this question.