Adversarial Auto-Augment with Label Preservation: A Representation Learning Principle Guided Approach
Abstract
Data augmentation is a critical contributing factor to the success of deep learning but heavily relies on prior domain knowledge which is not always available.
Recent works on automatic data augmentation learn a policy to form a sequence of augmentation operations, which are still pre-defined and restricted to limited options.
In this paper, we show that a prior-free autonomous data augmentation’s objective can be derived from a representation learning principle that aims to preserve the minimum sufficient information of the labels.
Given an example, the objective aims at creating a distant “hard positive example” as the augmentation, while still preserving the original label.
We then propose a practical surrogate to the objective that can be optimized efficiently and integrated seamlessly into existing methods for a broad class of machine learning tasks, e.g., supervised, semi-supervised, and noisy-label learning.
Unlike previous works, our method does not require training an extra generative model but instead leverages the intermediate layer representations of the end-task model for generating data augmentations.
In experiments, we show that our method consistently brings non-trivial improvements to the three aforementioned learning tasks from both efficiency and final performance, either or not combined with pre-defined augmentations, e.g., on medical images when domain knowledge is unavailable and the existing augmentation techniques perform poorly.
Code is available at: https://github.com/kai-wen-yang/LPA3.
Introduction
Data augmentation has emerged as an effective data pre-processing or data transformation step to mitigate overfitting [31], to encourage local smoothness [57], and to improve generalization [6] in machine learning pipelines such as deep neural networks.
Notably, effective data augmentation, which incorporates class-related data invariance and enriches the in-class sample, is one of the key contributing factors for representation learning with weak or self supervision [9, 23].
Given a task, we aim to generate “good” augmentations efficiently.
As part of the machine learning model pipeline, an autonomous domain-agnostic but task-informed data augmentation mechanism is desirable.
However, a number of challenges exist.
(1) Existing augmentation operators are usually hand-crafted based on domain expert knowledge, which is not always available in some domain [49].
For example, widely used augmentations for natural images are not effective on medical images.
Moreover, the performance of those machine learning pipelines drastically varies with different choices of data augmentations.
Existing few autonomous augmentation approaches developed lately are neither fully autonomous nor universally applicable to varying domains.
Although a few autonomous data augmentation approaches have been developed in recent years [14, 12], they train policies to produce a sequence of pre-defined augmentation operations and thus are not fully automated and are limited to a few domains.
(3) Existing augmentations usually do not fully utilize the task feedback (i.e., task-agnostic) and may be sub-optimal for the targeted task.
A class of automated data augmentation methods train an extra data generative model to generate new augmentations from scratch given a real-world example [2].
However, they require training a generative model, which is a non-trivial task in practice that may either relies on strong prior knowledge or a substantial increased number of training examples.
In this paper, we first investigate the conditions required to generate domain-agnostic but taskinformed data augmentations.
Consider a representation learning pipeline, we started from a probabilistic graphical model that describes the relations among the label Y , the nuisance N , the example
X , its augmentation X ′ , and the latent representations Z .
We argue that a minimum-sufficient representation for the task preserves the label information but excludes other distractive information from the nuisance.
We then investigate the conditions for an augmentation X ′ that results in learning such preferred representations.
These conditions motivate an optimization objective that can be used to produce automated domain-agnostic but task-informed data augmentations for each example, without replying on pre-defined augmentation operators or specific domain knowledge.
Consequently, our proposed optimization objective addresses all aforementioned challenges.
For practicality, we further propose a surrogate of the derived objective that can be efficiently computed from the intermediate-layer representations of the model-in-training.
The surrogate is built upon the data likelihood estimation through perceptual distance [24] defined on the intermediate layers’ representations.
Specifically, our proposed surrogate objective maximizes the perceptual distance between X and X ′ , under a label preserving constraint on the model prediction of X ′ .
This problem can be efficiently solved by optimizing its Lagaragian relaxation.
Thereby, given X and its label Y , the solution to our surrogate objective generates “hard positive examples” for X without loosing its label information.
Once generated, X ′ is used to train the model towards producing the minimum-sufficient representation Z for the targeted task.
Our proposed method, named LabelPreserving Adversarial Auto-Augment ( LP-A3 ) , does not require any extra generative models such as Generative Adversarial Networks, unlike previous automated augmentation methods [40].
We further propose a sharpness-aware criterion selecting only the most informative examples to apply our auto-augmentation on so it does not cause expensive extra computation.
Our proposed LP-A3 is a general and autonomous data augmentation technique applicable to a variety of machine learning tasks, such as supervised, semi-supervised and noisy-label learning.
Moreover, we demonstrate that it can be seamlessly integrated with existing algorithms for these tasks and consistently improve their performance.
In experiments on the three learning tasks, we equip LP-A with existing methods and obtain significant improvement on both the learning efficiency and the final performance.
The generated augmentations are optimized for the model-in-training in a targettask-aware manner and thus notably accelerate the slow convergence in computationally intensive tasks such as semi-supervised learning.
It is worth noting that our augmentation can consistently bring improvement to tasks without domain knowledge or pre-defined augmentations such as medical image classification, on which the traditional image augmentations lead to performance degeneration.
Related work
Hand-crafted vs. Autonomous Data Augmentations.
Most of the existing widely used data augmentations are hand-crafted based on domain expert knowledge [30, 39, 29, 9, 13].
For example,
MoCo [16] and InstDis [47] create augmentations by applying a stochastic but pre-defined data augmentation function to the input.
CMC [39] splits images across color channels.
PIRL [29] generates data augmentations through random JigSaw Shuffling.
CPC [30] renders strong data augmentations by utilizing RandAugment [12], which learns a policy producing a sequence of pre-defined augmentation operations selected from a pool [14].
AdvAA [60] designs a adversarial objective to learn the augmentation policy.
[12, 14, 60] are all based on pre-defined operations which is not available in certain domains, and their objective cannot guarantee the label-preserving of the generated data which may lead to suboptimal performance.
“InfoMin” principle of data augmentation is proposed [40] to minimize the mutual information between different views (equivalent to min I ( X , X ′ ) ).
However, their theory depends on access to a minimal sufficient encoder which may be difficult to obtain.
In contrast, we not only consider how to generate optimal views or augmentations, but also consider generating the minimal sufficient representation.
The algorithm [40] deploys a generator to render augmentation (which may be costly to train especially on non-natural image domains), while we directly learn the augmentation through gradient descent w.r.t.
the input.
Information Theory for Representation Learning.
Information theory is introduced in deep learning to measure the quality of representations [42, 1].
The key idea is to use information bottleneck methods [41, 42] to encourage the learned representation being minimal sufficient.
Mutual information objectives are commonly used in self-supervised learning.
For example, InfoMax principle [27] used by many works aims to maximize the mutual information between the representation and the input [39, 4, 46].
But simply maximizing the mutual information does not always lead to a better representation in practice [43].
In contrast, InfoMin principle [40] minimizes the mutual information between different views.
Both InfoMax and the InfoMin principles can be associated with our proposed representation learning criteria in Section 4, as they lead to sufficiency and minimality of the learned representation, respectively.
Augmentation in Self-supervised Contrastive Learning.
Self-supervised Contrastive Representation Learning [30, 18, 47, 39, 35, 9] learn representation through optimization of a contrastive loss which pulls similar pairs of examples closer while pushing dissimilar example pairs apart.
Creating multiple views of each example is crucial for the success of self-supervised contrastive learning.
However, most of the data augmentation methods used in generating views, although sophisticated, are hand-crafted or not learning-based.
Some use luminance and chrominance decomposition [39], while others use random augmentation from a pool of augmentation operators [47, 9, 4, 16, 53, 37, 62, 65]. Recently, adversarial perturbation based augmentation has been proposed to generate more challenging positives/negatives for contrastive learning [51, 19].
Augmentation in Semi-supervised Learning.
Data augmentation plays an important role in semisupervised learning, e.g., (1) consistency regularization [33, 34] enforces the model to produce similar outputs for a sample and its augmentations; (2) pseudo labeling [25] trains a model using confident predictions produced by itself [38] for unlabeled data.
Data augmentations are critical [23, 7] because they determine both the output targets and input signals: (1) accurate pseudo labels are achieved by averaging the predictions over multiple augmentations; (2) weak augmentations (e.g., flip-and-shift) are important to produce confident pseudo labels, while strong augmentations [14, 12]) are used to train the model and expand the confidence regions (so more confident pseudo labels can be collected later).
Data selection [55, 63] for high-quality pseudo labels is also critical and its criterion is estimated on augmentations, e.g., the confidence [8] or time-consistency [63] of each sample.
Augmentation in Noisy-label Learning Two primary challenges in noisy-label learning is clean label detection [28, 15, 20] and noisy label correction by pseudo labels [32, 3, 26].
Both significantly depend on the choices of data augmentations since the former usually relies on confidence thresholding and augmentations help rule out the overconfident samples, while the latter relies on the quality of semi-supervised learning.
Moreover, as shown in previous works [26, 64], removing strong augmentations such as RandAugment can considerably degenerate the noisy label learning performance.
Preliminaries
Basics of Information Theory Our analyses make frequent use of information theoretical quantities [11].
Given a joint distribution P X , Y and its marginal distributions P X , P Y , we define their entropy as H ( X , Y ) =
E X , Y [ − log P ( x, y )] , H ( X ) =
E X [ − log P ( x )] , and H ( Y ) = E Y [ − log P ( y )] . Furthermore, we define the conditional entropy of X given Y as H ( X | Y ) = E Y [ − log H ( X | y )]
= H ( X , Y ) − H ( Y ) . Finally, we define the mutual information between X and Y as I ( X ∧ Y ) =
H ( X ) − H ( X | Y ) = H ( X ) + H ( Y ) − H ( X , Y ) .
Notations and Problem Setup.
In this paper, we use bold capital letters (e.g., X , Y ) to denote random variables, lowercase letters (e.g., x, y ) to denote their realizations, and curly capital letters (e.g., X , Y ) to denote the corresponding sample spaces.
Since we mainly consider supervised and semi-supervised problems, we define Let P X
Y be the joint distribution of data observation X and label Y , where X is a random vector taking values on a finite observation space X (e.g., images) and Y is a discrete random variable taking values on the label space Y
(e.g., classes).
Our goal is to learn a classifier to predict y ∈ Y from an observation x ∈ X . [Figure]
Task-nuisance Decomposition.
To advance the analysis, we decouple the randomness in X into two parts, one pertaining to the label and another independent to the label.
Concretely, we define a random variable nuisance N such that 1) the nuisance N is independent to the label Y , i.e., N ⊥⊥ Y ; and 2) the observation X is a deterministic function of the nuisance N and the label Y , i.e., X =
g
( Y , N ) for some g .
Lemma 3.1 demonstrates that such a random variable always exists.
Lemma 3.1 (Task-nuisance Decomposition [1]) .
Given a joint distribution P X , Y , where Y is a discrete random variable, we can always find a random variable N independent of Y such that
X =
d ( Y , N ) , for some deterministic function d .
Remarks.
We can rewrite the conditions of task-nuisance decomposition in terms of information theory.
1) Since the nuisance N is independent to the label Y , we have I ( Y ∧ N ) = 0 ; and 2) Since the nuisance N and the label Y determines the observation X , we have H ( X | Y , N ) = 0 .
Principles of Representation Learning: Theoretical Interpretation 4.1 What Is A Good Representation?
In real-world applications, the observation X is usually complex in a high-dimensional space X , making it hard to directly learn a good classifier for Y .
To remedy this curse of dimensionality, it is important to learn a good representation of X , i.e., learn an encoder E ( · ) that maps the highdimensional observation X into a low-dimensional representation Z .
We illustrate the process of data generation and representation learning by a probabilistic graphical model as shown in Figure 1a.
An ideal encoder should keep the important information from X (e.g. label-relevant information) and maximally discard the noise or nuisance of X , such that it is much easier to learn a classifier from Z than from X .
Based on the above intuition, we define an ϵ -optimal representation of X , which has sufficient information for classifying w.r.t.
Y , while remaining little information of the nuisance.
Definition 4.0.1 ( ϵ -Minimal Sufficient Representation ( ϵ -Optimal Representation)) .
For a Markov chain Y → X → Z , we say thata representation Z of X is sufficient for Y if I ( Z ∧ Y ) =
I ( X ∧ Y ) , and Z is ϵ -minimal sufficient for Y if Z is sufficient and I ( Z ∧ X ) ≤ I (˜ Z ∧ X )+ ϵ for all ˜ Z satisfying
I (˜ Z ∧ Y ) =
I ( X ∧ Y ) .
Remark.
Due to the property of mutual information, we have 0 ≤ ϵ ≤ H ( X ) .
The lower ϵ is, the more “minimal” the representation is.
When ϵ = 0 , the representation is minimal sufficient, which is a desirable property as characterized by many prior works [42, 1].
Definition 4.0.1 characterizes how good a sufficient representation is, based on how much redundant information is remained.
Recall that X comes from a deterministic function of label Y and nuisance
N .
The redundancy of Z can also be measured by the mutual information between Z and N .
Achille et al.
[1] prove that if a representation Z is sufficient and is invariant to nuisance N , i.e.,
I ( Z ∧ N ) = 0 , then Z is also minimal.
However, since N is not known, it is hard to directly encourage the representation to be invariant to N .
Can we learn an ϵ -minimal sufficient representation in a principled way?
Inspired by the recent success of data augmentation techniques in self-supervised learning and semi-supervised learning, we find that data augmentation can implicitly encourage the representation to be invariant to the nuisance
N .
However, most augmentation methods are driven by pre-defined transformations, which do not necessarily render a minimal sufficient representation.
In the next section, we will analyze the effects of data augmentation in representation learning in details.
4.2 Proper Data Augmentation Leads to (Near-)Optimal Representation
In this section, we investigate the role of data augmentation for learning good representations.
We first make the following mild assumption on the underlying relationship between X and Y .
Assumption 4.1.
There exists a deterministic function π : X → Y , i.e., H ( Y | X ) = 0 .
Assumption 4.1 requires that there exists a “perfect classifier” that identifies the label y of the observation x with no error, which is common in practice.
Note that for data with ambiguity, a tie breaker can be used to map each observation to a unique label.
Therefore, Assumption 4.1 is realistic.
Let g be a deterministic augmentation function such that X ′ :
= g ( X , A ) is the augmented data, where A is a random variable denoting the augmentation selection.
For example, if X = x is an image sample, A = a is the augmentation “rotate by 90 degree”, then X ′ = x ′ is the corresponding rotated image sample.
We learn an encoder E ( · ) that maps the augmented data X ′ to a representation
Z ′ .
With this augmentation processes, the graphical model in Figure 1a is updated to Figure 1b.
We show in the theorem below that if the augmentation process preserves the information of Y , Z ′ can be sufficient for Y .
Furthermore, if the augmented data X ′ contains no information of the original nuisance N , Z ′ will be invariant to N and thus will become a minimal sufficient representation.
Theorem 4.2.
Consider label variable Y , observation variable X and nuisance variable N satisfying
Assumption 4.1.
Let A be the augmentation variable, X ′ be the augmented data, and Z ∗ be the solution to
[Equation]
to
[Equation]
Then, Z ∗ is a ϵ -minimal sufficient representation of X for label Y if the following conditions hold:
Condition (a) : I ( X ′ ∧ Y ) =
I ( X ∧ Y ) ( X ′ is an in-class augmentation) and
Condition (b) : I ( X ′ ∧ N ) ≤
ϵ
( X ′ does not remain much information about N ).
Remarks.
(1) The objective of learning Z ∗ can be either task-independent (maximizing I ( Z ′
∧ X ′ ) ), or task-dependent (maximizing I ( Z ′ ∧ Y ) ).
The former matches the “InfoMax” principle commonly used in self-supervised learning works [27, 18], while the latter can be achieved by supervised training (e.g., learning a classifier of Z for Y with cross-entropy loss).
(2) When Condition (b) holds for ϵ = 0 , representation Z ′ is optimal (minimal sufficient).
Theorem 4.2, proved in Appendix B.1, shows that if we have a good augmentation that maximally perturbs the label-irrelevant information while keeps the label-relevant information, then the representation learned on the augmented data can be minimal sufficient.
Theorem 4.2 serves as a principle of constructing augmentation.
Based on this principle, we propose an auto-augment algorithm in
Section 5, and verify the algorithm in a wide range tasks in Section 6.
Proposed Methods
In this section, we introduce our data augmentation and how to obtain the augmentation using the representation learning network F ( · ) .
Then we show how to plug our augmentation into the representation learning procedure of F ( · ) .
5.1 Label-Preserving Adversarial Auto-Augment ( LP-A3 )
As illustrated in the previous section, an ideal data augmentation X ′ for representation learning should contain as little information about nuisance N as possible while still keeping all the information about class Y .
Since N is not observed, we transfer the objective min X
′ I
( X ′ ∧ N ) into min X
′ I
( X ′ ∧ X ) since I ( X ′ ∧ X )
=
I ( X ′ ∧ N ) + I
( X ′ ∧ Y )
and I ( X ′ ∧ Y ) is a constant under the constraint
I ( X ′ ∧ Y ) =
I ( X ∧ Y ) .
Thus the optimization problem is:
[Equation]
Implementation of Mutual Information.
To solve Equation (2), computing the mutual information terms I ( X ′ ∧ X ) , I ( X ′ ∧ Y ) and I ( X ∧ Y ) is required.
Next, we will show how to compute these terms using a neural net classifier F ( · ; θ ) , parameterized by θ , that consists of two components: a representation encoder E ( · ) and a predictor M ( · ) .
Specifically, F ( · ; θ ) =
M ( E ( · )) , where the representation encoder E ( · ) maps input X into representation Z , and the predictor M ( · ) predicts the class of Z .
This is demonstrated in Figure 2.
Constraint implementation.
Since I ( X ′ ∧ Y ) =
H ( Y ) − H
( Y | X ′ )
and I ( X ∧ Y ) =
H ( Y ) − H
( Y | X ) , we can remove the H ( Y ) term in both sides and turn the constraint into
H ( Y | X ) =
H ( Y | X ′ ) .
Thus we only need to compute the conditional entropy of Y given X or X ′ , which can be approximated through the neural net classifier: H ( Y | X ) =
E X , Y [ − log P ( y | x )] ≈
E X , Y [ − log( F ( x ; θ )
[ y ])] , where we use softmax class probability F ( x ; θ )
[ y ] to approximate the likelihood P ( y | x ) .
And H ( Y | X ′ ) can be computed similarly.
Objective implementation.
Then we show how to compute the objective I ( X ′ ∧ X ) .
Since I ( X ′ ∧
X )
=
H ( X ) − H
( X | X ′ )
where H ( X ) is not related to X ′ and thus can be neglected, we only need to compute H ( X | X ′ )
=
E X , X ′
[ − log P ( x | x ′ )] .
We use the Learned Perceptual Image Patch
Similarity (LPIPS) [59] between x and x ′ to compute the data likelihood P ( x | x ′ ) since LPIPS distance is a widely used metric to measure the data similarity in data generative model field [21, 58] and many previous work has shown that LPIPS distance is the best surrogate for human comparisons of similarity [59, 24], compared with any other distance including ℓ 2 and ℓ ∞ distance.
Although such surrogate may have error, it worth noting that Theorem 4.2 allows the surrogate to have ϵ error.
The
LPIPS distance is defined by the ℓ 2 distance of stacked feature maps from a neural network.
Here we use F ( · ; θ ) to compute the LPIPS distance.
Let F ( · ; θ ) has L layers and (cid:98) F l ( · ; θ ) denotes these channel-normalized activations at the l -th layer of the network.
Next, the activations are normalized again by layer size and flattened into a single vector ϕ ( x ) ≜ ( (cid:99) F 1 ( x ; θ ) √ w 1 h 1 , ..., (cid:99) F L ( x ; θ ) √ w L h L ) , where w l and h l are the width and height of the activations in layer l , respectively.
The LPIPS distance between input x and the augmentation x ′ is then defined as:
[Equation]
Constraint Relaxation for Efficiency.
Now, given an input x , its data augmentation x ′ can be computed by solving the following optimization problem using the neural network F ( · ; θ ) in practice:
[Equation]
The equality constraint in Equation (4) is too strict to solve since it may be inefficient to search for an x ′ that exactly satisfies log F ( x ′ ; θ )
[ y ] = log F ( x ; θ )
[ y ] .
Thus we relax the constraint with a small σ and change the constaint into: log F ( x ′ ; θ )
[ y ] ≥ log F ( x ; θ )
[ y ] − σ .
It’s worth noting that if σ is sufficiently small, the label is still well preserved.
There is a trade-off to the value of σ , we search σ to find a sweet spot where the problem is practical to solve and meanwhile the label is well preserved.
There are many off-the-shelf methods that solve Equation (4), and here we apply the Fast Lagrangian
Attack Method [24] as a demonstration.
We initialize x ′ by x plus a uniform noise.
And we find the optimal x ′ by solving the following the Lagrangian multiplier function and gradually scheduling the value of the multiplier λ :
[Equation]
The detailed procedure of the algorithm can be found in Appendix 2.
The algorithm has a similar form as adversarial attack [61, 52] in that they both find an optimal augmentation x ′ by adding perturbations to the original image x .
However, the difference is that we aim to generate hard augmentation that preserves the label, while adversarial attack aims to change the class label.
5.2 Plugging LP-A3 into a Representation Learning Task
One primary advantage of LP-A3 is that it only requires a neural net F ( · ; θ ) to produce the augmentation and F ( · ; θ ) can be the current representation learning model, so we can plug LP-A3 into any representation learning procedure requiring no additional parameters, which is plug-and-play and parameter-free.
At each step, we first fix F ( · ; θ ) to generate the augmentation x ′ by solving
Equation (5) using Algorithm 2.
And then we train F ( · ; θ ) by running the original representation learning algorithm using our augmentation x ′ .
Data selection.
It is not necessary to find hard positives for every sample.
To save more computation, we can apply a sharpness-aware criterion, i.e., time-consistency (TCS) [63], to select the most informative data ( τ % data with the lowest TCS in Algorithm 1) that have sharp loss landscapes, which indicate the existence of nearby hard positives, and we only apply LP-A3 to them.
It reduces the computational cost without degrading the performance because (1) the improvement brought by augmentations is limited for examples whose loss already reaches a flat minimum, while the model does not generalize well near examples with a sharp loss landscapes; and (2) the hard positives for examples with flat loss landscape are distant from the original ones and might introduce extra bias to the training.
LP-A3 is compatible with any representation learning task minimizing a loss L : X ×Y ×W → R + , which takes in a data batch and a model to output a loss value.
Y here denotes the groundtruth label for labeled data and pseudo label for unlabeled data.
The pseudo-code of plugging LP-A3 into the representation learning procedure with TCS-based data selection is provided in Algorithm 1.
Experiments
In this section, we apply LP-A3 as a data augmentation method to several popular methods for three different learning tasks, i.e., (1) semi-supervised classification; (2) noisy-label learning and (3) medical image classification.
In all the experiments, LP-A3 can (1) consistently improve the convergence and test accuracy of existing methods and (2) autonomously produce augmentations that bring non-trivial improvement even without any domain knowledge available.
A walk-clock time comparison is given in the Appendix, showing LP-A3 effectively reduces the computational cost.
In addition, we conduct a thorough sensitivity study of LP-A3 by changing (1) label-preserving margin and (2) data selection ratio on the three tasks.
More experimental details can be found in the Appendix.
[Figure] [Figure]
6.1 Medical Image Augmentations produced by LP-A3 vs. RandAugment
We visualize data augmentations generated by LP-A3 and RandAugment [12] on the testset of
DermaMnist [50] with a ResNet-18 classifier and its confidence on the groundtruth class in Fig.
We also use ScoreCAM [44] as an interpretation method to highlight the area in each image that the classifier relies on to make the prediction.
we find that LP-A3 preserves relevant derma areas highlighted by ScoreCAM and they are consistent with those in the original image.
On the contrary, RandAugment changes the color or occludes those derma areas, resulting in highly different
ScoreCAM heatmaps and hence wrong predictions (red bounding box in Fig. 3).
Instead, LP-A3 can preserve the class information and mainly perturb the class-unrelated area in the original image.
6.2 Applying LP-A3 to Three Different Representation Learning Tasks
Here we apply LP-A3 to three different tasks by pluging LP-A3 to existing baselines of each task.
Fig.
4 shows that LP-A3 greatly speeds up the convergence of each baseline.
Semi-supervised learning
To evaluate how LP-A3 improves the learning without sufficient labeled data [Table] we conduct experiments on semi-supervised classification on standard benchmarks including CIFAR [22] and STL-10 [10] where only a very small amount of labels are revealed.
We apply LP-A3 in
FixMatch [36] and compare it with the original FixMatch and InfoMin [40], a learnable augmentation method for semi-supervised learning.
Their results are reported in Table 1, where LP-A3 consistently improves FixMatch and the improvement becomes more significant if reducing the labeled data.
It’s worth noting that the original FixMatch already employs a carefully designed set of pre-defined augmentations [13] that have been tuned to achieve the best performance, indicating that LP-A3 is complementary to existing data augmentations.
Moreover, LP-A3 also outperforms InfoMin by a large margin ( > 5% ), which indicates that LP-A3 is also superior to existing learnable augmentations.
[Table]
Noisy-label Learning
Data augmentation is critical to noisy-label learning by providing different views of data to prevent neural nets from overfitting to noisy labels.
We apply LP-A3 to two state-ofthe-art methods DivideMix [26] and PES [5] on CIFAR with different ratios of noise labels.
LP-A can consistently improve the performance of these two SoTA methods and the improvement is more significant in more challenging cases with higher noise ratios, e.g., on CIFAR100 with 90% of labels to be noisy, LP-A3 improves PES by ≥ 15% (Table 2).
Medical Image Classification To evaluate the performance in specific areas without domain knowledge, we compare LP-A3 with existing data augmentations on medical image classification tasks from MedMNIST [50], which is composed of several sub-dataset with various styles of medical images.
We compare our LP-A3 with RandAugment [13] on training ResNet-18 and ResNet-50 [17].
We report the results in Table 3, where RandAugment designed for natural images fails to improve [Table] [Table] the performance in this scenario.
In contrast, LP-A3 does not rely on any domain knowledge brings improvement to all the datasets
[Table]
especially for OctMNIST where the improvement is over 1% .
The results indicate that hand-crafted data augmentations do not generalize to all domains but LP-A can autonomously produce augmentations guided by our representation learning principle without relying on any domain knowledge
[Table] [Figure]
6.3 Sensitivity Analysis of Hyperparameters
Label preserving margin σ : We evaluate how LP-A3 performs with different label preserving margin σ on the three tasks.
The results are presented in Fig.
5, where a reverse U-shape is observed.
And LP-A3 using all the evaluated σ outperforms baselines, which indicates LP-A3 is robust to σ .
Data selection ratio: We evaluate the performance of LP-A3 with different amount of data selected on the three tasks.
As shown in Fig.
5, selecting all the data does not perform the best since some data’ augmentations are useless to apply data augmentation.
Moreover, selecting only 30% data to apply LP-A3 can outperform all baselines by a large margin, especially on MedMNIST where the improvement is ≥ 2% , which verifies the effectiveness of LP-A3 and our data selection method.
Conclusion
In this paper, we study how to automatically generate domain-agnostic but task-informed data augmentations.
We first investigate the conditions required for augmentations leading to representations that preserves the task (label) information and then derive an optimization objective for the augmentations.
For practicality, we further propose a surrogate of the derived objective that can be efficiently computed from the intermediate-layer representations of the model-in-training.
The surrogate is built upon the data likelihood estimation through perceptual distance.
This leads to LP-A3 , a general and autonomous data augmentation technique applicable to a variety of machine learning tasks, such as supervised, semi-supervised and noisy-label learning.
In experiments, we demonstrate that LP-A3 can consistently bring improvement to SoTA methods for different tasks even without domain knowledge.
In future work, we will extend LP-A3 to more learning tasks and further improve its efficiency.
Acknowledgements
This work was supported by, the Major Science and Technology Innovation 2030 “New Generation Artificial Intelligence” key project under Grant 2021ZD0111700, NSFC No. 61872329, No. 62222117, and the Fundamental Research Funds for the Central Universities under contract WK3490000005.
Huang, Sun and Su are supported by NSF-IIS-FAI program, DOD-ONR-Office of Naval Research, DOD-DARPA-Defense Advanced Research Projects Agency Guaranteeing AI Robustness against Deception (GARD).
Huang is also supported by Adobe, Capital One and JP Morgan faculty fellowships. Checklist For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[No] (c) Did you discuss any potential negative societal impacts of your work?
[N/A] (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] See Sec.
(b) Did you include complete proofs of all theoretical results?
[Yes] See Appendix B 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[No] Will open source later (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Aappendix C (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[No] (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[No] 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators? [Yes] (b) Did you mention the license of the assets?
[N/A] (c) Did you include any new assets either in the supplemental material or as a URL? [N/A] (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5. If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]
Supplementary Material A Algorithmic Details A.1 Data Selection Via Time-Consistency We use time-consistency (TCS) [63] to select informative sample to apply our augmentation, which computes the consistency of the output distribution for each sample along the training procedure. Specifically, TCS metric c t ( x ) for an individual sample is an negative exponential moving average of a t ( x ) over training history before t :
[Equation]
where D KL ( ·∥· ) is Kullback–Leibler divergence, y t − 1 ( x ) is pesudo label (for unlabeled data) or real label (for labeled data) for x at step t and γ c ∈ [0 , 1] is a discount factor. Intuitively, the KL-divergence between output distributions measures how consistent the output is between two consecutive steps, and a moving average of a t ( x ) naturally captures inconsistency of x over time quantify. And larger c t ( x ) means better time-consistency. We select top τ % sample with the lowest TCS to apply our data augmentation because samples with small TCS tend to have sharp loss landscapes.
These samples provide more informative gradients than others and applying our model-adaptive data augmentations can bring more improvement to their representation invariance and loss smoothness.
In Fig.
5, we conduct a thorough sensistivity analysis on τ % over three tasks and find that sample selection with
TCS can effectively improve the performance.
Moreover, in this way, we do not need to apply our augmentation to every training samples and thus save the training cost.
A.2 Fast Lagaragian Attack Method
We use the fast lagaragian perceptual attack method (Algorithm 3 in [24]) to solve the Lagragian multiplier function in Equation.(5), which finds the optimal x ′ through gradient descent over x ′ , starting at x with a small amount of noise added.
During the T gradient descent steps, λ is increased exponentially form 1 to 10 and the step size is decreased.
T is set to be 5 for all the experiments.
Input:
Training data ( x , y );
The class preserving margin σ ; Neural Network F ( · )
Output: 1: x ′ = x + 0 .
01 ∗ N (0 , 1) 2: for t = 1 , ..., T do 3: λ ← 10 t/T 4: △ = −∇ x ′ [ ∥ ϕ ( x ) − ϕ
( x ′ )
∥ 2 − λ max(0 , log F ( x ; θ )
[ y ] − log F ( x ′ ; θ )
[ y ] − σ )] 5: ˆ △ = △ / ∥△∥6: γ = ϵ ∗ (0 . 1) t /T 7: m ← ( F ( x ; θ )
[ y ] − F ( x ′ + h ˆ △ ; θ )
[ y ]) /h 8: x ′
← x + ( γ/m ) ˆ △ 9: end for
B Additional Theoretical Results and Proofs B.1 Proof of Theorem 4.
Proof of Theorem 4.2 .
Problem (1) contains two versions of objectives for Z ′ :
argmax Z ′
I
( Z ′ ∧ X ′ ) subject to I (
Z ′ ∧ A )
= 0 , (8) or argmax
[Equation]
I ( Z
[Equation]
Y ) subject to I (
Z ′ ∧ A )
= 0 .
Both Problem (8) and Problem (9) lead to the ϵ -minimal sufficient representation Z ∗ .
We first prove the more challenging Problem (8) objective.
I.
For Problem (8) : argmax Z ′
I
( Z ′ ∧ X ′ ) subject to I (
Z ′ ∧ A )
= 0 .
We first prove the sufficiency of Z ∗ , then prove the ϵ -minimality of Z ∗ .
1) Proof of sufficiency
Since I ( Z ′ ∧ X ′ )
=
H ( X ′ )
− H ( X ′ | Z ′ ) , and H ( X ′ ) does not depend on Z ′ , we have that the solution to Problem (8), Z ∗ , minimizes H ( X ′ | Z ′ ) under constraint
I ( Z ′ ∧ A )
= 0 .
Then, we show that Z ∗ also minimizes H ( X | Z ′ ) .
We know that I ( X , A ∧ Z ′ |
X ′ )
{+= 
+}
because of the Markovian property.
Since I ( X , A ∧ Z ′ | X ′ )
=
H ( X , A | X ′ )
− H ( X , A | X ′ , Z ′ ) , we have
H ( X
[Equation]
A
[Equation]
X
[Equation]
Then we can derive
[Equation]
[Equation]
[Equation]
[Equation]
Equality (13) holds because X ′ comes from a deterministic function of X and A .
Since H ( X , A | X ′ ) does not depend on Z ′ , Z ∗ minimizes H ( X , A | Z ′ )
as it minimizes H ( X ′ | Z ′ ) .
Also, we known that I ( Z ∗ ∧ A ) = 0 , so we can further obtain
[Equation]
where Equation (19) holds because H ( A | X , Z ′ )
≤ H ( A | Z ′ )
= 0 .
Therefore, Z ∗ minimizes H ( X | Z ′ ) .
Following the similar procedure as above (Equation (10) to Equation (19)), we are able to show that
[Equation]
So Z ∗ also minimizes H ( Y , N | Z ′ ) , which can be further decomposed into H ( Y | Z ′ )
+ H ( N | Z ′ , Y ) .
Next we show by contradiction that H ( Y | Z ∗ ) equals to H ( Y | X ) and thus I ( Y ∧ Z ∗ )
=
I ( Y ∧ X ) .
Define L ( Z ′ ) :
= H ( Y | Z ′ )
+ H ( N | Z ′ , Y ) Assume that the optimizer Z ∗ minimizes L , but does not satisfy sufficiency, i.e., H ( Y | Z ∗ ) >
H ( Y | X )
= 0 .
We will then show that one can construct another representation ˆ Z such that L (ˆ Z ) <
L ( Z ∗ ) , conflicting with the assumption that Z ∗ minimizes L .
The construction of ˆ Z works as follows.
Since the augmented data X ′ satisfies I ( X ′ ∧ Y ) =
I ( X ∧ Y ) (Condition (a) of Theorem 4.2), we have H ( Y |
X ′ )
=
H ( Y | X ) = 0 .
Hence, there exists a function π ′ such that π ′ ( X ′ )
=
Y .
Define ˆ Z :=
( Z ∗ , π ( X ′ )) , then we have
[Equation]
Therefore, the constructed ˆ Z conflicts with the assumption.
We can conclude that any optimizer
Z ∗ ∈ argmin Z ′ H ( Y | Z ′ )
+ H ( N | Z ′ , Y ) has to satisfy H ( Y | Z ∗ )
=
H ( Y | X ) , which is equivalent to I ( Y ∧ Z ∗ )
=
I ( Y ∧ X ) .
The sufficiency of Z ∗ is thus proven.
As a result, the maximizer to Problem (8), Z ∗ , satisfies I ( Z ∗ ∧ Y )
=
I ( X ′ ∧ Y ) =
I ( X ∧ Y ) .
2) Proof of ϵ -Minimality
Since X is a deterministic function of Y and N , we have
[Equation]
29) where the equality in Equation (27) holds because I ( X ′ ∧ X ) ≥ I ( X ′ ∧ Y , N ) and I ( X ′ ∧ X ) ≤
I ( X ′ ∧ Y , N ) both hold.
And we can derive
[Equation]
Moreover, we know that
[Equation]
N )
[Equation]
X
[Equation]
And we have I ( Y ∧ N ) = 0 , so
[Equation]
Combining (30) and (32), we have
[Equation]
Note that (33) holds for all sufficient statistics of X w.r.t.
Y .
Then we first show that X ′ is ϵ -minimal of X w.r.t.
Y by contradiction.
Assume there exists a random variable ˜ X satisfying I ( ˜ X ∧ Y )
=
I ( X ∧ Y ) , such that I ( ˜ X ∧ X ) <
I ( X ′ ∧ X ) − ϵ .
Then we have
[Equation]
[Equation]
[Equation]
[Equation]
[Equation]
[Equation]
where (34) holds by replacing X ′ with ˜ X in (28).
Hence, we get I ( ˜ X ∧ Y | N ) <
I ( ˜ X ∧ Y | N ) which is impossible.
So we have that there does not exist such an ˜ X , and X ′ is ϵ -minimal representation of X w.r.t.
Y .
Then, since we have I ( Z ′ ∧ N ) ≤ I ( X ′ ∧ N ) ≤ ϵ (thanks to Data Processing Inequality), Z ′ is also a ϵ -minimal sufficient statistic of X w.r.t.
Y .
II.
For Problem (9) : argmax Z ′
I ( Z ′ ∧ Y ) subject to I ( Z ′ ∧ A )
= 0 .
Since the objective is to maximize I ( Z ′ ∧ Y ) , we only need to show that Z ∗ achieves the maximum mutual information with Y .
According to the above proof for Problem (8), we know that there exist
Z ′ such that
I ( Z ′ ∧ A ) = 0 and I ( Z ′ ∧ Y ) =
I ( X ∧ Y ) .
Hence, the optimizer to Problem (9) must satisfy sufficiency.
The proof of ϵ -minimality is identical to the one under Problem (8).
B.2 Additional Theoretical Results on Augmentation Properties
The two conditions in Theorem 4.2, Condition (a) or Condition (b), requires that the augmentation X ′ is (a) sufficient and (b) ( ϵ )-minimal.
These two conditions are closely related to some augmentation rationales in prior papers.
For example, Wang et al.
[45] propose a symmetric augmentation , which can result in Condition (a), as formalized in Lemma B.1 below.
Furthermore, Tian et al.
[40] propose an “InfoMin” principle of data augmentation, that minimizes the mutual information between different views (equivalent to min I ( X , X ′ ) ).
We show by Lemma B.2 that this InfoMin principle leads to the above Condition (b).
In contrast, our Theorem 4.2 characterizes two key conditions of augmentation and directly relate them to the optimality of the learned representation.
Lemma B.1 (Sufficiency of Augmentation) .
Suppose the original and augmented observations X and X ′ satisfy the following properties:
[Equation]
Then the augmented observation X ′ is sufficient for the label Y , i.e., I ( X ′
∧
Y )
=
I ( X ∧ Y ) .
Proof of Lemma B.1 .
[Equation]
where the third equation utilizes the property of symmetric augmentation. Lemma B.2 (Maximal Insensitivity to Nuisance) . If Assumption 4.1 holds, i.e., H ( Y | X ) = 0 , the mutual information I ( X ′ ∧ X ) can be decomposed as [Equation]
[Equation] Since X ′ is sufficient, i.e., I ( X ′ ∧ X ) = I ( X ∧ Y ) is a constant, minimizing I ( X ′ ∧ X ) is equivalent to minimizing I ( X ′ ∧ N ) . Lemma B.2 can be obtained by a simple adaptation from Proposition 3.1 by Achille and Soatto [1].
[Figure]
C Experiments C.1 Implementation Details
All codes are implemented with Pytorch 1 .
To train the neural net with LP-A3 augmentation, we apply seperate batch norm layer (BN), i.e., agumented data and normal data use different BN, which is a common strategy used by previous adversarial augmentations [19, 48, 51].
The only hyperparameters for LP-A3 are label preserving margin σ and data selection ratio τ , which are tuned for each task according to the results in Sec.6.3.
Semi-supervised learning We reproduce Fixmatch [36] based on public code 2 and apply LP-A3 to it.
Following [36], we used a Wide-ResNet-28-2 with 1.5M parameters for CIFAR10, WRN-28for CIFAR100, and WRN-37-2 for STL-10.
All the models are trained for 2 18 iterations.
σ is set to 0.002 for CIFAR10 and STL-10, and 0.02 for CIFAR100 and τ is set to be 90.
Since FixMatch only apply data augmentation to those unlabeled data, here LP-A3 is also applied to those unlabeled data as data augmentation.
For unlabeled data, label Y used in LP-A3 is the pesudo label generated by
FixMatch algorithm.
Noisy-label learning We reproduce DivideMix [26] and PES [5] based on their official code 3 and apply LP-A3 to them as data augmentation.
Following [26, 5], we used a ResNet-18 for CIFAR and CIFAR100.
All the models are trained for 300 epochs.
σ is set to 0.002 for CIFAR10 and 0.
for CIFAR100, and τ is set to be 90.
All the noise are symmetric noise.
For noisy labeled data, label Y used in LP-A3 is the pesudo label generated by DivideMix or PES algorithm respectively. Medical Image Classification Here we follow the original training and evaluation protocol of
MedMNIST 4 and apply LP-A3 to the training procedure as data augmentation.
ResNet-18 and
ResNet-50 are trained for 100 epochs with cross-entropy loss on all the multi-class classfication subset of MedMNIST.
σ is set to 0.02 and τ is tuned from { 20 , 50 , 90 } for each dataset.
The hyperparameters of RandAugment [13] is set to N = 3 , M = 5 by following their original paper.
Sensitivity Analysis of Hyperparameters In Figure.
5, the experiments for semi-supervised learning are conducted on CIFAR100 with 2500 labeled data, the experiments for noisy-label learning are conducted on CIFAR100 with 80% noisy label, and the experiments for medical image classification are conducted on DermaMNIST with ResNet50.
[Figure]
S
[Figure]
RandAugment
CLAE
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
L a
[Figure]
e l P r e s e r v i n g
A cc u r a c y
LP
[Figure]
A
RandAugment
CLAE
[Figure] [Table]
C.2 Computational Cost
Although Algorithm 2 is a pretty fast algorithm to solve Lagragian multiplier function, it still requires several gradient descent steps which is computationally expensive.
One way to reduce computational cost is to generate LP-A3 for every few epochs.
To be specific, once LP-A3 is generated, it will be saved and used to train the network for the next K epochs.
When K = 1 , it degenerates to the original
Algorithm 1.
The walk-clock time comparison on CIFAR100 with 2500 labeled data is give in Fig.
6, where we can see that LP-A3 ( K = 10 ) and LP-A3 ( K = 100 ) achieves much better accuracy than baseline within the same training time.
Moreover, LP-A3 ( K = 10 ) and LP-A3 ( K = 100 ) achieves comparable accuracy as the original LP-A3 ( K = 1 ) after convergence, indicating that LP-A3 is quite informative and it takes several epochs for the neural net to learn from it.
C.3 Mutual Information Terms of Different Data Augmentation
In order to further analyze the properties of different data augmentations, here we report the value of mutual information terms I ( X ′ ∧ X ) and I ( X ′ ∧ Y ) of training data generated by LP-A3,
RandAugment and CLAE [19] (an adversarial augmentation method) during the training procedure.
The results on CIFAR10 are given in Table.
7, where − I ( X ′ ∧ X ) is measured by the LPIPS distance between x and x ′
and I ( X ′ ∧ Y ) is measured by the label preserving accuracy, i.e., the classification accuracy of the current model on x ′ .
We can clearly see that LP-A3 is the most different from the original data (largest LPIPS distance) and at the same time preserves the label well.
Although
RandAugment can also preserve label, as a pre-defined augmentation, it is the closest to the original data.
Another adaptive augmentation CLAE has larger LPIPS ditance than RandAugment but cannot preserve the label well, achieving the lowest label preserving accuracy. C.4 ImageNet Experiments In order to validate the performance of LP-A3 on large-scale datasets, we compare FixMatch and "FixMatch+LP-A3" on ImageNet the semi-supervised learning. ResNet-50 is used as the backbone network.
We randomly choose 10% data and set them as labeled data, while the remaining 90% are unlabeled data.
The batch size for labeled (unlabeled) data is 64 (320). The results are reported in the
Table 4, in which LP-A3 can improve FixMatch by a large margin, especially during the early stage (>6 % at 100,000 iterations).
[Table]
In this section, we compare LP-A3 with state-of-the-art data augmentation on the full dataset in a supervised manner.
We select Mixup [56] and Adversarial AutoAugment [60] as the representative of sample-mixing based augmentaiton and automated data augmentation methods respectively, and we empirically compare LP-A3 with them by applying LP-A3 on top of them.
The backbone model is WideResNet-28-10 and all the model are trained for 150 epochs.
The results are given in Table 5.
It shows that Mixup and Adversarial Autoaugment achieves very high accuracy (>96%) on CIFAR as they are designed for this task, but LP-A3 can further improve them, which indicates that LP-A3 is complementaray to these previous data augmentation using domain knowledge.
Note in early stage the advantage of LP-A3 over Adversarial Autoaugment is especially significant ( > 0 .