Excretion Detection in Pigsties Using Convolutional and Transformerbased Deep Neural Networks
Simon Mielke, Anthony Stein
TL;DR
This study tackles automated detection of urine puddles and related excretions in pig barns using thermal infrared imagery to support emission modeling and farm management. It benchmarks four deep learning detectors—Faster R-CNN, YOLOv8, DETR, and DAB-DETR—across two pig-house datasets with nested cross-validation–style training and eight detection metrics, achieving average APs above 90% and demonstrating robustness to out-of-distribution data. The results reveal model-specific strengths: Faster R-CNN and YOLOv8 excel in precision-driven AP on the primary dataset, while transformer-based DETR and DAB-DETR offer enhanced robustness in recall across datasets; untrained configurations perform poorly, underscoring the value of pretraining. The work highlights practical implications for emission estimation and motivates further research with larger, more diverse datasets and potential pixel-wise segmentation to extend applicability beyond bounding-box detection.
Abstract
Animal excretions in form of urine puddles and feces are a significant source of emissions in livestock farming. Automated detection of soiled floor in barns can contribute to improved management processes but also the derived information can be used to model emission dynamics. Previous research approaches to determine the puddle area require manual detection of the puddle in the barn. While humans can detect animal excretions on thermal images of a livestock barn, automated approaches using thresholds fail due to other objects of the same temperature, such as the animals themselves. In addition, various parameters such as the type of housing, animal species, age, sex, weather and unknown factors can influence the type and shape of excretions. Due to this heterogeneity, a method for automated detection of excretions must therefore be not only be accurate but also robust to varying conditions. These requirements can be met by using contemporary deep learning models from the field of artificial intelligence. This work is the first to investigate the suitability of different deep learning models for the detection of excretions in pigsties, thereby comparing established convolutional architectures with recent transformer-based approaches. The detection models Faster R-CNN, YOLOv8, DETR and DAB-DETR are compared and statistically assessed on two created training datasets representing two pig houses. We apply a method derived from nested cross-validation and report on the results in terms of eight common detection metrics. Our work demonstrates that all investigated deep learning models are generally suitable for reliably detecting excretions with an average precision of over 90%. The models also show robustness on out of distribution data that possesses differences from the conditions in the training data, however, with expected slight decreases in the overall detection performance.
