Table of Contents
Fetching ...

Enhancing AI microscopy for foodborne bacterial classification via adversarial domain adaptation across optical and biological variability

Siddhartha Bhattacharya, Aarham Wasit, Mason Earles, Nitin Nitin, Luyao Ma, Jiyoon Yi

TL;DR

This study tackles rapid detection and classification of foodborne bacteria with AI-enabled microscopy under optical and biological variability, aiming to reduce culture-based incubation time. It uses EfficientNetV2 as the shared feature extractor and leverages adversarial domain adaptation via DANNs and MDANNs to learn domain-invariant features, optimizing a joint loss $L = \mathcal{L}_C + \lambda \mathcal{L}_D$ via a gradient reversal layer and an adaptive weight $\tau$. Results show target-domain accuracy gains up to $54.45\%$, $43.44\%$, and $31.67\%$ for different domains, with source degradation $<4.44\%$, and MDANNs offering strong generalization particularly in the BF domain; Grad-CAM and t-SNE confirm domain alignment. The few-shot learning approach enables scalable deployment with as few as $1$–$5$ labeled samples per species, reducing reliance on staining, extended incubation, and highly specialized equipment, making the framework suitable for decentralized and resource-limited settings. This work lays the groundwork for unsupervised domain adaptation and integration with cross-modality imaging to further enhance robustness and applicability.

Abstract

Rapid detection of foodborne bacteria is critical for food safety and quality, yet traditional culture-based methods require extended incubation and specialized sample preparation. This study addresses these challenges by i) enhancing the generalizability of AI-enabled microscopy for bacterial classification using adversarial domain adaptation and ii) comparing the performance of single-target and multi-domain adaptation. Three Gram-positive (Bacillus coagulans, Bacillus subtilis, Listeria innocua) and three Gram-negative (E. coli, Salmonella Enteritidis, Salmonella Typhimurium) strains were classified. EfficientNetV2 served as the backbone architecture, leveraging fine-grained feature extraction for small targets. Few-shot learning enabled scalability, with domain-adversarial neural networks (DANNs) addressing single domains and multi-DANNs (MDANNs) generalizing across all target domains. The model was trained on source domain data collected under controlled conditions (phase contrast microscopy, 60x magnification, 3-h bacterial incubation) and evaluated on target domains with variations in microscopy modality (brightfield, BF), magnification (20x), and extended incubation to compensate for lower resolution (20x-5h). DANNs improved target domain classification accuracy by up to 54.45% (20x), 43.44% (20x-5h), and 31.67% (BF), with minimal source domain degradation (<4.44%). MDANNs achieved superior performance in the BF domain and substantial gains in the 20x domain. Grad-CAM and t-SNE visualizations validated the model's ability to learn domain-invariant features across diverse conditions. This study presents a scalable and adaptable framework for bacterial classification, reducing reliance on extensive sample preparation and enabling application in decentralized and resource-limited environments.

Enhancing AI microscopy for foodborne bacterial classification via adversarial domain adaptation across optical and biological variability

TL;DR

This study tackles rapid detection and classification of foodborne bacteria with AI-enabled microscopy under optical and biological variability, aiming to reduce culture-based incubation time. It uses EfficientNetV2 as the shared feature extractor and leverages adversarial domain adaptation via DANNs and MDANNs to learn domain-invariant features, optimizing a joint loss via a gradient reversal layer and an adaptive weight . Results show target-domain accuracy gains up to , , and for different domains, with source degradation , and MDANNs offering strong generalization particularly in the BF domain; Grad-CAM and t-SNE confirm domain alignment. The few-shot learning approach enables scalable deployment with as few as labeled samples per species, reducing reliance on staining, extended incubation, and highly specialized equipment, making the framework suitable for decentralized and resource-limited settings. This work lays the groundwork for unsupervised domain adaptation and integration with cross-modality imaging to further enhance robustness and applicability.

Abstract

Rapid detection of foodborne bacteria is critical for food safety and quality, yet traditional culture-based methods require extended incubation and specialized sample preparation. This study addresses these challenges by i) enhancing the generalizability of AI-enabled microscopy for bacterial classification using adversarial domain adaptation and ii) comparing the performance of single-target and multi-domain adaptation. Three Gram-positive (Bacillus coagulans, Bacillus subtilis, Listeria innocua) and three Gram-negative (E. coli, Salmonella Enteritidis, Salmonella Typhimurium) strains were classified. EfficientNetV2 served as the backbone architecture, leveraging fine-grained feature extraction for small targets. Few-shot learning enabled scalability, with domain-adversarial neural networks (DANNs) addressing single domains and multi-DANNs (MDANNs) generalizing across all target domains. The model was trained on source domain data collected under controlled conditions (phase contrast microscopy, 60x magnification, 3-h bacterial incubation) and evaluated on target domains with variations in microscopy modality (brightfield, BF), magnification (20x), and extended incubation to compensate for lower resolution (20x-5h). DANNs improved target domain classification accuracy by up to 54.45% (20x), 43.44% (20x-5h), and 31.67% (BF), with minimal source domain degradation (<4.44%). MDANNs achieved superior performance in the BF domain and substantial gains in the 20x domain. Grad-CAM and t-SNE visualizations validated the model's ability to learn domain-invariant features across diverse conditions. This study presents a scalable and adaptable framework for bacterial classification, reducing reliance on extensive sample preparation and enabling application in decentralized and resource-limited environments.

Paper Structure

This paper contains 22 sections, 7 equations, 5 figures, 3 tables.

Figures (5)

  • Figure 1: Schematic of the model training process using a domain-adversarial neural network (DANN) for domain adaptation for $M$ domains
  • Figure 2: Example of bacterial microcolony images across domains. Columns represent different bacterial species, including Bacillus coagulans (Bc), Bacillus subtilis (Bs), Listeria innocua (Li), E. coli (Ec), Salmonella Enteritidis (SE), Salmonella Typhimurium (ST). Rows represent domains with different laboratory conditions, as detailed in Table 1.
  • Figure 3: Comparison of classification confusion matrices for source-only training and domain-adversarial training across three target domains. (a, c, e) Classification results for source-only training for the BF, 20×, 20×–5h target domains, respectively. (b, d, f) Improved classification results for the corresponding target domains using domain-adversarial training with DANNs. Bc: Bacillus coagulans. Bs: Bacillus subtilis. Ec: E. coli. Li: Listeria innocua. SE: Salmonella Enteritidis. ST: Salmonella Typhimurium.
  • Figure 4: Gradient-based class activation mapping (Grad-CAM) visualizations of feature representations for a 5-shot MDANN. Activations are shown for the source domain (a: PC) and target domains (b: BF, c: 20×), with warmer colors indicating stronger model attention.
  • Figure 5: t-distributed stochastic neighbors embedding (t-SNE) visualization of feature embeddings extracted by the 5-shot DANN. The source domain is PC, and the target domain is 20×–5h. Clusters represent feature embeddings for specific bacterial species, with source samples (black dots) and target samples (colored crosses). Overlapping clusters indicate effective alignment of features across domains. Bc: Bacillus coagulans. Bs: Bacillus subtilis. Ec: E. coli. Li: Listeria innocua. SE: Salmonella Enteritidis. ST: Salmonella Typhimurium.