write a review for the following paper:

%% 
%% Copyright 2007-2024 Elsevier Ltd
%% 
%% This file is part of the 'Elsarticle Bundle'.
%% ---------------------------------------------
%% 
%% It may be distributed under the conditions of the LaTeX Project Public
%% License, either version 1.3 of this license or (at your option) any
%% later version.  The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 1999/12/01 or later.
%% 
%% The list of all files belonging to the 'Elsarticle Bundle' is
%% given in the file `manifest.txt'.
%% 
%% Template article for Elsevier's document class `elsarticle'
%% with numbered style bibliographic references
%% SP 2008/03/01
%% $Id: elsarticle-template-num.tex 249 2024-04-06 10:51:24Z rishi $
%%
\documentclass[preprint,12pt]{elsarticle}

%% Use the option review to obtain double line spacing
%% \documentclass[authoryear,preprint,review,12pt]{elsarticle}

%% Use the options 1p,twocolumn; 3p; 3p,twocolumn; 5p; or 5p,twocolumn
%% for a journal layout:
%% \documentclass[final,1p,times]{elsarticle}
%% \documentclass[final,1p,times,twocolumn]{elsarticle}
%% \documentclass[final,3p,times]{elsarticle}
%% \documentclass[final,3p,times,twocolumn]{elsarticle}
%% \documentclass[final,5p,times]{elsarticle}
%% \documentclass[final,5p,times,twocolumn]{elsarticle}

%% For including figures, graphicx.sty has been loaded in
%% elsarticle.cls. If you prefer to use the old commands
%% please give \usepackage{epsfig}

%% The amssymb package provides various useful mathematical symbols
\usepackage{amssymb}
%% The amsmath package provides various useful equation environments.
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{makecell}
%% The amsthm package provides extended theorem environments
%% \usepackage{amsthm}

%% The lineno packages adds line numbers. Start line numbering with
%% \begin{linenumbers}, end it with \end{linenumbers}. Or switch it on
%% for the whole article with \linenumbers.
\usepackage{lineno}


\journal{Medical Image Analysis}

\begin{document}

\begin{frontmatter}

\title{CausalMixNet: A Mixed-Attention Framework for Causal Intervention in Robust Medical Image Diagnosis}

\author[1]{Yajie Zhang}
\author[2]{Yu-An Huang}
\author[1]{Yao Hu}
\author[1]{Rui Liu}
\author[1,3]{Jibin Wu*}
% \cormark[1]
\author[4]{Zhi-An Huang*}
% \cormark[1]
\author[1]{Kay Chen Tan*}
% \cormark[1]
\cortext[1]{Corresponding author}

\affiliation[1]{organization={Department of Data Science and Artificial Intelligence, The Hong Kong Polytechnic University},
            city={Hong Kong SAR},
            country={China}}
\affiliation[2]{organization={School of Computer Science, Northwestern Polytechnical University},
            city={Xi'an},
            country={China}}
\affiliation[3]{organization={Department of Computing, The Hong Kong Polytechnic University},
            city={Hong Kong SAR},
            country={China}}
\affiliation[4]{organization={Research Office, City University of Hong Kong (Dongguan)},
            city={Dongguan},
            country={China}}


%% Abstract
\begin{abstract}
%% Text of abstract
Confounding factors inherent in medical images can significantly impact the causal exploration capabilities of deep learning models, resulting in compromised accuracy and diminished generalization performance. In this paper, we present an innovative methodology named CausalMixNet that employs query-mixed intra-attention and key\&value-mixed inter-attention to probe causal relationships between input images and labels. For mitigating unobservable confounding factors, CausalMixNet seamlessly integrates the non-local reasoning module (NLRM) and the key\&value-mixed inter-attention (KVMIA) to conduct a front-door adjustment strategy. Furthermore, CausalMixNet incorporates a patch-masked ranking module (PMRM) and query-mixed intra-attention (QMIA) to enhance mediator learning, thereby facilitating causal intervention. The patch mixing mechanism applied to query/(key\&value) features within QMIA and KVMIA specifically targets lesion-related feature enhancement and the inference of average causal effect inference. CausalMixNet consistently outperforms existing methods, achieving superior accuracy and F1-scores across in-domain and out-of-domain scenarios on multiple datasets, with an average improvement of 3\% over the closest competitor. Demonstrating robustness against noise and gender bias, CausalMixNet excels in handling unobservable confounders, maintaining stable performance even in challenging conditions.
\end{abstract}

%%Graphical abstract
% \begin{graphicalabstract}
% %\includegraphics{grabs}
% \end{graphicalabstract}

%%Research highlights
\begin{highlights}
\item {CausalMixNet Overview: We present CausalMixNet, an innovative framework for medical image diagnosis that effectively mitigates the impact of unobservable confounders. By leveraging front-door adjustment principles, it explores the true causal relationships between image features and diagnostic labels, enhancing the reliability of diagnostic outcomes.}
\item {Advanced Mechanisms: CausalMixNet integrates four key modules, Non-Local Reasoning Module (NLRM), Patch-Masked Ranking Module (PMRM), Query-Mixed Intra-Attention (QMIA), and Key\&Value-Mixed Inter-Attention (KVMIA), to robustly identify lesion and non-lesion patches while controlling for unobservable confounding factors. This seamless integration significantly strengthens the causal inference process.}
\item {Empirical Validation: Comprehensive experiments across four widely-used datasets demonstrate that CausalMixNet achieves high diagnostic accuracy both in-domain and out-of-domain. It exhibits remarkable stability and effectiveness under noisy conditions, showcasing its potential to enhance clinical applications and improve diagnostic reliability in diverse scenarios.}
\end{highlights}

%% Keywords
\begin{keyword}
\sep Unobserved confounders \sep front-door adjustment \sep medical image diagnosis \sep patch mixing
\end{keyword}

\end{frontmatter}

%% Add \usepackage{lineno} before \begin{document} and uncomment 
%% following line to enable line numbers
%% \linenumbers
\section{Introduction}
\label{sec:introduction}
Computer-aided diagnosis systems are designed to automate the feature extraction and pattern recognition processes from medical images, streamlining the crucial analysis tasks such as lesion detection \cite{chen2020unsupervised,li2023self}, segmentation \cite{zhong2025cross,jiang2025labeled}, and classification \cite{liuattention2022,liuspatial2024,huang2021identifying}. They enhance the efficiency of medical practitioners and also reduce subjectivity in disease diagnosis. Typically, deep learning-based computer-aided diagnosis systems have become pivotal in medical image analysis. 

However, the pervasive presence of both observable and unobservable noise \cite{xu2020contrast,van2022explainable} presents substantial obstacles for deep learning applications in disease diagnosis when they attribute diagnostic relevance to a confluence of observable noise and pathological indicators \cite{miao2023caussl}. The complex interplay between various tissues, organs, and imaging artifacts poses a significant challenge in precisely demarcating pathological regions \cite{chen2022c}. Furthermore, performance degradation can occur due to domain shifts \cite{hu2023source}, where the well-learned patterns do not generalize well to new, unseen data. Additionally, these issues are further complicated by unobservable noise, which subtly undermines the learning process of pathological features. Unlike observable noise, unobservable noise cannot be directly detected or quantified, making it challenging for existing deep learning methods in directly countering its effects. 

Currently, a myriad of methods exhibit promising potential in addressing observable noise. KDFD \cite{wang2022disentangled} employs a multi-task learning paradigm to stimulate the model towards acquiring content-related features, prioritizing them over stylistic features. STS \cite{chen2022disentangle} identifies invariant features in the feature matrix using gradient information, thereby alleviating the impact of noise. ${C}^2$-net adopts a contrastive learning strategy in spatial and frequency domains to extract features associated with labels. CMCL \cite{mao2022towards} utilizes counterfactual invariance/variance representations to enhance the model's robustness to noise. Causal\_CXR \cite{nie2023chest} employs attention mechanism-based backdoor adjustments to learn the etiology in images. However, these methods generally overlook how to address unobservable noise.

Unobservable noise, as a confounding factor, significantly impacts the interpretation of causal relationships in deep learning models. Previous research has demonstrated that physiological differences, such as age, gender \cite{polsterl2021estimation}, and genetic background \cite{zardavas2015clinical}, not only influence imaging features but are also linked to the probability of disease occurrence. Furthermore, variations in operational techniques can introduce biases in dataset annotations \cite{fabbrizzi2022survey}, leading to misleading inference results. These biases may result in improved model performance in specific populations or conditions, thereby compromising generalizability and reliability in clinical applications. Such instances highlight the pervasive influence of unobservable confounding factors in disease diagnostic systems. Therefore, it is essential to develop algorithms that can effectively mitigate the impact of these unobservable confounders.

In this paper, we propose the CausalMixNet, a novel medical image diagnosis approach, integrated with query-mixed intra-attention and key\&value-mixed inter-attention by eliminating the negative effects of unobserved confounders and exploring the true causality between input and output. CausalMixNet is underpinned by the concept of front-door adjustment (FDA) \cite{pearl2018book} that introduces a mediator to bridge the gap between input and output, thereby controlling unobservable confounding factors. We first design a non-local reasoning module (NLRM) to extract the mediator in FDA to link the causal effect from image features to labels. Then, a patch-masked ranking module (PMRM) is proposed to identify the lesion patches and non-lesion patches by masking each sub-patch and calculating their individual importance score. To enhance the discernibility of mediator, we propose the query-mixed intra-attention (QMIA) module to increase the diveristy of query vectors. Finally, a key\&value-mixed inter-attention (KVMIA) module is designed to conduct causal intervention on the refined mediator. Extensive experiments spanning four widely-used datasets for both in-domain and out-of-domain testing demonstrate that CausalMixNet achieves promising improvements in both scenarios.
CausalMixNet also exhibits remarkable robustness in noise testing even in the presence of severe data noise. The main contributions of this work can be summarized as follow.
\begin{itemize}
    \item The proposed deconfounding method CausalMixNet is designed to explore the causality for medical image diagnosis, especially when unobserved confounders are existed in the system. This method aims to uncover the true causal relationships between image features and diagnosis labels.
    \item The seamless integration of four distinct modules NLRM, PMRM, QMIA, and KVMIA are demonstrated to effectively suppress the impact of unobservable confounding factors. The NLRM and KVMIA are the core components of the causal inference model following the strategy of FDA, while the PMRM and QMIA modules further enhance the causal inference process.
    \item Comprehensive experimental assessments demonstrate that CausalMixNet achieves accurate disease diagnosis not only within the domain it was trained on but also maintains stability and effectiveness when applied to out-of-domain data, gender bias analysis, and in noisy testing conditions.
\end{itemize}

\section{Related Works}
In this section, we systematically outline the applications of supervised deep learning in medical image diagnosis. Subsequently, we conduct a concise discussion of existing methods for image debiasing. Lastly, we provide a comprehensive summary of causal inference methods employed in the realm of medical imaging.
\subsection{Supervised Medical Image Diagnosis}
Supervised medical image diagnosis has garnered significant attention in recent years, with numerous studies contributing to its advancement. Researchers have delved into leveraging annotated medical image datasets to train and fine-tune various deep learning architectures, empowering them to recognize patterns and features indicative of specific disease labels. Tajbakhsh et al. \cite{tajbakhsh2016convolutional} explored the effectiveness of fine-tuning pre-trained deep convolutional neural networks for various medical image analysis. 
Previous work has also attempted to explore the adaptability of different deep model structures to medical images. Gao et al. \cite{gao2020time} investigated the recurrent neural network to model the temporal information for the classification task.
 Wang et al. \cite{wang2022follow} introduced an attention mechanism guided by the radiologists’ gaze tracks. 
STCAL \cite{liu2023spatial} introduces a spatial-temporal co-attention learning graph neural network for computer-aided diagnosis of mental disorders. 
SPT \cite{he2022fully} captures long-range contextual information through the spatial pyramid transformer for medical image diagnosis. 
While these exemplary approaches have indeed yielded substantial advantages in the realm of medical image diagnosis, their efficacy in mitigating bias within medical images remains less than ideal. Bias in medical data increases the risk of model overfitting and undermines the accuracy of various deep learning architectures. Therefore, medical image debiasing has gained ongoing attention in recent years.

\subsection{Image Debiasing}
Image bias generally refers to the systematical difference of a statistical estimation from its population value, steaming from subject selection, acquisition method, processing biases, etc \cite{wachinger2019quantifying}.
Overfitting to data bias in deep neural networks can lead to decreased performance and reduced generalization ability \cite{ktena2024generative}. In the early stages, many methods address biases in multi-source domain generalization. For instance, the IRM \cite{arjovsky2019invariant} aims to develop a model that is unaffected by specific domains by maximizing the consistency of predictions across all source domains, thereby improving its generalization ability in new domains. Makar et al. \cite{makar2022causally} enhanced model performance in multi-source domain generalization by incorporating auxiliary labels and conditional independence. However, the reliance on multi-source data in these methods limits their applicability in single-source scenarios. To address the bias issues in single-source domain generalization, a set of methods leverages techniques such as adversarial training \cite{gokhale2023improving} and contrastive learning \cite{duboudin2021encouraging} to learn invariant features. Additionally, Meta-Causal \cite{chen2023meta} and FAGT \cite{nguyen2023causal} also aim to mitigate the effects of data bias through causal inference techniques. However, these methods often overlook the influence of confounding factors in medical imaging, which can result in a failure to accurately capture causal relationships.


\subsection{Causality for Medical Imaging}
Causality \cite{pearl2018book} in medical imaging represents a novel paradigm aimed at unraveling the intricate relationships between imaging features and underlying physiological phenomena. Based on the nature of confounding factors, current methods can be categorized into two types: methods addressing observable confounders and methods targeting unobservable confounders. 
% Observable confounding factors typically refer to variables in medical imaging that can be measured, such as the type of imaging equipment, artifacts, and anatomical structures. 
To tackle the side-effect of observable confounding factors, backdoor adjustment \cite{QU2024103154} and counterfactual reasoning \cite{SINGLA2023102721} have gained significant attention in recent years. C-cam\cite{chen2022c}, CauSSL \cite{miao2023caussl}, and Qu et al. \cite{QU2024103154} advocate for adopting backdoor-adjustment strategies to effectively decouple the misleading associations between organ features and background information. TraCE \cite{thiagarajan2022training} employs an interval calibration strategy based on uncertainty to effectively generate counterfactuals, ensuring desired alterations in model predictions. 
% Singla et al. \cite{singla2023explaining} employed a conditional generative adversarial network to create counterfactual samples, introducing perturbations to an image while preserving both anatomical shapes and extraneous objects from the input image. 
% Unobservable confounding factors, on the other hand, refer to variables that cannot be directly measured or observed from the images, such as the patient's age, sex, genetic background, psychological state, or the experience level of the physician. These unobservable factors can potentially impact the analysis results of medical images, leading to biases or misdiagnoses. 
On the other hand, a set of methods specifically targets the unobservable confounding factors by leveraging auxiliary labels from biased sources. For example, Bissoto et al. \cite{bissoto2020debiasing} proposed debiasing skin disease recognition by additionally identifying and classifying artifacts in the images. FCRO \cite{deng2023fairness} achieves debiasing by decoupling the bias features (e.g. race and gender) and image features through orthogonalization constraints. However, the reliance of bias labels limits their applicability in scenarios with unknown or unlabeled bias sources. To address this limitation, some attempts have been made to identify and mitigate bias without relying on explicit bias labels.
PBBL \cite{luo2022pseudo} assumes that easily learned features are biased features and uses this assumption to perform bias pseudo-labeling, thereby debiasing for the model. In contrast to these methods, this work adopts a causal inference approach by utilizing front-door adjustment, which introduces a mediator between the input and output. This mediator enables our method to perform causal interventions, effectively circumventing the need to directly address unobservable confounding factors.

\begin{figure*}[]
	\centering
	\includegraphics[width=12cm]{images/FDA.pdf}
	\caption{(a) The structural causal model for medical image diagnosis: $X$ is the input image, $E$ denotes the mediator, $Y$ is the predicted label, and $S$ represents unobserved confounders. The front-door path is $X \rightarrow E \rightarrow Y$, and the backdoor path is $X \leftarrow S \rightarrow Y$. (b) The structural causal model of $X \rightarrow E$. (c) The structual causal model of $E \rightarrow Y$, where the backdoor path is $E \leftarrow X \leftarrow S \rightarrow Y$.}
	\label{fda}
\end{figure*}

\section{Preliminaries  of Front-Door Adjustment}
Front-door adjustment involves the identification and incorporation of an intermediate variable positioned on the causal pathway between a treatment and an outcome. The objective is to isolate the direct effect of the treatment by adjusting for the mediator variable.
In this section, we introduce the fundamentals of front-door adjustment to learn the true causal effect from input images to predicted labels, as shown in Fig. \ref{fda}. (a). Here, $X$ refers to input images of a deep learning model encompassing both the lesion feature and additional irrelevant features introduced by unoberseved confounders. Term $S$ represents the unobserved confounders (age, gender, genetic background, etc.), and term $Y$ corresponds to the ground-truth label of $X$. Deconfounding $S$ necessitates causal intervention on $X$ (a.k.a. $do(X)$) by calculating the average causal effects across various confounders. However, the unobserved confounds are not directly estimable, the implementation of causal intervention on $X$ is impractical. To tackle this dilamma, we introduce the mediator $E$ between $X$ and $Y$, facilitating the knowledge transfer from $X$ to $Y$. The causal effect of $P(Y|do(X)$ can be transferred to $\sum P(Y|do(E))P(E|do(X))$ by considering the joint effect of the causal relationships $X \rightarrow E$ and $E \rightarrow Y$.

The causal relationship of $X \rightarrow E$ is shown in Fig. \ref{fda}. (b). There is only one causal path between $X$ and $E$, as the path $X \leftarrow S \rightarrow Y \leftarrow E$ is blocked by the collider $ S \rightarrow Y \leftarrow E$. Therefore, the causal effect $P(E|do(X)$ can be directly expressed as $P(E|X)$.

The causal relationship of $E \rightarrow Y$ is shown in Fig. \ref{fda}. (c). It can be observed that there are two paths connecting $E$ and $Y$: the front-door path $E \rightarrow Y$ and the backdoor path $E \leftarrow X \leftarrow S \rightarrow Y$. To block the backdoor path, we should perform causal intervention on $E$ by calculating the average causal effects across different $X$ stratums or $S$ stratums. Due to the unmeasurable nature of $S$, we can express $P(Y|do(E)$ as follows:
\begin{equation}
    P(Y|do(E))=\sum_{x}P(Y|E=e,x)P(x),
    \label{eqfd1}
\end{equation}
where $x$ denotes one stratum of variable $X$. 


Through a step-by-step causal reasoning approach \cite{pearl2018book}, the causality from $X$ to $Y$ unfolds as follows:
\begin{equation}
\label{frontdooreq}
\begin{split}
    P(Y|do(X))&=\sum_{e}P(Y|do(E))P(E=e|do(X))\\
    &=\sum_{e}P(E=e|x)\sum_{x'}P(Y|E=e,x')P(x'),
\end{split}
\end{equation}
where $x'$ is an index of summation at $P(Y|do(E))$.

\section{Method}
The proposed framework illustrated in Fig. \ref{fig3} encompasses crucial components: NLRM, PMRM, QMIA, and KVMIA. Acting as the foundational model, the NLRM plays a pivotal role in extracting mediators as $P(E|do(X))$ in Eq. (\ref{eqfd1}) and conducting predictions for medical images. Mediators refer to invariant features in images, such as texture characteristics, that can effectively reflect lesions. The NLRM employs a self-attention-based convolutional neural network to extract these features from images. PMRM is a mechanism that ranks the importance of image sub-blocks by assessing the distance between the sub-blocks and global features. It aids in the identification of lesion and non-lesion areas within the image for QMIA. 
QMIA specifically enhances the learning process of mediators to focus on lesion-related features. It employs an intra-class sample exchange mechanism for lesion sub-blocks, enabling the NLRM to be more robust against various lesion features.
Concurrently, KVMIA facilitates causal intervention on the mediator, which corresponds to the process of $P(Y|do(E))$ as Eq. (\ref{frontdooreq}). KVMIA implements causal intervention on mediators through an exchange mechanism of non-lesion sub-blocks between samples.
The whole process is designed to implement the front-door adjustment, effectively diminishing the effects of unobserved confounders, thus improving generalization ability.

\begin{figure*}[]
	\centering
	\includegraphics[width=13cm]{images/structure.pdf}
	\caption{The framework of CausalMixNet, which consists of NLRM, PMRM, QMIA, and KVMIA. NLRM is utilized to generate mediator $\mathbf{E}$ by capturing global dependencies within the image. PMRM dissects the image into multiple sub-patches and systematically evaluates the significance of each sub-patch through masking, scoring, and sorting. QMIA marked with red lines can enhance the learnining of the mediator. KVMIA marked with green lines is developed to perform causal interventions on the mediator. Collectively, these processes constitute the implementation of front-door adjustment for deconfounding.}
	\label{fig3}
\end{figure*}

\subsection{Non-Local Reasoning Module}
NLRM serves as the mediator extractor by abstracting disease features in images into highly correlated semantic features that are less effected by background information. 
Non-local reasoning module aims to capture long-range dependencies and relationships across the input space to fundamentally enhance CNN attention computation, as non-local reasoning in neural networks.

Given an input image $x$, the mediator of feature map $\mathbf{E}$ is computed using a convolutional neural network. Specifically, we utilize the first three layers of ResNet18 \cite{he2016deep} for this purpose, as expressed in the following equation:
\begin{equation}
    \mathbf{E}=ResNet^{1:3}(x) \in \mathbb{R}^{D \times H \times W},
    \label{wqm1}
\end{equation}
where $D$, $H$, and $W$ are the number of channels, height and width of $\mathbf{E}$, respectively. The mediator extractor encompasses low-level contextual features, such as colors and edges, that are essential for discerning subtle visual distinctions in lesions. To effectively capture pertinent information from surrounding pixels, this module employs an self-attention mechanism based on query ($\mathbf{Q}$), key ($\mathbf{K}$), and value ($\mathbf{V}$). Query is a representation or feature extracted from a specific location on the feature map, probing other positions. Key encode descriptors of the feature map, guiding the queries to find related content. Values represent the substantive information linked to the keys, which are harnessed to refine the feature map. When a query aligns with a key, the corresponding value will be aggregated to calculate the final output.
The calculations of $\mathbf{Q}$, $\mathbf{K}$, and $\mathbf{V}$ for the input tensor $\mathbf{E}$ are expressed as follows:
\begin{equation}
\begin{split}
    \mathbf{Q}=\theta (\mathbf{E}) = \mathbf{E}\mathbf{W}_{\theta} \in \mathbb{R}^{\frac{D}{d} \times HW},\\
    \mathbf{K}=\phi (\mathbf{E}) = \mathbf{E}\mathbf{W}_{\phi} \in \mathbb{R}^{\frac{D}{d} \times HW},\\
    \mathbf{V}=g (\mathbf{E}) = \mathbf{E}\mathbf{W}_{g} \in \mathbb{R}^{D \times HW},
\end{split}
\label{eqm2}
\end{equation}
where $\theta(\cdot)$, $\phi(\cdot)$, and $g(\cdot)$ represent the learnable transformation functions with parameters $\mathbf{W}_{\theta}$, $\mathbf{W}_{\phi}$, and $\mathbf{W}_g$, respectively. The parameter $d$ serves as a shrinkage parameter designed to reduce computational costs. The affinity between all positions is calculated by the pairwise function $f(\cdot,\cdot)$ as:
\begin{equation}
    f(\mathbf{Q},\mathbf{K})=softmax({\mathbf{Q}}^T\mathbf{K}).
    \label{eqm3}
\end{equation}
Subsequently, the output $\hat{\mathbf{E}}$, which integrates surrounding information, is expressed through the aggregation and residual structure as given by Eq. (\ref{eqm4}):
\begin{equation}
\hat{\mathbf{E}} = \mathbf{E} + f(\mathbf{Q}, \mathbf{K})\mathbf{V}.
\label{eqm4}
\end{equation}
Next, $\hat{\mathbf{E}}$ is further fed into the subsequent layer of ResNet18 to obtain the one-dimensional feature vector $\mathbf{u} \in \mathbb{R}^{D^4}$, where $D^4$ represents the dimension of $\mathbf{u}$. The prediction $\hat{\mathbf{y}}$ for $x$ is then computed by applying a classifier to $\mathbf{u}$. To optimize the model, we minimize the negative log-likelihood of the cross-entropy loss as follows:
\begin{equation}
\mathcal{L}_o=-argmin \sum \mathbf{y} log \hat{\mathbf{y}},
    \label{eqm5}
\end{equation}
where $\mathbf{y}$ is the ground-truth label of $x$.

\begin{figure}[]
	\centering
	\includegraphics[width=9cm]{images/PMRM.pdf}
	\caption{The PMRM process divides an image into $M \times M$ sub-patches and assesses the importance of each sub-patch by contrasting the distance between the patch-masked sample and the original sample. The red sub-patches represent lesion areas, while the green sub-patches signify non-lesion regions.}
	\label{pmrm}
\end{figure}

\subsection{Patch Masked Ranking Module}
PMRM is designed to capture pivotal cues within the image associated with corresponding labels, as shown in Fig. \ref{pmrm}. This module dissects the image into multiple sub-patches and systematically evaluates the significance of each sub-patch through a crafted process involving masking, scoring, and sorting. Given the feature matrix $\mathbf{E}$, it is divided into $M \times M$ (abbreviated as $MM$) sub-patches, where the \textit{i}-th sub-patch is denoted as $\mathbf{M}^{i} \in \mathbb{R}^{D \times \frac{H}{M} \times \frac{W}{M}}$. To gauge the significance of each sub-patch, $MM$ patch-masked samples are generated by applying masks to the sub-patches within the completed feature matrix. The \textit{i}-th patch-masked sample is expressed as $\mathbf{E}^{\overline{\mathbf{M}}^i}$:
\begin{equation}
    \mathbf{E}^{\overline{\mathbf{M}}^i}=\{\mathbf{E}|\mathbf{M}^i=0\}.
\end{equation}
The resultant $\mathbf{E}^{\overline{\mathbf{M}}^i}$ is then fed into the last convolutional layer to derive the corresponding feature vector $\mathbf{u}^{\overline{\mathbf{M}}^i}$. Subsequently, a ranking process is adopted to appraise the importance of sub-patches, determined by calculating the Euclidean distance between $\{\mathbf{u}^{\overline{\mathbf{M}}^1}, \cdots, \mathbf{u}^{\overline{\mathbf{M}}^{MM}} \}$ and the feature vector of the complete image $\mathbf{u}$. Notably, when the distance between $\mathbf{u}^{\overline{\textbf{M}}^i}$ and $\mathbf{u}$ is larger, the \textit{i}-th sub-patch is considered more important, as the masked area loses more crucial information. Through this process, the $k_i$-th sub-patch $\mathbf{R}^{k_i}$ is sorted as follows:
\begin{equation}
\mathbf{R}^{k_i}=\{\mathbf{M}^{k_i}|Dis^{k_1} \leq \cdots \leq Dis^{k_i} \leq \cdots \leq Dis^{k_{MM}}\},
\end{equation}
where $k_i \in \{1, \cdots, MM\}$ denotes the ranking index of a sub-patch, and $Dis^{k_i}$ represents the Euclidean distance between $\mathbf{u}$ and $\mathbf{u}^{\overline{\textbf{M}}^{k_i}}$.


\subsection{Query-Mixed Intra-Attention}
QMIA is designed to facilitate the learning of mediators, focusing on capturing lesion features effectively. Inspired by the attention mechanism within the global contextual network, the query feature plays a crucial role in identifying disease-related features. Therefore, the effective integration of lesion information through the query feature is paramount. To address this issue, this module augments the diversity of the query feature by randomly mixing lesion patches of samples within the same class. The lesion patches are selected based on their ranking in PMRM. The diversified query features enable the retrieval of lesion information from multiple perspectives, thereby improving the learning of the mediator for ResNet18. 

\begin{figure}[]
	\centering
	\includegraphics[width=12cm]{images/QM-KVM.pdf}
	\caption{(a) Showcase of the QMIA process. QMIA enhances the learning of mediator by enhancing the diversity of the query feature. Lesion patches are randomly mixed between samples of the same category. (b) Showcase of the KVMIA process. Causal intervention is conducted on the mediator through randomized mixing of non-lesion patches across samples, altering key and value features dynamically.}
	\label{qmkvm}
\end{figure}

The process of QMIA is illustrated in Fig. \ref{qmkvm}. (a). Firstly, we randomly select a sample $x_{intra}$ from the same category as sample $x$ within a mini-batch, and the ranked sub-patches of $x_{intra}$ are denoted as $\{\mathbf{R}^1_{intra}, \cdots, \mathbf{R}^{MM}_{intra}\}$. Next, a mixed intra-sample $\Tilde{x}_{intra}$ is generated by randomly exchanging a lesion patch of $x$ with a lesion patch of $x_{intra}$. This process can be formulated as:
\begin{equation}
    \Tilde{\mathbf{E}}_{intra}=\{\mathbf{E}|\mathbf{R}^{k_1} \leftrightarrows \mathbf{R}_{intra}^{k_2}\},
\end{equation}
where $k_1 \in \{1,\cdots, \mathcal{K}\}$, $k_2 \in \{1,\cdots, \mathcal{K}\}$, and $\mathcal{K}$ represents the range of the selected top-$\mathcal{K}$ patches. With the obtained mixed intra-sample, the mixed intra-query is generated as:
\begin{equation}
    \Tilde{\mathbf{Q}}_{intra}=\theta (\Tilde{\mathbf{E}}_{intra}) = \Tilde{\mathbf{E}}_{intra}\mathbf{W}_{\theta} \in \mathbb{R}^{\frac{D}{d} \times HW}.
\end{equation}
Subsequently, we utilize the mixed intra-query $\Tilde{\mathbf{Q}}_{intra}$, original key $\mathbf{K}$, and original value $\mathbf{V}$ to summarize disease-related features in an augmented manner by:
\begin{equation}
    \hat{\mathbf{E}}_{intra}=\mathbf{E}+f(\Tilde{\mathbf{Q}}_{intra},\mathbf{K})\mathbf{V}.
\end{equation}
Finally, we minimize the negative cross-entropy loss to optimize the predicted result $\hat{\mathbf{y}}_{intra}$ of mixed intra-sample by:
\begin{equation}
    \mathcal{L}_{inra}=- argmin \sum \mathbf{y} log \hat{\mathbf{y}}_{intra}.
\end{equation}

\subsection{Key\&Value-Mixed Inter-Attention}
KVMIA is a key module for causal intervention of $P(Y|do(E))$, thereby diminishing the impact of unobserved confounders. In light of Eq. (\ref{eqfd1}), $P(Y|do(E))$ can be expressed as $\sum P(Y|E,x)P(x)$. This formulation facilitates the coexistence of the mediator $\mathbf{E}$ with confounding factors across different stratums, ensuring equal probability of coexistence and computing the average causal effect. Therefore, two essential elements underline causal intervention on the mediator: (1) fostering the coexistence of the mediator and confounding factors from different stratums, and (2) maintaining an equal probability of coexistence. To achieve these goals, KVMIA constructs the mixed key\&value features for sample $x$ by randomly exchanging non-lesion patches with another randomly selected sample. Swapping non-lesion patches actively facilitates the coexistence of the mediator with confounding factors of different stratums, while random operations ensure an equal probability of coexistence, facilitating causal intervention on the mediator. 

As illustrated in Fig. \ref{qmkvm}. (b), firstly, a data $x_{inter}$ is randomly selected within a mini-batch, and its ranked sub-patches are denoted as $\{\mathbf{R}^1_{inter}, \cdots, \mathbf{R}^{MM}_{inter}\}$. Next, the mixed inter-sample $\Tilde{x}_{inter}$ is generated by randomly exchanging a non-lesion patch of $x$ with a non-lesion patch of $x_{inter}$. Similarly, this process can be formulated as:
\begin{equation}
    \Tilde{\mathbf{E}}_{inter}=\{\mathbf{E}|\mathbf{R}^{k_1} \leftrightarrows \mathbf{R}_{inter}^{k_2}\},
\end{equation}
where $k_1 \in \{MM-\mathcal{K},\cdots, MM\}$ and $k_2 \in \{MM-\mathcal{K},\cdots, MM\}$. With the obtained mixed inter-sample, the mixed inter-key and inter-value are generated as:
\begin{equation}
\begin{split}
    \Tilde{\mathbf{K}}_{inter}=\phi (\Tilde{\mathbf{E}}_{inter}) = \Tilde{\mathbf{E}}_{inter}\mathbf{W}_{\phi} \in \mathbb{R}^{\frac{D}{d} \times HW},\\
    \Tilde{\mathbf{V}}_{inter}=g (\Tilde{\mathbf{E}}_{inter}) = \Tilde{\mathbf{E}}_{inter}\mathbf{W}_{g} \in \mathbb{R}^{D \times HW}.
\end{split}    
\end{equation}
Then, we can utilize the original $\mathbf{Q}$, mixed inter-key $\Tilde{\mathbf{K}}_{inter}$, and mixed inter-value $\Tilde{\mathbf{V}}_{inter}$ to perform causal intervention by:
\begin{equation}
    \hat{\mathbf{E}}_{inter}=\mathbf{E}+f(\mathbf{Q},\Tilde{\mathbf{K}}_{inter})\Tilde{\mathbf{V}}_{inter}.
\end{equation}
QMIA and KVMIA employ different mixing mechanisms due to their distinct objectives: QMIA is designed to enhance the model's comprehension of lesion features in the mediator, necessitating modification solely in the query feature. A targeted adjustment in the query allows for streamlining the learning process. On the other hand, KVMIA operates with the objective of introducing various new confounding factors to intervene in the mediator. This intervention requires to detect the nuanced alternations in both the key and value features.
Finally, akin to QMIA, the negative cross-entropy loss is adopted to optimize the predicted result $\hat{\mathbf{y}}_{inter}$ of mixed inter-sample as follows:
\begin{equation}
    \mathcal{L}_{inter}=- argmin \sum \mathbf{y} log \hat{\mathbf{y}}_{inter}.
\end{equation}

\subsection{Overall Objective Function}
Combining the contributions of NLRM, PMRM, QMIA, and KVMIA, we construct the overall objective function for the proposed framework as: 
\begin{equation}
\label{overallloss}
\mathcal{L}=\mathcal{L}_o+\alpha \mathcal{L}_{intra}+\beta \mathcal{L}_{inter},
\end{equation}
where $\alpha$ and $\beta$ represent the hyper-parameters, finely tuned to harmonize the interplay among the three fundamental components.
% The training process of CausalMixNet is summarized in Algorithm \ref{AL}.

\section{Experiment}
In this section, we conduct comprehensive experiments to assess the performance of CausalMixNet. Initially, we introduce the datasets used, evaluation protocols, compared methods, and implementation details. Subsequently, we disclose the quantitative results for both in-domain and out-of-domain (OOD) experiments spanning four established medical datasets. Further experimental analysis are conducted to evaluate the capabilities of the proposed methods, encompassing ablation studies, gender bias analysis, parameter sensitivity examination, robustness checks against noise using the CUB-200-2011 dataset \cite{wah2011caltech}, and the effectiveness assessment of PMRM. Finally, we present a qualitative analysis to elucidate the interpretability of the methods used in comparison.

\subsection{Datasets and Evaluation Protocols}
Our assessment of the proposed method spans six extensively recognized datasets: BRACS \cite{brancati2022bracs}, DDR \cite{li2019diagnostic}, APTOS \footnote{https://www.kaggle.com/competitions/aptos2019-blindness-detection}, FGADR \cite{zhou2020benchmark},  NIH dataset \cite{wang2017chestx}, and CUB-200-2011 \cite{wah2011caltech}. The images in BRACS are captured through microscopy, while DDR, APTOS, and FGADR images are obtained via optical imaging. The NIH dataset includes pulmonary images extracted using X-ray technology, while CUB-200-2011 features RGB images of birds from the natural world. 
In-domain evaluations utilize the BRACS and DDR datasets, while out-of-domain testing utilizes the APTOS and FGADR datasets.
The NIH dataset is utilized for gender bias analysis and the CUB-200-2011 dataset serves to test the noise resilience of our proposed algorithm.
The application of these various modalities of data can thoroughly validate the adaptability of our method.

The BRACS dataset is pertinent to breast carcinoma subtyping in hematoxylin and eosin (H\&E) histopathology images, comprising 4,539 regions of interest (ROIs) extracted from whole slide images (WSIs). This dataset includes three primary lesion types: benign, malignant, and atypical, which are further categorized into seven subtypes. The benign category consists of normal (484 ROIs), pathological benign (836 ROIs), and usual ductal hyperplasia (517 ROIs). The malignant category compasses ductal carcinoma in situ (790 ROIs) and invasive carcinoma (649 ROIs). The atypical category contains flat epithelial atypia (756 ROIs) and atypical ductal hyperplasia (ADH, 507 ROIs). For diagnostic, benign and malignant ROI images from BRACS are utilized following the official partition, with 2,646/222/408 ROIs allocated for training, validation, and testing, respectively.

The DDR dataset, which specifically targets diabetic retinopathy, contains 12,522 fundus images distributed among five classes. These classes contain 6,266, 630, 4,477, 236, and 913 samples, respectively. Following \cite{che2023towards}, we randomly partition this dataset into training and test sets with an 8:2 ratio.

For out-of-domain testing, the optimal source model is trained using the DDR training subset and vetted against the DDR test subset. 

% APTOSS dataset is collected by Aravind Eye Hospital in India and used for APTOS 2019 Blindness Detection Competition through 4th Asia Pacific Tele-Ophthalmology Society (APTOS) Symposium. We use 3,657 public images with official DR labels for testing the model's generalization performance.

% The FGADR dataset, a large-scale fine-grained annotated diabetic retinopathy dataset collected by the Inception Institute of Artificial Intelligence (IIAI), consists of two subsets: Seg-set and Grade-set. We utilize 1842 images with image-level DR labels.

The APTOSS dataset, curated by Aravind Eye Hospital for the APTOS 2019 Blindness Detection Competition, includes 3,657 publicly available images with official diabetic retinopathy (DR) grading. The dataset is distributed across five classes with the following sample counts: 1,801, 370, 998, 193, and 295. All samples are employed to assess the out-of-domain generalization capabilities.

The FGADR dataset, curated by the Inception Institute of Artificial Intelligence (IIAI), offers a comprehensive set of fine-grained annotations for DR. It comprises two distinct subsets: Seg-set and Grade-set. Our analysis incorporates 1,841 images with image-level DR labels from this dataset. The sample distribution across the classes is 101, 212, 594, 647, and 287, respectively. All samples are used to assess the generalization ability in out-of-domain scenarios.

To analysis the ability to address gender bias, following \cite{luo2022pseudo}, we select data from the NIH dataset involving patients with no findings and pneumothorax, constructing three experimental setups with varying gender biases. The sample selection for the first two setups strictly follows this work \cite{luo2022pseudo}. Specifically: 1) GbP-Tr1 includes 800 male pneumothorax samples, 100 male no finding samples, 800 female no finding samples, and 100 female pneumothorax samples; 2) GbP-Tr2 consists of 800 female pneumothorax samples, 100 female no finding samples, 800 male no finding samples, and 100 male pneumothorax samples. Additionally, we establish a gender-balanced experimental setup (GbP-B) as a control, comprising 450 female pneumothorax samples, 450 female no finding samples, 450 male no finding samples, and 450 male pneumothorax samples. For the validation and testing sets, we evenly collect 150 and 250 samples from each group (with or without pneumothorax; male or female) according to the settings in \cite{luo2022pseudo}.

To test the noise resilience, the CUB-200-2011 dataset provides 11,788 images of 200 bird species, presenting an ideal challenge due to the species' shared global features but different attributes. To simulate noise, we use images from the first 100 classes as base categories, adding images from the remaining 100 species as noise \cite{dubey2018maximum}. The resulting noisy training set and the pristine test set, taken from base categories, are divided in an 80:20 ratio.


% And the test dataset are totally clear images from base categories. The training set and test set are divided in an 8:2 ratio.

Our evaluation protocol adopts the widely-used medical diagnostic metrics: accuracy (Acc), precision (Precision), recall (Recall), F1-score (F1), and the mean area under the ROC curve (AUC), to quantitatively evaluate the proposed methods across various datasets.


\subsection{Compared Methods and Implementation Details}
\textbf{Compared Methods.} In order to comprehensively evaluate our proposed method, we benchmark against nine state-of-the-art comparative methods. These methods, known for their efficiency in various disease diagnostics and causal inference methods, include GDRNet \cite{che2023towards}, GREEN \cite{liu2020green}, CABNet \cite{he2020cabnet}, MixupNet \cite{zhang2018mixup}, MixStyleNet \cite{zhou2020domain}, Fishr \cite{rame2022fishr}, PBBL \cite{luo2022pseudo}, Meta-Causal \cite{chen2023meta}, and FAGT \cite{nguyen2023causal}. These methods are designed to extract domain-invariant features through supervised learning \cite{liu2020green,he2020cabnet}, domain generalization techniques \cite{che2023towards,zhang2018mixup,zhou2020domain,rame2022fishr}, data augmentation strategies \cite{che2023towards,zhang2018mixup,zhou2020domain}, or causal inference strategies \cite{chen2023meta,nguyen2023causal}. Comparisons with these methods enable a reliable validation of our proposed method's performance in both in-domain, out-of-domain scenarios and bias analysis.


\textbf{Implementation Details.} 
In our experimental setup, ResNet18 serves as the backbone model for in-domain, out-of-domain, and noise testing, while DenseNet121 \cite{huang2017densely} is used as the backbone model for gender bias analysis, following the work in \cite{luo2022pseudo}.
All experiments are executed on an RTX 3090 GPU. Images are resized to a universal dimension of 256x256 pixels. We employ the stochastic gradient descent (SGD) optimizer with a momentum of 0.9 and a weight decay of 0.05 to refine our model. For the experiments involving the BRACS dataset, we set the learning rate to 10e-4, the batch size to 16, and limit the training to 30 epochs. The hyper-parameters $\alpha$ and $\beta$ are specifically tuned to 5.0 and 3.0, respectively. For the DDR dataset, the learning rate is fixed at 10e-4, with a larger batch size of 64, and the training duration also capped at 30 epochs. The $\alpha$ and $\beta$ are adjusted to 5.0 and 1.0, respectively. For the experiments on the NIH dataset, the learning rate is set to $10^{-4}$  , the batch size to 128, and both $\alpha$ and $\beta$ are set to 5.0. In tests with the CUB-200-2011 dataset, we use a learning rate of 10e-3, a batch size of 128, and a shorter training span of 20 epochs, setting both $\alpha$ and $\beta$ to 5.0. The $\mathcal{K}$ for the top-$\mathcal{K}$ sub-patches and $M$ are set as 3 and 4, respectively, across all datasets. We use the validation set to implement an early stopping training strategy. All experimental results are based on the average of five trials conducted with different random seeds.

% Our code will be release at \url{https://github.com/Yajie-Zhang/CausalMixNet}.

\subsection{Quantitative Results}

\begin{table*}[]\small\centering
\caption{The experiment results of in-domain and out-of-domain tests in DDR, APTOS, and FGADR datasets. The \textbf{best results} and \underline{second-best results} are marked with corresponding formats.}
% \begin{tabular}{c|ccc|c| |ccc|ccc|c}
\begin{tabular}{p{1.3cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}}
  \hline 
  \multirow{2}{*}{Method} & \multicolumn{3}{c|}{In-domain (DDR)}  & \multicolumn{3}{c|}{OOD (APTOS)} & \multicolumn{3}{c|}{OOD (FGADR)}
 &   \multirow{2}{*}{AVG} \\
 % \cline{2-4} \cline{6-11}
 \cline{2-10}
                      & Acc & AUC& F1        & Acc & AUC & F1                             & Acc & AUC & F1 & \\\hline
GDRNet        &61.86	&79.64	&32.17	&65.14	&76.47	&34.36	&31.85	&75.87	&24.67	&53.56 \\
&${\pm1.60}$	&${\pm2.43}$	&${\pm3.24}$	&${\pm2.08}$	&${\pm1.10}$	&${\pm5.57}$	&${\pm3.29}$	&${\pm4.12}$	&${\pm4.02}$	&${\pm3.08}$ \\\hline

GREEN         &77.37	&88.23	&54.82	&68.20	&76.61	&38.73	&\underline{43.50}	&75.37	&29.91	&61.42 \\
&${\pm0.42}$	&${\pm1.47}$	&${\pm1.68}$	&${\pm1.02}$	&${\pm2.08}$	&${\pm3.61}$	&${\pm2.44}$	&${\pm3.69}$	&${\pm2.98}$	&${\pm3.11}$ \\\hline


CABNet        &75.29	&88.30	&52.43	&67.54	&77.15	&37.68	&41.26	&75.01	&27.84	&60.28 \\
&${\pm2.74}$	&${\pm1.35}$	&${\pm2.98}$	&${\pm1.63}$	&${\pm1.96}$	&${\pm2.73}$	&${\pm2.68}$	&${\pm2.12}$	&${\pm1.35}$	&${\pm2.06}$ \\\hline

Mixup-      &76.33	&88.38	&51.28	&\textbf{73.18}	&76.62	&41.82	&27.46	&70.62	&25.36	&59.01 \\
Net&${\pm0.50}$	&${\pm0.88}$	&${\pm1.38}$	&${\pm2.77}$	&${\pm1.78}$	&${\pm2.20}$	&${\pm1.28}$	&${\pm1.70}$	&${\pm5.03}$	&${\pm4.85}$ \\\hline

MixSt-   &68.30	&78.22	&38.47	&57.33	&74.88	&35.80	&20.45	&62.93	&16.70	&50.34 \\
yleNet&${\pm2.09}$	&${\pm2.03}$	&${\pm1.52}$	&${\pm3.15}$	&${\pm3.93}$	&${\pm5.79}$	&${\pm3.57}$	&${\pm2.28}$	&${\pm1.25}$	&${\pm3.16}$ \\\hline

Fishr         &80.51	&89.44	&55.04	&\underline{70.46}	&77.68	&42.30	&38.35	&75.13	&28.96	&61.99 \\
&${\pm1.33}$	&${\pm1.21}$	&${\pm0.97}$	&${\pm2.79}$	&${\pm2.66}$	&${\pm2.57}$	&${\pm1.91}$	&${\pm1.24}$	&${\pm2.31}$	&${\pm2.05}$ \\\hline

Meta-  &\underline{80.88}	&88.65	&56.48	&68.33	&\underline{77.84}	&\underline{42.87}	&40.55	&\underline{76.40}	&\underline{31.85}	&\underline{62.65} \\
causal&${\pm0.63}$	&${\pm0.98}$	&${\pm0.49}$	&${\pm2.07}$	&${\pm2.39}$	&${\pm3.80}$	&${\pm3.17}$	&${\pm1.61}$	&${\pm3.97}$	&${\pm4.30}$ \\\hline

FAGT  &79.52	&\underline{89.79}	&\underline{57.07}	&67.05	&77.56	&40.18	&38.60	&72.15	&27.58	&61.06 \\
&${\pm0.67}$	&${\pm0.81}$	&${\pm1.04}$	&${\pm1.83}$	&${\pm1.82}$	&${\pm2.72}$	&${\pm4.33}$	&${\pm1.91}$	&${\pm3.27}$	&${\pm2.95}$ \\\hline

Ours  &\textbf{80.93}	&\textbf{89.87}	&\textbf{62.41}	&69.53	&\textbf{78.17}	&\textbf{44.62}	&\textbf{49.63}	&\textbf{77.24}	&\textbf{37.46}	&\textbf{65.54} \\
&${\pm0.65}$	&${\pm0.69}$	&${\pm1.12}$	&${\pm3.33}$	&${\pm1.97}$	&${\pm0.97}$	&${\pm1.00}$	&${\pm2.52}$	&${\pm1.31}$	&${\pm1.85}$ \\\hline

\end{tabular}
\label{table2}
\end{table*}



\begin{table*}[]\small\centering
% \label{table1}
\caption{The experiment results of in-domain testing for mutli-class classification task and binary classification task in BRACS dataset. The \textbf{best results} and \underline{second-best results} are marked with corresponding formats.}
% \begin{tabular}{c|ccc|ccccc}
\begin{tabular}{p{1.8cm}<{\centering}|p{1.0cm}<{\centering}p{1.0cm}<{\centering}p{1.0cm}<{\centering}|p{1.0cm}<{\centering}p{1.2cm}<{\centering}p{1.0cm}<{\centering}p{1.0cm}<{\centering}p{1.0cm}<{\centering}}
  \hline
  \multirow{2}{*}{Method} & \multicolumn{3}{c|}{Multi class (5 classes)}  & \multicolumn{5}{c}{Binary class} \\
  \cline{2-9}
                        & Acc & F1 & AVG   & Acc & Precision &Recall& F1 & AVG\\\hline

GREEN           &62.14	&62.35	&62.24	&83.85	&\textbf{84.76}	&81.63	&81.25	&82.87 \\
&${\pm1.53}$	&${\pm1.27}$	&${\pm1.16}$	&${\pm1.53}$	&${\pm0.80}$	&${\pm1.61}$	&${\pm0.92}$	&${\pm0.59}$ \\\hline

CABNet          &63.27	&63.75	&63.51	&84.91	&\underline{84.26}	&79.02	&79.85	&82.01 \\
&${\pm0.83}$	&${\pm0.42}$	&${\pm0.44}$	&${\pm1.38}$	&${\pm1.16}$	&${\pm1.17}$	&${\pm1.25}$	&${\pm0.89}$ \\\hline

MixupNet        &63.71	&63.61	&63.66	&84.57	&80.62	&80.30	&80.32	&81.45 \\
&${\pm0.72}$	&${\pm0.68}$	&${\pm0.71}$	&${\pm0.75}$	&${\pm2.90}$	&${\pm1.67}$	&${\pm0.57}$	&${\pm0.54}$ \\\hline

MixStyle-     &\underline{65.97}	&65.22	&65.59	&85.10	&81.28	&81.34	&81.41	&82.28 \\
Net&${\pm1.02}$	&${\pm0.86}$	&${\pm0.96}$	&${\pm0.12}$	&${\pm0.21}$	&${\pm0.36}$	&${\pm0.53}$	&${\pm0.31}$ \\\hline

Fishr           &65.11	&65.13	&65.12	&84.20	&80.81	&80.87	&80.33	&81.55 \\
&${\pm0.13}$	&${\pm0.89}$	&${\pm0.71}$	&${\pm1.44}$	&${\pm1.23}$	&${\pm0.94}$	&${\pm0.66}$	&${\pm0.48}$ \\\hline

Meta-  &65.75	&65.62	&65.68	&\underline{85.29}	&83.73	&82.56	&82.05	&83.41 \\
causal&${\pm0.20}$	&${\pm0.41}$	&${\pm0.32}$	&${\pm1.24}$	&${\pm1.41}$	&${\pm1.29}$	&${\pm1.13}$	&${\pm1.68}$ \\\hline

FAGT  &65.30	&\textbf{66.14}	&\underline{65.72}	&85.13	&80.26	&\textbf{86.18}	&\textbf{83.77}	&\underline{83.83} \\
&${\pm0.24}$	&${\pm0.36}$	&${\pm0.28}$	&${\pm0.31}$	&${\pm0.98}$	&${\pm0.74}$	&${\pm0.76}$	&${\pm0.85}$ \\\hline

Ours         &\textbf{65.98}	&\underline{65.75}	&\textbf{65.86}	&\textbf{86.13}	&83.16	&\underline{83.92}	&\underline{83.76}	&\textbf{84.24} \\
&${\pm0.46}$	&${\pm0.43}$	&${\pm0.43}$	&${\pm0.78}$	&${\pm1.43}$	&${\pm4.63}$	&${\pm1.54}$	&${\pm1.38}$ \\\hline

\end{tabular}
\label{table1}
\end{table*}


\textbf{In-Domain Results.} Table \ref{table2} and Table \ref{table1} provide results from in-domain testing on the DDR and BRACS datasets, respectively. 
% Notably, in binary classification task, the average performance of CausalMixNet across four evaluation metrics surpass that of the second-best method by roughly 3.5\%. 
Table \ref{table2} indicates that CausalMixNet achieves commendable results on the DDR dataset. In the F1-score metric, for instance, CausalMixNet outshines the runner-up method by an impressive 5\%. These findings suggest that CausalMixNet is proficient at discerning both positive and negative instances, showcasing robust overall capabilities. 
Similarly, our method CausalMixNet is assessed on the BRACS dataset through a multi-class classification task across five categories, as well as a binary classification task targeting benign versus malignant differentiation. Table \ref{table1} reveals that CausalMixNet outperforms competing approaches in both multi-class and binary classification tasks. 
The thorough in-domain experiments validate that CausalMixNet adeptly captures causal relationships and effectively mitigates the influence of confounding factors.





\textbf{Out-of-Domain Results.} We test the generalization performance of the compared methods using the APTOS and FGADR datasets. Strong generalization suggests that a model has likely learned the true causal factors of diseases, as opposed to simply memorizing dataset-specific noise. As shown in Table \ref{table2}, CausalMixNet stands out as the leader in generalization across both datasets, boasting an average improvement of 3\% over the closest rival. 
Although CausalMixNet exhibits a 4\% dip in accuracy compared to MixupNet on the APTOS dataset, it surpasses MixupNet by 3\% in F1-score, highlighting its adeptness at identifying positive cases.
On the FGADR dataset, CausalMixNet achieves an 6\% and 6\% increase in accuracy and F1-score, respectively, over the second-best method. Specifically, our proposed approach, which utilizes a sub-patch mixing strategy for causal intervention, demonstrates superior generalization compared to the MixUp technique used in MixupNet and MixStyleNet. This superiority can be contributed to our method's emphasis on exploring authentic causal relationships, rather than depending primarily on data augmentation for model generalization. Furthermore, the integration of PMRM steers an importance-weighted mixing scheme that enables the model to learn more precise disease markers and execute effective causal interventions.

\subsection{Exploration Experiments}

\begin{table*}[]\small\centering
\caption{The ablation study of in-domain and out-of-domain tests in DDR, APTOS, and FGADR datasets.}
% \begin{tabular}{c|ccc|c| |ccc|ccc|c}
\begin{tabular}{p{1.7cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}}
  \hline 
  \multirow{2}{*}{Method} & \multicolumn{3}{c|}{In-domain (DDR)}  & \multicolumn{3}{c|}{OOD (APTOS)} & \multicolumn{3}{c|}{OOD (FGADR)}
 &   \multirow{2}{*}{AVG} \\
 % \cline{2-4} \cline{6-11}
 \cline{2-10}
                      & Acc & AUC& F1        & Acc & AUC & F1                             & Acc & AUC & F1 & \\\hline


Baseline      &79.51	&88.50	&55.61	&\underline{69.30}	&78.14	&43.81	&37.11	&76.14	&26.31	&61.60 \\
&${\pm0.31}$	&${\pm0.88}$	&${\pm2.57}$	&${\pm1.36}$	&${\pm2.57}$	&${\pm2.21}$	&${\pm2.07}$	&${\pm1.66}$	&${\pm1.19}$	&${\pm2.17}$ \\ \hline

QMIA          &79.57	&89.61	&57.47	&69.21	&\textbf{79.47}	&\underline{44.52}	&44.72	&76.69	&31.25	&63.61 \\
&${\pm1.60}$	&${\pm0.74}$	&${\pm0.86}$	&${\pm1.57}$	&${\pm1.19}$	&${\pm1.67}$	&${\pm1.53}$	&${\pm2.31}$	&${\pm2.88}$	&${\pm2.41}$ \\ \hline

KVMIA         &\underline{80.59}	&\textbf{90.68}	&\underline{61.75}	&63.47	&\underline{78.66}	&43.86	&\underline{46.88}	&\underline{77.34}	&\underline{36.20}	&\underline{64.38} \\
&${\pm0.62}$	&${\pm0.15}$	&${\pm0.37}$	&${\pm2.45}$	&${\pm2.03}$	&${\pm2.82}$	&${\pm1.41}$	&${\pm1.21}$	&${\pm2.89}$	&${\pm1.20}$ \\ \hline

Causal-  &\textbf{80.93}	&\underline{89.87}	&\textbf{62.41}	&\textbf{69.53}	&78.17	&\textbf{44.62}	&\textbf{49.63}	&\textbf{77.24}	&\textbf{37.46}	&\textbf{65.54} \\
MixNet&${\pm0.65}$	&${\pm0.69}$	&${\pm1.12}$	&${\pm3.33}$	&${\pm1.97}$	&${\pm0.97}$	&${\pm1.00}$	&${\pm2.52}$	&${\pm1.31}$	&${\pm1.85}$ \\ \hline


% KVMIA         &\underline{80.59}$_{\pm0.62}$	&\textbf{90.68}$_{\pm0.15}$  &\underline{61.75}$_{\pm0.37}$ &63.47$_{\pm2.45}$	&\underline{78.66}$_{\pm2.03}$  &43.86$_{\pm2.82}$	&\underline{46.88}$_{\pm1.41}$	&\underline{77.34}$_{\pm1.21}$  &\underline{36.20}$_{\pm2.89}$  &\underline{64.38}$_{\pm1.20}$ \\\hline
% CausalMixNet  &\textbf{80.93}$_{\pm0.65}$	&\underline{89.87}$_{\pm0.69}$	&\textbf{62.41}$_{\pm1.12}$	&\textbf{69.53}$_{\pm3.33}$	&78.17$_{\pm1.97}$	&\textbf{44.62}$_{\pm0.97}$	&\textbf{49.63}$_{\pm1.00}$	&\textbf{77.24}$_{\pm2.52}$	&\textbf{37.46}$_{\pm1.31}$	&\textbf{65.54}$_{\pm1.85}$ \\\hline
\end{tabular}
\label{ablation2}
\end{table*}

\begin{table*}[]\small\centering
% \label{table1}
\caption{The ablation study for BRACS dataset}
% \begin{tabular}{c|ccc|ccccc}
\begin{tabular}{p{1.8cm}<{\centering}|p{1.1cm}<{\centering}p{1.1cm}<{\centering}p{1.1cm}<{\centering}|p{1.1cm}<{\centering}p{1.3cm}<{\centering}p{1.1cm}<{\centering}p{1.1cm}<{\centering}p{1.1cm}<{\centering}}
  \hline
  \multirow{2}{*}{Method} & \multicolumn{3}{c|}{Multi class (5 classes)}  & \multicolumn{5}{c}{Binary class} \\
  \cline{2-9}
                        & Acc & F1 & AVG   & Acc & Precision &Recall& F1 & AVG\\\hline
Baseline        &63.64	&63.47	&63.55	&83.98	&79.36	&83.54	&82.87	&82.43 \\
&${\pm0.27}$	&${\pm0.76}$	&${\pm0.18}$	&${\pm1.31}$	&${\pm2.74}$	&${\pm1.53}$	&${\pm0.39}$	&${\pm0.45}$ \\ \hline
QMIA            &\textbf{66.03}	&\underline{65.47}	&\underline{65.75}	&\underline{85.13}	&\textbf{83.27}	&81.30	&82.17	&82.96 \\
&${\pm0.10}$	&${\pm0.22}$	&${\pm0.14}$	&${\pm0.52}$	&${\pm0.78}$	&${\pm0.69}$	&${\pm0.72}$	&${\pm0.51}$ \\ \hline
KVMIA           &63.89	&63.48	&63.68	&84.91	&80.36	&\textbf{85.95}	&\underline{83.64}	&\underline{83.71} \\
&${\pm0.81}$	&${\pm0.86}$	&${\pm0.70}$	&${\pm0.11}$	&${\pm1.74}$	&${\pm1.63}$	&${\pm1.83}$	&${\pm1.99}$ \\ \hline
Causal-    &\underline{65.98}	&\textbf{65.75}	&\textbf{65.86}	&\textbf{86.13}	&\underline{83.16}	&\underline{83.92}	&\textbf{83.76}	&\textbf{84.24} \\
MixNet&${\pm0.46}$	&${\pm0.43}$	&${\pm0.43}$	&${\pm0.78}$	&${\pm1.43}$	&${\pm4.63}$	&${\pm1.54}$	&${\pm1.38}$ \\ \hline

      
\end{tabular}
\label{ablation1}
\end{table*}

\textbf{Ablation Study.} To evaluate the efficacy of the key modules in our methodology, QMIA and KVMIA, we conducte ablation studies in both in-domain and out-of-domain scenarios using the DDR, BRACS, APTOS, and FAGDR datasets. Tables \ref{ablation2} and \ref{ablation1} exhibit a performance increase ranging from 1\% to 3\% over the baseline in in-domain experiments on the DDR and BRACS datasets. Specifically, KVMIA demonstrates a marked impact on the BRACS dataset, while both QMIA and KVMIA are comparable on the DDR dataset.
Out-of-domain ablation results, as shown in Table \ref{ablation2}, underscore the benefits of QMIA for both APTOS and FAGDR datasets.
The synergy between QMIA and KVMIA, where the latter builds on the findings of the former, facilitates enhanced model generalization, underscoring the complementary nature between these two modules.

\begin{table}[]\centering
\caption{The experimental results of gender bias on NIH datasets.}
\begin{tabular}{p{2.5cm}<{\centering}|p{1.8cm}<{\centering}p{1.8cm}<{\centering}p{1.8cm}<{\centering}}
  \hline 
Method   & GbP-Tr1   & GbP-Tr2  & GbP-B  \\\hline

GREEN         &82.61$_{\pm0.57}$	&78.58$_{\pm1.85}$	&84.20$_{\pm0.21}$   \\
CABNet        &82.52$_{\pm0.20}$	&80.23$_{\pm1.02}$	&83.96$_{\pm0.21}$	\\

MixupNet      &\underline{82.78}$_{\pm0.38}$	&80.48$_{\pm0.92}$	&84.02$_{\pm0.14}$	 \\
MixStyleNet   &82.67$_{\pm0.24}$	&\underline{80.69}$_{\pm0.95}$  &83.79$_{\pm0.39}$	 \\
Fishr         &82.41$_{\pm0.12}$	&79.68$_{\pm0.57}$	&83.96$_{\pm0.37}$	\\

Meta-causal  &82.62$_{\pm0.36}$	&80.47$_{\pm0.34}$	&84.04$_{\pm0.12}$	  \\
FAGT  &82.75$_{\pm0.51}$	&80.25$_{\pm0.84}$	&83.97$_{\pm0.36}$	 \\
PBBL &82.26$_{\pm0.20}$	&80.25$_{\pm0.70}$  &\underline{84.51}$_{\pm0.83}$ \\\hline

Baseline      &\underline{82.78}$_{\pm0.36}$	&79.82$_{\pm1.55}$  &84.04$_{\pm0.63}$	\\\hline
CausalMixNet  &\textbf{82.92}$_{\pm0.61}$	&\textbf{80.99}$_{\pm0.55}$	&\textbf{84.73}$_{\pm0.31}$	\\\hline
                      
\end{tabular}
\label{genderbias}
\end{table}


\textbf{Gender-Biased Analysis.} As shown in Table \ref{genderbias}, we evaluate multiple algorithms across three different gender bias scenarios: GbP-Tr1, GbP-Tr2, and GbP-B.
Among the methods assessed, CausalMixNet demonstrates the highest performance across all conditions, with scores of 82.92\% for GbP-Tr1, 80.99\% for GbP-Tr2, and 84.73\% for GbP-B, indicating its robustness in handling gender bias. 
When comparing CausalMixNet to the baseline model, it can be seen that CausalMixNet consistently outperforms the baseline across the evaluated metrics, especially in GbP-Tr2 and GbP-B. This improvement suggests that CausalMixNet's approach to addressing gender bias provides a distinct advantage over the more conventional methods represented by the baseline.





\textbf{Parameter Analysis.} We conducte an analysis of the hyperparameters $\alpha$ and $\beta$ on the DDR dataset. As shown in Table \ref{table3}, when varying these two parameters from 0.5 to 5.0, their impact on the overall performance is moderate. Optimal results on the DDR dataset are achieved with $\alpha=5.0$ and $\beta=3.0$. A similar method was applied to determine the optimal hyperparameters for other datasets. On the BRACS dataset, the best performance is obtained with $\alpha=5.0$ and $\beta=1.0$.  For the NIH and CUB-200-2011 dataset, the optimal settings are $\alpha=5.0$ and $\beta=5.0$.

\begin{table}[]\centering
\caption{The parameter analysis of $\alpha$ and $\beta$ in DDR dataset for in-domain testing.}
% \begin{tabular}{c|cccc}
\begin{tabular}{p{3.5cm}<{\centering}|p{1.6cm}<{\centering}p{1.6cm}<{\centering}p{1.6cm}<{\centering}|p{1.6cm}<{\centering}}
  \hline
  \multirow{2}{*}{Parameters} & \multicolumn{4}{c}{In-domain (DDR)} \\
 \cline{2-5}
                      & Acc & AUC & F1 & AVG       \\\hline
$\alpha=5.0$, $\beta=0.5$	&80.45$_{\pm0.35}$	&89.75$_{\pm0.17}$	&61.16$_{\pm0.97}$	&77.12$_{\pm0.31}$ \\\hline
$\alpha=5.0$, $\beta=1.0$	&79.94$_{\pm0.19}$	&89.39$_{\pm0.28}$	&61.81$_{\pm0.28}$	&77.05$_{\pm0.31}$ \\\hline
$\alpha=5.0$, $\beta=2.0$	&80.50$_{\pm0.47}$	&89.27$_{\pm0.73}$	&62.02$_{\pm0.31}$	&77.26$_{\pm0.31}$ \\\hline
$\alpha=5.0$, $\beta=3.0$	&\textbf{80.93}$_{\pm0.65}$	&\textbf{89.87}$_{\pm0.69}$	&\textbf{62.41}$_{\pm1.12}$	&\textbf{77.74}$_{\pm0.82}$ \\\hline
$\alpha=5.0$, $\beta=4.0$	&80.20$_{\pm0.28}$	&89.55$_{\pm0.71}$	&61.91$_{\pm1.06}$  &77.22$_{\pm0.31}$ \\\hline
$\alpha=5.0$, $\beta=5.0$ 	&80.53$_{\pm0.56}$  &89.62$_{\pm0.34}$  &61.95$_{\pm0.93}$	&77.36$_{\pm0.31}$ \\\hline
$\alpha=1.0$, $\beta=3.0$	&80.55$_{\pm0.67}$	&89.20$_{\pm0.61}$  &61.52$_{\pm0.48}$	&77.09$_{\pm0.31}$ \\\hline
$\alpha=2.0$, $\beta=3.0$	&80.12$_{\pm0.89}$	&88.91$_{\pm0.52}$	&61.44$_{\pm0.50}$	&76.83$_{\pm0.31}$ \\\hline
$\alpha=3.0$, $\beta=3.0$	&80.77$_{\pm0.18}$	&89.35$_{\pm0.86}$	&61.95$_{\pm0.74}$	&77.36$_{\pm0.31}$ \\\hline
$\alpha=4.0$, $\beta=3.0$	&80.62$_{\pm0.24}$	&89.31$_{\pm0.85}$	&62.25$_{\pm0.73}$  &77.39$_{\pm0.31}$ \\\hline
\end{tabular}
\label{table3}
\end{table}

\textbf{Noise Testing.} To evaluate the model's resilience against unobservable confounding factors, we introduce simulated noise into the CUB-200-2011 dataset. 
According to the noise settings in the reference \cite{dubey2018maximum}, the model is trained on a dataset consisting of (1-a\%) samples from the base classes and a\% samples from other classes, with the latter serving as noise.
For evaluation, a noise-free test set containing only base class images is used.
In this setting, we varied the noise ratio from 0\% to 60\%. Fig. \ref{cub} displays how the baseline performance deteriorates with increasing noise levels, showing a drop of up to 20\% in accuracy and F1-score. However, incorporating QMIA and KVMIA modules stabilizes performance, exhibiting a steady trend despite escalating noise. These experiments highlight the distinct advantage of CausalMixNet in mitigating the impact of unobservable confounding factors.


\begin{figure*}[]
	\centering
	\includegraphics[width=14cm]{images/cub.pdf}
	\caption{The noise testing on CUB-200-2011 dataset.}
	\label{cub}
\end{figure*}



\textbf{Effectiveness of PMRM.} To assess the significance of PMRM, we employ various intervention strategies on the mediator. These include: 1) a random approach, indiscriminately swapping sub-patches without considering their relevance; 2) intra-sample, leveraging $\textbf{E}_{intra}$ within the same category to modify $\mathbf{Q}/\mathbf{K}/\mathbf{V}$; and 3) inter-sample, leveraging $\mathbf{E}_{inter}$ across different categories to modify $\mathbf{Q}/\mathbf{K}/\mathbf{V}$. Table \ref{table4} presents the outcomes, revealing that the proposed PMRM attains superior performance. Conversely, disregarding the significance of sub-patches or simply exchanging full $\mathbf{Q}/\mathbf{K}/\mathbf{V}$ sets leads to a decline in results.
\begin{table*}[]\small\centering
\caption{The results in DDR dataset for evaluating the effectiveness of PMRM}
% \begin{tabular}{c|ccc|c||ccc|ccc|c}
\begin{tabular}{p{1.5cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}p{0.8cm}<{\centering}p{0.8cm}<{\centering}|p{0.8cm}<{\centering}}
  \hline 
  \multirow{2}{*}{Method} & \multicolumn{3}{c|}{In-domain (DDR)}  & \multicolumn{3}{c|}{OOD (APTOS)} & \multicolumn{3}{c|}{OOD (FGADR)}
 &   \multirow{2}{*}{AVG} \\
 % \cline{2-4} \cline{6-11}
 \cline{2-10}
                      & Acc & AUC& F1        & Acc & AUC & F1                             & Acc & AUC & F1 & \\\hline
Random          &80.36	&\textbf{89.98}	&58.30	&67.42	&75.08	&40.16	&\underline{49.09}	&75.24	&36.28	&63.55 \\
&${\pm0.36}$	&${\pm0.38}$	&${\pm0.60}$	&${\pm0.19}$	&${\pm0.27}$	&${\pm1.42}$	&${\pm0.75}$	&${\pm0.47}$	&${\pm1.04}$	&${\pm1.15}$ \\ \hline
Intra-    &\underline{80.50}	&88.42	&60.41	&69.28	&77.10	&\underline{42.42}	&48.96	&76.03	&36.42	&64.39 \\
sample&${\pm0.56}$	&${\pm0.49}$	&${\pm0.39}$	&${\pm0.27}$	&${\pm0.64}$	&${\pm1.27}$	&${\pm0.39}$	&${\pm0.73}$	&${\pm0.96}$	&${\pm1.06}$ \\ \hline
Inter-   &80.19	&89.35	&\underline{61.99}	&\underline{69.41}	&\underline{78.05}	&42.34	&48.33	&\underline{77.21}	&\underline{37.17}	&\underline{64.89} \\
sample&${\pm0.40}$	&${\pm0.68}$	&${\pm0.62}$	&${\pm0.53}$	&${\pm0.49}$	&${\pm0.95}$	&${\pm1.07}$	&${\pm0.85}$	&${\pm1.21}$	&${\pm0.98}$ \\ \hline
PMRM            &\textbf{80.93}	&\underline{89.87}	&\textbf{62.41}	&\textbf{69.53}	&\textbf{78.17}	&\textbf{44.62}	&\textbf{49.63}	&\textbf{77.24}	&\textbf{37.46}	&\textbf{65.54} \\
&${\pm0.65}$	&${\pm0.69}$	&${\pm1.12}$	&${\pm3.33}$	&${\pm1.97}$	&${\pm0.97}$	&${\pm1.00}$	&${\pm2.52}$	&${\pm1.31}$	&${\pm1.85}$ \\ \hline

\end{tabular}
\label{table4}
\end{table*}

\begin{table*}[htbp]\small\centering
\caption{FPS results for the all methods on the DDR dataset.}
\begin{tabular}{p{1.2cm}<{\centering}|p{1.5cm}<{\centering}|p{2.2cm}<{\centering}|p{1.5cm}<{\centering}|p{2.4cm}<{\centering}|p{1.9cm}<{\centering}}
  \hline 
Method   &GDRNet & GREEN   & CABNet  & MixupNet &MixStyleNet   \\\hline
FPS        &35.75&36.19&35.45&35.73&35.89  \\       \hline 

Method   &Fishr&Meta-causal&FAGT&CausalMixNet&  \\\hline
FPS        &36.59&36.29& 35.94 &34.39&  \\       \hline  
\end{tabular}
\label{fps}
\end{table*}


\textbf{Adaptability of Real-Time Data.} We assess the frames per second (FPS) on the DDR dataset, as shown in Table \ref{fps}. The FPS results indicate the adaptability of various methods for processing real-time data \cite{vcivzek2017real}.
CausalMixNet achieved an FPS of 34.39, which, while slightly lower than some of the competing methods, demonstrates a commendable level of performance suitable for real-time applications. The overall similarity in FPS among the different methods indicates that they are well-optimized for handling real-time data streams, with only slight variations in processing speed. The CausalMixNet's architecture is designed to enhance causal inference while maintaining efficiency, which can be particularly beneficial in dynamic environments where rapid adjustments and real-time decision-making are essential.

\begin{figure*}[]
	\centering
	\includegraphics[width=13cm]{images/cam.pdf}
	\caption{The visualization analysis on the NIH dataset. Professional doctors have annotated the lesions
in the original images, which are delineated in red for clarity.}
	\label{cam}
\end{figure*}



\subsection{Visualization Analysis}
We perform a visualization analysis of DenseNet121 using Grad-CAM \cite{selvaraju2017grad} on the NIH dataset. As shown in Fig. \ref{cam}, the lesions in the original images are outlined in red by a professional physician. The visualization results demonstrate that the CausalMixNet method is more accurate in lesion localization compared to other methods. In contrast, other approaches either fail to identify the lesions or focus on irrelevant areas, such as the shoulders. This highlights the effectiveness of CausalMixNet in addressing gender bias and improving diagnostic accuracy. By accurately localizing the lesions, CausalMixNet not only enhances the identification rate of pneumothorax cases but also provides more reliable support for clinical decision-making, further emphasizing the importance of selecting appropriate models to tackle gender bias.





\section{Conclusion}
This study presents CausalMixNet as a sophisticated deconfounding method for investigating causality within medical image diagnosis, effectively integrating NLRM, PMRM, QMIA, and KVMIA modules to mitigate the influence of unobservable confounding factors. NLRM is specifically crafted to extract the mediator in front-door adjustment, establishing a causal link from image features to diagnostic labels. PMRM is charged with the identification of lesion and non-lesion patches, refining the focus of the analysis. QMIA enhances the discernment of the mediator by diversifying the query feature and deepening the learning of lesion characteristics. KVMIA applies causal intervention to the mediator by integrating key and value features to compute average causal effects. Empirical evaluation across four datasets in both in-domain and out-of-domain testing scenarios demonstrate that CausalMixNet can be consistently effective, scalable, and reliable in improving image classification accuracy. Additionally, our analysis of gender bias illustrates CausalMixNet's effectiveness in reducing the influence of unobserved confounders.
Through comprehensive experimentation, we have validated the contribution of each individual component within CausalMixNet, the system's resilience in noisy conditions, and its exceptional interpretability. In future work, we aim to extend our framework to tackle both observable and unobservable confounders within multimodal contexts and larger-scale model settings.

\bibliographystyle{elsarticle-num}
\bibliography{cas-refs}

% \begin{thebibliography}{00}

% %% For numbered reference style
% %% \bibitem{label}
% %% Text of bibliographic item

% \bibitem{lamport94}
%   Leslie Lamport,
%   \textit{\LaTeX: a document preparation system},
%   Addison Wesley, Massachusetts,
%   2nd edition,
%   1994.

% \end{thebibliography}
\end{document}

\endinput
%%
%% End of file `elsarticle-template-num.tex'.