# Cross-Domain Feature Augmentation for Domain Generalization

Yingnan Liu1,2 Yingtian Zou1,2 Rui Qiao1 Fusheng Liu2 Mong Li Lee1,2 &Wynne
Hsu1,2
1School of Computing, National University of Singapore
2Institute of Data Science, National University of Singapore
{liu.yingnan, yingtian, rui.qiao<EMAIL_ADDRESS>{leeml,
<EMAIL_ADDRESS>
###### Abstract

Domain generalization aims to develop models that are robust to distribution
shifts. Existing methods focus on learning invariance across domains to
enhance model robustness, and data augmentation has been widely used to learn
invariant predictors, with most methods performing augmentation in the input
space. However, augmentation in the input space has limited diversity whereas
in the feature space is more versatile and has shown promising results.
Nonetheless, feature semantics is seldom considered and existing feature
augmentation methods suffer from a limited variety of augmented features. We
decompose features into class-generic, class-specific, domain-generic, and
domain-specific components. We propose a cross-domain feature augmentation
method named XDomainMix that enables us to increase sample diversity while
emphasizing the learning of invariant representations to achieve domain
generalization. Experiments on widely used benchmark datasets demonstrate that
our proposed method is able to achieve state-of-the-art performance.
Quantitative analysis indicates that our feature augmentation approach
facilitates the learning of effective models that are invariant across
different domains. Our code is available at
https://github.com/NancyQuris/XDomainMix.

##  1 Introduction

Deep learning methods typically assume that training and testing data are
independent and identically distributed. However, this assumption is often
violated in the real world, leading to a decrease in model performance when
faced with a different distribution Torralba and Efros (2011). The field of
domain generalization aims to mitigate this issue by learning a model from one
or more distinct yet related training domains, with the goal of generalizing
effectively to domains that have not been previously encountered. Studies
suggest that the poor generalization on unseen distributions can be attributed
to the failure of learning the invariance across different domains during the
training phase Muandet et al. (2013); Li et al. (2018). To tackle this,
research has focused on representation learning and data augmentation as key
to learning invariance.

Invariant representation learning aims to align representation across domains
Shi et al. (2022), and learn invariant causal predictors Arjovsky et al.
(2019). They usually impose regularization, which may result in a hard
optimization problem Yao et al. (2022a). In contrast, data augmentation
techniques propose to generate additional samples for the learning of
invariance, and avoid the complexities in the regularization approach Mancini
et al. (2020). Data augmentation can be generally classified into two types:
input space and feature space augmentation. The former often encounters
limitations due to a lack of diversity in the augmented data Li et al.
(2021b), while the latter offers more versatility and has yielded promising
outcomes Zhou et al. (2021).

(a) Original

(b) DSU

(c) XDomainMix

Figure 1: Samples of images reconstructed from features produced by DSU Li et
al. (2022) and the proposed XDomainMix. The elephant reconstructed from
XDomainMix’s features shows a more complex background. The horse reconstructed
from XDomainMix’s features displays different characteristics such as a white
belly. The top floor of the house generated by XDomainMix’s features shows
solid walls, instead of glass walls in the original. In contrast, images
reconstructed from DSU’s features have limited diversity and appear largely
similar to the original images.

Despite the versatility of feature space augmentation, existing methods such
as MixStyle Zhou et al. (2021) and DSU Li et al. (2022) do not consider
feature semantics during the augmentation process. Instead, they alter feature
statistics which often leads to a limited range of diversity. This lack of
diversity in the generated features motivates us to decompose the features
according to feature semantics. We build on prior research which suggests that
the features learned for each class can be viewed as a combination of class-
specific and class-generic components Chu et al. (2020). The class-specific
component carries information unique to a class, while the class-generic
component carries information that is shared across classes. We observe that,
even within the same class, features of samples from different domains can be
distinguished, indicating that these features may contain domain-specific
information. As such, we broaden our understanding of features to include
domain-specific and domain-generic components.

We introduce a method called XDomainMix that changes domain-specific
components of a feature while preserving class-specific components. With this,
the model is able to learn features that are not tied to specific domains,
allowing it to make predictions based on features that are invariant across
domains. Figure 1 shows samples of original images and reconstructed images
based on existing feature augmentation technique (DSU) and the proposed
XDomainMix. We visualize the augmented features using a pre-trained
autoencoder Huang and Belongie (2017). From the reconstructed images, we see
that DSU’s augmented features remain largely the same as that of the original
image feature. On the other hand, the images reconstructed from the features
obtained using XDomainMix have richer variety while preserving the salient
features of the class.

Results of experiments on benchmark datasets show the superiority of
XDomainMix for domain generalization. We quantitatively measure the invariance
of learned representation and prediction to show that the models trained with
XDomainMix’s features are more invariant across domains compared to state-of-
the-art feature augmentation methods. Our measurement of the divergence
between original features and augmented features shows that XDomainMix results
in more diverse augmentation.

##  2 Related Work

To learn invariance, existing domain generalization approaches can be
categorized into representation learning methods and data augmentation
methods. Works on learning invariant representation employ regularizers to
align representations or gradients Sun and Saenko (2016); Li et al. (2020);
Kim et al. (2021); Mahajan et al. (2021); Shi et al. (2022); Rame et al.
(2022); Yao et al. (2022b) across different domains, enforce the optimal
classifier on top of the representation space to be the same across all
domains Arjovsky et al. (2019); Ahuja et al. (2021), or uses distributionally
robust optimization Sagawa et al. (2020). However, the use of regularization
terms during learning of invariant representation could make the learning
process more complex and potentially limit the model’s expressive power.

Another approach is to employ data augmentation to learn invariance. Existing
work that operates in the input space includes network-learned transformation
Zhou et al. (2020); Li et al. (2021a), adversarial data augmentation Volpi et
al. (2018); Shankar et al. (2018), mixup Mancini et al. (2020); Yao et al.
(2022a), and Fourier-based transformation Xu et al. (2021). Each of these
techniques manipulates the input data in different ways to create variations
that help the model learn invariant features. However, the range of
transformations that can be applied in the input space is often limited.

On the other hand, feature augmentation can offer more flexibility and
potential for learning more effective invariant representations. Prior work
has generated diverse distributions in the feature space by changing feature
statistics Zhou et al. (2021); Jeon et al. (2021); Wang et al. (2022); Li et
al. (2022); Fan et al. (2023), adding noise Li et al. (2021b), or mixing up
features from different domains Mancini et al. (2020); Qiao and Peng (2021).
For example, MixStyle Zhou et al. (2021) synthesizes new domains by mixing the
feature statistics of two features. DSU Li et al. (2022) extends the idea by
modeling feature statistics as a probability distribution and using new
feature statistics drawn from the distribution to augment features. In
addition to generating diverse distributions, RSC Huang et al. (2020) adopts a
different approach by discarding the most activated features instead of
generating diverse data. This encourages the model to use less-activated
features that might be associated with labels relevant to data outside the
domain.

In contrast to existing methods, our work carefully considers feature
semantics by leveraging class-label information and domain information to
augment features. This increases intra-class variability and helps the model
to learn a broader understanding of each class, thus improving its ability to
handle new, unseen data.

##  3 Proposed Method

Figure 2: Overview of XDomainMix. To perform augmentation, the feature of an
input is decomposed into four components based on the semantics’ correlation
with class and domain. Afterward, features of other two samples from different
domains, one from the same class and one from a different class are used to
augment features by changing domain-specific feature components.

We consider the problem where we have a set of source domains
$\mathcal{D}_{S}=\\{S_{1},\cdots,S_{N}\\}$, $N>1$ and a set of unseen domains
$\mathcal{D}_{U}$. Each source domain
$S_{i}=\\{(x_{j}^{(i)},y_{j}^{(i)})\\}_{j=1}^{n_{i}}$ has a joint distribution
on the input $x$ and the label $y$. Domains in $\mathcal{D}_{U}$ have distinct
joint distributions from those of the domains in $\mathcal{D}_{S}$. We assume
that all domains in $D_{S}$ and $D_{U}$ share the same label space but the
class distribution across domains need not be the same. The goal is to learn a
mapping $g:x\to y$ using the source domains in $\mathcal{D}_{S}$ such that the
error is minimized when $g$ is applied to samples in $\mathcal{D}_{U}$.

In deep learning, $g$ is typically realized as a composition of two functions:
a feature extractor $f:x\to Z$ that maps input $x$ to $Z$ in the latent
feature space, followed by a classifier $c:Z\to y$ that maps $Z$ to the output
label $y$. Ideally, $f$ should extract features that are domain invariant yet
retain class-specific information. The features of a given input can be
decomposed into two components: class-specific and class-generic. The class-
specific component consists of feature semantics that are strongly correlated
with class labels, making them more important in discriminating a target class
from other classes.

Furthermore, features can also be decomposed into domain-specific and domain-
generic components. This is because samples from different domains, even if
they belong to the same class, possess unique feature characteristics to their
respective domains. We extend these notions to decompose the features
extracted by $f$ into four distinct components: class-specific domain-specific
($Z_{c,d}$), class-specific domain-generic ($Z_{c,\neg d}$), class-generic
domain-specific ($Z_{\neg c,d}$), and class-generic domain-generic ($Z_{\neg
c,\neg d}$) component.

We determine whether an extracted feature contains information that is
specific to a class or a domain by its importance to the prediction of the
class and domain respectively. In other words, if a feature is important to
the prediction of a specific class and a specific domain, it is considered a
class-specific domain-specific component. If a feature is crucial in class
prediction but not domain prediction, it falls into the class-specific domain-
generic category. Similarly, features that are important for domain but not
class predictions are categorized as class-generic domain-specific, and those
not significant to either are labeled as class-generic domain-generic.

Our proposed feature augmentation strategy, XDomainMix, performs augmentation
in the feature space by modifying the domain-specific component of features in
a way that preserves class-related information. To discourage the use of
domain-specific features for class prediction and encourage the exploitation
of less activated features, class-specific domain-specific component is
discarded with some probability during training. Details of feature
decomposition and augmentation are described in the following subsections.
Figure 2 shows an overview of our proposed method.

###  3.1 Feature Decomposition

Suppose the feature extractor $f$ extracts $Z=f(x)\in\mathbb{R}^{K}$. Let
$z^{k}$ be the $k^{th}$ dimension of $Z$. We determine whether $z^{k}$ is
class-specific or class-generic via the class importance score, which is
computed as the product of feature value and the derivative of class
classifier $c$’s predicted logit $v_{c}$ of $x$’s ground truth class Selvaraju
et al. (2017); Chu et al. (2020) as they show how much $z^{k}$ contributes to
$v_{c}$:

$\text{class\\_score}(z^{k})=\frac{\partial v_{c}}{\partial z^{k}}z^{k}$ (1)

To determine if $z^{k}$ is domain-specific, we employ a domain classifier $d$
that has an identical architecture as the class classifier $c$. $d$ is trained
to predict domain labels of features extracted by the feature extractor.
Similar to Equation 1, domain importance score is computed using the
derivative of $d$’s predicted logit $v_{d}$ of $x$’s ground truth domain:

$\text{domain\\_score}(z^{k})=\frac{\partial v_{d}}{\partial z^{k}}z^{k}$ (2)

Let $\tau_{c}$ and $\tau_{d}$ be predefined thresholds for filtering feature
dimensions that are class-specific and domain-specific respectively. We obtain
a class-specific mask $M_{c}\in\mathbb{R}^{K}$ and a domain-specific mask
$M_{d}\in\mathbb{R}^{K}$ on $Z$ for $\\{z^{k}\\}_{k=1}^{K}$ where their
respective $k^{th}$ entries are given as follows:

$\begin{split}M_{c}[k]&=\begin{cases}1&\text{if
}\text{class\\_score}(z^{k})>\tau_{c}\\\ 0&\text{otherwise}\end{cases},\\\
M_{d}[k]&=\begin{cases}1&\text{if }\text{domain\\_score}(z^{k})>\tau_{d}\\\
0&\text{otherwise}\end{cases}\end{split}$ (3)

Complementary class-generic mask and domain-generic mask are obtained by
$\mathds{1}-M_{c}$ and $\mathds{1}-M_{d}$ where $\mathds{1}$ is the tensor of
values 1 and of the same size as $Z$. Class-specific domain-specific
($Z_{c,d}$), class-specific domain-generic ($Z_{c,\neg d}$), class-generic
domain-specific ($Z_{\neg c,d}$), and class-generic domain-generic ($Z_{\neg
c,\neg d}$) feature components are obtained by

$\begin{split}Z_{c,d}&=M_{c}\odot M_{d}\odot Z\\\ Z_{c,\neg
d}&=M_{c}\odot(\mathds{1}-M_{d})\odot Z\\\ Z_{\neg
c,d}&=(\mathds{1}-M_{c})\odot M_{d}\odot Z\\\ Z_{\neg c,\neg
d}&=(\mathds{1}-M_{c})\odot(\mathds{1}-M_{d})\odot Z\end{split}$ (4)

where $\odot$ is element-wise multiplication. Note that $Z_{c,d}+Z_{c,\neg
d}+Z_{\neg c,d}+Z_{\neg c,\neg d}=Z$.

###  3.2 Cross Domain Feature Augmentation

To achieve domain invariance and reduce reliance on domain-specific
information presented in training domains during prediction, we manipulate
domain-specific feature components to enhance diversity from a domain
perspective. Further, the augmentation should increase feature diversity while
preserving class semantics using existing data. This is achieved by mixing the
class-specific domain-specific feature component of a sample with the class-
specific domain-specific feature component of a same-class sample from other
domains. For class-generic domain-specific feature component, it is mixed with
the class-generic domain-specific feature component of a different-class
sample from other domains, introducing further diversity.

Specifically, for the feature $Z$ extracted from input $x$, we randomly sample
two inputs $x_{i}$ and $x_{j}$ whose domains are different from $x$. Further,
$x_{i}$ has the same class label as $x$ while $x_{j}$ is from a different
class. Let $Z_{i}$ be the feature extracted from input $x_{i}$ and $Z_{j}$ be
the feature extracted from $x_{j}$. Then we have

$\begin{split}\tilde{Z}_{c,d}&=\lambda_{1}Z_{c,d}+(1-\lambda_{1}){Z_{i}}_{c,d},\\\
\tilde{Z}_{\neg c,d}&=\lambda_{2}Z_{\neg c,d}+(1-\lambda_{2}){Z_{j}}_{\neg
c,d}\end{split}$ (5)

where $\lambda_{1}$ and $\lambda_{2}$ are the mixup ratios independently
sampled from a uniform distribution $U(0,1)$.

A new feature $\tilde{Z}$ with the same class label as $Z$ is generated by
replacing the domain-specific component in $Z$ as follows:

$\tilde{Z}=\tilde{Z}_{c,d}+\tilde{Z}_{\neg c,d}+Z_{c,\neg d}+Z_{\neg c,\neg
d}$ (6)

To further encourage the model to focus on domain-invariant features and
exploit the less activated feature during class prediction, we discard the
class-specific domain-specific feature component with some probability
$p_{\text{discard}}$ as follows:

$\tilde{Z}=\begin{cases}\tilde{Z}_{\neg c,d}+Z_{c,\neg d}+Z_{\neg c,\neg
d}&\text{if }p\leq p_{\text{discard}}\\\ \tilde{Z}_{c,d}+\tilde{Z}_{\neg
c,d}+Z_{c,\neg d}+Z_{\neg c,\neg d}&\text{otherwise}\end{cases}$ (7)

where $p$ is randomly sampled from a uniform distribution $U(0,1)$.

###  3.3 Training Procedure

Prior research has shown that empirical risk minimization (ERM) Vapnik (1999)
is a competitive baseline Gulrajani and Lopez-Paz (2021); Wiles et al. (2022).
The objective function of ERM is given by

$\mathcal{L}_{erm}=\frac{1}{N}\sum_{i=1}^{N}\frac{1}{n_{i}}\sum_{j=1}^{n_{i}}\ell(\hat{y}_{j}^{(i)},y_{j}^{(i)})$
(8)

where $\ell$ is the loss function to measure the error between the predicted
class $\hat{y}_{j}^{(i)}$ and the ground truth $y_{j}^{(i)}$. $N$ is the
number of training domains and $n_{i}$ is the number of training samples in
domain $i$.

We train the model in two phases. During the warm-up phase, the feature
extractor $f$ and class classifier $c$ are trained on the original dataset for
class label prediction following $\mathcal{L}_{erm}$. The domain classifier
$d$ is trained using ${Z}$, the features extracted by $f$, to predict domain
labels. The objective function of $d$ is given by

$\mathcal{L}_{d}=\frac{1}{N}\sum_{i=1}^{N}\frac{1}{n_{i}}\sum_{j=1}^{n_{i}}\ell(d({Z}_{j}^{(i)}),i)$
(9)

where $\ell$ is the loss function to measure the error between the predicted
domain $d({Z}_{j}^{(i)})$ and the ground truth $i$.

When the warm-up phase is completed, we use Equation 4 to decompose the
features obtained from $f$. Augmented features are then derived using Equation
7. Both feature extractor $f$ and class classifier $c$ are trained using the
original and augmented features with the following objective function:

$\begin{split}\mathcal{L}_{aug}=\frac{1}{N}\sum_{i=1}^{N}\frac{1}{2n_{i}}\sum_{j=1}^{n_{i}}\left[\ell(c({Z}_{j}^{(i)}),y_{j}^{(i)})+\ell(c(\tilde{Z}_{j}^{(i)}),y_{j}^{(i)})\right]\end{split}$
(10)

where $\tilde{Z}_{j}^{(i)}$ is the augmented feature derived from
$Z_{j}^{(i)}$. $c({Z}_{j}^{(i)})$ is the predicted class given
${Z}_{j}^{(i)}$, and $c(\tilde{Z}_{j}^{(i)})$ is the predicted class given
$\tilde{Z}_{j}^{(i)}$. $y_{j}^{(i)}$ is the ground truth class.

We also train the domain classifier $d$ using $\mathcal{L}_{d}$. Note that the
domain classifier $d$ is not trained using this set of augmented features, as
the augmented features do not have assigned domain labels since they need not
follow the distribution of existing domains.

##  4 Performance Study

We implement our proposed solution using PyTorch 1.12.0 and perform a series
of experiments on NVIDIA Tesla V100 GPU to evaluate the effectiveness of the
proposed XDomainMix. The following benchmark datasets are used:

  * •

Camelyon17 Bandi et al. (2018) from Wilds Koh et al. (2021). This dataset
contains 455,954 tumor and normal tissue slide images from 5 hospitals
(domains). Distribution shift arises from variations in patient population,
slide staining, and image acquisition.

  * •

FMoW Christie et al. (2018) from Wilds. This dataset contains 141,696
satellite images from 62 land use categories across 16 years from 5 regions
(domains).

  * •

PACS Li et al. (2017). This dataset contains 9,991 images of 7 objects in 4
visual styles (domains): art painting, cartoon, photo, and sketch.

  * •

TerraIncognita Beery et al. (2018). The dataset contains 24,788 images from 10
categories of wild animals taken from 4 different locations (domains).

  * •

DomainNet Peng et al. (2019). This dataset contains 586,575 images from 365
classes in 6 visual styles (domains): clipart, infograph, painting, quickdraw,
real, and sketch.

Method | Camelyon17 | FMoW | PACS | TerraIncognita | DomainNet
---|---|---|---|---|---
ERM | 70.3$\pm$6.4 | 32.3$\pm$1.3 | 85.5$\pm$0.2 | 46.1$\pm$1.8 | 43.8$\pm$0.1
GroupDRO | 68.4$\pm$7.3 | 30.8$\pm$0.8 | 84.4$\pm$0.8 | 43.2$\pm$1.1 | 33.3$\pm$0.2
RSC | 77.0$\pm$4.9^ | 32.6$\pm$0.5^ | 85.2$\pm$0.9 | 46.6$\pm$1.0 | 38.9$\pm$0.5
MixStyle | 62.6$\pm$6.3^ | 32.9$\pm$0.5^ | 85.2$\pm$0.3 | 44.0$\pm$0.7 | 34.0$\pm$0.1
DSU | 69.6$\pm$6.3^ | 32.5$\pm$0.6^ | 85.5$\pm$0.6^ | 41.5$\pm$0.9^ | 42.6$\pm$0.2^
LISA | 77.1$\pm$6.5 | 35.5$\pm$0.7 | 83.1$\pm$0.2^ | 47.2$\pm$1.1^ | 42.3$\pm$0.3^
Fish | 74.7$\pm$7.1 | 34.6$\pm$0.2 | 85.5$\pm$0.3 | 45.1$\pm$1.3 | 42.7$\pm$0.2
XDomainMix | 80.9$\pm$3.2 | 35.9$\pm$0.8 | 86.4$\pm$0.4 | 48.2$\pm$1.3 | 44.0$\pm$0.2
Table 1: Domain generalization performance of XDomainMix compared with state-
of-the-art methods performance published in Yao et al. (2022a); Gulrajani and
Lopez-Paz (2021); Cha et al. (2021). Results with ^ are produced by us.

The class importance thresholds $\tau_{c}$ and domain importance thresholds
$\tau_{d}$ in Equation 3 are set as follows: $\tau_{c}$ is set to be the
50%-quantile of the class importance scores of $\\{z^{k}\\}$ in a feature $Z$
so that 50% dimensions are considered class-specific, while the remaining 50%
are class-generic. $\tau_{d}$ controls the strength of the augmentation as it
determines the identification of domain-specific feature components. We employ
a cyclic changing scheme for $\tau_{d}$ to let the model learn gradually from
weak augmentation to strong augmentation and give the domain classifier more
time to adapt to a more domain-invariant feature extractor. The value is
initially set to be 90%-quantile of domain importance scores of $\\{z^{k}\\}$
in a feature $Z$. As the training proceeds, $\tau_{d}$ is decreased by 10%
quantile for every $n$ step until it reaches the 50%-quantile, where it also
remains for $n$ steps. The same cycle is repeated where $\tau_{d}$ is set to
be 90%-quantile again. Input $x_{i},x_{j}$ used in augmentation (Equation 5)
are samples from the same training batch. $p_{\text{discard}}$ is set to 0.2.

For Camelyon17 and FMoW datasets, we follow the setup in LISA Yao et al.
(2022a). Non-pretrained DenseNet-121 is used for Canmelyon17 and pretrained
DenseNet-121 is used for FMoW. We use the same partitioning in Wilds Koh et
al. (2021) to obtain the training, validation, and test domains. The batch
size is set to 32, and the model is trained for 2 epochs for Camelyon17 and 5
epochs for FMoW. The learning rate and weight decay are set to 1e-4 and 0. The
warm-up phase is set to 4000 steps. We tune the step $n$ in $\\{100,500\\}$
for changing $\tau_{d}$. The best model is selected based on its performance
in the validation domain.

For PACS, TerraIncognita and DomainNet datasets, we follow the setup in
DomainBed Gulrajani and Lopez-Paz (2021), and use a pre-trained ResNet-50.
Each domain in the dataset is used as a test domain in turn, with the
remaining domains serving as training domains. The batch size is set to 32 (24
for DomainNet), and the model is trained for 5000 steps (15000 steps for
DomainNet). We tune the learning rate in {2e-5, 3e-5, 4e-5, 5e-5, 6e-5} and
weight decay in (1e-6, 1e-2) using the DomainBed framework. The warm-up phase
is set to 3000 steps and $n$ is set to 100 steps. The best model is selected
based on its performance on the validations split of the training domains.

###  4.1 Domain Generalization Performance

We compare our proposed XDomainMix with ERM Vapnik (1999) and the following
state-of-the-art methods:

  * •

GroupDRO Sagawa et al. (2020) minimizes worst-case loss for distributionally
robust optimization.

  * •

RSC Huang et al. (2020) discards features that have higher activation to
activate the remaining features appear to be applicable to out-of-domain data.

  * •

MixStyle Zhou et al. (2021) synthesizes new domains by mixing feature
statistics of two features.

  * •

DSU Li et al. (2022) synthesizes new domains by re-normalizing feature
statistics of features with the ones drawn from a probability distribution.

  * •

LISA Yao et al. (2022a) selectively mixes up samples to learn an invariant
predictor.

  * •

Fish Shi et al. (2022) aligns gradients across domains by maximizing the
gradient inner product.

Classification accuracy, which is the ratio of the number of correct
predictions to the total number of samples is reported. Following the
instruction of datasets, average accuracy on the test domain over 10 runs is
reported for the Camelyon17 dataset; worst-group accuracy on the test domain
over 3 runs is reported for the FMoW dataset. For PACS, TerraIncognita and
DomainNet datasets, the averaged accuracy of the test domains over 3 runs is
reported.

Table 1 shows the results. Our method consistently achieves the highest
average accuracy across all the datasets, outperforming SOTA methods. This
result suggests that XDomainMix is able to train models with good domain
generalization ability.

Method | Camelyon17 | FMoW | PACS | TerraIncognita | DomainNet
---|---|---|---|---|---
ERM | 0.47$\pm$0.18 | 0.35$\pm$0.09 | 0.69$\pm$0.12 | 0.50$\pm$0.09 | 3.60$\pm$0.38
GroupDRO | 0.21$\pm$0.02 | 0.40$\pm$0.04 | 0.77$\pm$0.16 | 0.43$\pm$0.05 | 2.13$\pm$0.09
RSC | 0.32$\pm$0.17 | 0.55$\pm$0.14 | 42.3$\pm$12.8 | 29.9$\pm$3.02 | 17.3$\pm$1.43
MixStyle | 0.28$\pm$0.26 | 0.36$\pm$0.05 | 0.69$\pm$0.03 | 0.38$\pm$0.09 | 3.39$\pm$0.17
DSU | 0.07$\pm$0.02 | 0.32$\pm$0.02 | 0.33$\pm$0.04 | 9.18$\pm$1.84 | 4.61$\pm$0.24
LISA | 0.19$\pm$0.05 | 0.29$\pm$0.05 | 0.04$\pm$0.00 | 0.13$\pm$0.01 | 0.72$\pm$ 0.06
Fish | 3.95$\pm$3.28 | 0.47$\pm$0.02 | 0.64$\pm$0.34 | 0.34$\pm$0.04 | 2.60$\pm$0.26
XDomainMix | 0.19$\pm$0.07 | 0.28$\pm$0.01 | 0.02$\pm$0.00 | 0.04$\pm$0.00 | 0.11$\pm$0.02
(a) Representation invariance measured by distance of covariance matrix of
same class representations across domains.

Method | Camelyon17 | FMoW | PACS | TerraIncognita | DomainNet
---|---|---|---|---|---
ERM | 1.55$\pm$0.27 | 139$\pm$50.0 | 9.89$\pm$2.09 | 12.7$\pm$2.6 | 553$\pm$26.5
GroupDRO | 0.93$\pm$0.11 | 161$\pm$171 | 398$\pm$65.1 | 603$\pm$22.3 | 668$\pm$17.9
RSC | 1.90$\pm$0.50 | 181$\pm$70.8 | 6.34$\pm$0.91 | 10.3$\pm$3.6 | 631$\pm$7.06
MixStyle | 1.67$\pm$0.91 | 110$\pm$88.9 | 6.51$\pm$1.20 | 9.10$\pm$0.56 | 563$\pm$4.68
DSU | 3.85$\pm$1.30 | 237$\pm$136 | 16.2$\pm$5.24 | 10.6$\pm$1.5 | 567$\pm$21.1
LISA | 1.81$\pm$1.14 | 111$\pm$15.2 | 3.02$\pm$0.47 | 9.39$\pm$0.51 | 520$\pm$11.9
Fish | 5.68$\pm$1.81 | 251$\pm$45.3 | 9.08$\pm$5.38 | 9.37$\pm$1.59 | 567$\pm$13.2
XDomainMix | 0.90$\pm$0.28 | 109$\pm$11.7 | 2.10$\pm$0.21 | 8.22$\pm$1.05 | 504$\pm$15.8
(b) Prediction invariance measured by variance of risk across domains. The
results are reported in the unit of 1e-3.

Table 2: Results of model invariance. Method | Camelyon17 | FMoW | PACS | TerraIncognita | DomainNet
---|---|---|---|---|---
MixStyle | 6.65$\pm$0.18 | 8.58$\pm$0.50 | 3.11$\pm$0.34 | 3.20$\pm$0.26 | 2.81$\pm$0.11
DSU | 26.77$\pm$2.53 | 20.93$\pm$1.87 | 6.97$\pm$0.03 | 10.85$\pm$0.32 | 5.75$\pm$0.01
XDomainMix | 38.82$\pm$0.28 | 34.06$\pm$0.11 | 14.82$\pm$0.11 | 14.36$\pm$0.12 | 10.27$\pm$0.02
Table 3: Divergence of the augmented feature and original feature measured by
MMD in the unit of 1e-2.

###  4.2 Model Invariance

One advantage of XDomainMix is that is able to learn invariance across
training domains. We quantify the invariance in terms of representation
invariance and predictions invariance. Representation invariance refers to the
disparity between representations of the same class across different domains.
The distance between second-order statistics (covariances) Sun and Saenko
(2016) can be used to measure representation invariance. Prediction invariance
considers the variation in predictions across different domains. We employ
risk variance Yao et al. (2022a) which measures how similar the model performs
across domains.

Let $\\{Z^{(i)}_{j}|y^{(i)}_{j}=y_{c}\\}$ be the set of representations of
class label $y_{c}$ from domain $i$. We use $C^{(i)}_{y_{c}}$ to denote the
covariance matrix of the representations. Given the set of class labels
$\mathcal{Y}$ and the set of training domains $\mathcal{D}_{S}$, the
measurement result is given by
$\frac{1}{|\mathcal{Y}||\mathcal{D}_{S}|}\sum_{y_{c}\in\mathcal{Y}}\sum_{i,i^{\prime}\in\mathcal{D}_{S}}||C^{(i)}_{y_{c}}-C^{(i^{\prime})}_{y_{c}}||^{2}_{F}$.
$||\cdot||^{2}_{F}$ denotes the squared matrix Frobenius norm. A smaller
distance suggests that same-class representations across domains are more
similar.

Let $R^{i}$ be the loss in predicting the class labels of inputs from domain
$i$. The risk variance is given by the variance among training domains,
$\text{Var}\\{R^{1},R^{2},...,R^{|\mathcal{D}_{S}|}\\}$. Lower risk variance
suggests a more consistent model performance across domains.

Table 2 shows the results. We see that our method has the smallest covariance
distance in the FMoW, PACS, TerraIncognita, and DomainNet dataset, and the
second-smallest in the Camelyon17 dataset. The results indicate that the
representations of the same class learned by our method have the least
divergence across domains. Additionally, XDomainMix has the lowest risk
variance, suggesting that it is able to maintain consistent performance in
predictions across domains. Overall, the results demonstrate that our approach
is able to learn invariance at both the representation level and the
prediction level.

###  4.3 Diversity of Augmented Features

To show that XDomainMix can generate more diverse features, we measure the
distance between the original and augmented features using maximum mean
discrepancy (MMD). A higher MMD suggests that the distance between the
original and augmented features is further. The same set of original features
is used to ensure fairness and comparability of the measurement result.
Average and standard deviation over three runs are reported. Table 3 shows the
results. Features augmented by XDomainMix consistently have the highest MMD
compared to MixStyle and DSU which are two SOTA feature augmentation methods.
This suggests that the features augmented by XDomainMix exhibit the most
deviation from the original features, leading to a more varied augmentation.
Visualization of sample images reconstructed from augmented features are given
in Supplementary.

###  4.4 Experiments on the Identified Features

In this set of experiments, we demonstrate that XDomainMix is able to identify
features that are important for class and domain prediction. We evaluate the
model performance for class or domain prediction after eliminating those
features with the highest importance score computed in Equations 1 and 2. A
decrease in accuracy suggests that the features that have been removed are
important for the predictions.

For comparison, we implement two alternative selection strategies: a random
method that arbitrarily selects features to remove, and a gradient norm
approach, where features are chosen for removal based on the magnitude of the
gradient in the importance score computation. Samples in the validation set of
PACS dataset are used in this experiment.

Figure 3 shows the results. Our method shows the largest drop in both class
prediction and domain prediction accuracies compared to random removal and
gradient norm methods. This indicates that XDomainMix is able to identify
features that are specific to the domain and class effectively.

Figure 3: Prediction accuracy after removing x% of features with the highest
importance scores.

(a) Class-related features

(b) Domain-related features

Figure 4: Visualization of features from different classes/domains, indicated
by the different colors.

To visualize the extracted features, we map the high dimensional feature
vectors obtained by $f$ to a lower dimensional space, This transformation is
carried out using two linear layers, as described in Zhang et al. (2021).
Figure 4(a) provides a visualization for the model that is trained on the PACS
dataset, with Art as the unseen domain. We see that the features identified as
class-specific are well separated by class. This is in contrast to the
features that are generic across classes, which are not as clearly delineated.

Similarly, we also visualize the extracted domain-specific and domain-
invariant features. As shown in Figure 4(b), the domain-specific features are
noticeably better separated compared to the domain-invariant features.

###  4.5 Ablation Study

To understand the contribution of each component in the augmentation, we
perform ablation studies on Camelyon17 and FMoW datasets. Table 4 shows the
result. Compared to the baseline, mixing class-specific domain-specific
feature components ($Z_{c,d}$) only, or mixing class-generic domain-specific
feature components ($Z_{\neg c,d}$) only in the augmentation can improve the
performance. This suggests that by manipulating domain-specific feature
components, models that are better at domain generalization can be learned.
Mixing $Z_{\neg c,d}$ leads to greater improvement, indicating that enriching
diversity by content from other classes is more helpful than simply intra-
class augmentation.

Augmenting both $Z_{c,d}$ and $Z_{\neg c,d}$ does not consistently lead to
performance improvement, possibly due to dataset-specific characteristics.
Probabilistically discarding $Z_{c,d}$ seems to encourage the model to use
less domain-specific information and exploit less activated features in
prediction, which improves the domain generalization performance.

mix | mix | discard | Camelyon17 | FMoW
---|---|---|---|---
$Z_{c,d}$ | $Z_{\neg c,d}$ | $Z_{c,d}$ |  |
| 70.3$\pm$6.4 | 32.3$\pm$1.3
$\checkmark$ |  |  | 78.3$\pm$5.5 | 32.9$\pm$2.2
| $\checkmark$ |  | 79.1$\pm$6.0 | 33.6$\pm$1.1
$\checkmark$ | $\checkmark$ |  | 79.6$\pm$7.0 | 31.9$\pm$0.4
$\checkmark$ | $\checkmark$ | $\checkmark$ | 80.9$\pm$3.2 | 35.9$\pm$0.8
Table 4: Ablation study.

##  5 Conclusion and Future Work

In this work, we have developed a feature augmentation method to address the
domain generalization problem. Our approach aims to enhance data diversity
within the feature space for learning models that are invariant across domains
by mixing domain-specific components of features from different domains while
retaining class-related information. We have also probabilistically discarded
domain-specific features to discourage the model from using such features for
their predictions, thereby achieving good domain generalization performance.
Our experiments on multiple datasets demonstrate the effectiveness of the
proposed method.

While our method presents a promising approach to solving the domain
generalization problem, there are several limitations. Our method needs more
than one training domain to perform cross-domain feature augmentation. Our
method assumes that the datasets across different domains share the same label
space and similar class distributions, and its performance may be affected if
this is not the case. Our method is mainly empirically validated, and a
theoretical analysis or guarantee of its performance is still lacking. Further
research is needed to provide a deeper theoretical understanding of the
proposed method and its performance bounds.

## Acknowledgements

This research/project is supported by the National Research Foundation,
Singapore under its AI Singapore Programme (AISG Award No: AISG-
GC-2019-001-2B). We thank Dr Wenjie Feng for the helpful discussions.

## References

  * Ahuja et al. [2021] Kartik Ahuja, Ethan Caballero, Dinghuai Zhang, Jean-Christophe Gagnon-Audet, Yoshua Bengio, Ioannis Mitliagkas, and Irina Rish.  Invariance principle meets information bottleneck for out-of-distribution generalization.  Advances in Neural Information Processing Systems, 34:3438–3450, 2021.
  * Arjovsky et al. [2019] Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz.  Invariant risk minimization.  arXiv preprint arXiv:1907.02893, 2019.
  * Bandi et al. [2018] Peter Bandi, Oscar Geessink, Quirine Manson, Marcory Van Dijk, Maschenka Balkenhol, Meyke Hermsen, Babak Ehteshami Bejnordi, Byungjae Lee, Kyunghyun Paeng, Aoxiao Zhong, et al.  From detection of individual metastases to classification of lymph node status at the patient level: the camelyon17 challenge.  IEEE Transactions on Medical Imaging, 2018.
  * Beery et al. [2018] Sara Beery, Grant Van Horn, and Pietro Perona.  Recognition in terra incognita.  In Proceedings of the European conference on computer vision (ECCV), pages 456–473, 2018.
  * Cha et al. [2021] Junbum Cha, Sanghyuk Chun, Kyungjae Lee, Han-Cheol Cho, Seunghyun Park, Yunsung Lee, and Sungrae Park.  Swad: Domain generalization by seeking flat minima.  Advances in Neural Information Processing Systems, 34:22405–22418, 2021.
  * Christie et al. [2018] Gordon Christie, Neil Fendley, James Wilson, and Ryan Mukherjee.  Functional map of the world.  In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2018.
  * Chu et al. [2020] Peng Chu, Xiao Bian, Shaopeng Liu, and Haibin Ling.  Feature space augmentation for long-tailed data.  In European Conference on Computer Vision, pages 694–710. Springer, 2020.
  * Dosovitskiy et al. [2020] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al.  An image is worth 16x16 words: Transformers for image recognition at scale.  arXiv preprint arXiv:2010.11929, 2020.
  * Fan et al. [2023] Qi Fan, Mattia Segu, Yu-Wing Tai, Fisher Yu, Chi-Keung Tang, Bernt Schiele, and Dengxin Dai.  Towards robust object detection invariant to real-world domain shifts.  In The Eleventh International Conference on Learning Representations, 2023.
  * Fang et al. [2013] Chen Fang, Ye Xu, and Daniel N Rockmore.  Unbiased metric learning: On the utilization of multiple datasets and web images for softening bias.  In Proceedings of the IEEE International Conference on Computer Vision, pages 1657–1664, 2013.
  * Foret et al. [2021] Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur.  Sharpness-aware minimization for efficiently improving generalization.  In International Conference on Learning Representations, 2021.
  * Gulrajani and Lopez-Paz [2021] Ishaan Gulrajani and David Lopez-Paz.  In search of lost domain generalization.  In International Conference on Learning Representations, 2021.
  * Huang and Belongie [2017] Xun Huang and Serge Belongie.  Arbitrary style transfer in real-time with adaptive instance normalization.  In Proceedings of the IEEE International Conference on Computer Vision (ICCV), Oct 2017.
  * Huang et al. [2020] Zeyi Huang, Haohan Wang, Eric P Xing, and Dong Huang.  Self-challenging improves cross-domain generalization.  In European Conference on Computer Vision, pages 124–140. Springer, 2020.
  * Jeon et al. [2021] Seogkyu Jeon, Kibeom Hong, Pilhyeon Lee, Jewook Lee, and Hyeran Byun.  Feature stylization and domain-aware contrastive learning for domain generalization.  In Proceedings of the 29th ACM International Conference on Multimedia, pages 22–31, 2021.
  * Kim et al. [2021] Daehee Kim, Youngjun Yoo, Seunghyun Park, Jinkyu Kim, and Jaekoo Lee.  Selfreg: Self-supervised contrastive regularization for domain generalization.  In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9619–9628, 2021.
  * Koh et al. [2021] Pang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, et al.  Wilds: A benchmark of in-the-wild distribution shifts.  In International Conference on Machine Learning, pages 5637–5664. PMLR, 2021.
  * Li et al. [2017] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales.  Deeper, broader and artier domain generalization.  In Proceedings of the IEEE international conference on computer vision, pages 5542–5550, 2017.
  * Li et al. [2018] Ya Li, Mingming Gong, Xinmei Tian, Tongliang Liu, and Dacheng Tao.  Domain generalization via conditional invariant representations.  In Proceedings of the AAAI conference on artificial intelligence, volume 32, number 1, 2018.
  * Li et al. [2020] Haoliang Li, YuFei Wang, Renjie Wan, Shiqi Wang, Tie-Qiang Li, and Alex Kot.  Domain generalization for medical imaging classification with linear-dependency regularization.  Advances in neural information processing systems, 33:3118–3129, 2020.
  * Li et al. [2021a] Lei Li, Ke Gao, Juan Cao, Ziyao Huang, Yepeng Weng, Xiaoyue Mi, Zhengze Yu, Xiaoya Li, and Boyang Xia.  Progressive domain expansion network for single domain generalization.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 224–233, 2021.
  * Li et al. [2021b] Pan Li, Da Li, Wei Li, Shaogang Gong, Yanwei Fu, and Timothy M Hospedales.  A simple feature augmentation for domain generalization.  In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 8886–8895, 2021.
  * Li et al. [2022] Xiaotong Li, Yongxing Dai, Yixiao Ge, Jun Liu, Ying Shan, and LINGYU DUAN.  Uncertainty modeling for out-of-distribution generalization.  In International Conference on Learning Representations, 2022.
  * Mahajan et al. [2021] Divyat Mahajan, Shruti Tople, and Amit Sharma.  Domain generalization using causal matching.  In International Conference on Machine Learning, pages 7313–7324. PMLR, 2021.
  * Mancini et al. [2020] Massimiliano Mancini, Zeynep Akata, Elisa Ricci, and Barbara Caputo.  Towards recognizing unseen categories in unseen domains.  In European Conference on Computer Vision, pages 466–483. Springer, 2020.
  * Muandet et al. [2013] Krikamol Muandet, David Balduzzi, and Bernhard Schölkopf.  Domain generalization via invariant feature representation.  In International Conference on Machine Learning, pages 10–18. PMLR, 2013.
  * Peng et al. [2019] Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang.  Moment matching for multi-source domain adaptation.  In Proceedings of the IEEE International Conference on Computer Vision, pages 1406–1415, 2019.
  * Qiao and Peng [2021] Fengchun Qiao and Xi Peng.  Uncertainty-guided model generalization to unseen domains.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6790–6800, 2021.
  * Radford et al. [2021] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al.  Learning transferable visual models from natural language supervision.  In International conference on machine learning, pages 8748–8763. PMLR, 2021.
  * Rame et al. [2022] Alexandre Rame, Corentin Dancette, and Matthieu Cord.  Fishr: Invariant gradient variances for out-of-distribution generalization.  In International Conference on Machine Learning, pages 18347–18377. PMLR, 2022.
  * Sagawa et al. [2020] Shiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, and Percy Liang.  Distributionally robust neural networks.  In International Conference on Learning Representations, 2020.
  * Selvaraju et al. [2017] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra.  Grad-cam: Visual explanations from deep networks via gradient-based localization.  In Proceedings of the IEEE international conference on computer vision, pages 618–626, 2017.
  * Shankar et al. [2018] Shiv Shankar, Vihari Piratla, Soumen Chakrabarti, Siddhartha Chaudhuri, Preethi Jyothi, and Sunita Sarawagi.  Generalizing across domains via cross-gradient training.  arXiv preprint arXiv:1804.10745, 2018.
  * Shi et al. [2022] Yuge Shi, Jeffrey Seely, Philip Torr, Siddharth N, Awni Hannun, Nicolas Usunier, and Gabriel Synnaeve.  Gradient matching for domain generalization.  In International Conference on Learning Representations, 2022.
  * Sun and Saenko [2016] Baochen Sun and Kate Saenko.  Deep coral: Correlation alignment for deep domain adaptation.  In European conference on computer vision, pages 443–450. Springer, 2016.
  * Torralba and Efros [2011] Antonio Torralba and Alexei A Efros.  Unbiased look at dataset bias.  In CVPR 2011, pages 1521–1528. IEEE, 2011.
  * Vapnik [1999] Vladimir Vapnik.  The nature of statistical learning theory.  Springer science & business media, 1999.
  * Venkateswara et al. [2017] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan.  Deep hashing network for unsupervised domain adaptation.  In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5018–5027, 2017.
  * Volpi et al. [2018] Riccardo Volpi, Hongseok Namkoong, Ozan Sener, John C Duchi, Vittorio Murino, and Silvio Savarese.  Generalizing to unseen domains via adversarial data augmentation.  Advances in neural information processing systems, 31, 2018.
  * Wang et al. [2022] Yue Wang, Lei Qi, Yinghuan Shi, and Yang Gao.  Feature-based style randomization for domain generalization.  IEEE Transactions on Circuits and Systems for Video Technology, 2022.
  * Wang et al. [2023] Pengfei Wang, Zhaoxiang Zhang, Zhen Lei, and Lei Zhang.  Sharpness-aware gradient matching for domain generalization.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3769–3778, 2023.
  * Wiles et al. [2022] Olivia Wiles, Sven Gowal, Florian Stimberg, Sylvestre-Alvise Rebuffi, Ira Ktena, Krishnamurthy Dj Dvijotham, and Ali Taylan Cemgil.  A fine-grained analysis on distribution shift.  In International Conference on Learning Representations, 2022.
  * Xu et al. [2021] Qinwei Xu, Ruipeng Zhang, Ya Zhang, Yanfeng Wang, and Qi Tian.  A fourier-based framework for domain generalization.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14383–14392, 2021.
  * Yao et al. [2022a] Huaxiu Yao, Yu Wang, Sai Li, Linjun Zhang, Weixin Liang, James Zou, and Chelsea Finn.  Improving out-of-distribution robustness via selective augmentation.  In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato, editors, Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 25407–25437. PMLR, 17–23 Jul 2022.
  * Yao et al. [2022b] Xufeng Yao, Yang Bai, Xinyun Zhang, Yuechen Zhang, Qi Sun, Ran Chen, Ruiyu Li, and Bei Yu.  Pcl: Proxy-based contrastive learning for domain generalization.  In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7097–7107, 2022.
  * Zhang et al. [2021] Yifan Zhang, Bryan Hooi, Dapeng Hu, Jian Liang, and Jiashi Feng.  Unleashing the power of contrastive self-supervised visual models via contrast-regularized fine-tuning.  In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021.
  * Zhou et al. [2020] Kaiyang Zhou, Yongxin Yang, Timothy Hospedales, and Tao Xiang.  Learning to generate novel domains for domain generalization.  In European conference on computer vision, pages 561–578. Springer, 2020.
  * Zhou et al. [2021] Kaiyang Zhou, Yongxin Yang, Yu Qiao, and Tao Xiang.  Domain generalization with mixstyle.  In International Conference on Learning Representations, 2021.

##  Appendix A Comparison with Sharpness-aware Methods

Apart from learning invariance across domains, learning a flat minimum is
another approach to improve domain generalization, as recent work suggests
that flat minima bring better generalization than sharp minima. As a result,
several domain generalization works seek flat minima by optimization that
leads to flatter loss landscapes.

Here we compare the performance of XDomainMix with two sharpness-aware
methods:

  * •

SAM Foret et al. [2021] seeks parameters that lie in neighborhoods that have
uniformly low loss.

  * •

SAGM Wang et al. [2023] aligns the gradient direction between the SAM loss and
the empirical risk.

The results are shown in Table 5. We follow the same experiment and reporting
protocol as that in Table 1. XDomainMix outperforms SAM and SAGM on Camelyon17
and FMoW datasets. On the PACS and TerraIncognita datasets, XDomainMix comes
as a close second to SAGM. The result is expected as the superiority of
considering sharpness in domain generalization has been empirically
demonstrated.

It is worth mentioning that sharpness-aware methods can be easily incorporated
into XDomainMix to learn a flatter minimum. We see that XDomainMix+SAM
achieves better performance on Camelyon17, FMoW, PACS, and DomainNet datasets,
indicating that incorporating sharpness-related strategies can further boost
the performance of XDomainMix.

Method | Camelyon17 | FMoW | PACS | TerraIncognita | DomainNet
---|---|---|---|---|---
SAM | 75.8$\pm$5.9 | 35.4$\pm$1.4 | 85.8$\pm$0.2 | 43.3$\pm$0.7 | 44.3$\pm$0.0
SAGM | 80.0$\pm$2.9 | 31.0$\pm$1.6 | 86.6$\pm$0.2 | 48.8$\pm$0.9 | 45.0$\pm$0.2
XDomainMix | 80.9$\pm$3.2 | 35.9$\pm$0.8 | 86.4$\pm$0.4 | 48.2$\pm$1.3 | 44.0$\pm$0.2
XDomainMix+SAM | 81.4$\pm$3.1 | 36.1$\pm$1.3 | 86.7$\pm$0.4 | 44.4$\pm$0.4 | 45.1$\pm$0.1
Table 5: Domain generalization performance of XDomainMix compared with
sharpness-aware methods.

##  Appendix B Additional Results on Experiments of the Identified Features

We present the results of eliminating features with the highest importance
score computed in Equations 1 and 2 on other datasets in Figure 5. As that we
see on the PACS dataset, XDomainMix outperforms random selection and gradient
norm methods by exhibiting the most significant decline in both class and
domain prediction accuracies on other datasets. This highlights its effective
identification of class and domain-specific features.

(a) Camelyon17

(b) FMoW

(c) TerraIncognita

(d) DomainNet

Figure 5: Prediction accuracy after removing x% of features with the highest
importance scores on additional datasets.

##  Appendix C Scalability

Large-scale foundation models have emerged as a prominent trend. XDomainMix
can be applied to any model architecture that allows for the decomposition of
its features, including larger and more complex models like Vision Transformer
Dosovitskiy et al. [2020]. We applied the ViT-B/16 CLIP model Radford et al.
[2021] to XDomainMix by using its image encoder to extract features and fine-
tuning the classifier. Feature augmentation is performed on the features
extracted by the image encoder.

We compared with CLIP’s zero-shot prediction and ERM fine-tuning of the
classifier. We use the prompt template “a photo of a {class name}” for zero-
shot prediction. For ERM and XDomainMix fine-tuning, the image encoder is
frozen, and only the classifier is updated. We follow the same experiment and
reporting protocol as that in Table 1 for finetuning. Table 6 shows the
result. On the Camelyon17 dataset, CLIP’s zero-shot prediction achieves fair
performance. Finetuning the classifier further improves the performance, and
XDomainMix gives better result than ERM. On the FMoW dataset, XDomainMix
finetuning gives the best performance. CLIP’s subpar zero-shot prediction
suggests that the image encoder may not be optimal for FMoW. While finetuning
enhances performance, it falls short of achieving the levels seen in Table 1.

Method | Camelyon17 | FMoW
---|---|---
zero-shot | 68.2 | 12.9
ERM | 86.4$\pm$0.3 | 26.6$\pm$0.4
XDomainMix | 86.6$\pm$0.3 | 26.9$\pm$0.2
Table 6: Domain generalization performance with ViTB/16 CLIP.

##  Appendix D Visualization of Augmented Features

We visualize the augmented features by employing a pre-trained autoencoder
Huang and Belongie [2017] 111Weights are from
https://github.com/naoto0804/pytorch-AdaIN. to map these features back in the
input space. Figure 6 shows the reconstructed images using both the original
and augmented features generated from the Camelyon17 dataset.

Cell nuclei and the general structural features of the tissue are highlighted
by the stain. In general, tumor cells are larger than normal cells Bandi et
al. [2018]. For both classes, XDomainMix is able to generate augmented
features with greater diversity, while DSU’s augmented features show only
limited differences. In addition, XDomainMix also preserves class semantics as
no large cells are included in the generated results for the normal class.
This demonstrates the effectiveness of using XDomainMix for diverse feature
augmentation.

Original

DSU

XDomainMix

(a) Normal tissues

Original

DSU

XDomainMix

(b) Tumor tissues

Figure 6: Visualization of images reconstructed using augmented features
obtained from DSU and XDomainMix. Features from XDomainMix result in samples
that are more diverse than DSU method.

Additionally, we also visualize the XDomainMix augmented features in a lower
dimensional space (see Figure 7). The augmented features clearly lie in the
same cluster formed by the original features of their respective classes,
indicating that XDomainMix is able to preserve class-specific information.

Figure 7: Visualization of original and augmented features.

##  Appendix E Alternative Design of XDomainMix

#### Sample selection in the interpolation of class-generic domain-specific
Feature Component

To augment the feature $Z$ extracted from input $x$, we randomly sample two
inputs $x_{i}$ and $x_{j}$ whose domains are different from $x$. $x_{i}$ has
the same class label as $x$ and is used to interpolate $Z_{c,d}$. $x_{j}$ is
from a different class and is used to interpolate $Z_{\neg c,d}$. We select
$x_{j}$ from a different class and a different domain so that the augmented
feature has greater diversity, compared to samples from the same class or
domain.

We compare the maximum mean discrepancy (MMD) between the original and
augmented features on the Camelyon17 dataset when different $x_{j}$ selection
strategies are used in the interpolation of $Z_{\neg c,d}$. A higher MMD
suggests that the features are more diverged. Table 7 shows the result. When
same-class or same-domain inputs are sampled, the augmented features always
have a lower divergence. Selecting samples from different classes and
different domains results in the highest MMD, which implies the greatest
diversity.

Sample used | MMD (1e-2)
---|---
same as $x_{i}$ | 35.94$\pm$0.11
same class different domain (not $x_{i}$) | 36.00$\pm$0.03
different class same domain | 38.24$\pm$0.23
different class different domain | 38.82$\pm$0.28
Table 7: Feature divergence of different sample selection in the augmentation
of $Z_{\neg c,d}$ on Camelyon17 dataset

#### Training domain classifier with augmented features

We performed an experiment to train the domain classifier with and without
augmented features when $Z_{c,d}$ is not discarded.

We give each augmented feature $\tilde{Z}$ a soft domain label. Suppose $N$
domains are present in training. the original feature $Z$ is from domain $d$.
$Z_{i}$ is from domain $d_{i}$ and $Z_{j}$ is from domain $d_{j}$. The ratio
to interpolate $Z_{c,d}$ with $Z_{i_{c,d}}$ is $\lambda_{1}$, and the ratio to
interpolate $Z_{\neg c,d}$ with $Z_{j_{c,d}}$ is $\lambda_{2}$. The domain
label of $\tilde{Z}$, $\tilde{d}\in\mathbb{R}^{N}$ at position $d$ is
$\frac{\lambda_{1}+\lambda_{2}}{2}$. The value of $\tilde{d}$ at position
$d_{i}$ is $\frac{1-\lambda_{1}}{2}$, and at position $d_{j}$ is
$\frac{1-\lambda_{2}}{2}$. Other positions are set to 0. Binary cross-entropy
loss is used in the training.

Table 8 shows the results on the Camelyon17 dataset. Classification accuracy
on the test domain is reported. It suggests that training the domain
classifier with augmented features could harm the domain generalization
performance. Augmented features may not follow the distribution of existing
domains.

Training domain classifier | Test domain accuracy
---|---
with aug features | 77.4$\pm$7.1
without aug features | 79.6$\pm$7.0
Table 8: Training domain classifier with and without augmented features on the
Camelyon17 dataset.

##  Appendix F Additional Results on Domain Generalization Performance

We include the domain generalization performance of XDomainMix on two more
datasets, VLCS and OfficeHome.

  * •

VLCS Fang et al. [2013]. This dataset contains 10,729 photos of 5 classes from
4 existing datasets (domains).

  * •

OfficeHome Venkateswara et al. [2017]. This dataset contains 15,588 images of
65 office and home objects in 4 visual styles (domains): art painting,
clipart, product (images without background), and real-world (images captured
with a camera).

In addition, we include the results of two methods that were proposed earlier.

  * •

CORAL Sun and Saenko [2016] aligns the second-order statistics of the
representations across different domains.

  * •

IRM Arjovsky et al. [2019] learns a representation such that the optimal
classifier matches all domains.

To perform experiments on VLCS and OfficeHome, We follow the setup in
DomainBed, and use a pre-trained ResNet-50. Each domain in the dataset is used
as a test domain in turn, with the remaining domains serving as training
domains. Hyperparameters are the same as what we used for PACS and
TerraIncognita. The best model is selected based on its performance on the
validations split of the training domains. The averaged classification
accuracy of the test domains over 3 runs is reported.

Table 9 shows the result. Our method does not perform well on VLCS and ranks
third on the OfficeHome dataset. Overall, our method still yields the highest
average performance on benchmark datasets.

Method | Camelyon17 | FMoW | PACS | VLCS | OfficeHome | TerraIncognita | DomainNet | Average
---|---|---|---|---|---|---|---|---
ERM | 70.3$\pm$6.4 | 32.3$\pm$1.3 | 85.5$\pm$0.2 | 77.5$\pm$0.4 | 66.5$\pm$0.3 | 46.1$\pm$1.8 | 43.8$\pm$0.1 | 60.3
CORAL | 59.5$\pm$7.7 | 32.8$\pm$0.7 | 86.2$\pm$0.3 | 78.8$\pm$0.6 | 68.7$\pm$0.3 | 47.6$\pm$1.0 | 41.5$\pm$0.1 | 59.3
IRM | 64.2$\pm$8.1 | 30.0$\pm$1.4 | 83.5$\pm$0.2 | 78.5$\pm$0.5 | 64.3$\pm$2.2 | 47.6$\pm$0.8 | 33.9$\pm$2.8 | 57.4
GroupDRO | 68.4$\pm$7.3 | 30.8$\pm$0.8 | 84.4$\pm$0.8 | 76.7$\pm$0.6 | 66.0$\pm$0.7 | 43.2$\pm$1.1 | 33.3$\pm$0.2 | 57.5
RSC | 77.0$\pm$4.9^ | 32.6$\pm$0.5^ | 85.2$\pm$0.9 | 77.1$\pm$0.5 | 65.5$\pm$0.9 | 46.6$\pm$1.0 | 38.9$\pm$0.5 | 60.4
MixStyle | 62.6$\pm$6.3^ | 32.9$\pm$0.5^ | 85.2$\pm$0.3 | 77.9$\pm$0.5 | 60.4$\pm$0.3 | 44.0$\pm$0.7 | 34.0$\pm$0.1 | 56.7
DSU | 69.6$\pm$6.3^ | 32.5$\pm$0.6^ | 85.5$\pm$0.6^ | 77.2$\pm$0.5^ | 65.7$\pm$0.4^ | 41.5$\pm$0.9^ | 42.6$\pm$0.2^ | 59.2
LISA | 77.1$\pm$6.5 | 35.5$\pm$0.7 | 83.1$\pm$0.2^ | 76.8$\pm$1.0^ | 67.4$\pm$0.2^ | 47.2$\pm$1.1^ | 42.3$\pm$0.3^ | 61.3
Fish | 74.7$\pm$7.1 | 34.6$\pm$0.2 | 85.5$\pm$0.3 | 77.8$\pm$0.3 | 68.6$\pm$0.4 | 45.1$\pm$1.3 | 42.7$\pm$0.2 | 61.3
XDomainMix | 80.9$\pm$3.2 | 35.9$\pm$0.8 | 86.4$\pm$0.4 | 76.3$\pm$0.5 | 68.1$\pm$0.2 | 48.2$\pm$1.3 | 44.0$\pm$0.2 | 62.8
Table 9: Performance of XDomainMix compared with state-of-the-art methods
performance. Results with ^ are produced by us.

##  Appendix G Domain Generalization Experiment Details

Details of the domain generalization experiments of state-of-the-art methods
produced by us are as below.

#### Camelyon17 and FMoW dataset

We run the experiments of RSC, MixStyle, and DSU in the testbed provided by
LISA. Following the instruction of the publisher of the datasets, non-
pretrained DenseNet-121 is used as the backbone for Camelyon17. Pretrained
DenseNet-121 is used as the backbone for FMoW.

Our implementation of RSC follows that in DomainBed. The drop factors are set
to 1/3, the value recommended in RSC.

For MixStyle, our implementation is based on the code published by the author.
MixStyle module is inserted after the first and second DenseBlock. All
hyperparameters are set to be the value recommended by the author. The
MixStyle mode is random, which means that feature statistics are mixed from
two randomly drawn features. The probability of using MixStyle is set to 0.5.
$\alpha$, the parameter of the Beta distribution is set to 0.1. The scaling
parameter to avoid numerical issues, $\epsilon$ is set to 1e-6.

We implement DSU following the published code by the author. All
hyperparameters are set to be the value recommended by the author. DSU module
is inserted after the first convolutional layer, first maxpool layer, and
every transition block. The probability of using DSU is set to 0.5. The
scaling parameter to avoid numerical issues, $\epsilon$ is set to 1e-6.

For the three experiments, the batch size is set to 32, and the model is
trained for the same number of epochs as we used to train our method. We tune
the learning rate in {1e-4, 1e-3, 1e-2} and select the optimal learning rate
based on the performance on the validation domain. Weight decay is set to 0.

#### PACS, VLCS, OfficeHome, TerraIncognita and DomainNet dataset

We use DomainBed as the testbed to experiment DSU and LISA. ResNet-50
pretrained on ImageNet is used as the backbone.

Our implementation of LISA is based on the code published by the author.
Following the author’s suggestion, CuMix is used to mix up input samples. The
mix_up alpha is set to 2.

The official code of DSU for ResNet-50 is used. Other settings are the same as
what we used for Camelyon17 and FMoW experiments.

The model is trained for the same number of steps as we used to train our
method. We tune the learning rate, weight decay, and batch size in the range
listed by DomainBed. The learning rate is tuned in (1e-5, 1e-3.5). The weight
decay is tuned in (1e-6, 1e-2). The batch size is tuned in $[32,45]$ (24 for
DomainNet). 20 groups of hyperparameters are searched. The optimal
hyperparameters are selected based on the performance of the validation split
of training domains.


#  Research Article A lower bound for the beta function

Tiehong Zhao1, Miaokun Wang${}^{2,\href<EMAIL_ADDRESS>
††${}^{\href<EMAIL_ADDRESS>Miaokun
<EMAIL_ADDRESS><EMAIL_ADDRESS>††1
School of mathematics, Hangzhou Normal University, 311121, People’s Republic
of China††2 Department of mathematics, Huzhou University, Huzhou 313000,
People’s Republic of China

Abstract. We present a new lower bound for Euler’s beta function, $B(x,y)$,
which states that the inequality

$B(x,y)>\frac{x+y}{xy}\left(1-\frac{2xy}{x+y+1}\right)$

holds on $(0,1]\times(0,1]$, which improves a lower bound obtained by P. Ivády
[12, Theorem, (3.2)] in the case of $0<x+y<1$.

Keywords. beta function, gamma function, psi function, inequalities

Mathematics Subject Classification. Primary 26D07 $\cdot$ Secondary 33B15

##  1 Introduction

The classical gamma function and its logarithmic derivative (or psi function)
are defined as

$\Gamma(x)=\int_{0}^{\infty}e^{-t}t^{x-1}dt\quad\text{and}\quad\psi(x)=\frac{\Gamma^{\prime}(x)}{\Gamma(x)},\qquad
x>0.$

The derivatives of $\psi$, i.e. $\psi^{\prime},\psi^{\prime\prime},\cdots$,
are called polygamma functions. The beta function, as a well-known Euler’s
integral of the first kind, is defined by

$B(x,y)=\int_{0}^{1}t^{x-1}(1-t)^{y-1}dt,\quad x,y>0,$

which is closely related to the gamma function by a elegant identity

$B(x,y)=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}.$

The utility of the beta function is often overshadowed by that of the gamma
function, partly perhaps because it can be evaluated in terms of the gamma
function. In fact, it has various applications not only in the theory of
special functions, but it also plays a role in other fields, for instance,
statistics, mathematical physics, and graph theory; see [1, 10, 17].

In the recent past years, numerous papers on remarkable inequalities related
to the gamma and polygamma functions were published (see [25, 5, 7, 15, 18,
14, 16, 9] and and the references therein), only few inequalities concerning
the beta function can be found in the literature [3, 4, 6, 8, 11].

In 2000, S. Dragomir at al. [8] proved that the inequality

$0\leq\frac{1}{xy}-B(x,y)\leq\frac{1}{4}$

holds for $x,y\geq 1$. Later, Alzer [2] improved $1/4$ to the best possible
constant $\max\limits_{x\geq 1}\\{\Delta(x)\\}=0.08731\cdots$, where
$\Delta(x)=1/x^{2}-\Gamma^{2}(x)/\Gamma(2x)$.

For all $x,y\in(0,1]$, sharp rational bounds for the difference
$1/(xy)-B(x,y)$ were obtained in [4], which are given by

$\frac{1}{xy}\left[1-\alpha\frac{(1-x)(1-y)}{(1+x)(1+y)}\right]\leq
B(x,y)\leq\frac{1}{xy}\left[1-\beta\frac{(1-x)(1-y)}{(1+x)(1+y)}\right]$ (1.1)

with the best possible constants $\alpha=\frac{2}{3}\pi^{2}-4=2.57973\cdots$
and $\beta=1$.

In 2012, Ivády [12] strengthened the right side of (1.1), although there were
some errors in the proof and had been corrected in [13], in which a double
inequality for $B(x,y)$ was presented, explicitly, for all $x,y\in(0,1]$, the
inequalities

$\frac{x+y-xy}{xy}\leq B(x,y)\leq\frac{x+y}{xy(1+xy)}$ (1.2)

hold with equality only for $x=y=1$. We remark that not only the upper bound
of (1.1) has been improved, but the lower bound of (1.2) is also better than
that of (1.1) for $x,y\in(0,1]$ with $x+y\leq 1$. Indeed, due to $\alpha>5/2$,
for $x+y\leq 1$,

$\displaystyle
x+y-xy-\left[1-\alpha\frac{(1-x)(1-y)}{(1+x)(1+y)}\right]>x+y-xy-\left[1-\frac{5}{2}\frac{(1-x)(1-y)}{(1+x)(1+y)}\right]$
$\displaystyle=\frac{(1-x)(1-y)(3-2x-2y-2xy)}{2(1+x)(1+y)}\geq\frac{(1-x)(1-y)\left[3-2x-2y-(x+y)^{2}\right]}{2(1+x)(1+y)}$
$\displaystyle=\frac{(1-x)(1-y)(1-x-y)(3+x+y)}{2(1+x)(1+y)}\geq 0.$

The aim of this article is to present a new lower bound of $B(x,y)$ for all
$x,y\in(0,1]$.

######  Theorem 1.1.

Let $x,y\in(0,1]$. Then the inequality

$B(x,y)>\frac{x+y}{xy}\left(1-\frac{2xy}{x+y+1}\right)$

holds.

######  Remark 1.1.

It was observed that

$1-\frac{xy}{x+y}\geq 1-\frac{2xy}{x+y+1}$

holds for $x+y\geq 1$ and $xy>0$, which together with (1.2) implies

$B(x,y)\geq\frac{x+y}{xy}\left(1-\frac{xy}{x+y}\right)\geq\frac{x+y}{xy}\left(1-\frac{2xy}{x+y+1}\right),$
(1.3)

where the equality cannot hold simultaneously. This enables us to prove the
Theorem 1.1 only in the case of $0<x+y<1$. Moreover, if Theorem 1.1 is true,
then

$B(x,y)>\frac{x+y}{xy}\left(1-\frac{2xy}{x+y+1}\right)\geq\frac{x+y}{xy}\left(1-\frac{xy}{x+y}\right)$

holds for $x,y\in(0,1]$ with $x+y\leq 1$, of which in the case, that is to
say, our lower bound is better than that of (1.2).

##  2 Lemmas

Before proving the main theorem, we need the following four lemmas. The first
one is to estimate a lower bound for the difference of two psi functions,
which is contributed by H Alzer [2, Theorem 7]

######  Lemma 2.1.

Let $n\geq 0$ be an integer and $s\in(0,1)$. Then the inequality

$\psi(x+1)-\psi(x+s)>(1-s)\left[\frac{1}{x+s+n}+\sum_{i=0}^{n-1}\frac{1}{(x+i+1)(x+i+s)}\right]$

holds for $x>0$.

The following lemma plays an important role in the proof of the main theorem,
which gives the rational bounds for the derivatives of psi function. In [19],
Yang introduced the function

$\mathcal{L}(x,a)=\frac{1}{90a^{2}+2}\log\left(x^{2}+x+\frac{3a+1}{3}\right)+\frac{45a^{2}}{90a^{2}+2}\log\left(x^{2}+x+\frac{15a-1}{45a}\right),$

which will be approximated to psi function. Taking $a=2/5$ or $4/5$, several
partial derivatives of $\mathcal{L}(x,a)$ are given by

$\displaystyle\mathcal{L}_{x}(x,2/5)$
$\displaystyle=\frac{3(1+2x)(61+90x+90x^{2})}{2(11+15x+15x^{2})(5+18x+18x^{2})},$
$\displaystyle\mathcal{L}_{x}(x,4/5)$
$\displaystyle=\frac{3(1+2x)(199+180x+180x^{2})}{2(17+15x+15x^{2})(11+36x+36x^{2})},$
$\displaystyle\mathcal{L}_{xx}(x,2/5)$
$\displaystyle=-\frac{3(4993+36546x+110526x^{2}+196560x^{3}+219780x^{4}+145800x^{5}+48600x^{6})}{2(11+15x+15x^{2})^{2}(5+18x+18x^{2})^{2}},$
$\displaystyle\mathcal{L}_{xx}(x,4/5)$
$\displaystyle=-\frac{3(46537+322206x+784446x^{2}+1118880x^{3}+1045440x^{4}+583200x^{5}+194400x^{6})}{2(17+15x+15x^{2})^{2}(11+36x+36x^{2})^{2}}.$

In particular, it has been proved in [19, Lemma 1] that
$a\mapsto\mathcal{L}_{x}(x,a)$ is decreasing and
$a\mapsto\mathcal{L}_{xx}(x,a)$ is increasing on $(1/15,\infty)$. This
together with [27, Corollary 3.3] gives the following lemma.

######  Lemma 2.2.

Let $a_{1}=\frac{40+3\sqrt{205}}{105}=0.79003\cdots$,
$a_{2}=\frac{45-4\pi^{2}+3\sqrt{4\pi^{4}-80\pi^{2}+405}}{30(\pi^{2}-9)}=0.47053\cdots$
and $a_{3}=0.43218\cdots$ be is the unique solution of the equation
$\mathcal{L}_{xx}(0,a)=\psi^{\prime\prime}(1)$. Then the inequalities

$\displaystyle\mathcal{L}_{x}(x,4/5)<\mathcal{L}_{x}(x,a_{1})$
$\displaystyle<\psi^{\prime}(x+1)<\mathcal{L}_{x}(x,a_{2})<\mathcal{L}_{x}(x,2/5)$
(2.1) $\displaystyle\mathcal{L}_{xx}(x,2/5)<\mathcal{L}_{xx}(x,a_{3})$
$\displaystyle<\psi^{\prime\prime}(x+1)<\mathcal{L}_{xx}(x,a_{1})<\mathcal{L}_{xx}(x,4/5)$
(2.2)

hold for all $x>0$ with the best possible constants $a_{1},a_{2}$ and $a_{3}$.

######  Lemma 2.3.

Let $0<x<(\sqrt{3}+1)/2$ and define the function

$f(x)=\log\left[\frac{\Gamma(x+1)^{2}}{\Gamma(2x+1)}\right]-\log\left(1-\frac{2x^{2}}{1+2x}\right).$

Then $f(x)>0$.

######  Proof.

Differentiation yields

$\displaystyle f^{\prime}(x)$
$\displaystyle=2\left[\psi(x+1)-\psi(2x+1)+\frac{2x(1+x)}{(1+2x)(1+2x-2x^{2})}\right]\triangleq
2\hat{f}(x),$ (2.3) $\displaystyle\hat{f}^{\prime}(x)$
$\displaystyle=\psi^{\prime}(x+1)-2\psi^{\prime}(2x+1)+\frac{2(1+2x+2x^{2}+8x^{3}+4x^{4})}{(1+2x)^{2}(1+2x-2x^{2})^{2}},$

which together with (2.1) implies

$\displaystyle\hat{f}^{\prime}(x)$
$\displaystyle>\mathcal{L}_{x}(x,4/5)-2\mathcal{L}_{x}(2x,2/5)+\frac{2(1+2x+2x^{2}+8x^{3}+4x^{4})}{(1+2x)^{2}(1+2x-2x^{2})^{2}}$
$\displaystyle=\dfrac{\left(\begin{array}[]{l}5533+37994x+92054x^{2}+935456x^{3}+11448028x^{4}+67479864x^{5}\\\
\quad+232646232x^{6}+513934848x^{7}+747879552x^{8}+717361920x^{9}\\\
\qquad+442143360x^{10}+158630400x^{11}+18662400x^{12}\end{array}\right)}{2\left[\begin{array}[]{l}(1+2x)^{2}(1+2x-2x^{2})^{2}(17+15x+15x^{2})\\\
\quad\times(11+36x+36x^{2})(11+30x+60x^{2})(5+36x+72x^{2})\end{array}\right]}>0.$

That is to say, $\hat{f}(x)$ is strictly increasing on $(0,\infty)$. According
to this with (2.3) and $\hat{f}(0)=f(0)=0$, it follows that $f(x)>0$ for
$0<x<(\sqrt{3}+1)/2$. ∎

The following lemma offers a simple criterion to determine the sign of a class
of special polynomial, which is called a Positive-Negative type (PN type for
short) polynomial (see [26, 24, 22]) while its opposite is called a Negative-
Positive type polynomial. More information related to these polynomials and
the series version can be found in [23, 20, 21].

######  Lemma 2.4.

([24, Lemma 4]) Let $P_{n}(x)$ be a Positive-Negative type polynomial of
degree $n$, which is given by

$P_{n}(x)=\sum_{k=0}^{m}a_{k}x^{k}-\sum_{k=m+1}^{n}a_{k}x^{k},$

where $a_{k}\geq 0$ for all $k\geq 0$ and there exist at least two integers
$0\leq k_{1}\leq m$ and $m+1\leq k_{2}\leq n$ such that
$a_{k_{1}},a_{k_{2}}\neq 0$. Then there exist $x_{0}\in(0,\infty)$ such that
$P_{n}(x_{0})=0$ and $P_{n}(x)>0$ for $x\in(0,x_{0})$ and $P_{n}(x)<0$ for
$x\in(x_{0},\infty).$

######  Remark 2.1.

For a PN type polynomial, it can be easily seen that $P_{n}(x)>0$ for
$x\in(0,x_{1})$ if $P_{n}(x_{1})>0$ and $P_{n}(x)<0$ for $x\in(x_{2},\infty)$
if $P_{n}(x_{2})<0$. Correspondingly, for a NP type polynomial $P_{n}(x)$, the
signs of $P_{n}(x)$ on $(0,x_{1})$ and $(x_{2},\infty)$ are reversed.

By Applying Lemma 2.4, we list some examples as PN or NP type polynomials
below, which are used to prove the main theorem.

######  Example 2.1.

Let us introduce several PN type polynomials as

$\displaystyle p_{0}(x)$
$\displaystyle=1802+51043x-183763x^{2}-789936x^{3}-613605x^{4},$
$\displaystyle p_{1}(x)$
$\displaystyle=\left[\begin{array}[]{l}158486648+11733123789x+31469130662x^{2}+40356637167x^{3}\\\
\quad+19492784598x^{4}-25810079475x^{5}-68587238430x^{6}-84246205050x^{7}\\\
\quad-76169872800x^{8}-54370440000x^{9}-28066500000x^{10}-9112500000x^{11}\end{array}\right],$
$\displaystyle p_{2}(x)$
$\displaystyle=\left[\begin{array}[]{l}9221+85665x+368643x^{2}+918717x^{3}+1422360x^{4}\\\
\quad+1354842x^{5}+652860x^{6}-76140x^{7}-291600x^{8}-145800x^{9}\end{array}\right],$
$\displaystyle p_{3}(x)$
$\displaystyle=\left[\begin{array}[]{l}3699375712+26523455964x+60608029362x^{2}+68646948321x^{3}+32033337786x^{4}\\\
\quad-25862152266x^{5}-50136084000x^{6}-35657677440x^{7}-11393978400x^{8}\end{array}\right],$
$\displaystyle p_{4}(x)$
$\displaystyle=37+90x-93x^{2}-636x^{3}-810x^{4}-540x^{5}.$

Since $p_{0}(3/20)=75107551/32000$, $p_{1}(1/5)=64124455182553/15625$,
$p_{2}(1)=4298768$, $p_{3}(1)=68461255039$ and $p_{4}(9/25)=21101408/1953125$,
we conclude from Lemma 2.4 that

$\displaystyle p_{0}(x)$ $\displaystyle>0\quad\text{for}\quad x\in[0,3/20],$
(2.4) $\displaystyle p_{1}(x)$ $\displaystyle>0\quad\text{for}\quad
x\in[0,1/5],$ (2.5) $\displaystyle p_{2}(x)$
$\displaystyle>0\quad\text{for}\quad x\in[0,1],$ (2.6) $\displaystyle
p_{3}(x)$ $\displaystyle>0\quad\text{for}\quad x\in[0,1],$ (2.7)
$\displaystyle p_{4}(x)$ $\displaystyle>0\quad\text{for}\quad x\in[0,9/25].$
(2.8)

######  Example 2.2.

In the following, we will use several NP type polynomials, which are given by

$\displaystyle q_{0}(x)$ $\displaystyle=-11-5x+11x^{2}+5x^{3},\hskip
31.86694ptq_{1}(x)=-5+129x+131x^{2}+33x^{3},$ $\displaystyle q_{2}(x)$
$\displaystyle=-65+254x+242x^{2}+49x^{3},\quad
q_{3}(x)=-84+222x+157x^{2}+19x^{3},$ $\displaystyle q_{4}(x)$
$\displaystyle=-45+101x+43x^{2}+2x^{3},\hskip
22.76228ptq_{5}(x)=-11+23x+4x^{2}.$

Since $q_{0}(1/2)=-81/8$, $q_{1}(1/2)=771/8$, $q_{2}(1/2)=1029/8$,
$q_{3}(1/2)=549/8$, $q_{4}(1/2)=33/2$ and $q_{5}(1/2)=3/2$, it follows from
Lemma 2.4 that $q_{0}(x)<0$ for $x\in(0,1/2)$ and each of $q_{j}(x)$ ($1\leq
j\leq 5$) has a unique root on $(0,1/2)$. Suppose that $x_{j}$ is the positive
root of $q_{j}(x)$ for $1\leq j\leq 5$. A simple numerical computation gives
$x_{1}=0.03733\cdots<$
$x_{2}=0.2114\cdots<x_{3}=0.3085\cdots<x_{4}=0.3822\cdots<x_{5}=0.4439\cdots$.
In other words, by Remark 2.1, we see that $q_{j}(x)<0$ implies $q_{j+1}(x)<0$
on $(0,1/2]$ for $1\leq j\leq 4$.

##  3 Proof of Theorem 1.1

In this section, we give the proof of Theorem 1.1 in the case of $0<x+y\leq
1$. Without loss of generality, we assume that $x\leq y$.

######  Proof of Theorem 1.1.

Let $0<x\leq y\leq 1-x$ (namely, $0<x\leq 1/2$) and

$\displaystyle F(x,y)$
$\displaystyle=\log\left[\frac{xyB(x,y)}{x+y}\right]-\log\left(1-\frac{2xy}{x+y+1}\right)$
$\displaystyle=\log\left[\frac{\Gamma(x+1)\Gamma(y+1)}{\Gamma(x+y+1)}\right]-\log\left(1-\frac{2xy}{x+y+1}\right).$
(3.1)

Differentiating $F$ with respect to $x$ (res. $y$) gives

$\frac{\partial F}{\partial
x}=\psi(x+1)-\psi(x+y+1)+\frac{2y(1+y)}{(1+x+y)(1+x+y-2xy)}$ (3.2)

and

$\displaystyle\frac{\partial F}{\partial y}$
$\displaystyle=\psi(y+1)-\psi(x+y+1)+\frac{2x(1+x)}{(1+x+y)(1+x+y-2xy)}$
$\displaystyle=\psi(y+1)-\psi(y+x)-\frac{1}{x+y}+\frac{2x(1+x)}{(1+x+y)(1+x+y-2xy)}.$
(3.3)

We divide into two cases to complete the proof.

Case 1:

$1/5\leq x\leq 1/2$ and $x\leq y\leq 1-x$.
By taking $n=3$ into Lemma 2.1, it follows from (3.3) that

$\displaystyle\frac{\partial F}{\partial y}$
$\displaystyle>(1-x)\left[\frac{1}{x+y+3}+\sum_{i=0}^{2}\frac{1}{(y+i+1)(y+i+x)}\right]$
$\displaystyle\hskip
56.9055pt-\frac{1}{x+y}+\frac{2x(1+x)}{(1+x+y)(1+x+y-2xy)}$
$\displaystyle=\frac{xQ(x,y)}{(1+x+y-2xy)\prod_{j=1}^{3}\big{[}(y+j)(x+y+j)\big{]}},$

where $Q(x,y)=-q_{0}(x)+\sum_{k=1}^{5}q_{k}(x)y^{k}-(1-2x)y^{6}$ and
$q_{k}(x)$ ($0\leq k\leq 5$) is given in Example 2.2. From Example 2.2, we see
that $Q(x,y)$ is a PN type polynomial of $y$ for $x\in(0,1/2]$. So we
conclude, by Lemma 2.4, that $Q(x,y)>0$ for $1/5<x\leq 1/2$ and $x\leq y\leq
1-x$ together with

$Q(x,1-x)=\frac{4}{625}(1-x)\Big{[}252+(5x-1)\big{(}7137+(1-x)(24365+375x^{2})+5300x^{2}\big{)}\Big{]}>0.$

Hence, $F(x,y)\geq F(x,x)=f(x)>0$ for $1/5\leq x\leq 1/2$ and $x\leq y\leq
1-x$ by Lemma 2.3.

Case 2:

$0<x<1/5$ and $x\leq y\leq 1-x$.
In this case, we denote by $D$ and $\partial D$ the trapezoidal domain
$\\{(x,y)|\ x<y<1-x,\ 0<x<1/5\\}$ and its boundary. Then we will prove that
$F(x,y)$ has no extreme value for $(x,y)\in D$.

By (3.2) and (3.3),

$G(x,y)=\frac{\partial F(x,y)}{\partial x}-\frac{\partial F(x,y)}{\partial
y}=\psi(x+1)-\psi(y+1)-\frac{2(x-y)}{1+x+y-2xy}.$ (3.4)

We continue to divide into three subcases.

Subcase A:

$y\geq x+9/25$.
In this case, by differentiation, we obtain

$\displaystyle\frac{\partial G}{\partial x}$
$\displaystyle=\psi^{\prime}(x+1)-\frac{2(1+2y-2y^{2})}{(1+x+y-2xy)^{2}},$
$\displaystyle\frac{\partial^{2}G}{\partial x\partial y}$
$\displaystyle=\frac{\partial^{2}G}{\partial y\partial
x}=\frac{12(y-x)}{(1+x+y-2xy)^{3}}>0,$ (3.5)

which gives

$\frac{\partial G(x,y)}{\partial x}>\frac{\partial G(x,x+9/25)}{\partial
x}=\psi^{\prime}(x+1)-\frac{913+350x-1250x^{2}}{2(17+16x-25x^{2})^{2}}\triangleq
g(x).$ (3.6)

It follows from (2.1) and (2.4) that

$\displaystyle g(x)$
$\displaystyle>\mathcal{L}_{x}(x,4/5)-\frac{913+350x-1250x^{2}}{2(17+16x-25x^{2})^{2}}$
$\displaystyle=\frac{p_{0}(x)+307230x^{5}+823500x^{6}+675000x^{7}}{2(17+15x+15x^{2})(17+16x-25x^{2})^{2}(11+36x+36x^{2})}>0$

for $x\in(0,3/20]$. On the other hand, by (2.2) and (2.5),

$\displaystyle g^{\prime}(x)$
$\displaystyle=\psi^{\prime\prime}(x+1)+\frac{11633-21600x-13125x^{2}+31250x^{3}}{(17+16x-25x^{2})^{3}}$
$\displaystyle<\mathcal{L}_{xx}(x,4/5)+\frac{11633-21600x-13125x^{2}+31250x^{3}}{(17+16x-25x^{2})^{3}}$
$\displaystyle=-\frac{127679911(10x-1)+xp_{1}(x)}{2(17+15x+15x^{2})^{2}(17+16x-25x^{2})^{3}(11+36x+36x^{2})^{2}}<0$

for $x\in(1/10,1/5)$, which implies that $g(x)>g(1/5)=0.001914\cdots>0$ for
$x\in(1/10,1/5)$. In summary, $\partial G/\partial x>0$ for $0<x<1/5$ by
(3.6). Further, by (2.2), (2.6) and (3.4), for $y\in[0,1]$,

$\displaystyle\frac{d^{2}}{dy^{2}}G(0,y)$
$\displaystyle=-\frac{4}{(1+y)^{3}}-\psi^{\prime\prime}(1+y)<-\frac{4}{(1+y)^{3}}-\mathcal{L}_{yy}(y,2/5)$
$\displaystyle=-\frac{p_{2}(y)}{2(1+y)^{3}(11+15y+15y^{2})^{2}(5+18y+18y^{2})^{2}}<0,$

which shows that $G(0,y)$ is strictly concave on $[0,1]$. Hence,

$G(x,y)>G(0,y)\geq\min\big{\\{}G(0,0),G(0,1)\big{\\}}=0$

for $0<x<1/5$ and $x+9/25\leq y<1$.

Subcase B:

$9/25<y<x+9/25$.
In this case, $y-9/25<x<1/5$. It is easy to see from (3.5) that $\partial
G/\partial y$ is strictly increasing for $0<x<y$ and so by (2.1)

$\displaystyle\frac{\partial G(x,y)}{\partial y}$
$\displaystyle>\frac{\partial G(y-9/25,y)}{\partial y}$
$\displaystyle=\frac{13+2150y-1250y^{2}}{2(8+34y-25y^{2})^{2}}-\psi^{\prime}(y+1)>\frac{13+2150y-1250y^{2}}{2(8+34y-25y^{2})^{2}}-\mathcal{L}_{y}(y,2/5)$
$\displaystyle=\dfrac{5275352+(25y-9)\left[\begin{array}[]{l}4404553+18643550y+55576875y^{2}+88996875y^{3}\\\
\quad+9375000y^{4}+843750y^{4}(1-y)(57+50y)\end{array}\right]}{6250(11+15y+15y^{2})(5+18y+18y^{2})(8+34y-25y^{2})^{2}}>0.$

Moreover, by (2.2) and (2.7),

$\displaystyle\frac{d^{2}}{dx^{2}}G(x,9/25)$
$\displaystyle=\psi^{\prime\prime}(x+1)+\frac{25564}{(34+7x)^{3}}<\mathcal{L}_{xx}(x,4/5)+\frac{25564}{(34+7x)^{3}}$
$\displaystyle=-\frac{p_{3}(x)+200037600x^{9}}{2(34+7x)^{3}(17+15x+15x^{2})^{2}(11+36x+36x^{2})^{2}}<0$

for $x\in(0,1/5)$. That is to say, $G(x,9/25)$ is strictly concave on
$(0,1/5)$ and thereby

$\displaystyle G(x,y)>G(x,9/25)$
$\displaystyle>\min\big{\\{}G(0,9/25),G(1/5,9/25)\big{\\}}$
$\displaystyle=\min\\{0.0554\cdots,0.04015\cdots\\}>0.$

Subcase C:

$x<y\leq 9/25$.
As mentioned in Subcase B, $\partial G/\partial y$ is strictly increasing for
$0<x<y$ and so by (2.1)

$\displaystyle\frac{\partial G(x,y)}{\partial y}$
$\displaystyle>\frac{\partial G(0,y)}{\partial
y}=\frac{2}{(y+1)^{2}}-\psi^{\prime}(y+1)>\frac{2}{(y+1)^{2}}-\mathcal{L}_{y}(y,2/5)$
$\displaystyle=\frac{p_{4}(y)}{2(1+y)^{2}(11+15y+15y^{2})(5+18y+18y^{2})}>0$

for $0<x<y\leq 9/25$, where $p_{4}(y)>0$ for $y\in(0,9/25]$ follows from
(2.8). Hence, $G(x,y)>G(x,x)=0$ by (3.4).

In conclusion, $G(x,y)>0$ for all $(x,y)\in D$, which shows that $F(x,y)$ has
no extreme value for $(x,y)\in D$. Otherwise there exists a point
$(x_{0},y_{0})\in D$ such that

$\frac{\partial F(x_{0},y_{0})}{\partial x}=\frac{\partial
F(x_{0},y_{0})}{\partial y}=0\quad\Longleftrightarrow\quad G(x_{0},y_{0})=0.$

For $(x,y)\in\partial D$, $F(x,y)$ has the following properties:

  1. (i)

when $x+y=1$, $F(x,y)>0$ by (1.3) and (3.1);

  2. (ii)

when $x=0$, it is easy to see from (3.1) that $F(0,y)=0$;

  3. (iii)

when $x=y$, by Lemma 2.3, $F(x,x)=f(x)>0$ for $x\in(0,1)$;

  4. (iv)

when $x=1/5$, it has been proved in Case 1 that $F(1/5,y)>0$ for $1/5\leq
x\leq 4/5$.

Due to the continuity of $F(x,y)$ on $\bar{D}$, it follows that $F(x,y)$ can
only attain its minimal value at the boundary of $\bar{D}$, that is to say,

$F(x,y)\geq\min_{(x,y)\in\partial
D}\big{\\{}F(x,1-x),F(0,y),F(x,x),F(1/5,y)\big{\\}}=0$

with the equality only for $x=0$.

This completes the proof. ∎

Funding
This work was supported by the National Natural Science Foundation of China
(11971142) and the Natural Science Foundation of Zhejiang Province
(LY19A010012).

Availability of data and materials Not applicable.

Declarations

Conflict of interest The authors declare that they have no conflict of
interest.

## References

  * [1] ${\rm\mathring{A}}$hag P., Czy${\rm\dot{z}}$ R.: An inequality for the beta function with application to pluripotential theory, J. Ineuqual. Appl. 2009, Article number: 901397, (2009)
  * [2] Alzer H.: On some inequalities for the gamma and psi functions, Math. Comp. 66(217), 373–389, (1997)
  * [3] Alzer H.: Sharp inequalities for the beta function, Indagationes Math. 12, 15–21, (2001)
  * [4] Alzer H.: Some beta function inequalities, Proc. of the Royal Soc. of Edinburgh 133A, 731–745, (2003)
  * [5] Atale O.: Newman’s inequalities and log-convexity properties of gamma function. Bull. Int. Math. Virtual Inst. 12(3), 469–476, (2022)
  * [6] Cerone P.: Special functions: approximations and bounds, Appl. Anal. Discrete Math. 1(1), 72–91, (2007)
  * [7] Chen C.-P., Mortici C.: Asymptotic expansions and inequalities relating to the gamma function. Appl. Anal. Discrete Math. 16(2), 379–399, (2022)
  * [8] Dragomir S. S., Agarwal R. P., Barnett N. S.: Inequalities for beta and gamma functions via some classical and new integral inequalities. J. Inequal. Appl. 5, 103–165 (2000)
  * [9] Das S., Swaminathan, A.: A harmonic mean inequality for the polygamma function. Math. Inequal. Appl. 23(1), 71–76, (2020)
  * [10] Dwyer J.: Circuits in complete graphs and their relations to rapidly-increasing special functions, www.algana.co.uk/publications/Circuits.pdf
  * [11] From, S. G., Ratnasingam, S.: Some new inequalities for the beta function and certain ratios of beta functions. Results Appl. Math. 15, Paper No. 100302, 17 pp, (2022)
  * [12] Ivády P.: On a beta function inequality, J. Math. Inequal. 6(3), 333-341, (2012)
  * [13] Ivády P.: Corrigendum to: “On a beta function inequality", J. Math. Inequal. 10(2), 597–601, (2016)
  * [14] Liang L.-C., Zheng L.-F., Wan, A.: A class of completely monotonic functions involving the polygamma functions. J. Inequal. Appl. Paper No. 12, 16 pp, (2022)
  * [15] Pérez-Marco, R.: On the definition of the Euler gamma function. Enseign. Math. 68(1-2), 135–160, (2022)
  * [16] Qi, F.: Lower bound of sectional curvature of Fisher-Rao manifold of beta distributions and complete monotonicity of functions involving polygamma functions. Results Math. 76(4), Paper No. 217, 16 pp, (2021)
  * [17] Rao B. R.: Gautschi-type inequalities for incomplete moments of a multivariate distribution with applications, Metron., 39, 43–51, (1981)
  * [18] Yin L.: Monotonic properties for ratio of the generalized (p,k)-polygamma functions. J. Math. Inequal. 16(3), 915–921, (2022)
  * [19] Yang Z.-H.: The monotonicity and convexity of a function involving digamma one and their applications (2014). arXiv:1408.2245 [math.CA]
  * [20] Yang Z.-H.: Sharp approximations for the complete elliptic integrals of the second kind by one-parameter means. J. Math. Anal. Appl. 467(1), 446-–461, (2018)
  * [21] Yang Z.-H, Tian J.-F.: Monotonicity rules for the ratio of two Laplace transforms with applications. J. Math. Anal. Appl. 470(2), 821–-845, (2019)
  * [22] Yang Z.-H., Qian W.-M., Chu Y.-M, Zhang W.: On rational bounds for the gamma function. J Inequal Appl, 2017, 17pp, Paper No. 210, (2017)
  * [23] Yang Z.-H., Qian, W.-M., Chu, Y.-M., Zhang, W.: On approximating the arithmetic–geometric mean and complete elliptic integral of the first kind. J. Math. Anal. Appl. 462(2), 1714–1726, (2018)
  * [24] Yang Z.-H., Tian J.-F.: Monotonicity and sharp inequalities related to gamma function. J Math Inequal, 12(1), 1–22, (2018)
  * [25] Yang, Z.-H. Tian, J.-F.: Complete monotonicity of the remainder of the asymptotic series for the ratio of two gamma functions. J. Math. Anal. Appl. 517(2), Paper No. 126649, 15 pp, (2023)
  * [26] Yang Z.-H., Tian J.-F., Wang M.-K.: A positive answer to Bhatia–Li conjecture on the monotonicity for a newmean in its parameter. Rev. R. Acad. Cienc. Exactas Fís. Nat. Ser. A Mat., 114(3), Paper No. 126, (2020)
  * [27] Zhao, T.-H., Yang Z.-H., Chu Y.-M.: Monotonicity properties of a function involving the psi function with applications, J. Inequal. Appl. 2015, Article No. 193 (2015).