Home  >  Article  >  Technology peripherals  >  How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

WBOY
WBOYforward
2023-04-11 09:11:021317browse

Domain adaptation is an important method to solve transfer learning. The current domain adaptation method relies on the data of the original domain and the target domain for synchronous training. When the source domain data is not available and the target domain data is not completely visible, test-time training becomes a new domain adaptation method. Current research on Test-Time Training (TTT) widely utilizes self-supervised learning, contrastive learning, self-training and other methods. However, how to define TTT in real environments is often ignored, resulting in a lack of comparability between different methods.

Recently, South China University of Technology, the A*STAR team and Pengcheng Laboratory jointly proposed a systematic classification criterion for TTT problems, by distinguishing whether the method has sequential reasoning ability (Sequential Inference) and whether the source domain training objectives need to be modified, the current methods are classified in detail. At the same time, a method based on anchored clustering of target domain data is proposed, which achieves the highest classification accuracy under various TTT classifications. This article points out the right direction for subsequent research on TTT and avoids confusion in experimental settings. The results are not comparable. The research paper has been accepted for NeurIPS 2022.

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

  • ##Paper: https://arxiv.org/abs/2206.02721
  • Code: https://github.com/Gorilla-Lab-SCUT/TTAC
1. Introduction

The success of deep learning is mainly due to the large amount of annotated data and the assumption that the training set and the test set are independent and identically distributed. In general, when it is necessary to train on synthetic data and then test on real data, the above assumptions cannot be met, which is also called domain shift. To alleviate this problem, Domain Adaptation (DA) was born. Existing DA jobs either require access to data from the source and target domains during training, or train on multiple domains simultaneously. The former requires the model to always have access to source domain data during adaptation training, while the latter requires more expensive calculations. In order to reduce the dependence on source domain data, source domain data cannot be accessed due to privacy issues or storage overhead. Source-Free Domain Adaptation (SFDA) without source domain data solves the domain adaptation problem of inaccessible source domain data. The author found that SFDA needs to be trained on the entire target data set for multiple rounds to achieve convergence. SFDA cannot solve such problems when facing streaming data and the need to make timely inference predictions. This more realistic setting that requires timely adaptation to streaming data and making inference predictions is called Test-Time Training (TTT) or Test-Time Adaptation (TTA).

The author noticed that there is confusion in the community about the definition of TTT which leads to unfair comparisons. The paper classifies existing TTT methods based on two key factors:

  • For data that appears in a streaming format and requires timely prediction of the currently occurring data, It is called One-Pass Adaptation; for other protocols that do not meet the above settings, it is called Multi-Pass Adaptation. The model may need to be updated on the entire test set for multiple rounds. , and then make inference predictions from beginning to end.
  • Modify the training loss equation of the source domain according to whether it is necessary, such as introducing additional self-supervised branches to achieve a more effective TTT.

The goal of this paper is to solve the most realistic and challenging TTT protocol, that is, single-round adaptation without modifying the training loss equation. This setting is similar to the TTA proposed by TENT [1], but is not limited to using lightweight information from the source domain, such as statistics of features. Given the goal of TTT to adapt efficiently at test time, this assumption is computationally efficient and greatly improves the performance of TTT. The authors named this new TTT protocol sequential Test Time Training (sTTT).

In addition to the above classification of different TTT methods, the paper also proposes two technologies to make sTTT more effective and accurate:

  • The paper proposes the Test-Time Anchored Clustering (TTAC) method.
  • In order to reduce the impact of erroneous pseudo-labels on cluster updates, the paper filters pseudo-labels based on the network's prediction stability and confidence in the sample.

2. Method introduction

The paper is divided into four parts to explain the proposed method, which are 1) introducing the anchor of test-time training (TTT) fixed clustering module, as shown in the Anchored Clustering part in Figure 1; 2) introduce some strategies for filtering pseudo labels, as shown in the Pseudo Label Filter part in Figure 1; 3) different from the use of L2 distance in TTT [2] To measure the distance between two distributions, the author uses KL divergence to measure the distance between two global feature distributions; 4) Introduce an effective update iteration method for feature statistics in the test-time training (TTT) process. Finally, the fifth section gives the process code of the entire algorithm.

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

In the first part, in anchored clustering, the author first uses a mixture of Gaussians to model the features of the target domain, where each Gaussian component represents A discovered cluster. The authors then use the distribution of each category in the source domain as anchor points for the distribution in the target domain for matching. In this way, test data features can form clusters at the same time, and the clusters are associated with source domain categories, thereby achieving generalization to the target domain. In summary, the features of the source domain and the target domain are modeled according to the category information respectively:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

and then measure the two through KL divergence Mix the distance of Gaussian distribution and achieve the matching of the two domain features by reducing the KL divergence. However, there is no closed-form solution for directly solving the KL divergence on two mixed Gaussian distributions, which prevents the use of effective gradient optimization methods. In this paper, the author allocates the same number of clusters in the source and target domains, and each target domain cluster is assigned to a source domain cluster, so that the KL divergence solution of the entire mixed Gaussian can be turned into each pair Sum of KL divergences between Gaussians. The following formula:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

The closed form solution of the above formula is:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

In Formula 2, the parameters of the source domain cluster can be collected offline, and because only lightweight statistical data is used, it will not cause privacy leakage problems and only uses a small amount of computing and storage overhead. For variables in the target domain, the use of pseudo-labels is involved. For this purpose, the author designed an effective and lightweight pseudo-label filtering strategy.

The second part of the pseudo label filtering strategy is mainly divided into two parts:

1) Filtering of consistency prediction in time series:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

2) Filtering based on posterior probability:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

Finally , use the filtered samples to solve for the statistics of the target domain cluster:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

Part 3: In anchored clustering, some of the filtered samples do not participate in the estimation of the target domain. The author also performs global feature alignment on all test samples, similar to the approach to clusters in anchored clustering. Here all samples are regarded as an overall cluster, and

is defined in the source domain and target domain respectively. How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

Then again align the global feature distribution with the goal of minimizing KL divergence:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

Fourth The above three parts all introduce some domain alignment methods, but in the TTT process, it is not simple to estimate the distribution of a target domain because we cannot observe the data of the entire target domain. In cutting-edge work, TTT [2] uses a feature queue to store past partial samples to calculate a local distribution to estimate the overall distribution. But this not only brings memory overhead, but also leads to a trade off between accuracy and memory. In this paper, the author proposes an iterative update of statistics to alleviate memory overhead. The specific iterative update formula is as follows:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

In general, the entire algorithm is as shown in Algorithm 1:

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

3. Experimental results

As mentioned in the introduction, the author in this paper attaches great importance to the fair comparison of different methods under different TTT strategies. The author classifies all TTT methods according to the following two key factors: 1) whether one-pass adaptation protocol (One-Pass Adaptation) and 2) modifying the training loss equation of the source domain, respectively recorded as Y/N to indicate the need or no need to modify Source domain training equation, O/M represents single-round adaptation or multi-round adaptation. In addition, the author conducted sufficient comparative experiments and some further analysis on 6 benchmark data sets.

As shown in Table 1, TTT [2] appears under both N-O and Y-O protocols because TTT [2] has an additional self-supervised branch. We use N-O The loss of the self-supervised branch will not be added under the protocol, while the loss of this molecule can be used normally under Y-O. TTAC also uses the same self-supervised branch as TTT [2] under Y-O. As can be seen from the table, TTAC has achieved optimal results under all TTT protocols and all data sets; on both CIFAR10-C and CIFAR100-C data sets, TTAC has achieved an improvement of more than 3%. Table 2 - Table 5 show the data on ImageNet-C, CIFAR10.1, and VisDA respectively. TTAC has achieved the best results.

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

also, The author conducted rigorous ablation experiments under multiple TTT protocols at the same time, and clearly saw the role of each component, as shown in Table 6. First of all, from the comparison between L2 Dist and KLD, it can be seen that using KL divergence to measure the two distributions has a better effect; secondly, it is found that if Anchored Clustering or pseudo-label supervision is used alone, the improvement is only 14%, but if combined With Anchored Cluster and Pseudo Label Filter, you can see a significant performance improvement of 29.15% -> 11.33%. This also shows the necessity and effective combination of each component.

How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods

Наконец, автор полностью анализирует TTAC по пяти измерениям в конце текста, а именно совокупную производительность при sTTT (Н-О) и TSNE-визуализацию функций TTAC. , анализ TTT, независимый от исходного домена, анализ очередей тестовых образцов и раундов обновления, вычислительные затраты, измеряемые во времени настенных часов. Более интересные доказательства и анализ приведены в приложении к статье.

4.Резюме

В этой статье лишь кратко представлены основные моменты этой работы TTAC: классификация и сравнение существующих методов TTT, предлагаемых методов и различных экспериментов в рамках Классификация протоколов ТТТ. Более подробное обсуждение и анализ будут представлены в статье и приложении. Мы надеемся, что эта работа может стать справедливым эталоном для методов ТТТ и что будущие исследования будут сравниваться в рамках соответствующих протоколов.

The above is the detailed content of How to correctly define test phase training? Sequential inference and domain-adaptive clustering methods. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:51cto.com. If there is any infringement, please contact admin@php.cn delete