{
  "abstract": "Early and accurate identification of mastitis-associated inflammation is critical to increasing animal comfort, reducing financial losses, and enhancing milk quality. Although infrared thermography (IRT) has emerged as a viable non-invasive screening technique, the relative efficacy of convolutional neural networks (CNNs) and Vision Transformers (ViTs) for automated CMT-status classification from thermal udder pictures is still unknown. This work carefully analyzed seven ImageNet-pretrained deep learning architectures using 976 thermal udder images (708 healthy and 268 mastitic images) from 488 Holstein cows (354 healthy cows, 708 images; 134 mastitic cows, 268 images), including two Vision Transformer models (ViT-B/16 and Swin-Tiny) and five CNN models (ResNet-50, DenseNet-121, EfficientNet-B0, MobileNetV2, Inception-V3). Before training, pictures were preprocessed using contrast-limited adaptive histogram equalization (CLAHE), scaled to 224 × 224 pixels, and divided using cow-oriented grouping intended to reduce animal-level data leakage (this grouping could not be independently verified against a ground-truth cow roster; see Limitations). Each model was developed from start to finish and evaluated using an independent hold-out test set and five-fold animal-level cross-validation. DenseNet-121 had the greatest results on the hold-out test set, with an accuracy of 82.2%, an AUC of 0.922, a sensitivity of 90.0%, and a specificity of 79.2%. Additionally, it achieved the highest cross-validation performance (mean AUC = 0.914 ± 0.019). According to statistical analysis, DenseNet-121 was statistically indistinguishable from Inception-V3 under both tests and from ResNet-50 under the more conservative corrected resampled t-test, but significantly outperformed EfficientNet-B0, MobileNetV2, and both Vision Transformers (p < 0.05), while all CNN models outperformed both Vision Transformer models (p < 0.05). Explainable artificial intelligence (XAI) investigation utilizing Grad-CAM corroborated the biological plausibility of the learnt plausibility characteristics by showing that heat patterns in the udder region had a significant impact on model predictions. Grad-CAM analysis showed that heat patterns in the udder region partly drove model predictions, though attention was occasionally influenced by background regions. The best-performing model was tested without retraining on an independent external cohort of 85 cows from a different farm. Although external performance decreased (accuracy = 60.0%; Cohen's κ = 0.199), consistent with the expected effects of domain shift, the somatic cell count was significantly higher in CMT-positive cows (p < 0.001; AUC = 0.783), supporting the biological significance of the identified thermal abnormalities. Fine-tuned CNNs, led by DenseNet-121, delivered accurate and reproducible thermal CMT-status classification under internal cross-validation, but transportability to an independent farm was limited (external accuracy = 0.600, κ = 0.199), indicating that domain adaptation and multi-farm validation are needed before broader deployment. These findings provide strong support for the application of CNN-based deep learning in IRT-assisted CMT-status screening while highlighting the necessity for larger multicenter datasets to further evaluate transformer-based approaches. aptation and multi-farm validation are needed before broader deployment. These findings provide strong support for the application of CNN-based deep learning in IRT-assisted mastitis screening while highlighting the necessity for larger multicenter datasets to further evaluate transformer-based approaches.",
  "abstract_shown": true,
  "affiliations": [
    "Department Artificial Intelligence, Faculty of Computers and Artificial Intelligence, Benha University, Benha 19111, Egypt.",
    "Department of Scientific Computing, Faculty of Computers and Artificial Intelligence, Benha University, Benha 19111, Egypt.",
    "Department of Computer Science, Faculty of Computers and Artificial Intelligence, Misr University for Science and Technology (MUST), Giza P.O. Box 77, Egypt.",
    "The Egyptian School of Data Science (ESDS), Benha, Egypt.",
    "Department of Animal and Poultry Production, College of Agriculture and Food, Qassim University, Buraydah 51452, Saudi Arabia.",
    "Animal Production Research Institute, Agricultural Research Center, Giza 12618, Egypt."
  ],
  "article_type": "research article",
  "arxiv": null,
  "author_total": 5,
  "authors": [
    {
      "affs": [
        0
      ],
      "name": "Alaa T Elmaria"
    },
    {
      "affs": [
        1,
        2,
        3
      ],
      "name": "Elsayed Badr"
    },
    {
      "affs": [
        4
      ],
      "name": "Sobhy M A Sallam",
      "orcid": "0000-0002-6949-2387"
    },
    {
      "affs": [
        5
      ],
      "name": "Marwa F A Attia"
    },
    {
      "affs": [
        0
      ],
      "name": "Sara Swedian",
      "orcid": "0000-0003-3183-8044"
    }
  ],
  "bibtex": "https://research.draconitic.com/paper/7h0r8y1vp4cjb.bib",
  "cited_by": 0,
  "doi": "10.3390/vetsci13101031",
  "fulltext_url": "https://europepmc.org/articles/PMC13709568",
  "id": "7h0r8y1vp4cjb",
  "issns": [
    "2306-7381"
  ],
  "landing_url": "https://europepmc.org/article/MED/42944128",
  "language": "eng",
  "licence": "CC-BY",
  "licence_label": "CC BY",
  "licence_source": "article",
  "licence_url": "https://creativecommons.org/licenses/by/4.0/",
  "metadata_licence": null,
  "native_subjects": [
    [
      "openalex",
      "1110|Smart Agriculture and AI"
    ]
  ],
  "openalex": "W7214744450",
  "pdf_url": "https://europepmc.org/articles/PMC13709568?pdf=render",
  "pmcid": "PMC13709568",
  "pmid": "42944128",
  "published": "2026-09-29",
  "publisher": null,
  "ris": "https://research.draconitic.com/paper/7h0r8y1vp4cjb.ris",
  "sources": [
    {
      "first_seen": "2026-10-30T12:22:24Z",
      "native_id": "MED:42944128",
      "source": "europepmc",
      "url": "https://europepmc.org/article/MED/42944128"
    }
  ],
  "subjects": [
    {
      "field": "biology",
      "origin": "openalex:1110|Smart Agriculture and AI",
      "subfield": "plant-biology"
    }
  ],
  "title": "Deep Learning and Explainable Artificial Intelligence for Infrared-Thermography-Based CMT-Status Classification in Dairy Cows: A Comparative Evaluation in Egyptian Farms.",
  "title_text": "Deep Learning and Explainable Artificial Intelligence for Infrared-Thermography-Based CMT-Status Classification in Dairy Cows: A Comparative Evaluation in Egyptian Farms.",
  "type": "peer-reviewed",
  "updated_at": "2026-10-30T12:22:24Z",
  "url": "https://research.draconitic.com/paper/7h0r8y1vp4cjb",
  "venue": "Veterinary sciences",
  "versions": []
}