Skip to main content
Data in Brief logoLink to Data in Brief
. 2026 Feb 11;65:112587. doi: 10.1016/j.dib.2026.112587

Thermal infrared italian mediterranean buffalo udder open dataset with expert-verified segmentation masks

Mattia Fonisto a,⁎, Maria Teresa Verde b, Francesco Bonavolontà a, Annalisa Liccardo a, Roberta Matera b, Matteo Santinello b, Flora Amato a
PMCID: PMC12925564  PMID: 41732363

Abstract

This data article describes an open dataset of thermal images of buffalo udders curated for pixel-level segmentation, the first publicly accessible open dataset on the topic. Images were acquired in situ at a commercial farm in southern Italy over >1 year during routine robotic milking, using a fixed, rear-facing long-wave infrared camera (640×480 resolution) positioned at approximately 1 m, with emissivity set to 0.98. Environmental measurements (ambient temperature and relative humidity) from a nearby station were recorded at capture time and used for temperature compensation before min–max conversion to single-channel 8-bit PNGs. The release contains 2148 image–mask pairs organised in predefined train/validation/test splits. Two veterinarians produced udder masks with polygonal annotation following a shared protocol and resolving disagreements by consensus. The dataset is intended to support reproducible research on udder-region segmentation, a necessary preprocessing step before extracting udder skin surface temperature (USST) in mastitis-oriented studies of dairy animals but not limited to only mastitis. Beyond udder health, thermal computer vision tasks in veterinary science include behaviour monitoring and localisation of anatomical regions for temperature tracking. Labelled thermal segmentation data can also serve as source material for pretraining and transfer to such applications.

Keywords: Thermal imaging, Veterinary imaging, Buffalo udder, Mastitis screening, Semantic segmentation, Computer vision


Specifications Table

Subject Computer Sciences
Specific subject area Veterinary infrared computer vision: buffalo udder segmentation for udder skin surface temperature processing
Type of data Thermal images (.png format) and binary masks (.png format)
Data collection Thermal udder images were acquired in situ before robotic milking at a commercial buffalo farm using a FLIR A700 LWIR camera (640×480) with a fixed rear-facing position at ≈1 m, and an emissivity of 0.98. Ambient temperature and relative humidity data from a nearby station were logged and used to compensate for radiometric frames, which were then normalized to a single channel using the min-max method and converted to 8-bit PNGs. Inclusion/exclusion criteria were: retaining clear udder view; discarding frames with obstructions, missing udder, or low udder coverage; keeping the clearest if multiple frames per milking were present.
Data source location Collection site: Commercial buffalo farm in Cancello e Arnone, Caserta, Campania, Italy (approx. 41.067° N, 14.017° E).
Data accessibility Repository name: ``buffalo-udder-seg: Thermal Infrared Images of Italian Mediterranean Buffalo Udders with Pixel-Level Segmentation Masks'' [1]
Data identification number: 10.5281/zenodo.17224006
Direct URL to data: https://doi.org/10.5281/zenodo.17224006
Related research article M. T. Verde, M. Fonisto, F. Amato, A. Liccardo, R. Matera, G. Neglia, and F. Bonavolontà, “An AI-driven multimodal monitoring system for early mastitis indicators in Italian Mediterranean buffalo,” Sensors, vol. 25, no. 15, p. 4865, 2025 [2]

1. Value of the Data

  • •

    Reviews of veterinary infrared thermography (IRT) highlight the need for better standardisation and data sharing across livestock disease studies. Recent IRT-based mastitis screening papers also state that their image data are not publicly available. Open thermal udder datasets remain, to the best of our knowledge, almost non-existent in literature; releasing a curated, expert-annotated segmentation dataset directly addresses this scarcity for udder-focused IRT [[3], [4], [5]].

  • •

    The dataset ships with deterministic filename pairing and predefined train/validation/test partitions, enabling researchers to evaluate segmentation pipelines under identical conditions and report results on the same splits. This supports reproducibility and facilitates fair comparisons.

  • •

    Thermal livestock vision spans multiple tasks, e.g., respiration/breathing analysis in cattle, estrus detection in dairy animals, and region detection on pigs’ ears. A labeled thermal segmentation dataset can serve as a starting point for domain adaptation across such applications, allowing researchers to initialize models in the veterinary thermal domain before fine-tuning on task-specific datasets [[6], [7], [8]].

2. Background

Mastitis is routinely monitored in dairy herds, and infrared thermography (IRT) is widely used to measure udder skin surface temperature (USST) as a non-contact indicator associated with inflammatory changes. Prior work on cattle and buffalo reports that mastitis is accompanied by elevations or asymmetries in udder surface temperature, as measured by IRT, motivating standardised image capture and processing for downstream temperature extraction. [[9], [10], [11]]

Our motivation was to enable reproducible research on udder-region segmentation—a necessary preprocessing step for any USST calculation—under real-farm conditions. We therefore compiled a year-span collection of thermal udder images acquired immediately before routine robotic milking, using a fixed rear-facing camera and recording ambient temperature and relative humidity for temperature correction before normalisation. Two veterinarians delineated udder polygons using a shared protocol that defined inclusion/exclusion criteria, and disagreements were resolved by consensus.

This dataset was previously used in our research article on thermal udder imaging for mastitis screening [2]; the present data article adds value by providing a fully documented, reusable segmentation resource for benchmarking and methods development in thermal veterinary imaging.

3. Data Description

This dataset contains paired thermal images and binary masks of buffalo udders collected between 2022–04–02 and 2023–06–11 for segmentation tasks in thermal veterinary imaging. An example image-mask pair is provided in Fig. 1.

Fig. 1.

Fig 1: dummy alt text

Image-mask pair and overlay example.

The files are organised into predefined training, validation, and test partitions and use UUID4 basenames so that each image and its corresponding mask share the same filename. Images are single-channel 8-bit PNGs obtained from radiometric frames after ambient-temperature and humidity correction, followed by min–max normalisation, while masks are single-channel 8-bit PNGs with values 0 (background) and 255 (udder). Images and masks have identical dimensions (640×480) and share the same pixel coordinate system, ensuring exact alignment. A summary of these informations is provided in Table 1, and a high-level overview of the pipeline from capture to binary mask generation is shown in Fig. 2.

Table 1.

Buffalo udder segmentation dataset description.

Collection period 2022–04–02 to 2023–06–11
Total pairs 2148
Image resolution 640×480 pixels
Splits (pairs) train 1545 - val 431 - test 172
Filenames UUID4 basenames
Image pre-processing Min–max normalisation after temperature/RH correction
Image encoding PNG, single channel, 8-bit, values 0–255
Mask encoding PNG, single channel, 8-bit, values {0, 255}
Alignment One-to-one filename pairing; identical shape and coordinates

Fig. 2.

Fig 2: dummy alt text

High-level dataset pipeline from frame capture to binary mask generation.

The top level contains two folders, images/ and masks/, each split into train/, val/, and test/. Every split directory under images/ contains one PNG per sample named 〈uuid4〉.png. The corresponding directory under masks/ contains a PNG with the same 〈uuid4〉.png basename, providing a deterministic 1:1 mapping between image and mask files. A concise tree is provided in Fig. 3.

Fig. 3.

Fig 3: dummy alt text

Directory structure of the buffalo udder segmentation dataset.

Basic geometry statistics are computed over all 2148 image–masks pairs. The mask area fraction (udder pixels divided by image pixels) has a mean of 0.053 and a median of 0.043, with an interquartile range of 0.035–0.053. Bounding-box aspect ratios (width/height of the tight mask box) have a mean of 1.06 and a median of 1.04. The average normalised mask centroid across the 640×480 grid in image coordinates, with the origin at the upper left, is (0.745, 0.221). These statistics are summarised in Fig. 4.

Fig. 4.

Fig 4: dummy alt text

Mask area distribution, aspect ratio and centroid location.

We also report additional derived mask geometry descriptors computed deterministically from each mask: the mask perimeter, computed as the number of boundary pixels using an 8-connected neighbourhood criterion; the tight bounding-box coverage (extent), defined as mask area divided by the area of the tight bounding box; the equivalent diameter, defined as the diameter of a circle with the same area as the mask; and solidity, defined as mask area divided by the area of the convex hull. Over the full dataset, these metrics have mean(median;IQR) values of perimeter 682.8(641;581−702) pixels, extent 0.603(0.606;0.573−0.637), equivalent diameter 137.9(130.1;117.1−144.3) pixels, and solidity 0.916(0.924;0.899−0.941).

Intersection-over-Union (IoU) and Dice are recommended for evaluating binary udder segmentation, reported as mean±std over the held-out test split; a straightforward baseline is a U-Net–style model trained on the training split and selected using validation performance. IoU is defined as

IoU=|M∩M^||M∪M^|, and the Dice coefficient is defined as Dice=2|M∩M^||M|+|M^|, where M denotes the ground-truth udder mask and M^ the predicted udder mask. As a pragmatic reference point, in our previous study, we considered IoU≥0.8 as an acceptable segmentation quality threshold for the task of maximum USST extraction.

4. Experimental Design, Materials and Methods

Thermal images were collected in situ at a commercial buffalo farm in Cancello e Arnone (Caserta, Southern Italy) during routine robotic milking from 2022–04–02 to 2023–06–11.

Imaging used a Teledyne FLIR A700 long-wave infrared camera (radiometric, 640×480 detector, 7.5–14 μm spectral range; NETD in the <30–40 mK band). The camera was mounted in a fixed rear-facing position relative to the milking unit at an ≈1 m working distance, emissivity = 0.98, and focus locked; no active illumination was used.

Frames were captured immediately before the milking cycle so that the udder region was unobstructed by moving tooling when possible. Each capture was timestamped. When the system produced multiple frames for a single milking session, annotators retained one “clearest” frame (sharp, minimal occlusion) for that session and discarded the others.

A nearby weather station recorded ambient temperature ( °C) and relative humidity ( %). These measurements were used as inputs for atmospheric/ambient compensation before normalization of the radiometric temperature matrices. After compensation, each frame was mapped to an 8-bit single-channel PNG by linear min–max scaling of the pixel values to the [0, 255] range.

Pixel-level udder regions were delineated by two veterinarians using polygon segmentation in Label Studio [12], a collaborative labeling web application, with a shared labeling interface and policy. Each image was annotated independently; disagreements were jointly reviewed and resolved by consensus, and the final polygon for each image was rasterized to a binary mask aligned to the image grid.

To quantify annotation consistency, a subset of 20 images was independently annotated by the two veterinarians prior to consensus resolution. Inter-annotator agreement was assessed on the resulting binary udder masks using overlap-based segmentation metrics (IoU and Dice). Across the 20 images, the two annotators achieved a mean IoU of 0.942±0.017 and a mean Dice of 0.970±0.06, indicating strong annotation consistency.

Decisions for inclusion or exclusion of thermal images were made before modelling and applied to the frames available from the capture pipeline. The criteria described in Table 2 were used. Some visual examples of the inclusions and exclusions are provided in Fig. 5.

Table 2.

Inclusion and exclusion criteria used by annotators.

Criterion Include / Exclude Operational definition for annotators
Clear udder visibility Include Udder region cleanly visible with minimal occlusion; focus acceptable; motion blur absent or minimal.
Occlusions by equipment or body Exclude Any obstruction (robotic tooling, limbs, tail) that hides a substantial portion of the udder or teats.
Insufficient field-of-view coverage Exclude Frames where the udder occupies an insufficient portion of the image.
Missing udder Exclude Udder absent or only marginally in frame.
Multiple frames per milking Include one; exclude others For sessions with >1 frame, retain the clearest single frame that best meets the criteria above.

Fig. 5.

Fig 5: dummy alt text

Visual example of inclusion and exclusion criteria.

Limitations

The dataset is modest in size for deep learning applications (2148 pairs). Masks were drawn with a polygonal lasso, which discretises curved boundaries into straight segments; this can introduce boundary imprecision that may affect models sensitive to fine edges even if summary metrics like IoU or Dice are comparatively robust. Frames are rear-view only from a fixed camera position on a single robotic milking unit; anterior or contralateral quarters may be partially occluded. The acquisition used a single thermal camera model and a single mounting geometry under the farm’s ambient conditions; transferability to different sensors, optics, or barn layouts is unknown. Finally, no animal-level clinical labels are included as the dataset is intended solely for udder-region segmentation in thermal veterinary imaging.

Ethics Statement

Thermal images were acquired during routine husbandry on a commercial farm without experimental manipulation, randomization, or procedures beyond standard robotic milking. Frames depict only the udder region and contain no identifiable information. The farm owner provided permission for research use and public release of anonymised data.

This work does not report an in vivo animal experiment; the ARRIVE guidelines are designed for publications describing animal experiments and therefore do not fully apply to this dataset.

Data collection complied with institutional and national standards for animal welfare and with the spirit of EU Directive 2010/63/EU on the protection of animals used for scientific purposes; no procedures beyond routine milking were performed.

CRediT authorship contribution statement

Mattia Fonisto: Conceptualization, Methodology, Software, Validation, Formal analysis, Data curation, Writing – original draft, Writing – review & editing, Visualization. Maria Teresa Verde: Conceptualization, Formal analysis, Investigation, Writing – original draft, Visualization. Francesco Bonavolontà: Conceptualization, Methodology, Validation, Formal analysis, Investigation, Resources, Writing – original draft, Writing – review & editing, Supervision, Project administration, Funding acquisition. Annalisa Liccardo: Methodology, Validation, Formal analysis, Resources, Writing – review & editing. Roberta Matera: Investigation, Visualization. Matteo Santinello: Investigation, Visualization. Flora Amato: Methodology, Software, Validation, Formal analysis, Data curation, Writing – original draft, Writing – review & editing, Supervision, Project administration.

Acknowledgements

This work was carried out within the Agritech National Research Centre and received funding from the European Union's ``Next Generation EU'' under the Italian PNRR (CN00000022), and from the European Union's “Future Artificial Intelligence Research (FAIR)” under the Italian PNRR (E63C22002150007).

Declaration of Competing Interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Data Availability

References

  • 1.Fonisto M., et al. buffalo-udder-seg: thermal infrared images of italian Mediterranean buffalo udders with pixel-level segmentation masks. Zenodo. 2025 doi: 10.5281/zenodo.17224006. [DOI] [Google Scholar]
  • 2.Verde M.T., et al. An AI-driven multimodal monitoring system for early mastitis indicators in Italian Mediterranean Buffalo. Sensors. 2025;25(15):4865. doi: 10.3390/s25154865. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.McManus R., et al. Thermography for disease detection in livestock: a scoping review. Front. Vet. Sci. 2022;9 doi: 10.3389/fvets.2022.965622. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Korelidou V., Simitzis P., Massouras T., Gelasakis A.I. Infrared thermography as a diagnostic tool for the assessment of mastitis in dairy ruminants. Animals. 2024;14(18):2691. doi: 10.3390/ani14182691. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Amato A., Bonavolontà F., Fonisto M., Verde M.T. International Conference on Advanced Information Networking and Applications. Springer; 2025. Machine learning approaches for detecting subclinical mastitis in dairy animals: a brief review of recent literature; pp. 1–7. [Google Scholar]
  • 6.Kim S., Hidaka Y. Breathing pattern analysis in cattle using infrared thermography and computer vision. Animals. 2021;11(1):207. doi: 10.3390/ani11010207. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Riaz U., Idris M., Ahmed M., Ali F., Yang L. Infrared thermography as a potential non-invasive tool for estrus detection in cattle and buffaloes. Animals. 2023;13(8):1425. doi: 10.3390/ani13081425. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Ma W., Wang X., Yang S.X., Song L., Li Q. Leveraging thermal infrared imaging for pig ear detection research: the TIRPigEar dataset and performances of deep learning models. Animals. 2024;15(1):41. doi: 10.3390/ani15010041. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Gayathri S., Bhakat M., Mohanty T. Seasonal assessment of mastitis using thermogram analysis in murrah buffaloes. J. Therm. Biol. 2024;121 doi: 10.1016/j.jtherbio.2024.103842. [DOI] [PubMed] [Google Scholar]
  • 10.Teja A., et al. Digital infrared thermal imaging of udder skin surface temperature: a novel non-invasive technology to monitor calving process in Murrah buffalo (Bubalus bubalis) Sci. Rep. 2023;13(1) doi: 10.1038/s41598-023-40447-4. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Velasco-Bolaños J., et al. Application of udder surface temperature by infrared thermography for diagnosis of subclinical mastitis in Holstein cows located in tropical highlands. J. Dairy Sci. 2021;104(9):10310–10323. doi: 10.3168/jds.2020-19894. [DOI] [PubMed] [Google Scholar]
  • 12.M. Tkachenko, M. Malyuk, A. Holmanyuk, and N. Liubimov, “Label Studio: data labeling software.” 2020. [Online]. Available: https://github.com/HumanSignal/label-studio

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement


Articles from Data in Brief are provided here courtesy of Elsevier

RESOURCES