# Guided Conditional Diffusion Classifier (ConDiff)
for Enhanced Prediction of Infection in
Diabetic Foot Ulcers

Palawat Busaranuvong, Emmanuel Agu, Deepak Kumar, Shefalika Gautam, Reza
Saadati Fard, Bengisu Tulu, Diane Strong This work is supported by the
National Institutes of Health (NIH) through grant 1R01EB031910-01A1
Smartphone-based wound infection screener by combining thermal images and
photographs using deep learning methods. (Corresponding author: Emmanuel
Agu.)Palawat Busaranuvong and Shefalika Gautam are with the Data Science
Department, Worcester Polytechnic Institute, Worcester, MA 01609 USA. Emmanuel
Agu, Deepak Kumar, and Reza Saadati Fard are with the Computer Science
Department, Worcester Polytechnic Institute, Worcester, MA 01609 USA. Bengisu
Tulu and Diane Strong are with the Foisie Business School, Worcester
Polytechnic Institute, Worcester, MA 01609 USA. (e-mail:
<EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS><EMAIL_ADDRESS>dstrong@wpi.edu).

###### Abstract

Goal: To detect infected wounds in Diabetic Foot Ulcers (DFUs) from
photographs, preventing severe complications and amputations. Methods: This
paper proposes the Guided Conditional Diffusion Classifier (ConDiff), a novel
deep-learning infection detection model that combines guided image synthesis
with a denoising diffusion model and distance-based classification. The
process involves (1) generating guided conditional synthetic images by
injecting Gaussian noise to a guide image, followed by denoising the noise-
perturbed image through a reverse diffusion process, conditioned on infection
status and (2) classifying infections based on the minimum Euclidean distance
between synthesized images and the original guide image in embedding space.
Results: ConDiff demonstrated superior performance with an accuracy of 83% and
an F1-score of 0.858, outperforming state-of-the-art models by at least 3%.
The use of a triplet loss function reduces overfitting in the distance-based
classifier. Conclusions: ConDiff not only enhances diagnostic accuracy for DFU
infections but also pioneers the use of generative discriminative models for
detailed medical image analysis, offering a promising approach for improving
patient outcomes.

###### Index Terms:

Diabetic Foot Ulcers, Diffusion Models, Distance-based Image Classification,
Generative Models, Wound Infection.

Impact Statement- ConDiff enhances the accuracy of automatic diagnosis of
infections in diabetic foot ulcers, offering a promising tool for early
detection and improved patient care.

##  I Introduction

Chronic wounds, affecting over 6.5 million people or approximately 2% of the
U.S. population, represent a significant health issue with healthcare expenses
exceeding $25 billion each year [1, 2]. Among these, Diabetic Foot Ulcers
(DFUs) are a prevalent subtype that poses a substantial risk for patients with
diabetes. The commonality of DFUs on lower limbs, especially on the soles of
the feet, makes them highly susceptible to infection [3], with an alarming 40%
to 80% of cases leading to infection [4]. These infections, often caused by
bacteria, can result in severe complications, including cell death, limb
amputation, and hospitalization [5]. Given these risks, effective monitoring
and early detection of infections are crucial in the management of DFUs to
prevent further complications.

Table I: Summary of prior work on wound infection classification using deep
learning

Specific ML problem | Related Work |  | Summary of
---
Approach
| No. of
---
Target Classes
Dataset | Results
| Wound segmentation
---
and Infection
Classification
| Wang et al.
---
2015 [6]
| CNN-based:
---
ConvNet + SVM
2 classes (infection and no infection) |  | NYU wound
---
Database
| Accuracy: 95.6%
---
PPV: 40%
Sensitivity: 31%
| Classification of
---
7 tissue types
including infection
| Nejati et al.
---
2018 [7]
| CNN-based: AlexNet
---
\+ PCA + SVM
| Private data
---
(data statistics
is unknown)
| Accuracy 95.6%
---
(Only reported accuracy)
|  | Goyal et al.
---
2020 [8]
| CNN-based:
---
Ensemble CNN
2 classes (infection and no infection) |  Part B DFU 2020 dataset (We also used this dataset) |  | Accuracy: 72.7%
---
PPV: 73.5%
Sensitivity: 70.9%
DFU infection classification |  | Al-Garaawi et al.
---
2022 [9]
| CNN-based:
---
DFU-RGB-TEX-Net
| Accuracy: 74.2%
---
PPV: 74.1%
Sensitivity: 75.1%
|  | Liu et al.
---
2022 [10]
| CNN-based:
---
augmentations
\+ EfficientNet
| Data leakage
---
when splitting &
performing augmentations
DFU wound ischemia and infection classification |  | Yap et al.
---
2021 [11]
| CNN-based:
---
VGG, ResNet,
InceptionV3, DenseNet,
EfficientNet
4 classes (both infection and ischemia, infection, ischemia, none) |  DFUC2021 dataset |  | EfficientNet B0
---
performance:
F1, PPV, SEN
= 55% , 57%, 62%
|  | Galdran et al.
---
2021 [12]
| ViT-based: ViT,
---
DeiT, BiT
| BiT performance:
---
F1, PPV, SEN
= 61%, 66% , 61%

The problem: Accurately diagnosing infections in DFUs involves analyzing the
wound’s bacteriology, and reviewing patient records including clinical
history, physical health assessments, and blood tests. However, as clinicians
do not always have access to this comprehensive wound information, they often
rely on visual inspection to identify signs of infection in DFUs. Visual
indicators of infection include increased redness around the ulcer and colored
purulent discharge. Moreover, experienced wound experts are not always
available, especially in low-resource settings and developing countries. This
paper proposes an automated method that uses deep-learning to detect infected
DFUs from images.

Prior work: Recently, machine learning methods have achieved impressive
performance in various medical image analysis and wound assessment tasks
including works by Liu et al. [13, 14] for scoring the healing progress of
chronic wounds from photographs based on evidence-based rubrics such as the
Photographic Wound Assessment Tool (PWAT). Additionally, State-Of-The-Art
(SOTA) machine learning image classification techniques have been proposed for
detecting infections from the visual appearance of wounds in photographs [8,
12, 11] without the need for direct wound tests, medical notes, or extensive
clinical examinations. Goyal et al. [8] introduced the CNN-Ensemble model,
which extracts bottleneck features from Inception-V3, ResNet50, and
InceptionResNetV2 that are then classified using an SVM classifier. Goyal et
al. [8] also described the DFU infection dataset, in which clinical experts at
Lancashire Teaching Hospital in the United Kingdom, used visual inspection to
label whether wound images are infected. CNN-Ensemble achieved 72.7% accuracy
for binary infection classification of wound images in the DFU infection
dataset.

In a subsequent study, Liu et al. [10] reported an impressive accuracy of 99%
for wound infection classification by adapting the EfficientNet model [15],
along with data augmentation techniques. However, their high accuracy was in
part due to data leakage issues between the training and testing datasets.
Specifically, the original DFU infection dataset from Goyal et al. [8]
included each wound image in three naturally augmented forms with varying
magnifications (see Fig. 1). Liu et al. [10] randomly divided these augmented
images between the training and testing sets on a sample-wise basis, which
resulted in significant data leakage as the testing set included images that
closely resembled augmented versions of the training images.

Figure 1: Natural data augmentation of an original image with three different
magnifications.

Challenges: Automated DFU image analyses to detect infection using deep
learning methods face several challenges that hinder accurate diagnoses.
Firstly, the distinction between images of infected and uninfected wounds is
fine-grained [8], exemplified by high inter-class similarity and intra-class
variation, which present a challenge to machine learning infection
classifiers. Secondly, wound image datasets often have inconsistent imaging
conditions, including variations in camera distance, orientation, and lighting
[8]. Lastly, as data collection in clinical environments is expensive and
tedious, labeled DFU image datasets are often small, making it challenging to
train deep-learning models.

Figure 2: Inference in the ConDiff Classier Framework. Input $x_{0}$ is
perturbed by noise of strength $t_{0}$. The perturbed input $x_{t_{0}T}$ is
denoised through a reverse diffusion process to synthesize image
$\hat{x}_{0}^{(y_{i})}$ conditioned on label $y_{i}$. Infection classification
is based on the minimum $L_{2}$ distance between $x_{0}$ and
$\hat{x}_{0}^{(y_{i})}$ in embedding space.

Our approach: This paper presents the Guided Conditional Diffusion Classifier
(ConDiff), a novel generative discriminative approach for wound infection
classification (see Fig. 2). ConDiff leverages conditional guide image editing
with a generative diffusion model [16, 17] by perturbing an input image with a
specific amount of Gaussian noise, and generating new images by using a
reverse diffusion process to gradually remove noise from the noise-perturbed
input image. ConDiff’s diffusion process is conditioned on the state of the
wound (no infection ($y_{1}$) or infection ($y_{2}$)), creating synthetic
images reflective of these states. One key importance is the ability of
ConDiff to discern and learn similarities between representations of the
conditionally generated images $\hat{x}^{y}_{0}$ and the original wound image
$x_{0}$ via an $L_{2}$ distance-based classifier in embedding space. The
condition that yields the synthetic image that is most similar to the
original, is selected as the predictive label. Unlike traditional supervised
classification techniques that minimize a binary cross-entropy loss function,
ConDiff mitigates overfitting by utilizing the triplet loss function [18], to
increase the distances between non-similar image pairs and reduce the
distances between similar ones. This work utilizes the DFU infection dataset
provided by Goyal et al. [8] (see Table. I). However, to eliminate data
leakage between the training and test sets, we have refined our dataset
creation and splitting strategy. Using subject-wise splitting, only the second
magnified naturally augmented image (refer to Fig. 1) is utilized for each
subject.

The main contributions of this paper are:

  * •

We propose the Guided Conditional Diffusion Classifier (ConDiff), an
integrated end-to-end framework for classifying infected wound images. The
ConDiff framework has 2 main components: (1) Guided diffusion, which injects
Gaussian noise into a DFU image and then gradually removes noise from noise-
perturbed images conditioned on infection status to synthesize conditional
images (2) A distance-based classifier, which predicts an input image’s label
based on the minimum $L_{2}$ distance between original and synthesized images
in embedding space. To the best of our knowledge, ConDiff is the first
generative discriminative method to analyze fine-grained wound images,
advancing the detection of Diabetic Foot Ulcer (DFU) infections.

  * •

In rigorous evaluation on unseen test wound images (148 infected and 103
uninfected) from the DFU infection dataset [8], our ConDiff framework
significantly outperformed state-of-the-art baselines, improving on the
accuracy and F1-score of wound infection detection by at least 3%.

  * •

We demonstrate that by minimizing the Triplet loss function during training,
ConDiff reduces overfitting on a small DFU dataset of 1416 training images.

  * •

Heatmaps generated by Score-CAM [19] are applied to visually illustrate that
ConDiff focuses on the correct wound image regions when classifying wound
infection status.

##  II Related Work

###  II-A Wound Infection Classification with Deep Learning

Two neural network architectures have predominantly been popular for image
analyses: Convolutional Neural Network (CNN) and Vision Transformer (ViT)
based models. Table. I summarizes prior work on DFU infection classification
from wound images. Unlike other prior discriminative approaches that directly
predict the probability of each label from wound images, ConDiff utilizes a
generative discrimination framework to predict a wound image’s infection label
based on the guided synthetic image that has the highest similarity to the
input image in embedding space.

###  II-B Generative Diffusion Models

Diffusion Models [20, 21] have recently emerged as a new class of generative
models, drawing attention for their robustness and high-quality outputs, and
presenting an alternative to Generative Adversarial Networks (GANs). In
contrast to the adversarial approach used to train GANs, diffusion models
incrementally learn to reverse a process that introduces noise into data. This
method avoids issues with GANs such as mode collapse, yielding a significantly
more stable training process. Diffusion models have shown great potential in
various applications including Text-to-Image generation and Image-to-Image
translation [16, 22, 23]. A standout quality of diffusion models is their
ability to generate highly detailed and varied outputs, which is particularly
advantageous in medical imaging. Recent studies have demonstrated the
potential of diffusion models to effectively synthesize medical images
including detecting and segmenting brain anomalies [24, 25] , performing
multi-contrast MRI and MRI-CT translations [26], and enhancing the resolution
of 3D Brain MRIs [27]. To the best of our knowledge, diffusion models have not
previously been applied to wound image analyses.

##  III Methodology

We now expound on the ConDiff framework, its components, theoretical bases,
and practical application.

###  III-A Denoising Diffusion Probabilistic Model (DDPM)

DDPM [20] is a generative model that leverages diffusion processes to generate
synthetic data. DDPM has two main stages: 1) a forward process and 2) a
reverse process. The forward process $q(x_{1:T}|x_{0})$ systematically adds
Gaussian noise to the data in $T$ steps, ultimately transforming the original
data into a Gaussian distribution $p(z)$. In the reverse process
$p_{\theta}(x_{0:T})$, the model learns to remove this noise iteratively to
reconstruct or generate data samples, accomplished using a neural network
trained to predict and reverse the noise added at each step.

####  III-A1 Forward Diffusion Process

Starting with an initial data point $x_{0}\sim q(x)$, to which noise is
incrementally added over $T$ steps. At each step $t$, this process is
represented as a Gaussian transition in a Markov chain:

$\displaystyle x_{t}$
$\displaystyle=\sqrt{1-\beta_{t}}x_{t-1}+\sqrt{\beta_{t}}\epsilon_{t}$
$\displaystyle q(x_{t}|x_{t-1})$
$\displaystyle=\mathcal{N}(x_{t};\mu_{t}=\sqrt{1-\beta_{t}}x_{t-1},\Sigma_{t}=\beta_{t}I)$
(1)

where $\epsilon_{t}\sim\mathcal{N}(0,I)$ represents the Gaussian noise, and
$\beta_{t}<1$ denotes the variance schedule. Considering
$\alpha_{t}=1-\beta_{t}$ and
$\bar{\alpha}_{t}=\prod_{\tau=1}^{T}{\alpha_{\tau}}$, a tractable closed-form
for sampling at any step $t$, given $x_{0}$ can be defined as (Eq. 2).

$\displaystyle q(x_{t}|x_{0})$
$\displaystyle=\mathcal{N}(x_{t};\sqrt{\bar{\alpha}_{t}}x_{0},(1-\bar{\alpha}_{t})I)$
(2)

The entire forward diffusion process can be viewed as a joint posterior
distribution: $q(x_{1:T}|x_{0})=\prod_{t=1}^{T}{q(x_{t}|x_{t-1})}$.

####  III-A2 Reverse Diffusion Process

Since the distribution $q(x_{0})$ of the underlying data is unknown,
analytically reversing the forward diffusion process to get
$q(x_{t-1}|x_{t})$, is intractable. To manage this, the reverse process is
approximated using a neural network-based distribution
$p_{\theta}(x_{t-1}|x_{t})$, characterized by learnable parameters $\theta$.
The reverse process’ joint distribution is given by
$p_{\theta}(x_{0:T})=p_{\theta}(x_{T})\prod_{t=1}^{T}{p_{\theta}(x_{t-1}|x_{t})}$.
Here, the reverse process starts from a Gaussian distribution $p(x_{T})$ and
follows learned Gaussian transitions defined as:

$p_{\theta}(x_{t-1}|x_{t})=\mathcal{N}(x_{t-1};\mu_{\theta}(x_{t},t),\Sigma_{\theta}(x_{t},t))$
(3)

where $\mu_{\theta}$ and $\Sigma_{\theta}$ are the neural network’s
predictions for the mean and variance at each step $t$.

####  III-A3 Learning Objective

Due to the intractability of exact likelihood computation in this context, a
technique adopted from Variational Autoencoders (VAEs) [28] is utilized,
focusing on maximizing the Evidence Lower Bound (ELBO) [29].

$\displaystyle L(\theta)$
$\displaystyle=\mathbb{E}_{q}\left[\log\frac{p_{\theta}(x_{0:T})}{q(x_{1:T}|x_{0})}\right]$
$\displaystyle=\mathbb{E}_{q}\Bigg{[}-\sum_{t>1}D_{KL}\left(q(x_{t-1}|x_{t})\|p_{\theta}(x_{t-1}|x_{t})\right)$
$\displaystyle\qquad\qquad+\log p_{\theta}(x_{0}|x_{1})\Bigg{]}$ (4)

Ho et al. [20] further refined the objective function in Eq. 4 to yield a
simplified objective function for minimizing the Mean Squared Error (MSE)
between the actual and predicted noise (Eq. 5).

$\displaystyle L_{DM}(\theta)$
$\displaystyle=\mathbb{E}_{x_{0},t,\epsilon\sim\mathcal{N}(0,I)}\left[{\|\epsilon-\epsilon_{\theta}(x_{t},t)\|}^{2}_{2}\right]$
(5)

Here, $\epsilon_{\theta}(x_{t},t)$ is a denoising U-Net model used for
approximating $\epsilon$ from $x_{t}$, which aids in determining the mean
$\mu_{\theta}(x_{t},t)$:

$\mu_{\theta}(x_{t},t)=\sqrt{\bar{\alpha}_{t-1}}F_{\theta}(x_{t},t)+\sqrt{1-\bar{\alpha}_{t-1}-\sigma^{2}_{t}}\epsilon_{\theta}(x_{t},t)$
(6) $\displaystyle\text{where }F_{\theta}(x_{t},t)$
$\displaystyle=\frac{x_{t}-\sqrt{1-\bar{\alpha}_{t}}\epsilon_{\theta}(x_{t},t)}{\sqrt{\bar{\alpha}_{t}}}$
$\displaystyle\text{and }\sigma^{2}_{t}$
$\displaystyle=\frac{1-\bar{\alpha}_{t-1}}{1-\bar{\alpha}_{t}}\beta_{t}$ (7)

####  III-A4 Sampling Process with DDIM

Generating new samples with DDPM is computationally intensive, often requiring
about a thousand sampling steps. To address this, Song et al. [21] introduced
the Denoising Diffusion Implicit Model (DDIM), which accelerates the sampling
process by significantly reducing the number of iterative steps. This is
achieved by redefining the diffusion process as a non-Markovian process.
Considering the DDPM sampling process in Eq. 3, the latent $x_{t-1}$ can be
derived from $x_{t}$ using the parameterized mean $\mu_{\theta}(x_{t},t)$ in
Eq. 6 and variances $\Sigma_{\theta}(x_{t},t)=\sigma^{2}_{t}I$.

$x_{t-1}=\sqrt{\bar{\alpha}_{t-1}}F_{\theta}(x_{t},t)+\sqrt{1-\bar{\alpha}_{t-1}-\sigma^{2}_{t}}\epsilon_{\theta}(x_{t},t)+\sigma_{t}z$
(8)

Here, $z\sim\mathcal{N}(0,I)$ represents standard Gaussian noise, independent
of $x_{t}$. In DDIM, setting $\sigma_{t}=0$ for all $t$ makes the process
deterministic, avoiding the need for a Markov chain and allowing for step-
skipping. Eq. 9 expresses the DDIM sampling step. This approach significantly
enhances efficiency, generating new samples $10\times$ to $50\times$ faster
than DDPM.

$x_{t-1}=\sqrt{\bar{\alpha}_{t-1}}F_{\theta}(x_{t},t)+\sqrt{1-\bar{\alpha}_{t-1}}\epsilon_{\theta}(x_{t},t)$
(9)

###  III-B Conditional Image Generation with Diffusion Models

Prior works have demonstrated that these models can be adapted to conditional
generation, where the generated data depends on a given condition or context,
such as a class label or a textual description [30, 31]. The simplest
implementation method involves introducing the conditioning variable $y$ as an
additional input to the denoising network, represented as
$\epsilon_{\theta}(x_{t},t,y)$. However, one limitation is that the network
may not adequately consider the conditioning variable, sometimes completely
overlooking it [29]. To address this, a guidance scale is introduced,
enhancing the influence of the conditioning variable during sample generation.

####  III-B1 Classifier-Free Diffusion Guidance

Dhariwal and Nichol [30] introduced Classifier Guidance where the diffusion
score
$\tilde{\epsilon}_{\theta}(x_{t},t,y)=\nabla_{x_{t}}\log{p(x_{t})}+\omega\nabla_{x_{t}}\log{p(y|x_{t})}$
includes a classifier $p_{\phi}(y|x_{t})$ that must be able to predict the
samples with varying degrees of noise $x_{t}$. A guidance scale $\omega$
controls the weight given to the classifier gradient. To prevent the inclusion
of the auxiliary classifier $p_{\phi}(y|x_{t})$, Ho et al. [31] later applied
Bayes’ theorem to reformulate $\nabla_{x_{t}}\log{p(y|x_{t})}$. Consequently,
the Classifier-Free Guidance (CFG) formula is expressed as:

$\tilde{\epsilon}_{\theta}(x_{t},t,y)=(1-\omega)\epsilon_{\theta}(x_{t},t)+\omega\epsilon_{\theta}(x_{t},t,y)$
(10)

To train this guided diffusion model, the label $y$ is incorporated as an
additional input in the learning objective (Eq. 5), resulting in Eq. 11.

$L_{DM}(\theta)=\mathbb{E}_{x_{0},t,y,\epsilon\sim\mathcal{N}(0,I)}\left[{\|\epsilon-\epsilon_{\theta}(x_{t},t,y)\|}^{2}_{2}\right]$
(11)

###  III-C Guided Conditional Diffusion Classifier (ConDiff)

To complete our ConDiff model, two additional components are now introduced:
1) guided image synthesis and 2) triplet loss for learning similarity.

####  III-C1 Guided Image Synthesis

Figure 3: Synthesizing conditional DFU images using ConDiff. A guide image
$x_{0}$ is perturbed with Gaussian noises that are then removed progressively
using a CFG-DDIM sampling technique (see Algorithm. 1), conditioned on the
infection status. This process gradually projects $x_{0}$ to guided synthetic
images of conditions: $\hat{x}_{0}^{(y_{1})}$ and $\hat{x}_{0}^{(y_{2})}$.

We aim to generate conditional images that are guided by original images.
Specifically, we seek to synthesize wound images that closely resemble the
input image, while also being distinct enough to differentiate between
infection and non-infection conditions. We employ a strategy from image
synthesis with Stochastic Differential Equations (SDEs) [17], introducing a
certain amount of Gaussian noise to the guide image through a forward
diffusion process (see Eq. 2). Next, we synthesize conditional images using
classifier-free guidance (Sec. III-B). The noise strength $t_{0}\in(0,1]$
indicates the level of noise added to the original image $x_{0}\sim q(x)$:

$x_{t_{0}T}=x_{0}+\sigma(t_{0})z,\text{ where }z\sim\mathcal{N}(0,I)$ (12)

Here,
$\sigma(t_{0})=\sqrt{\frac{1-\bar{\alpha}_{t_{0}T}}{\bar{\alpha}_{t_{0}T}}}$
is a scalar function determining the noise magnitude, and $T$ is the total
number of forward diffusion steps. Subsequently, the classifier-free guided
DDIM sampling is used to synthesize images, as illustrated in Algorithm 1 and
visualized in Fig. 3.

Algorithm 1 outlines ConDiff Sampling with CFG-DDIM. In line (1), Gaussian
noise of strength $t_{0}$ is added to the input image. The reverse process
begins from step $t_{0}T$ to step $1$ (line 2). Line (3) applies the modified
diffusion model $\tilde{\epsilon}_{\theta}(x_{t},t,y)$ following CFG (Eq. 10),
and the DDIM sampling process is conducted in line (4).

Algorithm 1 ConDiff Sampling with CFG-DDIM

1:Guide image: $x_{0}$, class label: $y$, guidance scale: $\omega$, noise
strength: $t_{0}$, and number of diffusion steps: $T$.

2:$x_{t_{0}T}=x_{0}+\sigma(t_{0})z,$ where $z\sim\mathcal{N}(0,I)$

3:for $t=t_{0}T,\ldots,1$ do

4:
$\tilde{\epsilon}_{\theta}(x_{t},t,y)=\omega\epsilon_{\theta}(x_{t},t,y)+(1-\omega)\epsilon_{\theta}(x_{t},t)$

5:
$x_{t-1}=\sqrt{\bar{\alpha}_{t-1}}\left(\frac{x_{t}-\sqrt{1-\bar{\alpha}_{t}}\tilde{\epsilon}_{\theta}}{\sqrt{\bar{\alpha}_{t}}}\right)+\sqrt{1-\bar{\alpha}_{t-1}}\tilde{\epsilon}_{\theta}$

6:end for

7:return $\hat{x}_{0}^{(y)}$

####  III-C2 Learning Similarity with Triplet Loss

Having generated images with different labels, our next goal is to determine
which synthesized image is most similar to the guide image $x_{0}$, a sub-
problem addressed using the triplet loss function (Eq. 13) introduced in
FaceNet [18]. The triplet loss function minimizes the distance between an
anchor image $x^{(a)}$ and a positive image $x^{(p)}$ with the same identity
while maximizing the distance between the anchor image and a negative image
$x^{(n)}$ with a different identity. A neural network $f_{\phi}(x)$ transforms
the images into a $d$-dimensional Euclidean space, facilitating similarity
measurement.

$\displaystyle L_{triplet}=\mathbb{E}\bigg{[}$
$\displaystyle\left(\|f_{\phi}(x^{(a)})-f_{\phi}(x^{(p)})\|^{2}_{2}\right.$
(13)
$\displaystyle\left.-\|f_{\phi}(x^{(a)})-f_{\phi}(x^{(n)})\|^{2}_{2}+\alpha\right)_{+}\bigg{]}$

The margin $\alpha$ is set to 1, indicating the desired separation between
similar and dissimilar pairs. Consequently, our classifier $D_{\phi}$
determines the closest conditional synthesized image to the guide image
$x_{0}$ by comparing their $L_{2}$ distance in embedding space (Eq. 14).

$D_{\phi}(x_{0},\hat{x}_{0}^{(y_{1})},\hat{x}_{0}^{(y_{2})})=\arg\min_{y_{i}}\left\\{L_{2}(f_{\phi}(x_{0}),f_{\phi}(\hat{x}_{0}^{(y_{i})}))\right\\}$
(14)

####  III-C3 ConDiff Training Process

The training process is divided into two stages. Stage 1 involves training
$\epsilon_{\theta}(x_{t},t,y)$ with the objective expressed in Eq. 11,
focusing on noise removal (Algorithm 2). After optimizing
$\epsilon_{\theta}(x_{t},t,y)$, conditional images $\hat{x}_{0}^{(y_{1})}$ and
$\hat{x}_{0}^{(y_{2})}$ are generatd using ConDiff, following the process in
Fig. 3 for all DFU images in our dataset. Stage 2 optimizes the embedding
network $f_{\phi}$ to learn the Triplet loss (Eq. 13, Algorithm 3).

Algorithm 2 Jointly training a diffusion model with CFG

1:diffusion model: $\epsilon_{\theta}$, pairs of guide image and class label:
$q(x_{0},y)$, probability of unconditional training: $p_{\text{uncond}}$, and
number of training steps: $N$.

2:learned $\epsilon_{\theta}$

3:for $n=1,\ldots,N$ do

4: Sample a pair of image-label $(x_{0},y)\sim q(x_{0},y)$

5: $y\leftarrow\emptyset$ with probability $p_{\text{uncond}}$

6: $t\sim\text{Uniform}\\{1,\ldots,T\\}$, $\epsilon\sim\mathcal{N}(0,I)$

7: $x_{t}=\sqrt{\bar{\alpha}_{t}}x_{0}+\sqrt{1-\bar{\alpha}_{t}}\epsilon$

8: Take gradient step on
$\nabla_{\theta}\left\|\epsilon-\epsilon_{\theta}(x_{t},t,y)\right\|^{2}$

9:end for

Algorithm 3 Training a distance-based classifier model with Triplet loss

1:embedding model: $f_{\phi}$, real dataset: $D_{r}$, synthetic dataset:
$D_{s}$, probability of sampling from $D_{s}$: $p_{gen}$, number of epochs:
$E$, and batch size: $B$.

2:learned $f_{\phi}$

3:for $\text{epoch}=1,\ldots,E$ do

4: for $\text{batch}=1,\ldots,\lceil\text{size}(D_{r})/B\rceil$ do

5: $(x^{(a)},x^{(p)},x^{(n)})\sim D_{r}$ (sample $B$ triplets)

6: $(x^{(p)},x^{(n)})\sim D_{s}$ with probability $p_{gen}$

7: Compute $L_{triplet}$ in Eq. 13.

8: Take gradient step on $\nabla_{\phi}L_{triplet}$

9: end for

10:end for

Training Stage 1: Algorithm 2 details joint training of the unconditional and
conditional models. Occasionally, $y$ is set to the unconditional class
identifier $\emptyset$ with a probability $p_{uncond}$, a hyperparameter
typically around 10–20% [31]. For each training step, an image $x_{0}$ and
condition $y$ are sampled from the dataset. The diffusion step $t$ is also
sampled from the uniform distribution of $[1,\ldots,T]$. Subsequently, in line
(5), a forward diffusion process is performed to add noise to the image
$x_{0}$ following Eq. 2. The diffusion model parameters $\theta$ are then
optimized to minimize the MSE between the actual and predicted noise.

Training Stage 2: The embedding model $f_{\phi}$ is trained in Algorithm 3. In
addition to the real DFU dataset $D_{r}$, a synthetic dataset $D_{s}$ is also
created from our trained ConDiff model following the sampling process in
Algorithm 1. For each iteration, a batch of triplets
$(x^{(a)},x^{(p)},x^{(n)})$ is sampled from $D_{r}$. To increase recognition
ability and improve training robustness, $(x^{(p)},x^{(n)})$ is sampled from
$D_{s}$ with the probability of $p_{gen}=0.2$. Embedding model parameters
$\phi$ are optimized to minimize the Triplet loss, thus learning to
distinguish between similar and dissimilar images effectively.

##  IV Experiments and Results

###  IV-A Diabetic Foot Ulcer (DFU) Dataset

The DFU Infection Dataset curated by Goyal et al. [8], comprises DFU images
collected at the Lancashire Teaching Hospital with the permission of the U.K.
National Health Service (NHS). These DFU images were labeled by two DFU
specialists (consultant physicians) based on visual inspection, independent of
medical notes or clinical tests. The dataset consists of 2,946 augmented
patches with infection and 2,946 augmented patches without infection. Natural
augmentation was performed with varying magnification as illustrated in Fig.
1. All patches have dimensions of $224\times 224\times 3$ pixels.

Data Preprocessing: The training, validation and test sets were created using
65%, 15% and 20% of the dataset respectively. To prevent data leakage,
subject-wise splitting was utilized, where all images for each case could only
belong to one class. As a further measure to prevent data leakage, as shown in
Fig. 1, only augmented patches with a $\times 2$ magnification level were
utilized. The model achieving the highest accuracy on the validation set
(optimal parameter values), was selected for final evaluation on the test
(unseen) dataset. Table. II shows the dataset statistics after pre-processing.

Table II: Refined DFU Dataset Statistics Processed Data | Category | # of Patches
---|---|---
Train Data (65%) | Infection | 709
No Infection | 495
Validation Data (15%) | Infection | 125
No Infection | 87
Test Data (20%) | Infection | 148
No Infection | 103

###  IV-B Experimental Setup

####  IV-B1 Implementation Details

As outlined in Sec. III-C3, the ConDiff classifier was trained in two distinct
stages on an NVIDIA A100 GPU.

Stage 1 - Fine-Tuning the Diffusion Model: First, a Stable Diffusion model
pre-trained on the LAION-400M dataset [32], a large collection of 400 million
image-text pairs, was retrieved [16]. Its denoising U-Net $\epsilon_{\theta}$
was fine-tuned on our wound training set $D_{r}$, as described in Algorithm 2.
The training involved 10,000 iterations, employing the AdamW optimizer with a
learning rate of $1\times 10^{-5}$ for fine-tuning. After training, our
ConDiff generator was utilized to synthesize conditional DFU images with the
following hyperparameter setting: guidance scale $\omega=0.75$, noise strength
$t_{0}=0.8$, and the number of sampling steps $T=30$. These images were
synthesized using training images as guide inputs, resulting in a collection
of synthetic data $D_{s}$, for use in the second stage of training.

Stage 2 - Training the Embedding Network $f_{\phi}$: utilized the
EfficientNet-B0 neural networks architecture as the backbone. The Euclidean
embedding dimension $d$ was set to 256. The optimal set of parameters $\phi$
was obtained from the best model performance on the validation partition. The
training was for 50 epochs as described in Algorithm 3, using the AdamW
optimizer with a learning rate of $1\times 10^{-3}$.

####  IV-B2 Evaluation Metrics

of all models on the DFU dataset were as follows.

Classification metrics: Accuracy, sensitivity, specificity, Positive
Predictive Value (PPV), and F1-score were used to evaluate DFU infection
classification performance.

Image generation metrics: To evaluate the quality of synthetic images, the
Fréchet Inception Distance (FID) score and the Inception Score (IS) were
employed. A lower FID indicates more realism and higher quality while a higher
IS indicates that the generated images are distinct and diverse.

Clustering metric: DFU images’ embedding vectors of uninfected and infected
wounds were analyzed using the Silhouette score. It measures how similar data
points within the cluster (cohesion) are compared to data points in other
clusters (separation). Its value ranges from $-1$ to $1$, where a high value
indicates that the object is well-matched to its cluster and poorly matched to
neighboring clusters.

####  IV-B3 SOTA Baseline Models

Recent deep learning image classification architectures including CNN and ViT-
based models were considered as baselines. Due to the small size of our
dataset, the base or tiny version of each model was selected for evaluation.

Table III: Quantitative comparison of ConDiff with SOTA baseline models on test images in the DFU infection dataset Model | Accuracy | F1-score | Sensitivity | Specificity | PPV | Test time
---|---|---|---|---|---|---
Convolutional Neural Networks | ResNet-18 | 0.785 | 0.817 | 0.817 | 0.738 | 0.818 | 1.01 sec.
DenseNet-121 | 0.733 | 0.763 | 0.730 | 0.738 | 0.800 | 4.02 sec.
Inception-V3 | 0.733 | 0.765 | 0.736 | 0.728 | 0.796 | 2.76 sec.
EfficientNet-B0 | 0.793 | 0.810 | 0.750 | 0.854 | 0.881 | 2.01 sec.
Vision Transformers | ViT-Small | 0.773 | 0.801 | 0.777 | 0.767 | 0.827 | 1.26 sec.
DeiT-Tiny | 0.789 | 0.828 | 0.824 | 0.738 | 0.819 | 1.25 sec.
SwinV2-Tiny | 0.785 | 0.822 | 0.878 | 0.650 | 0.783 | 2.51 sec.
EfficientFormer-L1 | 0.801 | 0.833 | 0.845 | 0.738 | 0.822 | 1.51 sec.
Diffusion | ConDiff (ours) | 0.833 | 0.858 | 0.858 | 0.796 | 0.858 | 12.55 mins

CNN-based models: ResNet [33] and Inception-V3 [34] were selected as baseline
models because Goyal et al. [8] employed them as backbones in the ensemble CNN
model for DFU infection classification. DenseNet [35] was selected as Yap et
al. [11] found that it achieved the best macro-F1 score in 4-class DFU image
classification. EfficientNet [15] was selected as it was the most effective
CNN-based model in analyzing wound infections [12, 11].

ViT-based models: ViT [36] and DeiT [37] were explored for for DFU ischemia &
infection classification by Galdran et al. [12], achieving a macro-F1 score
comparable to the best CNN-based model (EfficientNet). SwinV2 [38] and
EfficientFormer [39] were selected as baselines for DFU infection
classification because even have not previously been explored for infection
classification, they are recent architectures that outperformed previous ViT-
based & CNN-based models on ImageNet classification.

####  IV-B4 Score-Weighted Class Activation Mapping (Score-CAM)

[19] is a method for interpreting the decision-making process of CNN models in
visual tasks. It creates a visual heatmap that reveals which regions of a
conditional synthesized image $\hat{x}_{0}^{(y)}$ the embedding model
$f_{\phi}$ found similar to a guide (input) image $x_{0}$. Score-CAM has the
following steps: (1) extracting feature maps $A^{k}$ from the last
convolutional layer $L$; $A^{k}=f_{\phi,L}(\hat{x}_{0}^{(y)})$, (2) generating
activation maps that emphasize predictive regions of the image;
$M^{k}=\text{Upsample}(A^{k})$, (3) calculating cosine similarity scores
between the guide image embedding and the corresponding synthesized images
based on the activation maps;
$S^{k}=\text{Similarity}(f_{\phi}(x_{0}),f_{\phi}(M^{k}\circ\hat{x}_{0}^{(y)}))$,
and (4) aggregating these activation maps into a comprehensive heatmap, with
the weighting determined by the similarity scores
$\alpha^{k}=\frac{\exp(S^{k})}{\Sigma_{j}{\exp(S_{j}^{k})}}$; $H_{\text{Score-
CAM}}=\text{ReLU}(\Sigma_{k}{\alpha^{k}M^{k}})$.

###  IV-C Performance Comparison with SOTA baselines

Table III demonstrates that ConDiff achieves an accuracy of up to 83% and an
F1-score of 0.858, outperforming baselines by at least 3% on both metrics
while maintaining a balanced trade-off between sensitivity and PPV.
Furthermore, ViT-based models achieved performance superior to CNN-based
models. This may be due to their ability to use attention mechanisms to
capture global dependencies between all input data elements. In contrast, CNN-
based models, which apply uniform filters across the entire image, tend to
focus on local content and may not be suited to capturing high inter-class
similarity and intra-class variation.

Figure 4: The learning accuracy trajectories of the ConDiff classifier and
best-performing CNN-based (EfficientNet-B0) and ViT-based (EfficientFormer-L1)
models, on the train and validation sets.

However, since ViT-based models can be overfitted on our relatively small
training dataset (illustrated in Fig. 4(Right)), they are not entirely
suitable for infection classification. In contrast, the EfficientNet-B0 model
is less susceptible to overfitting than the EfficientFormer-L1 model, which
led us to select EfficientNet-B0 as the embedding network $f_{\phi}$ in the
ConDiff classifier. Consequently, as shown in Fig. 4(Left), ConDiff
effectively mitigates overfitting, which is attributed to the classifier’s use
of the Triplet loss function to learn to distinguish between similar and
dissimilar images based on Euclidean distances in embedding space. The main
ConDiff’s trade-off is its computational time during inference. Table III
shows that ConDiff takes around 12-13 minutes to analyze the 251 test images
using an NVIDIA A100 GPU while traditional classification models take less
than 4 seconds on the same device. The longer inference time is because the
ConDiff classifier iterates to synthesize the guided conditional images and
measure their similarities to the input image.

(a) Uninfected DFUs misclassified by ConDiff Classifier

(b) Infected DFUs misclassified by ConDiff Classifier

Figure 5: Examples of incorrectly classified DFU images for infection by our
ConDiff Classifier.

(c) Correctly classified uninfected wound.

(d) Correctly classified infected wound.

(e) Misclassified uninfected wound as infected.

(f) Misclassified infected wound as uninfected.

Figure 6: Visualization of ConDiff predictions with corresponding Score-CAM
images computed from the ConDiff’s embedding model $f_{\phi}$. Each sub-figure
shows an example with the guide image ($x_{0}$), conditional synthesized
images representing uninfected $\hat{x}_{0}^{(y_{1})}$ and infected
$\hat{x}_{0}^{(y_{2})}$ states, and their respective Score-CAM overlays
indicate regions with similar features to $x_{0}$.

####  IV-C1 Exploring mis-classifications

Fig. 5(a)-(b) show misclassified cases. The uninfected DFUs in Fig. 5(a)
resemble infected wounds exhibiting characteristics such as a large reddish
area or darkening of the wound, possibly caused by poor lighting conditions.
The misclassified examples in Fig. 5(b) are due to the small size of the
wounds and ambiguous features, such as a somewhat dried appearance, which
confuses the infection classifier.

####  IV-C2 Explaining image embedding similarity with Score-CAM

Fig. 6 presents Score-CAM visualizations that elucidate similarities the
embedding model perceives between conditional synthesized images and their
corresponding guide images $x_{0}$. Areas highlighted in red on the Score-CAM
heatmaps shown in Fig. 6, denote regions that the ConDiff classifier
identified as having a high degree of similarity to $x_{0}$. For instance,
Fig. 6(a) illustrates that the classifier recognizes similar features in a
synthesized uninfected image and the guide image, as indicated by the presence
of a red spot in the heatmap. Conversely, the heatmap corresponding to the
generated image conditioned on DFU infection does not reveal substantial
similarity, except for a marginal overlap in the background at the top-right
corner. Similarly, Fig. 6(b) depicts accurate infection detection, where the
embedding model $f_{\phi}$ concentrates on the necrotic tissue evident in both
$x_{0}$ and $\hat{x}_{0}^{(y_{2})}$. Nonetheless, the classifier is not
infallible. Examples of misclassifications are demonstrated in Fig. 6(c)-(d),
where the embedding model incorrectly assesses a synthesized image conditioned
on a different class as being more similar to the guide image, an error
attributable to the high inter-class similarity in embedding space.

Figure 7: t-SNE plot of train image embedding computed by $f_{\phi}$. Figure
8: (Left) $L_{2}$ norm squared between $\hat{x}_{0}^{(y_{1})}$ and
$\hat{x}_{0}^{(y_{2})}$ plot with respect to initial noise perturbation steps
$t_{0}$, (Right) illustration of conditional synthesized images of ConDiff +
CFG-DDIM sampling: $\omega=7.5$ with various $t_{0}$ initialization. As
$t_{0}$ increases, the difference in image level between conditional generated
images becomes larger.

####  IV-C3 Visualizing image embedding

To further investigate the information gained from the embedding space, a
t-SNE plot of train image embeddings is created, as shown in Fig. 7. It is
observed that infected and uninfected wounds are separated into two distinct
clusters. The Silhouette score of $0.586$ is relatively high, indicating well-
separated clusters.

###  IV-D Additional Experiments

####  IV-D1 Effects of different sampling methods on infection classification

We compared the DFU infection classification performance when two different
sampling approaches were applied to ConDiff; (1) DDIM sampling and (2) CFG-
DDIM sampling. Table. IV shows that using CFG-DDIM sampling (Algorithm 1)
significantly outperforms DDIM sampling in infection classification. This is
because the guided generated images between 2 labels by DDIM are not different
enough to make $D_{\phi}$ in Eq. 14 determine which of the synthesized images
is most similar to the input image.

Table IV: Comparison of DFU infection classification by ConDiff Classifier with various sampling methods. Method | Acc | F1 | SEN | SPEC | PPV
---|---|---|---|---|---
DDIM | 0.603 | 0.635 | 0.581 | 0.641 | 0.699
CFG-DDIM | 0.833 | 0.858 | 0.858 | 0.796 | 0.858

####  IV-D2 Effects of noise strengths $t_{0}$ on infection classification

Having demonstrated the efficacy of the CFG-DDIM reverse process in enabling
the $D_{\phi}$ network to accurately predict infection status from a DFU
image, this section focuses on experiments involving adding varying noise
strengths $t_{0}$ to the input images. For these experiments, the guidance
scale $\omega$, the control hyperparameter, was fixed at $7.5$.

Table V: Quantitative comparison of the result of DFU infection classification on the test data by ConDiff Classifier with different strengths $t_{0}$ of perturbed noise. $t_{0}$ | Acc | F1 | SEN | SPEC | PPV
---|---|---|---|---|---
0.5 | 0.721 | 0.761 | 0.757 | 0.670 | 0.767
0.6 | 0.721 | 0.757 | 0.736 | 0.699 | 0.779
0.7 | 0.773 | 0.800 | 0.770 | 0.777 | 0.832
0.8 | 0.833 | 0.858 | 0.858 | 0.796 | 0.858
0.9 | 0.809 | 0.829 | 0.791 | 0.835 | 0.873

Table V highlights the significant role of perturbed noise in image synthesis.
As the noise strength $t_{0}$ increases, the guided synthesized images
corresponding to different labels exhibit greater divergence, facilitating
more straightforward predictions by our distance-based classifier $D_{\phi}$.
However, when $t_{0}$ is increased beyond certain thresholds, the distances
between input images and their respective guided synthesized counterparts
become excessively large for both labels. This increase in distance diminishes
the distinguishability of $D_{\phi}$. Classification with $t_{0}$ values
ranging from $0.1$ to $0.4$ was excluded from our analysis, as depicted in
Fig. 8 (Left), where it is shown that the average difference in the $L_{2}$
norm squared between the two guided synthetic images $\hat{x}_{0}^{(y_{1})}$
and $\hat{x}_{0}^{(y_{2})}$ is relatively small. Fig. 8 (Right) presents
examples of conditional synthetic images generated by ConDiff + CFG-DDIM
sampling across different $t_{0}$ values.

(a) cGAN generation: $FID=11.201$, $IS=2.966$

(b) ConDiff, DDIM sampling method: $FID=2.917$, $IS=3.662$

(c) ConDiff, CFG-DDIM sampling method with $\omega=3$: $FID=3.779$, $IS=3.669$

(d) ConDiff, CFG-DDIM sampling method with $\omega=7.5$: $FID=5.068$,
$IS=3.885$

Figure 9: Guided Image Generation. Condition on the label: (Left) uninfected wound and (Right) infected wound. Table VI: Quality measurement of conditional synthesized images by generative models. Model | FID Score $\downarrow$ | IS $\uparrow$
---|---|---
ConDiff + DDIM | 2.917 | 3.662
ConDiff + CFG-DDIM, $\omega=3$ | 3.779 | 3.669
ConDiff + CFG-DDIM, $\omega=7.5$ | 5.068 | 3.885
Conditional GAN [40] | 11.201 | 2.965

####  IV-D3 Evaluation of Conditional Image Synthesis

Previously, in Sec. IV-D1, it was established that CFG-DDIM sampling is more
effective for distance-based classification. Nevertheless, realistic DFU
images can still be generated using the DDIM sampling method. Table VI reveals
that image synthesis using ConDiff + DDIM results in the lowest FID score,
indicating that the distribution of synthesized images closely resembles that
of real data. However, the Inception Score (IS) for the ConDiff + DDIM
approach is lower than the ConDiff + CFG-DDIM approach. This finding aligns
with Ho et al.’s experiment [31], which highlights a trade-off between FID and
IS. In our context, the IS reflects the ease of differentiating between
conditional synthesized images. Consequently, the ConDiff Classifier using the
DDIM sampling approach underperforms relative to the CFG-DDIM sampling
approach, as seen in Table IV. This is attributed to the challenge in label
clarification due to the lower IS. Note that IS is not significantly different
across our diffusion models because the IS metric considers not only the
clarity but also the diversity of synthesized images, as shown in Fig. 9.
Additionally, the experiment employed the popular conditional GAN approach
[40] for generating DFU images conditioned on infection status, providing a
comparison to diffusion methods. The results indicate that the quality of
synthesized images using the conditional GAN is inferior to those produced by
diffusion methods.

##  V Discussion

Summary of Findings: The ConDiff classifier outperforms other deep learning
models in detecting infections in DFU images by minimizing Triplet loss
instead of binary cross-entropy, enabling it to effectively match input images
with the most similar conditionally synthesized images in embedding space.

Overfitting Mitigation: ConDiff’s training strategy in Training Stage 2,
involving triplet loss, not only enhances its performance but also reduces
overfitting by learning to discern between infected and uninfected wounds in
the dataset.

CFG-DDIM Integration: When applying CFG-DDIM for the sampling process, ConDiff
outperforms the standard DDIM method in infection classification. This is
significant because, despite DDIM’s proven efficiency in generating DFU-like
images, CFG-DDIM’s guidance-label-influenced image generation aligns better
with ConDiff’s distance-based classification.

Score-CAM enhances ConDiff’s Interpretability: As shown in Figure 6, ConDiff
focuses on wound features critical for accurately predicting infection status
in its decision-making.

Limitation: ConDiff’s major drawback is its high computational cost during
inference, taking 3-4 seconds per image on an NVIDIA A100 GPU, in contrast to
less than 0.02 seconds for other models. This is due to its generative
discriminative approach, which synthesizes conditional images for each input
by gradually removing noise through a reverse diffusion process. The Stability
AI research group has recently found a way to overcome this limitation by
reducing the number of sampling steps to just one step when generating
conditional images by leveraging the adversarial diffusion distillation
technique [41].

Future Work: The potential of the embedding network $f_{\phi}$ in transforming
DFU images into meaningful vectors suggests future research in more efficient
prediction approaches. Exploring multi-modal data, including thermal images or
generative medical notes from Large Language Models (LLMs), could enhance the
classification capabilities of deep-learning models. The ConDiff classifier
might also be applied to other medical imaging tasks and other wound types,
such as classifying pressure injury severity [42].

##  VI Conclusion

This study introduced the Guided Conditional Diffusion classifier (ConDiff), a
new framework for classifying Diabetic Foot Ulcer (DFU) infections from wound
images. Outperforming traditional models by at least 3%, ConDiff achieves up
to 83% accuracy and an F1-score of 0.858. Its unique approach utilizes Triplet
loss instead of standard cross-entropy minimization, enhancing robustness and
reducing overfitting. This is especially important in medical imaging where
datasets are often small. ConDiff employs a forward diffusion process, to add
a specific amount of Gaussian noise into input images, and a reverse diffusion
with classifier-free guidance to iteratively refine these images for
classification based on the closest Euclidean distance in an embedding space.
The ConDiff’s effectiveness suggests significant potential in improving DFU
management, particularly in regions with limited medical resources. Its
precise, real-time infection detection could play a crucial role in early DFU
infection identification, reducing serious complications such as limb
amputation.

## Acknowledgment

This research was performed using computational resources supported by the
Academic & Research Computing group at Worcester Polytechnic Institute.

## References

  * [1] K. Järbrink, G. Ni, H. Sönnergren, A. Schmidtchen, C. Pang, R. Bajpai, and J. Car, “The humanistic and economic burden of chronic wounds: a protocol for a systematic review. syst rev. 2017; 6 (1): 15.”
  * [2] C. K. Sen, G. M. Gordillo, S. Roy, R. Kirsner, L. Lambert, T. K. Hunt, F. Gottrup, G. C. Gurtner, and M. T. Longaker, “Human skin wounds: a major and snowballing threat to public health and the economy,” _Wound repair and regeneration_ , vol. 17, no. 6, pp. 763–771, 2009.
  * [3] S. J. Landis, “Chronic wound infection and antimicrobial use,” _Advances in skin & wound care_, vol. 21, no. 11, pp. 531–540, 2008.
  * [4] J.-L. Richard, A. Sotto, and J.-P. Lavigne, “New insights in diabetic foot infection,” _World journal of diabetes_ , vol. 2, no. 2, p. 24, 2011.
  * [5] J. L. Mills Sr, M. S. Conte, D. G. Armstrong, F. B. Pomposelli, A. Schanzer, A. N. Sidawy, G. Andros, S. for Vascular Surgery Lower Extremity Guidelines Committee _et al._ , “The society for vascular surgery lower extremity threatened limb classification system: risk stratification based on wound, ischemia, and foot infection (wifi),” _Journal of vascular surgery_ , vol. 59, no. 1, pp. 220–234, 2014.
  * [6] C. Wang, X. Yan, M. Smith, K. Kochhar, M. Rubin, S. M. Warren, J. Wrobel, and H. Lee, “A unified framework for automatic wound segmentation and analysis with deep convolutional neural networks,” in _2015 37th annual international conference of the ieee engineering in medicine and biology society (EMBC)_. IEEE, 2015, pp. 2415–2418.
  * [7] H. Nejati, H. A. Ghazijahani, M. Abdollahzadeh, T. Malekzadeh, N.-M. Cheung, K.-H. Lee, and L.-L. Low, “Fine-grained wound tissue analysis using deep neural network,” in _2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)_. IEEE, 2018, pp. 1010–1014.
  * [8] M. Goyal, N. D. Reeves, S. Rajbhandari, N. Ahmad, C. Wang, and M. H. Yap, “Recognition of ischaemia and infection in diabetic foot ulcers: Dataset and techniques,” _Computers in biology and medicine_ , vol. 117, p. 103616, 2020.
  * [9] N. Al-Garaawi, R. Ebsim, A. F. Alharan, and M. H. Yap, “Diabetic foot ulcer classification using mapped binary patterns and convolutional neural networks,” _Computers in biology and medicine_ , vol. 140, p. 105055, 2022.
  * [10] Z. Liu, J. John, and E. Agu, “Diabetic foot ulcer ischemia and infection classification using efficientnet deep learning models,” _IEEE Open Journal of Engineering in Medicine and Biology_ , vol. 3, pp. 189–201, 2022.
  * [11] M. H. Yap, B. Cassidy, J. M. Pappachan, C. O’Shea, D. Gillespie, and N. D. Reeves, “Analysis towards classification of infection and ischaemia of diabetic foot ulcers,” in _2021 IEEE EMBS International Conference on Biomedical and Health Informatics (BHI)_. IEEE, 2021, pp. 1–4.
  * [12] A. Galdran, G. Carneiro, and M. A. G. Ballester, “Convolutional nets versus vision transformers for diabetic foot ulcer classification,” in _Diabetic Foot Ulcers Grand Challenge_. Springer, 2021, pp. 21–29.
  * [13] Z. Liu, E. Agu, P. Pedersen, C. Lindsay, B. Tulu, and D. Strong, “Comprehensive assessment of fine-grained wound images using a patch-based cnn with context-preserving attention,” _IEEE open journal of engineering in medicine and biology_ , vol. 2, pp. 224–234, 2021.
  * [14] Z. Liu, E. Agu _et al._ , “Chronic wound image augmentation and assessment using semi-supervised progressive multi-granularity efficientnet,” _OJEMB_ , 2023.
  * [15] M. Tan and Q. Le, “Efficientnet: Rethinking model scaling for convolutional neural networks,” in _International conference on machine learning_. PMLR, 2019, pp. 6105–6114.
  * [16] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, “High-resolution image synthesis with latent diffusion models,” in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ , 2022, pp. 10 684–10 695.
  * [17] C. Meng, Y. He, Y. Song, J. Song, J. Wu, J.-Y. Zhu, and S. Ermon, “Sdedit: Guided image synthesis and editing with stochastic differential equations,” _arXiv preprint arXiv:2108.01073_ , 2021.
  * [18] F. Schroff, D. Kalenichenko, and J. Philbin, “Facenet: A unified embedding for face recognition and clustering,” in _Proceedings of the IEEE conference on computer vision and pattern recognition_ , 2015, pp. 815–823.
  * [19] H. Wang, Z. Wang, M. Du, F. Yang, Z. Zhang, S. Ding, P. Mardziel, and X. Hu, “Score-cam: Score-weighted visual explanations for convolutional neural networks,” in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops_ , 2020, pp. 24–25.
  * [20] J. Ho, A. Jain, and P. Abbeel, “Denoising diffusion probabilistic models,” _Advances in neural information processing systems_ , vol. 33, pp. 6840–6851, 2020.
  * [21] J. Song, C. Meng, and S. Ermon, “Denoising diffusion implicit models,” _arXiv preprint arXiv:2010.02502_ , 2020.
  * [22] L. Zhang, A. Rao, and M. Agrawala, “Adding conditional control to text-to-image diffusion models,” in _Proceedings of the IEEE/CVF International Conference on Computer Vision_ , 2023, pp. 3836–3847.
  * [23] A. Nichol, P. Dhariwal, A. Ramesh, P. Shyam, P. Mishkin, B. McGrew, I. Sutskever, and M. Chen, “Glide: Towards photorealistic image generation and editing with text-guided diffusion models,” _arXiv preprint arXiv:2112.10741_ , 2021.
  * [24] J. Wyatt, A. Leach, S. M. Schmon, and C. G. Willcocks, “Anoddpm: Anomaly detection with denoising diffusion probabilistic models using simplex noise,” in _Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition_ , 2022, pp. 650–656.
  * [25] J. Wu, R. Fu, H. Fang, Y. Zhang, Y. Yang, H. Xiong, H. Liu, and Y. Xu, “Medsegdiff: Medical image segmentation with diffusion probabilistic model,” _arXiv preprint arXiv:2211.00611_ , 2022.
  * [26] M. Özbey, O. Dalmaz, S. U. Dar, H. A. Bedel, Ş. Özturk, A. Güngör, and T. Çukur, “Unsupervised medical image translation with adversarial diffusion models,” _IEEE Transactions on Medical Imaging_ , 2023.
  * [27] J. Wang, J. Levman, W. H. L. Pinaya, P.-D. Tudosiu, M. J. Cardoso, and R. Marinescu, “Inversesr: 3d brain mri super-resolution using a latent diffusion model,” in _International Conference on Medical Image Computing and Computer-Assisted Intervention_. Springer, 2023, pp. 438–447.
  * [28] D. P. Kingma and M. Welling, “Auto-encoding variational bayes,” _arXiv preprint arXiv:1312.6114_ , 2013.
  * [29] C. M. Bishop and H. Bishop, “Deep neural networks,” in _Deep Learning: Foundations and Concepts_. Springer, 2023, pp. 171–207.
  * [30] P. Dhariwal and A. Nichol, “Diffusion models beat gans on image synthesis,” _Advances in neural information processing systems_ , vol. 34, pp. 8780–8794, 2021.
  * [31] J. Ho and T. Salimans, “Classifier-free diffusion guidance,” _arXiv preprint arXiv:2207.12598_ , 2022.
  * [32] C. Schuhmann, R. Vencu, R. Beaumont, R. Kaczmarczyk, C. Mullis, A. Katta, T. Coombes, J. Jitsev, and A. Komatsuzaki, “Laion-400m: Open dataset of clip-filtered 400 million image-text pairs,” _arXiv preprint arXiv:2111.02114_ , 2021.
  * [33] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in _Proceedings of the IEEE conference on computer vision and pattern recognition_ , 2016, pp. 770–778.
  * [34] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, “Going deeper with convolutions,” in _Proceedings of the IEEE conference on computer vision and pattern recognition_ , 2015, pp. 1–9.
  * [35] G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger, “Densely connected convolutional networks,” in _Proceedings of the IEEE conference on computer vision and pattern recognition_ , 2017, pp. 4700–4708.
  * [36] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly _et al._ , “An image is worth 16x16 words: Transformers for image recognition at scale,” _arXiv preprint arXiv:2010.11929_ , 2020.
  * [37] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou, “Training data-efficient image transformers & distillation through attention,” in _International conference on machine learning_. PMLR, 2021, pp. 10 347–10 357.
  * [38] Z. Liu, H. Hu, Y. Lin, Z. Yao, Z. Xie, Y. Wei, J. Ning, Y. Cao, Z. Zhang, L. Dong _et al._ , “Swin transformer v2: Scaling up capacity and resolution,” in _Proceedings of the IEEE/CVF conference on computer vision and pattern recognition_ , 2022, pp. 12 009–12 019.
  * [39] Y. Li, G. Yuan, Y. Wen, J. Hu, G. Evangelidis, S. Tulyakov, Y. Wang, and J. Ren, “Efficientformer: Vision transformers at mobilenet speed,” _Advances in Neural Information Processing Systems_ , vol. 35, pp. 12 934–12 949, 2022.
  * [40] M. Mirza and S. Osindero, “Conditional generative adversarial nets,” _arXiv preprint arXiv:1411.1784_ , 2014.
  * [41] A. Sauer, D. Lorenz, A. Blattmann, and R. Rombach, “Adversarial diffusion distillation,” _arXiv preprint arXiv:2311.17042_ , 2023.
  * [42] B. Ay, B. Tasar, Z. Utlu, K. Ay, and G. Aydin, “Deep transfer learning-based visual classification of pressure injuries stages,” _Neural Computing and Applications_ , vol. 34, no. 18, pp. 16 157–16 168, 2022.