Deep learning has gained vital progress in various architecture designs, optimization techniques, data augmentation, and learning strategies and has demonstrated great potential in applications to real-world scenarios. However, applications with deep learning generally require a large amount of labeled data, which is time-consuming to collect and costly on manual labeling force.
Few-shot learning (FSL) is a machine Learning framework that enables a pre-trained model to generalize over new categories of data not seen during training and using only a few labeled samples per class. FSL becomes increasingly essential to significantly alleviate the dependence on data acquisition. Recent attention on FSL over out-of-distribution datum poses a challenge in obtaining efficient algorithms that can perform well on cross-domain situations. Finetuning a pre-trained feature extractor with a few samples has the potential to solve this challenge.
However, a few training samples leads to a biased estimation of the true data distribution. The biased learning during few-shot fine-tuning could further mislead the model to learn an imbalanced class marginal distribution. To verify this, the largest difference (LD) between the number of per-class predictions with a uniform testing set is quantified. If the fine-tuned model learns a balanced class marginal distribution, with a uniform testing set, LD should approach zero. However, empirical results show the opposite. As shown in
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended as an aid in determining the scope of the claimed subject matter.
Disclosed herein is a method providing an improvement to transductive fine-tuning for few-shot learning which effectively uses unlabeled testing data. The imbalanced categorical performance in FSL motivates two solutions.
The first solution uses per-sample loss weighting through margin-based uncertainty. As shown in
The second solution is probability regularization. As the ideal performance should be categorically balanced, the probability for each testing data is explicitly regularized. Precisely, the categorical probability of each testing sample is adjusted by a scale vector, which quantifies the difference between the class marginal distribution and the uniform. The class marginal distribution is estimated by combining each query sample with the complete support set.
The method for improving the fine-tuning of transductive few-shot learning using margin-based uncertainty weighting and probability regularization (TF-MP) effectively reduces the largest difference between per-class predictions by around 5 samples and further improves per-class accuracy approximately 2.1%. This is shown in
There are thus two novel aspects disclosed herein for improving transductive fine-tuning. These are utilizing margin-based uncertainty to weigh each unlabeled testing data in the loss objective to compress the utilization of possibly wrong predictions and regularizing the categorical probability for each testing sample to pursue a more balanced class marginal during finetuning.
The categorical probability for each testing data is regularized to pursue balanced class-wise learning during finetuning. Using TF-MP, the difference between per-class predictions reduces from 21.3% to 14.4% with per-class accuracy improved from 4.5% to 4.9%. Results are averaged over 100 episodes in the meta-dataset.
By way of example, specific exemplary embodiments of the disclosed systems and methods will now be described, with reference to the accompanying drawings, in which:
Transductive few shot learning uses the unlabeled query set (testing images) along with the support set (training images) to make up for the lack of training data. Disclosed herein is a framework for performing transductive fine tuning and a disclosure of TF-MP.
First, the terminology and episode setting in FSL will be formally described. For one episode in FSL, the training and testing set is referred to as the support and query set, respectively. Let (x, y) denote the pair of an input x with its ground-truth one-hot label y∈, where C is the number of classes. The support set is then represented as
={(xi, yi)}i=1N
q={(xi)}i=1N
A feature extractor fθ is first pre-trained on a meta-training dataset, and transductive fine-tuning is conducted on the meta-test dataset within each episode. We denote pθ(y|x) as the categorical probabilities on C classes, which is the output from the softmax layer in the model:
wi is the novel class prototype that is initialized as the mean feature from the support set s for every iteration. A model with parameter θ is learned to classify
s and
q as measured by the following criterion:
The loss s(x, y) for the labeled support set is the cross entropy loss and the loss
q(x) for the unlabeled query set is constructed as entropy minimization:
Specifically, the entropy loss for unsupervised data can be generally represented as H(pθ(y|x))=−ŷlog(pθ(y|x)). As widely used in semi-supervised learning, there are two types of ŷ: when ŷ=argmax(pθ(y|x)) it is referred to as pseudo-label, whereas when ŷ=pθ(y|x), it is noted as soft-label.
In prior art transductive fine-tuning, soft-label is utilized with λ=1 for every testing image, and the entropy minimization is conducted on the logit space. Different from the prior art, q(x) is directly optimized on the feature space and λ(pθ(y|x)) is designed to compress the utilization of wrong predictions. Probability regularization is applied on pθ(y|x) before forwarding it to H(pθ(y|x)).
Margin-based uncertainty is designed to assign low loss weights for wrongly predicted samples and high loss weights for the correct ones. However, the generally used entropy-based weighting may not truly reflect whether the sample has the wrong prediction. Furthermore, margin-based uncertainty weighting is used to compress the utilization of wrongly predicted testing data.
The class with the maximum probability pmax is assigned as the predicted class. Thus, pmax is referred to as the confidence, which indicates the confidence level of the categorical prediction. The other index used to indicate the confidence level of the prediction is the entropy of the predicted probabilities. In semi-supervised learning, an entropy-based per-sample loss weight is used as:
e(P) is normalized to [0,1] as the entropy ΣiC(pi, log pi) is scaled by its maximum value log C. Entropy on p(y|x) quantifies the uncertainty of probabilities. Larger uncertainty generally refers to a lower confidence level the sample carries towards its class prediction, consequently leading to lower loss weight λ(P). However, Eq. (5) indicates that the uncertainty on the whole probability distribution may not be ideal for distinguishing whether the predictions are wrong.
Intuitively, wrong predictions are more likely to be made when the model produces similar probabilities between two classes. In other words, the margin between the maximum and second maximum probability Δp can largely reflect how uncertain an example is with its prediction. A smaller margin indicates larger uncertainty on the prediction, which indicates a higher possibility that the prediction is wrong.
Margin information is reflected in the entropy-based uncertainty measurement. When pmax is fixed, the margin Δp is in the range of:
Samples with the largest margin (Δp)max are expected to be assigned with the least uncertainty on decisions. However, the entropy score gives the opposite answer. For max(Δp), the entropy is:
is non-negative, Eq. (6) reveals that samples with largest margin max(Δp) carry larger entropy-based uncertainty scores than samples with min(Δp), which is contradictory to the information implied by the margin.
To solve this contradiction, it is important to use only top-2 probabilities in Eq. (5). The maximum and second maximum probabilities are first normalized by dividing the sum to satisfy the requirement of Σicpi=1 in Eq. (5). {circumflex over (p)}max and Δ{circumflex over (p)} are referred to as the normalized results, which are further used in Eq. (7). The margin-based uncertainty is defined as:
This modification unifies the information carried by confidence, margin, and entropy. When margin Δ{circumflex over (p)} is fixed, ê(P) is non-decreasing with confidence {circumflex over (p)}max. When confidence {circumflex over (p)}max is fixed, ê(P) is non-decreasing with Δ{circumflex over (p)} as well. In doing so, the margin-based entropy score could consistently reflect the confidence level pmax as well as the margin Δp, as shown in
As previously discussed, the learned class marginal distribution from a few-shot fine-tuned model is severally imbalanced. Therefore, the importance of explicitly regularizing the categorical probability for each testing sample, as will now be disclosed, is emphasized.
The probability regularization is explicitly conducted on the predicted probability p(y|x) for each testing data. First, with x∈q, the learned class marginal distribution is estimated using the set x∪
s, which is constructed by combining each testing data with the whole support set. A unique scale vector v∈
is obtained for each testing sample by aligning the estimated marginal probability with a uniform prior:
Furthermore, v is used to conduct probability regularization on q=pθ(y|x) as:
and
(q*v) applies re-scaling on q to reduce the difference between estimated marginal distribution with the uniform prior.
In doing so, each sample from the query set obtains a unique scale vector v, which allows per-sample probability regularization. Meanwhile, aligning the estimated marginal probability of x∪s to uniform avoids direct regularization on the class marginal probability of the whole query set. This allows the probability regularization to be theoretically effective when the actual testing set is not uniform. The uniform prior serves as a solid regularization to enforce the class balance during fine-tuning.
By solving the issue of class-imbalanced predictions in few-shot learning, TF-MP enhances real-world few-shot applications. The margin-based uncertainty weighting provides a better measurement of the uncertainty in predictions with theoretical and empirical analysis.
As would be realized by one of skill in the art, many variations in the designs discussed herein fall within the intended scope of the invention. Moreover, it is to be understood that the features of the various embodiments described herein are not mutually exclusive and can exist in various combinations and permutations, even if such combinations or permutations were not made express herein, without departing from the spirit and scope of the invention. Accordingly, the method and system disclosed herein are not to be taken as limitations on the invention but as an illustration thereof. The scope of the invention is defined by the claims which follow.
This application is a non-provisional of, and claims the benefit of U.S. Provisional Patent Applications No. 63/396,655, filed Aug. 10, 2022, entitled “Transductive Few-Shot Classification With Decisive Weighting and Fairness Scaling”, the contents of which are incorporated herein in their entirety.
This invention was made with United States Government support under contract AW911NF20D0002 awarded by the U.S. Army. The U.S. Government has certain rights in the invention.
| Filing Document | Filing Date | Country | Kind |
|---|---|---|---|
| PCT/US23/29854 | 8/9/2023 | WO |
| Number | Date | Country | |
|---|---|---|---|
| 63396655 | Aug 2022 | US |