NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Automated collection of facial temperatures in dairy cows via improved UNet

Hang Shu, Kaiwen Wang, Leifeng Guo, Jérôme Bindelle, Wensheng WangComput. Electron. Agric 2024

Abstract

Monitoring the health and welfare of dairy cows is critical for modern smart farming. Infrared Thermography (IRT) offers a non-invasive way to track physiological states, but manual data extraction is labor-intensive and unscalable. This paper presents an improved UNet architecture, GhostECA-UNet, designed to automatically segment facial landmarks in thermal images. By integrating Ghost modules and Efficient Channel Attention (ECA), the model achieves a mean Intersection over Union (mIoU) of 80.76% while significantly reducing computational overhead. The system operates at 32.7 FPS, enabling real-time, high-precision temperature monitoring for precision livestock management.

Introduction

Infrared Thermography (IRT) is a powerful diagnostic tool in veterinary medicine, allowing for the detection of heat stress, respiratory diseases, and emotional states by measuring surface temperatures at specific facial landmarks. For instance, the temperature of the eyes serves as a reliable proxy for core body temperature. However, the current workflow relies on manual definition of "Regions of Interest" (ROIs) in thermal software, a process that is subjective and slow.

Automating this process is challenging due to the inherent properties of thermal images, which often feature lower resolution than RGB images and suffer from "thermal crossover," where the animal's heat signature blends into the background. This study addresses these challenges by developing a lightweight, high-performance deep learning model tailored for infrared data.

Methodology

The researchers built upon the standard UNet architecture, which is highly effective for grayscale medical imaging, and introduced two primary innovations to the decoder to enhance efficiency and accuracy:

  1. Ghost Modules: To reduce the computational burden, standard convolutional layers were replaced with Ghost modules. These modules use a small number of intrinsic filters and apply inexpensive linear operations to generate "ghost" feature maps, maintaining feature richness while cutting parameters by approximately 26%.
  2. Efficient Channel Attention (ECA): A lightweight attention mechanism was integrated to allow the network to prioritize the most informative feature channels. This is particularly useful for distinguishing subtle thermal boundaries, such as the edge of a cow's ear against a warm barn environment.
The GhostECA-UNet architecture, highlighting the integration of Ghost and GhostECA modules within the UNet framework.

Dataset and Task Definition

The model was trained and validated on a custom, open-source dataset consisting of 1,000 high-resolution thermal images (640x480 pixels) of 59 Holstein dairy cows. The images were collected in Shandong, China, during the summer to ensure a wide range of Temperature-Humidity Index (THI) levels, including heat-stressed conditions.

The task involved segmenting five key facial landmarks: Eyes, Muzzle, Nostrils, Ears, and Horns. These areas are critical for extracting accurate physiological data.

Examples of infrared cow images and their corresponding ground-truth segmentation masks for five facial landmarks.

Results and Discussion

The GhostECA-UNet outperformed several established models, including DeepLabV3+, PSPNet, and the transformer-based SegFormer.

Performance Metrics

  • Accuracy: The model achieved a top-tier mIoU of 80.76%.
  • Efficiency: Compared to the baseline UNet, the improved version reduced FLOPs (computational load) by 40%.
  • Speed: With a processing speed of 32.7 Frames Per Second (FPS), the model is suitable for real-time edge computing on farms.

Key Insights

Interestingly, the transformer-based SegFormer performed poorly compared to the UNet variants. This suggests that UNet's design—originally optimized for single-channel medical images—is inherently better suited for thermal data than models pre-trained on high-texture RGB datasets.

The model faced the greatest difficulty with the muzzle and nostrils. Moisture from saliva or mud on the nose alters thermal emissivity, creating blurry boundaries. Future iterations may combine these into a single "nose" class to improve robustness. Additionally, the model's performance on "horns" provided an unexpected benefit: it could identify cows with incomplete disbudding, serving as a secondary quality check for veterinary procedures.

Conclusion and Future Work

The GhostECA-UNet provides a robust foundation for automated cow health monitoring. While the system is ready for practical use in controlled settings, future work will focus on improving distance sensitivity (as cameras may be mounted further than the 1.5m used in this study) and integrating environmental corrections for sunlight and humidity to ensure the highest possible temperature accuracy across all seasons.

Summary updated

BibTeX
@article{shu2024automated,
  author = {Hang Shu and Kaiwen Wang and Leifeng Guo and Jérôme Bindelle and Wensheng Wang},
  title = {{Automated collection of facial temperatures in dairy cows via improved UNet}},
  journal = {Comput. Electron. Agric.},
  year = {2024},
  doi = {10.1016/j.compag.2024.108614},
}
Figure