Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
摘要1 引言2 相关工作3 方法3.1 BYOL 的描述3.2 关于 BYOL 行为的直觉3.3 实现细节图像增强架构优化4 实验评估ImageNet 上的线性评估ImageNet 上的半监督训练迁移到其他分类任务迁移到其他视觉任务5 用消融建立直觉批次大小图像增强自举相对对比方法的消融网络超参数与 Mean Teacher 的关系接近最优的预测器的重要性6 结论更广泛的影响致谢参考文献附录 A 算法附录 B 图像增强附录 C 在 ImageNet 训练上的评估C.1 ImageNet 上的自监督学习评估ImageNet 上的线性评估协议ImageNet 线性评估的变体ImageNet 上的半监督学习C.2 更大架构上的线性评估与监督基线附录 D 迁移到其他数据集D.1 数据集D.2 经线性分类的迁移D.3 经微调的迁移D.4 语义分割实现细节D.5 目标检测实现细节D.6 深度估计实现细节D.7 PASCAL 与 NYU v2 Depth 上的进一步比较附录 E 在 Places 365 上预训练附录 F 额外消融结果F.1 架构设置F.2 批次大小F.3 图像增强F.4 与对比方法关系的细节F.5 第 5 节的 SimCLR 基线F.6 损失函数中归一化的消融附录 G 用更小批次训练附录 H 第 3.2 节方程 5 的细节附录 I 接近最优的预测器的重要性I.1 预测器学习率I.2 闭式最优线性预测器
返回论文列表
目录

Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning

收录于 NeurIPS 2020;arXiv:2006.07733被引 3,844 次
打开论文来源

Bootstrap Your Own Latent A New Approach to Self-Supervised Learning

Bootstrap Your Own Latent:一种新的自监督学习方法

Jean-Bastien Grill   Florian Strub 1 1 footnotemark: 1   Florent Altché 1 1 footnotemark: 1   Corentin Tallec 1 1 footnotemark: 1   Pierre H. Richemond 1 1 footnotemark: 1 † † thanks: Equal contribution; the order of first authors was randomly selected. Affiliation:  DeepMind Affiliation:  Imperial College    Elena Buchatskaya   Carl Doersch   Bernardo Avila Pires   Zhaohan Daniel Guo Affiliation:  DeepMind    Mohammad Gheshlaghi Azar   Bilal Piot   Koray Kavukcuoglu   Rémi Munos   Michal Valko Email:  [jbgrill,fstrub,altche,corentint,richemond]@google.com Affiliation:  DeepMind

Abstract

摘要

We introduce Bootstrap Your Own Latent (BYOL), a new approach to self-supervised image representation learning. BYOL relies on two neural networks, referred to as online and target networks, that interact and learn from each other. From an augmented view of an image, we train the online network to predict the target network representation of the same image under a different augmented view. At the same time, we update the target network with a slow-moving average of the online network. While state-of-the art methods rely on negative pairs, BYOL achieves a new state of the art without them. BYOL reaches 74.3%74.3\%74.3% top-1 classification accuracy on ImageNet using a linear evaluation with a ResNet-50 architecture and 79.6%79.6\%79.6% with a larger ResNet. We show that BYOL performs on par or better than the current state of the art on both transfer and semi-supervised benchmarks. Our implementation and pretrained models are given on GitHub.[^3]

我们提出 Bootstrap Your Own Latent(BYOL),一种新的自监督图像表征学习方法。BYOL 依赖两个神经网络——分别称为在线网络与目标网络——彼此交互、互相学习。给定一幅图像的增强视图,我们训练在线网络去预测同一图像在另一增强视图下由目标网络给出的表征;与此同时,用在线网络参数的慢速滑动平均更新目标网络。当前最先进方法依赖负样本对,而 BYOL 不使用负样本 即达到新的最优水平。在 ImageNet 上,用线性评估协议,ResNet-50 达到 74.3%74.3\%74.3% top-1 分类精度,更大 ResNet 达到 79.6%79.6\%79.6%。我们表明 BYOL 在迁移与半监督基准上与当前最优持平或更优。实现与预训练模型见 GitHub。

1 Introduction

1 引言

[1, 2, 3, 4, 5, 6, 7]

Figure 1

Figure 1: Performance of BYOL on ImageNet (linear evaluation) using ResNet-50 and our best architecture ResNet-200 (2×2\times2×), compared to other unsupervised and supervised (Sup​.​) baselines [8].

图 1:BYOL 在 ImageNet(线性评估)上使用 ResNet-50 以及我们最好架构 ResNet-200(2×2\times2×)的表现,并与其他无监督及监督(Sup.)基线对比 [8]。

Learning good image representations is a key challenge in computer vision [1, 2, 3] as it allows for efficient training on downstream tasks [4, 5, 6, 7]. Many different training approaches have been proposed to learn such representations, usually relying on visual pretext tasks. Among them, state-of-the-art contrastive methods [8, 9, 10, 11, 12] are trained by reducing the distance between representations of different augmented views of the same image (‘positive pairs’), and increasing the distance between representations of augmented views from different images (‘negative pairs’). These methods need careful treatment of negative pairs [13] by either relying on large batch sizes [8, 12], memory banks [9] or customized mining strategies [14, 15] to retrieve the negative pairs. In addition, their performance critically depends on the choice of image augmentations [8, 12].

学习良好的图像表征是计算机视觉的关键挑战 [1, 2, 3],因为它能让下游任务更高效地训练 [4, 5, 6, 7]。人们提出了许多训练此类表征的方法,通常依赖视觉代理任务。其中,当前最优的对比方法 [8, 9, 10, 11, 12] 通过缩小同一图像不同增强视图表征之间的距离(「正样本对」),并增大不同图像增强视图表征之间的距离(「负样本对」)来训练。这些方法需要谨慎处理负样本对 [13],要么依赖大批次 [8, 12]、记忆库 [9],要么定制挖掘策略 [14, 15] 来获取负样本。此外,其表现严重依赖图像增强的选择 [8, 12]。

In this paper, we introduce Bootstrap Your Own Latent (BYOL), a new algorithm for self-supervised learning of image representations. BYOL achieves higher performance than state-of-the-art contrastive methods without using negative pairs. It iteratively bootstraps[^4] the outputs of a network to serve as targets for an enhanced representation. Moreover, BYOL is more robust to the choice of image augmentations than contrastive methods; we suspect that not relying on negative pairs is one of the leading reasons for its improved robustness. While previous methods based on bootstrapping have used pseudo-labels [16], cluster indices [17] or a handful of labels [18, 19, 20], we propose to directly bootstrap the representations. In particular, BYOL uses two neural networks, referred to as online and target networks, that interact and learn from each other. Starting from an augmented view of an image, BYOL trains its online network to predict the target network’s representation of another augmented view of the same image. While this objective admits collapsed solutions, e.g., outputting the same vector for all images, we empirically show that BYOL does not converge to such solutions. We hypothesize (see Section 3.2) that the combination of (i) the addition of a predictor to the online network and (ii) the use of a slow-moving average of the online parameters as the target network encourages encoding more and more information within the online projection and avoids collapsed solutions.

本文提出 Bootstrap Your Own Latent(BYOL),一种新的图像表征自监督学习算法。BYOL 在不使用负样本对的情况下,取得高于当前最优对比方法的表现。它迭代地自举网络输出,作为增强表征的目标。此外,BYOL 对图像增强选择比对比方法更稳健;我们怀疑不依赖负样本对是稳健性提升的主因之一。先前基于自举的方法使用伪标签 [16]、聚类索引 [17] 或少量标签 [18, 19, 20],我们则提出直接自举表征。具体地,BYOL 使用在线与目标两个神经网络彼此交互学习。从一幅图像的增强视图出发,BYOL 训练在线网络去预测目标网络对同一图像另一增强视图的表征。该目标虽允许崩塌解(例如对所有图像输出同一向量),但我们经验上表明 BYOL 不会收敛到这类解。我们猜想(见第 3.2 节):(i) 在在线网络上增加预测器,以及 (ii) 用在线参数的慢速滑动平均作为目标网络,二者结合会鼓励在线投影编码越来越多的信息,并避免崩塌解。

We evaluate the representation learned by BYOL on ImageNet [21] and other vision benchmarks using ResNet architectures [22]. Under the linear evaluation protocol on ImageNet, consisting in training a linear classifier on top of the frozen representation, BYOL reaches 74.3%74.3\%74.3% top-1 accuracy with a standard ResNet-505050 and 79.6%79.6\%79.6% top-1 accuracy with a larger ResNet (Figure 1). In the semi-supervised and transfer settings on ImageNet, we obtain results on par or superior to the current state of the art. Our contributions are: (i) We introduce BYOL, a self-supervised representation learning method (Section 3) which achieves state-of-the-art results under the linear evaluation protocol on ImageNet without using negative pairs. (ii) We show that our learned representation outperforms the state of the art on semi-supervised and transfer benchmarks (Section 4). (iii) We show that BYOL is more resilient to changes in the batch size and in the set of image augmentations compared to its contrastive counterparts (Section 5). In particular, BYOL suffers a much smaller performance drop than SimCLR, a strong contrastive baseline, when only using random crops as image augmentations.

我们在 ImageNet [21] 及其他视觉基准上,用 ResNet 架构 [22] 评估 BYOL 学到的表征。在 ImageNet 线性评估协议下——即在冻结表征上训练线性分类器——标准 ResNet-50 达到 74.3%74.3\%74.3% top-1 精度,更大 ResNet 达到 79.6%79.6\%79.6% top-1 精度(图 1)。在 ImageNet 半监督与迁移设置中,结果与当前最优持平或更优。我们的贡献是:(i) 提出 BYOL(第 3 节),一种不使用负样本对、在 ImageNet 线性评估协议下达到最优的自监督表征学习方法;(ii) 表明所学表征在半监督与迁移基准上优于当前最优(第 4 节);(iii) 表明 BYOL 相对对比方法对批次大小与图像增强集合的变化更有韧性(第 5 节)。特别是,当只使用随机裁剪作为图像增强时,BYOL 的性能下降远小于强对比基线 SimCLR。

2 Related work

2 相关工作

Most unsupervised methods for representation learning can be categorized as either generative or discriminative [23, 8]. Generative approaches to representation learning build a distribution over data and latent embedding and use the learned embeddings as image representations. Many of these approaches rely either on auto-encoding of images [24, 25, 26] or on adversarial learning [27], jointly modelling data and representation [28, 29, 30, 31]. Generative methods typically operate directly in pixel space. This however is computationally expensive, and the high level of detail required for image generation may not be necessary for representation learning.

多数无监督表征学习方法可归为生成式或判别式 [23, 8]。生成式方法在数据与隐嵌入上建立分布,并把学到的嵌入当作图像表征。其中许多依赖图像自编码 [24, 25, 26] 或对抗学习 [27],联合建模数据与表征 [28, 29, 30, 31]。生成式方法通常直接在像素空间操作,计算昂贵,且图像生成所需的高细节对表征学习未必必要。

Among discriminative methods, contrastive methods [9, 10, 32, 33, 34, 11, 35, 36] currently achieve state-of-the-art performance in self-supervised learning [37, 8, 38, 12]. Contrastive approaches avoid a costly generation step in pixel space by bringing representation of different views of the same image closer (‘positive pairs’), and spreading representations of views from different images (‘negative pairs’) apart [39, 40]. Contrastive methods often require comparing each example with many other examples to work well [9, 8] prompting the question of whether using negative pairs is necessary.

在判别式方法中,对比方法 [9, 10, 32, 33, 34, 11, 35, 36] 目前在自监督学习中表现最优 [37, 8, 38, 12]。对比方法通过拉近同一图像不同视图的表征(「正样本对」)、推远不同图像视图的表征(「负样本对」)[39, 40],避免在像素空间做昂贵生成。对比方法往往需要把每个样本与许多其他样本比较才能工作得好 [9, 8],于是引出负样本对是否必要的问题。

DeepCluster [17] partially answers this question. It uses bootstrapping on previous versions of its representation to produce targets for the next representation; it clusters data points using the prior representation, and uses the cluster index of each sample as a classification target for the new representation. While avoiding the use of negative pairs, this requires a costly clustering phase and specific precautions to avoid collapsing to trivial solutions.

DeepCluster [17] 部分回答了该问题。它对自己先前版本的表征做自举,为下一表征产生目标:用先前表征对数据点聚类,并把每个样本的聚类索引当作新表征的分类目标。虽然避免了负样本对,但这需要昂贵的聚类阶段,并需采取特定防范以避免崩塌到平凡解。

Some self-supervised methods are not contrastive but rely on using auxiliary handcrafted prediction tasks to learn their representation. In particular, relative patch prediction [23, 40], colorizing gray-scale images [41, 42], image inpainting [43], image jigsaw puzzle [44], image super-resolution [45], and geometric transformations [46, 47] have been shown to be useful. Yet, even with suitable architectures [48], these methods are being outperformed by contrastive methods [37, 8, 12].

一些自监督方法不是对比式的,而是依赖手工设计的辅助预测任务来学习表征。相对图块预测 [23, 40]、灰度图上色 [41, 42]、图像修复 [43]、拼图 [44]、超分辨率 [45] 以及几何变换 [46, 47] 都被证明有用。然而即便有合适架构 [48],这些方法也正被对比方法超越 [37, 8, 12]。

Our approach has some similarities with Predictions of Bootstrapped Latents (PBL, [49]), a self-supervised representation learning technique for reinforcement learning (RL). PBL jointly trains the agent’s history representation and an encoding of future observations. The observation encoding is used as a target to train the agent’s representation, and the agent’s representation as a target to train the observation encoding. Unlike PBL, BYOL uses a slow-moving average of its representation to provide its targets, and does not require a second network.

我们的方法与强化学习中的自监督表征学习技术 Predictions of Bootstrapped Latents(PBL,[49])有一些相似。PBL 联合训练智能体历史表征与未来观测编码。观测编码用作训练智能体表征的目标,智能体表征又用作训练观测编码的目标。与 PBL 不同,BYOL 用自身表征的慢速滑动平均提供目标,且不需要第二个网络。

The idea of using a slow-moving average target network to produce stable targets for the online network was inspired by deep RL [50, 51, 52, 53]. Target networks stabilize the bootstrapping updates provided by the Bellman equation, making them appealing to stabilize the bootstrap mechanism in BYOL. While most RL methods use fixed target networks, BYOL uses a weighted moving average of previous networks (as in [54]) in order to provide smoother changes in the target representation.

用慢速滑动平均目标网络为在线网络产生稳定目标的想法,受深度强化学习启发 [50, 51, 52, 53]。目标网络稳定贝尔曼方程提供的自举更新,因而也适合稳定 BYOL 中的自举机制。多数 RL 方法使用固定目标网络,而 BYOL 使用先前网络的加权滑动平均(如 [54]),以使目标表征变化更平滑。

In the semi-supervised setting [55, 56], an unsupervised loss is combined with a classification loss over a handful of labels to ground the training [19, 20, 57, 58, 59, 60, 61, 62]. Among these methods, mean teacher (MT) [20] also uses a slow-moving average network, called teacher, to produce targets for an online network, called student. An ℓ2\ell_{2}ℓ2​ consistency loss between the softmax predictions of the teacher and the student is added to the classification loss. While [20] demonstrates the effectiveness of MT in the semi-supervised learning case, in Section 5 we show that a similar approach collapses when removing the classification loss. In contrast, BYOL introduces an additional predictor on top of the online network, which prevents collapse.

在半监督设置中 [55, 56],无监督损失与少量标签上的分类损失结合,以锚定训练 [19, 20, 57, 58, 59, 60, 61, 62]。其中 mean teacher(MT)[20] 也使用慢速滑动平均网络(称为教师)为在线网络(称为学生)产生目标。教师与学生 softmax 预测之间的 ℓ2\ell_{2}ℓ2​ 一致性损失被加到分类损失上。[20] 证明了 MT 在半监督学习中的有效性,但在第 5 节我们表明:去掉分类损失后,类似做法会崩塌。相比之下,BYOL 在在线网络之上引入额外预测器,从而防止崩塌。

Finally, in self-supervised learning, MoCo [9] uses a slow-moving average network (momentum encoder) to maintain consistent representations of negative pairs drawn from a memory bank. Instead, BYOL uses a moving average network to produce prediction targets as a means of stabilizing the bootstrap step. We show in Section 5 that this mere stabilizing effect can also improve existing contrastive methods.

最后,在自监督学习中,MoCo [9] 使用慢速滑动平均网络(动量编码器)来维护从记忆库抽取的负样本对的一致表征。BYOL 则用滑动平均网络产生预测目标,作为稳定自举步骤的手段。我们在第 5 节表明,这一单纯的稳定效果也能改进现有对比方法。

3 Method

3 方法

We start by motivating our method before explaining its details in Section 3.1. Many successful self-supervised learning approaches build upon the cross-view prediction framework introduced in [63]. Typically, these approaches learn representations by predicting different views (e.g., different random crops) of the same image from one another. Many such approaches cast the prediction problem directly in representation space: the representation of an augmented view of an image should be predictive of the representation of another augmented view of the same image. However, predicting directly in representation space can lead to collapsed representations: for instance, a representation that is constant across views is always fully predictive of itself. Contrastive methods circumvent this problem by reformulating the prediction problem into one of discrimination: from the representation of an augmented view, they learn to discriminate between the representation of another augmented view of the same image, and the representations of augmented views of different images. In the vast majority of cases, this prevents the training from finding collapsed representations. Yet, this discriminative approach typically requires comparing each representation of an augmented view with many negative examples, to find ones sufficiently close to make the discrimination task challenging. In this work, we thus tasked ourselves to find out whether these negative examples are indispensable to prevent collapsing while preserving high performance.

我们先说明动机,再在第 3.1 节给出细节。许多成功的自监督学习方法建立在 [63] 提出的跨视图预测框架之上。这些方法通常通过从一个视图预测同一图像的另一视图(例如不同随机裁剪)来学习表征。许多方法把预测问题直接放在表征空间:一幅图像增强视图的表征应能预测同一图像另一增强视图的表征。然而直接在表征空间预测可能导致崩塌表征:例如跨视图恒定的表征总是能完全预测自身。对比方法把预测改写成判别:从一幅增强视图的表征出发,学会把同一图像另一增强视图的表征,与不同图像增强视图的表征区分开。绝大多数情况下,这能防止训练找到崩塌表征。但这种判别做法通常需要把每个增强视图的表征与大量负例比较,才能找到足够接近、使判别任务具有挑战性的样本。因此,本工作的任务是弄清:负例对于防止崩塌同时保持高性能是否必不可少。

To prevent collapse, a straightforward solution is to use a fixed randomly initialized network to produce the targets for our predictions. While avoiding collapse, it empirically does not result in very good representations. Nonetheless, it is interesting to note that the representation obtained using this procedure can already be much better than the initial fixed representation. In our ablation study (Section 5), we apply this procedure by predicting a fixed randomly initialized network and achieve 18.8%18.8\%18.8% top-1 accuracy (Table 5(a)) on the linear evaluation protocol on ImageNet, whereas the randomly initialized network only achieves 1.4%1.4\%1.4% by itself. This experimental finding is the core motivation for BYOL: from a given representation, referred to as target, we can train a new, potentially enhanced representation, referred to as online, by predicting the target representation. From there, we can expect to build a sequence of representations of increasing quality by iterating this procedure, using subsequent online networks as new target networks for further training. In practice, BYOL generalizes this bootstrapping procedure by iteratively refining its representation, but using a slowly moving exponential average of the online network as the target network instead of fixed checkpoints.

为防止崩塌,一个直接办法是用固定的随机初始化网络产生预测目标。虽能避免崩塌,但经验上得不到很好的表征。有趣的是,用该流程得到的表征已经可以远好于初始固定表征。在消融(第 5 节)中,我们预测一个固定随机初始化网络,在 ImageNet 线性评估上达到 18.8%18.8\%18.8% top-1 精度(表 5(a)),而随机初始化网络本身只有 1.4%1.4\%1.4%。这一实验发现是 BYOL 的核心动机:从给定表征(称为目标)出发,可通过预测目标表征来训练新的、可能更强的表征(称为在线)。由此可期望通过迭代该流程、把后续在线网络当作新的目标网络继续训练,构建质量递增的表征序列。实践中,BYOL 推广这一自举流程,迭代 refinement 其表征,但用在线网络的慢速指数滑动平均作为目标网络,而不是固定检查点。

3.1 Description of BYOL

3.1 BYOL 的描述

Figure 2

Figure 2: BYOL’s architecture. BYOL minimizes a similarity loss between qθ(zθ)q_{\theta}(z_{\theta})qθ​(zθ​) and sg(zξ′)\mathrm{sg}(z^{\prime}_{\xi})sg(zξ′​), where θ{\theta}θ are the trained weights, ξ\xiξ are an exponential moving average of θ{\theta}θ and sg\mathrm{sg}sg means stop-gradient. At the end of training, everything but fθf_{\theta}fθ​ is discarded, and yθy_{\theta}yθ​ is used as the image representation.

图 2:BYOL 的架构。BYOL 最小化 qθ(zθ)q_{\theta}(z_{\theta})qθ​(zθ​) 与 sg(zξ′)\mathrm{sg}(z^{\prime}_{\xi})sg(zξ′​) 之间的相似性损失,其中 θ{\theta}θ 是训练权重,ξ\xiξ 是 θ{\theta}θ 的指数滑动平均,sg\mathrm{sg}sg 表示停止梯度。训练结束时,除 fθf_{\theta}fθ​ 外全部丢弃,并用 yθy_{\theta}yθ​ 作为图像表征。

BYOL’s goal is to learn a representation yθy_{\theta}yθ​ which can then be used for downstream tasks. As described previously, BYOL uses two neural networks to learn: the online and target networks. The online network is defined by a set of weights θ{\theta}θ and is comprised of three stages: an encoder fθf_{\theta}fθ​, a projector gθg_{\theta}gθ​ and a predictor qθq_{\theta}qθ​, as shown in Figure 2 and Figure 8. The target network has the same architecture as the online network, but uses a different set of weights ξ\xiξ. The target network provides the regression targets to train the online network, and its parameters ξ\xiξ are an exponential moving average of the online parameters θ{\theta}θ [54]. More precisely, given a target decay rate τ∈[0,1]\tau\in[0,1]τ∈[0,1], after each training step we perform the following update,

BYOL 的目标是学习可用于下游任务的表征 yθy_{\theta}yθ​。如前所述,BYOL 用两个神经网络学习:在线网络与目标网络。在线网络由权重 θ{\theta}θ 定义,包含三个阶段:编码器 fθf_{\theta}fθ​、投影器 gθg_{\theta}gθ​ 与预测器 qθq_{\theta}qθ​,如图 2 与图 8 所示。目标网络架构与在线网络相同,但使用不同权重集 ξ\xiξ。目标网络为训练在线网络提供回归目标,其参数 ξ\xiξ 是在线参数 θ{\theta}θ 的指数滑动平均 [54]。更精确地,给定目标衰减率 τ∈[0,1]\tau\in[0,1]τ∈[0,1],每一步训练后执行如下更新,

ξ←τξ+(1−τ)θ.(1)\xi\leftarrow\tau\xi+(1-\tau){\theta}. \tag{1}ξ←τξ+(1−τ)θ.(1)

Given a set of images D\mathcal{D}D, an image x∼Dx\sim\mathcal{D}x∼D sampled uniformly from D\mathcal{D}D, and two distributions of image augmentations T\mathcal{T}T and T′\mathcal{T}^{\prime}T′, BYOL produces two augmented views v\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}t(x) and v^{\prime}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}t^{\prime}(x) from xxx by applying respectively image augmentations t∼Tt\sim\mathcal{T}t∼T and t′∼T′t^{\prime}\sim\mathcal{T}^{\prime}t′∼T′. From the first augmented view vvv, the online network outputs a representation y_{\theta}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}f_{\theta}(v) and a projection z_{\theta}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}g_{\theta}(y). The target network outputs y^{\prime}_{\xi}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}f_{\xi}(v^{\prime}) and the target projection z^{\prime}_{\xi}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}g_{\xi}(y^{\prime}) from the second augmented view v′v^{\prime}v′. We then output a prediction qθ(zθ)q_{\theta}(z_{\theta})qθ​(zθ​) of zξ′z^{\prime}_{\xi}zξ′​ and ℓ2\ell_{2}ℓ2​-normalize both qθ(zθ)q_{\theta}(z_{\theta})qθ​(zθ​) and zξ′z^{\prime}_{\xi}zξ′​ to \overline{q_{\theta}}(z_{\theta})\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}q_{\theta}(z_{\theta})/\mathopen{}\mathclose{{\left\|q_{\theta}(z_{\theta})}}\right\|_{2} and \overline{z}^{\prime}_{\xi}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{=}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{\scriptscriptstyle\Delta}}\hskip-2.7431pt\hskip 3.8889pt}}z^{\prime}_{\xi}/\|z^{\prime}_{\xi}\|_{2}. Note that this predictor is only applied to the online branch, making the architecture asymmetric between the online and target pipeline. Finally we define the following mean squared error between the normalized predictions and target projections,[^5]

给定图像集 D\mathcal{D}D,从 D\mathcal{D}D 均匀采样图像 x∼Dx\sim\mathcal{D}x∼D,以及两组图像增强分布 T\mathcal{T}T 与 T′\mathcal{T}^{\prime}T′,BYOL 分别施加增强 t∼Tt\sim\mathcal{T}t∼T 与 t′∼T′t^{\prime}\sim\mathcal{T}^{\prime}t′∼T′,从 xxx 产生两个增强视图 v=t(x)v=t(x)v=t(x) 与 v′=t′(x)v^{\prime}=t^{\prime}(x)v′=t′(x)。从第一个增强视图 vvv,在线网络输出表征 yθ=fθ(v)y_{\theta}=f_{\theta}(v)yθ​=fθ​(v) 与投影 zθ=gθ(y)z_{\theta}=g_{\theta}(y)zθ​=gθ​(y)。目标网络从第二个增强视图 v′v^{\prime}v′ 输出 yξ′=fξ(v′)y^{\prime}_{\xi}=f_{\xi}(v^{\prime})yξ′​=fξ​(v′) 与目标投影 zξ′=gξ(y′)z^{\prime}_{\xi}=g_{\xi}(y^{\prime})zξ′​=gξ​(y′)。然后我们输出对 zξ′z^{\prime}_{\xi}zξ′​ 的预测 qθ(zθ)q_{\theta}(z_{\theta})qθ​(zθ​),并把 qθ(zθ)q_{\theta}(z_{\theta})qθ​(zθ​) 与 zξ′z^{\prime}_{\xi}zξ′​ 都做 ℓ2\ell_{2}ℓ2​ 归一化。注意预测器只加在在线分支,使在线与目标流水线不对称。最后,我们定义归一化预测与目标投影之间的均方误差,

\mathcal{L}_{{\theta},\xi}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\mathopen{}\mathclose{{\left\|\overline{q_{\theta}}(z_{\theta})-\overline{z}^{\prime}_{\xi}}}\right\|_{2}^{2}=2-2\cdot\frac{\langle q_{\theta}(z_{\theta}),z^{\prime}_{\xi}\rangle}{\big\|q_{\theta}(z_{\theta})\big\|_{2}\cdot\big\|z^{\prime}_{\xi}\big\|_{2}}\cdot \tag{2}

We symmetrize the loss Lθ,ξ\mathcal{L}_{{\theta},\xi}Lθ,ξ​ in Equation 2 by separately feeding v′v^{\prime}v′ to the online network and vvv to the target network to compute L~θ,ξ\widetilde{\mathcal{L}}_{{\theta},\xi}Lθ,ξ​. At each training step, we perform a stochastic optimization step to minimize Lθ,ξBYOL=Lθ,ξ+L~θ,ξ\mathcal{L}^{\texttt{BYOL}}_{{\theta},\xi}=\mathcal{L}_{{\theta},\xi}+\widetilde{\mathcal{L}}_{{\theta},\xi}Lθ,ξBYOL​=Lθ,ξ​+Lθ,ξ​ with respect to θ{\theta}θ only, but not ξ\xiξ, as depicted by the stop-gradient in Figure 2. BYOL’s dynamics are summarized as

我们通过分别把 v′v^{\prime}v′ 送入在线网络、把 vvv 送入目标网络来计算 L~θ,ξ\widetilde{\mathcal{L}}_{{\theta},\xi}Lθ,ξ​,从而对称化方程 2 中的损失 Lθ,ξ\mathcal{L}_{{\theta},\xi}Lθ,ξ​。每一步训练中,我们对 θ{\theta}θ(而不是 ξ\xiξ)做随机优化步,以最小化 Lθ,ξBYOL=Lθ,ξ+L~θ,ξ\mathcal{L}^{\texttt{BYOL}}_{{\theta},\xi}=\mathcal{L}_{{\theta},\xi}+\widetilde{\mathcal{L}}_{{\theta},\xi}Lθ,ξBYOL​=Lθ,ξ​+Lθ,ξ​,如图 2 中的停止梯度所示。BYOL 的动态可概括为

\displaystyle{\theta}\leftarrow\mathrm{optimizer}\mathopen{}\mathclose{{\left({\theta},\nabla_{\theta}\mathcal{L}^{\texttt{BYOL}}_{{\theta},\xi},\eta}}\right), \\ \displaystyle\xi\leftarrow\tau\xi+(1-\tau){\theta}, \tag{3}

where optimizer\mathrm{optimizer}optimizer is an optimizer and η\etaη is a learning rate.

其中 optimizer\mathrm{optimizer}optimizer 是优化器,η\etaη 是学习率。

At the end of training, we only keep the encoder fθf_{\theta}fθ​; as in [9]. When comparing to other methods, we consider the number of inference-time weights only in the final representation fθf_{\theta}fθ​. The full training procedure is summarized in Appendix A, and python pseudo-code based on the libraries JAX [64] and Haiku [65] is provided in in Appendix J.

训练结束时,我们只保留编码器 fθf_{\theta}fθ​;与 [9] 相同。与其他方法比较时,我们只计最终表征 fθf_{\theta}fθ​ 中推理时权重的数量。完整训练流程见附录 A;基于 JAX [64] 与 Haiku [65] 的 python 伪代码见附录 J。

3.2 Intuitions on BYOL’s behavior

3.2 关于 BYOL 行为的直觉

As BYOL does not use an explicit term to prevent collapse (such as negative examples [10]) while minimizing Lθ,ξBYOL\mathcal{L}_{{\theta},\xi}^{\texttt{BYOL}}Lθ,ξBYOL​ with respect to θ{\theta}θ, it may seem that BYOL should converge to a minimum of this loss with respect to (θ,ξ)({\theta},\xi)(θ,ξ) (e.g., a collapsed constant representation). However BYOL’s target parameters ξ\xiξ updates are not in the direction of ∇ξLθ,ξBYOL\nabla_{\xi}\mathcal{L}_{{\theta},\xi}^{\texttt{BYOL}}∇ξ​Lθ,ξBYOL​. More generally, we hypothesize that there is no loss Lθ,ξL_{{\theta},\xi}Lθ,ξ​ such that BYOL’s dynamics is a gradient descent on LLL jointly over θ,ξ{\theta},\xiθ,ξ. This is similar to GANs [66], where there is no loss that is jointly minimized w.r.t. both the discriminator and generator parameters. There is therefore no a priori reason why BYOL’s parameters would converge to a minimum of Lθ,ξBYOL\mathcal{L}^{\texttt{BYOL}}_{{\theta},\xi}Lθ,ξBYOL​.

由于 BYOL 没有显式防崩塌项(例如负例 [10]),同时又相对 θ{\theta}θ 最小化 Lθ,ξBYOL\mathcal{L}_{{\theta},\xi}^{\texttt{BYOL}}Lθ,ξBYOL​,看似应收敛到该损失关于 (θ,ξ)({\theta},\xi)(θ,ξ) 的极小值(例如崩塌的恒定表征)。然而 BYOL 的目标参数 ξ\xiξ 更新并不沿 ∇ξLθ,ξBYOL\nabla_{\xi}\mathcal{L}_{{\theta},\xi}^{\texttt{BYOL}}∇ξ​Lθ,ξBYOL​ 方向。更一般地,我们猜想不存在损失 Lθ,ξL_{{\theta},\xi}Lθ,ξ​,使得 BYOL 的动态是对 LLL 关于 θ,ξ{\theta},\xiθ,ξ 的联合梯度下降。这与 GAN [66] 类似:不存在同时对判别器与生成器参数联合最小化的损失。因此,没有先验理由认为 BYOL 的参数会收敛到 Lθ,ξBYOL\mathcal{L}^{\texttt{BYOL}}_{{\theta},\xi}Lθ,ξBYOL​ 的极小值。

While BYOL’s dynamics still admit undesirable equilibria, we did not observe convergence to such equilibria in our experiments. In addition, when assuming BYOL’s predictor to be optimal[^6] i.e., qθ=q⋆q_{\theta}=q^{\star}qθ​=q⋆ with

尽管 BYOL 的动态仍存在不良均衡,我们在实验中并未观察到收敛到此类均衡。此外,当假定 BYOL 的预测器最优,即 qθ=q⋆q_{\theta}=q^{\star}qθ​=q⋆,其中

q^{\star}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\argmin_{q}\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|q(z_{\theta})-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right],\quad\text{where}\quad q^{\star}(z_{\theta})=\mathbb{E}\mathopen{}\mathclose{{\left[z^{\prime}_{\xi}|z_{\theta}}}\right], \tag{4}

we hypothesize that the undesirable equilibria are unstable. Indeed, in this optimal predictor case, BYOL’s updates on θ{\theta}θ follow in expectation the gradient of the expected conditional variance (see Appendix H for details),

我们猜想不良均衡是不稳定的。的确,在该最优预测器情形下,BYOL 对 θ{\theta}θ 的更新在期望上跟随期望条件方差的梯度(细节见附录 H),

\nabla_{\theta}\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|q^{\star}(z_{\theta})-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right]=\nabla_{\theta}\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|\mathbb{E}\mathopen{}\mathclose{{\left[z^{\prime}_{\xi}|z_{\theta}}}\right]-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right]=\nabla_{\theta}\mathbb{E}\mathopen{}\mathclose{{\left[\sum_{i}\var(z^{\prime}_{\xi,i}|z_{\theta})}}\right], \tag{5}

where zξ,i′z^{\prime}_{\xi,i}zξ,i′​ is the iii-th feature of zξ′z^{\prime}_{\xi}zξ′​.

其中 zξ,i′z^{\prime}_{\xi,i}zξ,i′​ 是 zξ′z^{\prime}_{\xi}zξ′​ 的第 iii 个特征。

Note that for any random variables X,X,X, Y,Y,Y, and ZZZ, \var(X∣Y,Z)≤\var(X∣Y)\var(X|Y,Z)\leq\var(X|Y)\var(X∣Y,Z)≤\var(X∣Y). Let XXX be the target projection, YYY the current online projection, and ZZZ an additional variability on top of the online projection induced by stochasticities in the training dynamics: purely discarding information from the online projection cannot decrease the conditional variance.

注意对任意随机变量 XXX、YYY 与 ZZZ,有 var(X∣Y,Z)≤var(X∣Y)\mathrm{var}(X|Y,Z)\leq\mathrm{var}(X|Y)var(X∣Y,Z)≤var(X∣Y)。令 XXX 为目标投影,YYY 为当前在线投影,ZZZ 为训练动态随机性在在线投影之上引入的额外可变性:单纯从在线投影丢弃信息不可能降低条件方差。

In particular, BYOL avoids constant features in zθz_{\theta}zθ​ as, for any constant ccc and random variables zθz_{\theta}zθ​ and zξ′z^{\prime}_{\xi}zξ′​, \var(zξ′∣zθ)≤\var(zξ′∣c)\var(z^{\prime}_{\xi}|z_{\theta})\leq\var(z^{\prime}_{\xi}|c)\var(zξ′​∣zθ​)≤\var(zξ′​∣c); hence our hypothesis on these collapsed constant equilibria being unstable. Interestingly, if we were to minimize E[∑i\var(zξ,i′∣zθ)]\mathbb{E}[\sum_{i}\var(z^{\prime}_{\xi,i}|z_{\theta})]E[∑i​\var(zξ,i′​∣zθ​)] with respect to ξ\xiξ, we would get a collapsed zξ′z^{\prime}_{\xi}zξ′​ as the variance is minimized for a constant zξ′z^{\prime}_{\xi}zξ′​. Instead, BYOL makes ξ\xiξ closer to θ{\theta}θ, incorporating sources of variability captured by the online projection into the target projection.

特别地,BYOL 会避免 zθz_{\theta}zθ​ 中的恒定特征,因为对任意常数 ccc 与随机变量 zθz_{\theta}zθ​、zξ′z^{\prime}_{\xi}zξ′​,有 var(zξ′∣zθ)≤var(zξ′∣c)\mathrm{var}(z^{\prime}_{\xi}|z_{\theta})\leq\mathrm{var}(z^{\prime}_{\xi}|c)var(zξ′​∣zθ​)≤var(zξ′​∣c);因此我们猜想这些崩塌的恒定均衡不稳定。有趣的是,若相对 ξ\xiξ 最小化 E[∑ivar(zξ,i′∣zθ)]\mathbb{E}[\sum_{i}\mathrm{var}(z^{\prime}_{\xi,i}|z_{\theta})]E[∑i​var(zξ,i′​∣zθ​)],会得到崩塌的 zξ′z^{\prime}_{\xi}zξ′​,因为方差在恒定 zξ′z^{\prime}_{\xi}zξ′​ 时最小。相反,BYOL 使 ξ\xiξ 靠近 θ{\theta}θ,把在线投影捕获的可变性来源并入目标投影。

Furthemore, notice that performing a hard-copy of the online parameters θ{\theta}θ into the target parameters ξ\xiξ would be enough to propagate new sources of variability. However, sudden changes in the target network might break the assumption of an optimal predictor, in which case BYOL’s loss is not guaranteed to be close to the conditional variance. We hypothesize that the main role of BYOL’s moving-averaged target network is to ensure the near-optimality of the predictor over training; Section 5 and Appendix I provide some empirical support of this interpretation.

此外,注意把在线参数 θ{\theta}θ 硬拷贝到目标参数 ξ\xiξ 已足以传播新的可变性来源。然而目标网络突变可能破坏预测器近似最优的假设,此时 BYOL 损失不再保证接近条件方差。我们猜想 BYOL 滑动平均目标网络的主要作用,是在整个训练过程中保证预测器接近最优;第 5 节与附录 I 为该解释提供了一些经验支持。

3.3 Implementation details

3.3 实现细节

Image augmentations

BYOL uses the same set of image augmentations as in SimCLR [8]. First, a random patch of the image is selected and resized to 224×224224\times 224224×224 with a random horizontal flip, followed by a color distortion, consisting of a random sequence of brightness, contrast, saturation, hue adjustments, and an optional grayscale conversion. Finally Gaussian blur and solarization are applied to the patches. Additional details on the image augmentations are in Appendix B.

图像增强

BYOL 使用与 SimCLR [8] 相同的图像增强集合。首先随机选取图像图块并缩放到 224×224224\times 224224×224,伴随随机水平翻转,然后做颜色扰动(亮度、对比度、饱和度、色调的随机序列调整,以及可选灰度转换)。最后对图块施加高斯模糊与曝光过度(solarization)。图像增强的更多细节见附录 B。

Architecture

We use a convolutional residual network [22] with 50 layers and post-activation (ResNet-50(1×)50(1\times)50(1×) v1) as our base parametric encoders fθf_{\theta}fθ​ and fξf_{\xi}fξ​. We also use deeper (505050, 101101101, 152152152 and 200200200 layers) and wider (from 1×1\times1× to 4×4\times4×) ResNets, as in [67, 48, 8]. Specifically, the representation yyy corresponds to the output of the final average pooling layer, which has a feature dimension of 204820482048 (for a width multiplier of 1×1\times1×). As in SimCLR [8], the representation yyy is projected to a smaller space by a multi-layer perceptron (MLP) gθg_{\theta}gθ​, and similarly for the target projection gξg_{\xi}gξ​. This MLP consists in a linear layer with output size 409640964096 followed by batch normalization [68], rectified linear units (ReLU) [69], and a final linear layer with output dimension 256256256. Contrary to SimCLR, the output of this MLP is not batch normalized. The predictor qθq_{\theta}qθ​ uses the same architecture as gθg_{\theta}gθ​.

架构

我们使用带 50 层与后激活的卷积残差网络 [22](ResNet-50(1×)50(1\times)50(1×) v1)作为基础参数编码器 fθf_{\theta}fθ​ 与 fξf_{\xi}fξ​。我们也使用更深(505050、101101101、152152152 与 200200200 层)与更宽(从 1×1\times1× 到 4×4\times4×)的 ResNet,如 [67, 48, 8]。具体地,表征 yyy 对应最终平均池化层的输出,特征维为 204820482048(宽度乘数 1×1\times1× 时)。与 SimCLR [8] 一样,表征 yyy 由多层感知机(MLP)gθg_{\theta}gθ​ 投影到更小空间,目标投影 gξg_{\xi}gξ​ 同理。该 MLP 由输出大小 409640964096 的线性层、批归一化 [68]、ReLU [69],以及输出维 256256256 的最终线性层组成。与 SimCLR 不同,该 MLP 输出不做批归一化。预测器 qθq_{\theta}qθ​ 使用与 gθg_{\theta}gθ​ 相同的架构。

Optimization

We use the LARS optimizer [70] with a cosine decay learning rate schedule [71], without restarts, over 100010001000 epochs, with a warm-up period of 101010 epochs. We set the base learning rate to 0.2,0.2,0.2, scaled linearly [72] with the batch size (LearningRate=0.2×BatchSize/256\text{LearningRate}=0.2\times\text{BatchSize}/256LearningRate=0.2×BatchSize/256). In addition, we use a global weight decay parameter of 1.5⋅10−61.5\cdot 10^{-6}1.5⋅10−6 while excluding the biases and batch normalization parameters from both LARS adaptation and weight decay. For the target network, the exponential moving average parameter τ\tauτ starts from τbase=0.996\tau_{\text{base}}=0.996τbase​=0.996 and is increased to one during training. Specifically, we set \tau\triangleq 1-(1-\tau_{\text{base}})\cdot\mathopen{}\mathclose{{\left(\cos\mathopen{}\mathclose{{\left(\pi k/K}}\right)+1}}\right)/2 with kkk the current training step and KKK the maximum number of training steps. We use a batch size of 409640964096 split over 512512512 Cloud TPU v333 cores. With this setup, training takes approximately 888 hours for a ResNet-50(×1)50(\times 1)50(×1). All hyperparameters are summarized in Appendix J; an additional set of hyperparameters for a smaller batch size of 512512512 is provided in Appendix G.

优化

我们使用 LARS 优化器 [70],配合余弦衰减学习率日程 [71],无重启,共 100010001000 个 epoch,预热 101010 个 epoch。基础学习率设为 0.20.20.2,并随批次线性缩放 [72](LearningRate=0.2×BatchSize/256\mathrm{LearningRate}=0.2\times\mathrm{BatchSize}/256LearningRate=0.2×BatchSize/256)。此外,全局权重衰减参数为 1.5⋅10−61.5\cdot 10^{-6}1.5⋅10−6,偏置与批归一化参数不参与 LARS 自适应与权重衰减。对目标网络,指数滑动平均参数 τ\tauτ 从 τbase=0.996\tau_{\mathrm{base}}=0.996τbase​=0.996 起步并在训练中增至 1。具体地,我们设 τ≜1−(1−τbase)⋅(cos⁡(πk/K)+1)/2\tau\triangleq 1-(1-\tau_{\mathrm{base}})\cdot(\cos(\pi k/K)+1)/2τ≜1−(1−τbase​)⋅(cos(πk/K)+1)/2,其中 kkk 为当前训练步,KKK 为最大训练步数。批次大小为 409640964096,分到 512512512 个 Cloud TPU v3 核心。该设置下,ResNet-50(×1)50(\times 1)50(×1) 训练约需 888 小时。全部超参见附录 J;批次 512512512 的另一组超参见附录 G。

4 Experimental evaluation

4 实验评估

We assess the performance of BYOL’s representation after self-supervised pretraining on the training set of the ImageNet ILSVRC-2012 dataset [21]. We first evaluate it on ImageNet (IN) in both linear evaluation and semi-supervised setups. We then measure its transfer capabilities on other datasets and tasks, including classification, segmentation, object detection and depth estimation. For comparison, we also report scores for a representation trained using labels from the train ImageNet subset, referred to as Supervised-IN. In Appendix E, we assess the generality of BYOL by pretraining a representation on the Places365-Standard dataset [73] before reproducing this evaluation protocol.

我们在 ImageNet ILSVRC-2012 数据集 [21] 的训练集上做自监督预训练后,评估 BYOL 表征的表现。先在 ImageNet(IN)上分别做线性评估与半监督设置;再度量其在其他数据集与任务上的迁移能力,包括分类、分割、目标检测与深度估计。为对照,我们也报告用 ImageNet 训练子集标签训练的表征分数,记为 Supervised-IN。附录 E 中,我们在 Places365-Standard 数据集 [73] 上预训练表征,并复现该评估协议,以检验 BYOL 的通用性。

Linear evaluation on ImageNet

We first evaluate BYOL’s representation by training a linear classifier on top of the frozen representation, following the procedure described in [48, 74, 41, 10, 8], and section C.1; we report top-111 and top-555 accuracies in % on the test set in Table 1. With a standard ResNet-505050 (×1\times 1×1) BYOL obtains 74.3%74.3\%74.3% top-111 accuracy (91.6%91.6\%91.6% top-555 accuracy), which is a 1.3%1.3\%1.3% (resp. 0.5%0.5\%0.5%) improvement over the previous self-supervised state of the art [12]. This tightens the gap with respect to the supervised baseline of [8], 76.5%76.5\%76.5%, but is still significantly below the stronger supervised baseline of [75], 78.9%78.9\%78.9%. With deeper and wider architectures, BYOL consistently outperforms the previous state of the art (Section C.2), and obtains a best performance of 79.6%79.6\%79.6% top-111 accuracy, ranking higher than previous self-supervised approaches. On a ResNet-505050 (4×4\times4×) BYOL achieves 78.6%78.6\%78.6%, similar to the 78.9%78.9\%78.9% of the best supervised baseline in [8] for the same architecture.

ImageNet 上的线性评估

我们首先在冻结表征上训练线性分类器来评估 BYOL 的表征,流程遵循 [48, 74, 41, 10, 8] 以及第 C.1 节;在表 1 中报告测试集上以 % 计的 top-111 与 top-555 精度。使用标准 ResNet-505050(×1\times 1×1),BYOL 获得 74.3%74.3\%74.3% top-111 精度(91.6%91.6\%91.6% top-555),相对先前自监督最优 [12] 分别提升 1.3%1.3\%1.3%(与 0.5%0.5\%0.5%)。这缩小了与 [8] 监督基线 76.5%76.5\%76.5% 的差距,但仍显著低于 [75] 更强监督基线的 78.9%78.9\%78.9%。使用更深更宽架构时,BYOL 持续优于先前最优(第 C.2 节),最好达到 79.6%79.6\%79.6% top-111。在 ResNet-505050(4×4\times4×)上 BYOL 达到 78.6%78.6\%78.6%,与 [8] 中同架构最好监督基线 78.9%78.9\%78.9% 接近。

Method Top-111 Top-555
Local Agg. 60.260.260.2 -
PIRL [35] 63.663.663.6 -
CPC v2 [32] 63.863.863.8 85.385.385.3
CMC [11] 66.266.266.2 87.087.087.0
SimCLR [8] 69.369.369.3 89.089.089.0
MoCo v2 [37] 71.171.171.1 -
InfoMin Aug. [12] 73.073.073.0 91.191.191.1
BYOL (ours) \pagecolorpearDark!2074.3\pagecolor{pearDark!20}\bf{74.3}\pagecolorpearDark!2074.3 \pagecolorpearDark!2091.6\pagecolor{pearDark!20}\bf{91.6}\pagecolorpearDark!2091.6
Method Architecture Param. Top-111 Top-555
SimCLR [8] ResNet-505050 (2×2\times2×) 949494M 74.274.274.2 92.092.092.0
CMC [11] ResNet-505050 (2×2\times2×) 949494M 70.670.670.6 89.789.789.7
BYOL (ours) ResNet-505050 (2×2\times2×) 949494M 77.477.477.4 93.693.693.6
CPC v2 [32] ResNet-161161161 305305305M 71.571.571.5 90.190.190.1
MoCo [9] ResNet-505050 (4×4\times4×) 375375375M 68.668.668.6 -
SimCLR [8] ResNet-505050 (4×4\times4×) 375375375M 76.576.576.5 93.293.293.2
BYOL (ours) ResNet-505050 (4×4\times4×) 375375375M \pagecolorpearDark!2078.6\pagecolor{pearDark!20}78.6\pagecolorpearDark!2078.6 94.294.294.2
BYOL (ours) ResNet-200200200 (2×2\times2×) 250250250M \pagecolorpearDark!2079.6\pagecolor{pearDark!20}\bf{79.6}\pagecolorpearDark!2079.6 94.8\bf{94.8}94.8

(a) ResNet-50 encoder.

方法 Top-111 Top-555
Local Agg. 60.260.260.2 -
PIRL [35] 63.663.663.6 -
CPC v2 [32] 63.863.863.8 85.385.385.3
CMC [11] 66.266.266.2 87.087.087.0
SimCLR [8] 69.369.369.3 89.089.089.0
MoCo v2 [37] 71.171.171.1 -
InfoMin Aug. [12] 73.073.073.0 91.191.191.1
BYOL(本文) 74.3\mathbf{74.3}74.3 91.6\mathbf{91.6}91.6
方法 架构 参数量 Top-111 Top-555
SimCLR [8] ResNet-505050(2×2\times2×) 949494M 74.274.274.2 92.092.092.0
CMC [11] ResNet-505050(2×2\times2×) 949494M 70.670.670.6 89.789.789.7
BYOL(本文) ResNet-505050(2×2\times2×) 949494M 77.477.477.4 93.693.693.6
CPC v2 [32] ResNet-161161161 305305305M 71.571.571.5 90.190.190.1
MoCo [9] ResNet-505050(4×4\times4×) 375375375M 68.668.668.6 -
SimCLR [8] ResNet-505050(4×4\times4×) 375375375M 76.576.576.5 93.293.293.2
BYOL(本文) ResNet-505050(4×4\times4×) 375375375M 78.678.678.6 94.294.294.2
BYOL(本文) ResNet-200200200(2×2\times2×) 250250250M 79.6\mathbf{79.6}79.6 94.8\mathbf{94.8}94.8

(a) ResNet-50 编码器。

Semi-supervised training on ImageNet

Next, we evaluate the performance obtained when fine-tuning BYOL’s representation on a classification task with a small subset of ImageNet’s train set, this time using label information. We follow the semi-supervised protocol of [74, 76, 8, 32] detailed in Section C.1, and use the same fixed splits of respectively 1%1\%1% and 10%10\%10% of ImageNet labeled training data as in [8]. We report both top-111 and top-555 accuracies on the test set in Table 2. BYOL consistently outperforms previous approaches across a wide range of architectures. Additionally, as detailed in Section C.1, BYOL reaches 77.7%77.7\%77.7% top-111 accuracy with ResNet-50 when fine-tuning over 100%100\%100% of ImageNet labels.

ImageNet 上的半监督训练

接下来,我们在带少量标签的分类任务上微调 BYOL 表征,评估其表现。我们遵循 [74, 76, 8, 32] 的半监督协议(细节见第 C.1 节),并使用与 [8] 相同的、分别占 ImageNet 有标签训练数据 1%1\%1% 与 10%10\%10% 的固定划分。表 2 报告测试集上的 top-111 与 top-555 精度。BYOL 在多种架构上持续优于先前方法。此外,如第 C.1 节所述,在 100%100\%100% ImageNet 标签上微调时,ResNet-50 的 BYOL 达到 77.7%77.7\%77.7% top-111 精度。

Method Top-111 Top-555
1%1\%1% 10%10\%10% 1%1\%1% 10%10\%10%
Supervised [77] 25.425.425.4 56.456.456.4 48.448.448.4 80.480.480.4
InstDisc - - 39.239.239.2 77.477.477.4
PIRL [35] - - 57.257.257.2 83.883.883.8
SimCLR [8] 48.348.348.3 65.665.665.6 75.575.575.5 87.887.887.8
BYOL (ours) 53.2\bf{53.2}53.2 68.8\bf{68.8}68.8 78.4\bf{78.4}78.4 89.0\bf{89.0}89.0
Method Architecture Param. Top-111 Top-555
1%1\%1% 10%10\%10% 1%1\%1% 10%10\%10%
CPC v2 [32] ResNet-161161161 305305305M - - 77.977.977.9 91.291.291.2
SimCLR [8] ResNet-505050 (2×2\times2×) 949494M 58.558.558.5 71.771.771.7 83.0{83.0}83.0 91.291.291.2
BYOL (ours) ResNet-505050 (2×2\times2×) 949494M 62.2{62.2}62.2 73.5{73.5}73.5 84.1{84.1}84.1 91.7{91.7}91.7
SimCLR [8] ResNet-505050 (4×4\times4×) 375375375M 63.063.063.0 74.474.474.4 85.885.885.8 92.6{92.6}92.6
BYOL (ours) ResNet-505050 (4×4\times4×) 375375375M 69.1{69.1}69.1 75.7{75.7}75.7 87.9{87.9}87.9 92.592.592.5
BYOL (ours) ResNet-200200200 (2×2\times2×) 250250250M 71.2\bf{71.2}71.2 \pagecolorpearDark!2077.7\pagecolor{pearDark!20}\bf{77.7}\pagecolorpearDark!2077.7 89.5\bf{89.5}89.5 93.7\bf{93.7}93.7

(a) ResNet-50 encoder.

方法 Top-111 Top-555
1%1\%1% 10%10\%10% 1%1\%1% 10%10\%10%
Supervised [77] 25.425.425.4 56.456.456.4 48.448.448.4 80.480.480.4
InstDisc - - 39.239.239.2 77.477.477.4
PIRL [35] - - 57.257.257.2 83.883.883.8
SimCLR [8] 48.348.348.3 65.665.665.6 75.575.575.5 87.887.887.8
BYOL(本文) 53.2\mathbf{53.2}53.2 68.8\mathbf{68.8}68.8 78.4\mathbf{78.4}78.4 89.0\mathbf{89.0}89.0
方法 架构 参数量 Top-111 Top-555
1%1\%1% 10%10\%10% 1%1\%1% 10%10\%10%
CPC v2 [32] ResNet-161161161 305305305M - - 77.977.977.9 91.291.291.2
SimCLR [8] ResNet-505050(2×2\times2×) 949494M 58.558.558.5 71.771.771.7 83.083.083.0 91.291.291.2
BYOL(本文) ResNet-505050(2×2\times2×) 949494M 62.262.262.2 73.573.573.5 84.184.184.1 91.791.791.7
SimCLR [8] ResNet-505050(4×4\times4×) 375375375M 63.063.063.0 74.474.474.4 85.885.885.8 92.692.692.6
BYOL(本文) ResNet-505050(4×4\times4×) 375375375M 69.169.169.1 75.775.775.7 87.987.987.9 92.592.592.5
BYOL(本文) ResNet-200200200(2×2\times2×) 250250250M 71.2\mathbf{71.2}71.2 77.7\mathbf{77.7}77.7 89.5\mathbf{89.5}89.5 93.7\mathbf{93.7}93.7

(a) ResNet-50 编码器。

Transfer to other classification tasks

We evaluate our representation on other classification datasets to assess whether the features learned on ImageNet (IN) are generic and thus useful across image domains, or if they are ImageNet-specific. We perform linear evaluation and fine-tuning on the same set of classification tasks used in [8, 74], and carefully follow their evaluation protocol, as detailed in Appendix D. Performance is reported using standard metrics for each benchmark, and results are provided on a held-out test set after hyperparameter selection on a validation set. We report results in Table 3, both for linear evaluation and fine-tuning. BYOL outperforms SimCLR on all benchmarks and the Supervised-IN baseline on 777 of the 121212 benchmarks, providing only slightly worse performance on the 555 remaining benchmarks. BYOL’s representation can be transferred over to small images, e.g., CIFAR [78], landscapes, e.g., SUN397 [79] or VOC2007 [80], and textures, e.g., DTD [81].

迁移到其他分类任务

我们在其他分类数据集上评估表征,以判断在 ImageNet(IN)上学到的特征是否通用、因而跨图像域有用,还是 ImageNet 特有的。我们在与 [8, 74] 相同的分类任务集合上做线性评估与微调,并严格遵循其评估协议(细节见附录 D)。各基准用标准指标报告表现;在验证集上选超参后,结果在留出测试集上给出。表 3 报告线性评估与微调结果。BYOL 在全部基准上优于 SimCLR,并在 121212 个基准中的 777 个上优于 Supervised-IN 基线,其余 555 个仅略差。BYOL 的表征可迁移到小图像(如 CIFAR [78])、风景(如 SUN397 [79] 或 VOC2007 [80])以及纹理(如 DTD [81])。

Method Food101 CIFAR10 CIFAR100 Birdsnap SUN397 Cars Aircraft VOC2007 DTD Pets Caltech-101 Flowers
Linear evaluation:
BYOL (ours) 75.3\bf{75.3}75.3 91.391.391.3 78.4\bf{78.4}78.4 57.2\bf{57.2}57.2 62.2\bf{62.2}62.2 67.8\bf{67.8}67.8 60.660.660.6 82.582.582.5 75.575.575.5 90.490.490.4 94.294.294.2 96.1\bf{96.1}96.1
SimCLR (repro) 72.872.872.8 90.590.590.5 74.474.474.4 42.442.442.4 60.660.660.6 49.349.349.3 49.849.849.8 81.481.481.4 75.7\bf{75.7}75.7 84.684.684.6 89.389.389.3 92.692.692.6
SimCLR [8] 68.468.468.4 90.690.690.6 71.671.671.6 37.437.437.4 58.858.858.8 50.350.350.3 50.350.350.3 80.580.580.5 74.574.574.5 83.683.683.6 90.390.390.3 91.291.291.2
Supervised-IN [8] 72.372.372.3 93.6\bf{93.6}93.6 78.378.378.3 53.753.753.7 61.961.961.9 66.766.766.7 61.0\bf{61.0}61.0 82.8\bf{82.8}82.8 74.974.974.9 91.5\bf{91.5}91.5 94.5\bf{94.5}94.5 94.794.794.7
Fine-tuned:
BYOL (ours) 88.5\bf{88.5}88.5 97.8\bf{97.8}97.8 86.186.186.1 76.3\bf{76.3}76.3 63.763.763.7 91.691.691.6 88.1\bf{88.1}88.1 85.4\bf{85.4}85.4 76.2\bf{76.2}76.2 91.791.791.7 93.8\bf{93.8}93.8 97.097.097.0
SimCLR (repro) 87.587.587.5 97.497.497.4 85.385.385.3 75.075.075.0 63.963.963.9 91.491.491.4 87.687.687.6 84.584.584.5 75.475.475.4 89.489.489.4 91.791.791.7 96.696.696.6
SimCLR [8] 88.288.288.2 97.797.797.7 85.985.985.9 75.975.975.9 63.563.563.5 91.391.391.3 88.188.188.1 84.184.184.1 73.273.273.2 89.289.289.2 92.192.192.1 97.097.097.0
Supervised-IN [8] 88.388.388.3 97.597.597.5 86.4\bf{86.4}86.4 75.875.875.8 64.3\bf{64.3}64.3 92.1\bf{92.1}92.1 86.086.086.0 85.085.085.0 74.674.674.6 92.1\bf{92.1}92.1 93.393.393.3 97.6\bf{97.6}97.6
Random init [8] 86.986.986.9 95.995.995.9 80.280.280.2 76.176.176.1 53.653.653.6 91.491.491.4 85.985.985.9 67.367.367.3 64.864.864.8 81.581.581.5 72.672.672.6 92.092.092.0

Table 3: Transfer learning results from ImageNet (IN) with the standard ResNet-50 architecture.

方法 Food101 CIFAR10 CIFAR100 Birdsnap SUN397 Cars Aircraft VOC2007 DTD Pets Caltech-101 Flowers
线性评估:
BYOL(本文) 75.3\mathbf{75.3}75.3 91.391.391.3 78.4\mathbf{78.4}78.4 57.2\mathbf{57.2}57.2 62.2\mathbf{62.2}62.2 67.8\mathbf{67.8}67.8 60.660.660.6 82.582.582.5 75.575.575.5 90.490.490.4 94.294.294.2 96.1\mathbf{96.1}96.1
SimCLR(复现) 72.872.872.8 90.590.590.5 74.474.474.4 42.442.442.4 60.660.660.6 49.349.349.3 49.849.849.8 81.481.481.4 75.7\mathbf{75.7}75.7 84.684.684.6 89.389.389.3 92.692.692.6
SimCLR [8] 68.468.468.4 90.690.690.6 71.671.671.6 37.437.437.4 58.858.858.8 50.350.350.3 50.350.350.3 80.580.580.5 74.574.574.5 83.683.683.6 90.390.390.3 91.291.291.2
Supervised-IN [8] 72.372.372.3 93.6\mathbf{93.6}93.6 78.378.378.3 53.753.753.7 61.961.961.9 66.766.766.7 61.0\mathbf{61.0}61.0 82.8\mathbf{82.8}82.8 74.974.974.9 91.5\mathbf{91.5}91.5 94.5\mathbf{94.5}94.5 94.794.794.7
微调:
BYOL(本文) 88.5\mathbf{88.5}88.5 97.8\mathbf{97.8}97.8 86.186.186.1 76.3\mathbf{76.3}76.3 63.763.763.7 91.691.691.6 88.1\mathbf{88.1}88.1 85.4\mathbf{85.4}85.4 76.2\mathbf{76.2}76.2 91.791.791.7 93.8\mathbf{93.8}93.8 97.097.097.0
SimCLR(复现) 87.587.587.5 97.497.497.4 85.385.385.3 75.075.075.0 63.963.963.9 91.491.491.4 87.687.687.6 84.584.584.5 75.475.475.4 89.489.489.4 91.791.791.7 96.696.696.6
SimCLR [8] 88.288.288.2 97.797.797.7 85.985.985.9 75.975.975.9 63.563.563.5 91.391.391.3 88.188.188.1 84.184.184.1 73.273.273.2 89.289.289.2 92.192.192.1 97.097.097.0
Supervised-IN [8] 88.388.388.3 97.597.597.5 86.4\mathbf{86.4}86.4 75.875.875.8 64.3\mathbf{64.3}64.3 92.1\mathbf{92.1}92.1 86.086.086.0 85.085.085.0 74.674.674.6 92.1\mathbf{92.1}92.1 93.393.393.3 97.6\mathbf{97.6}97.6
随机初始化 [8] 86.986.986.9 95.995.995.9 80.280.280.2 76.176.176.1 53.653.653.6 91.491.491.4 85.985.985.9 67.367.367.3 64.864.864.8 81.581.581.5 72.672.672.6 92.092.092.0

表 3:标准 ResNet-50 架构下从 ImageNet(IN)迁移学习的结果。

Transfer to other vision tasks

We evaluate our representation on different tasks relevant to computer vision practitioners, namely semantic segmentation, object detection and depth estimation. With this evaluation, we assess whether BYOL’s representation generalizes beyond classification tasks.

迁移到其他视觉任务

我们在对计算机视觉实践者相关的不同任务上评估表征,即语义分割、目标检测与深度估计。通过该评估,判断 BYOL 的表征是否能推广到分类以外的任务。

We first evaluate BYOL on the VOC2012 semantic segmentation task as detailed in Section D.4, where the goal is to classify each pixel in the image [7]. We report the results in Table 4(a). BYOL outperforms both the Supervised-IN baseline (+1.9+1.9+1.9 mIoU) and SimCLR (+1.1+1.1+1.1 mIoU).

我们首先按第 D.4 节所述在 VOC2012 语义分割任务上评估 BYOL,目标是对图像中每个像素分类 [7]。结果见表 4(a)。BYOL 同时优于 Supervised-IN 基线(+1.91.91.9 mIoU)与 SimCLR(+1.11.11.1 mIoU)。

Similarly, we evaluate on object detection by reproducing the setup in [9] using a Faster R-CNN architecture [82], as detailed in Section D.5. We fine-tune on trainval2007 and report results on test2007 using the standard AP50 metric; BYOL is significantly better than the Supervised-IN baseline (+3.1+3.1+3.1 AP50) and SimCLR (+2.3+2.3+2.3 AP50).

类似地,我们按第 D.5 节所述、复现 [9] 的设置,用 Faster R-CNN 架构 [82] 评估目标检测。在 trainval2007 上微调,并在 test2007 上用标准 AP50 指标报告结果;BYOL 显著优于 Supervised-IN 基线(+3.13.13.1 AP50)与 SimCLR(+2.32.32.3 AP50)。

Finally, we evaluate on depth estimation on the NYU v2 dataset, where the depth map of a scene is estimated given a single RGB image. Depth prediction measures how well a network represents geometry, and how well that information can be localized to pixel accuracy [40]. The setup is based on [83] and detailed in Section D.6. We evaluate on the commonly used test subset of 654654654 images and report results using several common metrics in Table 4(b): relative (rel) error, root mean squared (rms) error, and the percent of pixels (pct) where the error, max⁡(dgt/dp,dp/dgt)\max(d_{gt}/d_{p},d_{p}/d_{gt})max(dgt​/dp​,dp​/dgt​), is below 1.25n1.25^{n}1.25n thresholds where dpd_{p}dp​ is the predicted depth and dgtd_{gt}dgt​ is the ground truth depth [40]. BYOL is better or on par with other methods for each metric. For instance, the challenging pct.  ⁣  ⁣< ⁣ ⁣1.25\!\,\!<\!\!1.25<1.25 measure is respectively improved by +3.5+3.5+3.5 points and +1.3+1.3+1.3 points compared to supervised and SimCLR baselines.

最后,我们在 NYU v2 数据集上评估深度估计:给定单张 RGB 图像估计场景深度图。深度预测度量网络表征几何的能力,以及该信息能否定位到像素精度 [40]。设置基于 [83],细节见第 D.6 节。我们在常用的 654654654 张测试子集上评估,并用表 4(b) 中若干常见指标报告结果:相对(rel)误差、均方根(rms)误差,以及误差 max⁡(dgt/dp,dp/dgt)\max(d_{gt}/d_{p},d_{p}/d_{gt})max(dgt​/dp​,dp​/dgt​) 低于 1.25n1.25^{n}1.25n 阈值的像素百分比(pct),其中 dpd_{p}dp​ 为预测深度,dgtd_{gt}dgt​ 为真值深度 [40]。BYOL 在每项指标上都不劣于其他方法。例如,具有挑战性的 pct. <1.25<1.25<1.25 度量相对监督与 SimCLR 基线分别提升 +3.5+3.5+3.5 与 +1.3+1.3+1.3 个百分点。

Method AP50 mIoU
Supervised-IN [9] 74.474.474.4 74.474.474.4
MoCo [9] 74.974.974.9 72.572.572.5
SimCLR (repro) 75.275.275.2 75.275.275.2
BYOL (ours) 77.5\bf{77.5}77.5 76.3\bf{76.3}76.3
Higher better Lower better
Method pct.  ⁣< ⁣1.25\!<\!1.25<1.25 pct.  ⁣< ⁣1.252\!<\!1.25^{2}<1.252 pct.  ⁣< ⁣1.253\!<\!1.25^{3}<1.253 rms rel
Supervised-IN [83] 81.181.181.1 95.395.395.3 98.898.898.8 0.5730.5730.573 0.127\bf{0.127}0.127
SimCLR (repro) 83.383.383.3 96.596.596.5 99.199.199.1 0.5570.5570.557 0.1340.1340.134
BYOL (ours) 84.6\bf{84.6}84.6 96.7\bf{96.7}96.7 99.1\bf{99.1}99.1 0.541\bf{0.541}0.541 0.1290.1290.129

(a) Transfer results in semantic segmentation and object detection.

方法 AP50 mIoU
Supervised-IN [9] 74.474.474.4 74.474.474.4
MoCo [9] 74.974.974.9 72.572.572.5
SimCLR(复现) 75.275.275.2 75.275.275.2
BYOL(本文) 77.5\mathbf{77.5}77.5 76.3\mathbf{76.3}76.3
越高越好 越低越好
方法 pct. <1.25<1.25<1.25 pct. <1.252<1.25^{2}<1.252 pct. <1.253<1.25^{3}<1.253 rms rel
Supervised-IN [83] 81.181.181.1 95.395.395.3 98.898.898.8 0.5730.5730.573 0.127\mathbf{0.127}0.127
SimCLR(复现) 83.383.383.3 96.596.596.5 99.199.199.1 0.5570.5570.557 0.1340.1340.134
BYOL(本文) 84.6\mathbf{84.6}84.6 96.7\mathbf{96.7}96.7 99.1\mathbf{99.1}99.1 0.541\mathbf{0.541}0.541 0.1290.1290.129

(a) 语义分割与目标检测的迁移结果。

5 Building intuitions with ablations

5 用消融建立直觉

We present ablations on BYOL to give an intuition of its behavior and performance. For reproducibility, we run each configuration of parameters over three seeds, and report the average performance. We also report the half difference between the best and worst runs when it is larger than 0.250.250.25. Although previous works perform ablations at 100100100 epochs [8, 12], we notice that relative improvements at 100100100 epochs do not always hold over longer training. For this reason, we run ablations over 300300300 epochs on 646464 TPU v333 cores, which yields consistent results compared to our baseline training of 100010001000 epochs. For all the experiments in this section, we set the initial learning rate to 0.30.30.3 with batch size 409640964096, the weight decay to 10−610^{-6}10−6 as in SimCLR [8] and the base target decay rate τbase\tau_{\text{base}}τbase​ to 0.990.990.99. In this section we report results in top-111 accuracy on ImageNet under the linear evaluation protocol as in Section C.1.

我们对 BYOL 做消融,以直观理解其行为与表现。为可复现,每组参数配置跑三个随机种子,并报告平均表现;当最好与最差运行之差的一半大于 0.250.250.25 时也一并报告。尽管先前工作在 100100100 个 epoch 做消融 [8, 12],我们注意到 100100100 个 epoch 的相对改进并不总能延续到更长训练。因此,我们在 646464 个 TPU v3 核心上做 300300300 个 epoch 的消融,相对我们 100010001000 个 epoch 的基线训练结果一致。本节所有实验中,初始学习率设为 0.30.30.3(批次 409640964096),权重衰减 10−610^{-6}10−6(与 SimCLR [8] 相同),基础目标衰减率 τbase\tau_{\mathrm{base}}τbase​ 为 0.990.990.99。本节按第 C.1 节的线性评估协议报告 ImageNet top-111 精度。

Batch size

Among contrastive methods, the ones that draw negative examples from the minibatch suffer performance drops when their batch size is reduced. BYOL does not use negative examples and we expect it to be more robust to smaller batch sizes. To empirically verify this hypothesis, we train both BYOL and SimCLR using different batch sizes from 128128128 to 409640964096. To avoid re-tuning other hyperparameters, we average gradients over NNN consecutive steps before updating the online network when reducing the batch size by a factor NNN. The target network is updated once every NNN steps, after the update of the online network; we accumulate the NNN-steps in parallel in our runs.

批次大小

在对比方法中,从 minibatch 抽取负例的方法在缩小批次时会出现性能下降。BYOL 不使用负例,我们期望它对更小批次更稳健。为经验验证该假设,我们用从 128128128 到 409640964096 的不同批次训练 BYOL 与 SimCLR。为避免重调其他超参,当批次缩小 NNN 倍时,我们在更新在线网络前对连续 NNN 步梯度求平均。目标网络每 NNN 步、在在线网络更新之后更新一次;运行中我们并行累积这 NNN 步。

As shown in Figure 3(a), the performance of SimCLR rapidly deteriorates with batch size, likely due to the decrease in the number of negative examples. In contrast, the performance of BYOL remains stable over a wide range of batch sizes from 256256256 to 409640964096, and only drops for smaller values due to batch normalization layers in the encoder.[^7]

如图 3(a) 所示,SimCLR 的表现随批次迅速恶化,很可能由于负例数量减少。相比之下,BYOL 在从 256256256 到 409640964096 的宽批次范围内保持稳定,仅在更小值因编码器中的批归一化层而下降。

(a) Impact of batch size

(a) 批次大小的影响

Image augmentations

Contrastive methods are sensitive to the choice of image augmentations. For instance, SimCLR does not work well when removing color distortion from its image augmentations. As an explanation, SimCLR shows that crops of the same image mostly share their color histograms. At the same time, color histograms vary across images. Therefore, when a contrastive task only relies on random crops as image augmentations, it can be mostly solved by focusing on color histograms alone. As a result the representation is not incentivized to retain information beyond color histograms. To prevent that, SimCLR adds color distortion to its set of image augmentations. Instead, BYOL is incentivized to keep any information captured by the target representation into its online network, to improve its predictions. Therefore, even if augmented views of a same image share the same color histogram, BYOL is still incentivized to retain additional features in its representation. For that reason, we believe that BYOL is more robust to the choice of image augmentations than contrastive methods.

图像增强

对比方法对图像增强选择敏感。例如,SimCLR 在去掉颜色扰动后表现不佳。一种解释是:同一图像的裁剪大多共享颜色直方图,而颜色直方图在不同图像间变化。因此,当对比任务只依赖随机裁剪作为增强时,主要关注颜色直方图就能大体完成任务,表征便没有动力保留颜色直方图之外的信息。为防止这一点,SimCLR 在增强集合中加入颜色扰动。相反,BYOL 被激励把目标表征捕获的任何信息保留到在线网络中,以改进预测。因此,即便同一图像的增强视图共享颜色直方图,BYOL 仍被激励在表征中保留额外特征。基于此,我们相信 BYOL 对图像增强选择比对比方法更稳健。

Results presented in Figure 3(b) support this hypothesis: the performance of BYOL is much less affected than the performance of SimCLR when removing color distortions from the set of image augmentations (−9.1-9.1−9.1 accuracy points for BYOL, −22.2-22.2−22.2 accuracy points for SimCLR). When image augmentations are reduced to mere random crops, BYOL still displays good performance (59.4%59.4\%59.4%, i.e. −13.1-13.1−13.1 points from 72.5%72.5\%72.5% ), while SimCLR loses more than a third of its performance (40.3%40.3\%40.3%, i.e. −27.6-27.6−27.6 points from 67.9%67.9\%67.9%). We report additional ablations in Section F.3.

图 3(b) 的结果支持该假设:从增强集合中去掉颜色扰动时,BYOL 受影响远小于 SimCLR(BYOL 掉 9.19.19.1 个精度点,SimCLR 掉 22.222.222.2 个精度点)。当增强退化为单纯随机裁剪时,BYOL 仍有良好表现(59.4%59.4\%59.4%,即相对 72.5%72.5\%72.5% 掉 13.113.113.1 点),而 SimCLR 失去逾三分之一表现(40.3%40.3\%40.3%,即相对 67.9%67.9\%67.9% 掉 27.627.627.6 点)。更多消融见第 F.3 节。

Bootstrapping

BYOL uses the projected representation of a target network, whose weights are an exponential moving average of the weights of the online network, as target for its predictions. This way, the weights of the target network represent a delayed and more stable version of the weights of the online network. When the target decay rate is 111, the target network is never updated, and remains at a constant value corresponding to its initialization. When the target decay rate is 000, the target network is instantaneously updated to the online network at each step. There is a trade-off between updating the targets too often and updating them too slowly, as illustrated in Table 5(a). Instantaneously updating the target network (τ=0\tau=0τ=0) destabilizes training, yielding very poor performance while never updating the target (τ=1\tau=1τ=1) makes the training stable but prevents iterative improvement, ending with low-quality final representation. All values of the decay rate between 0.90.90.9 and 0.9990.9990.999 yield performance above 68.4%68.4\%68.4% top-111 accuracy at 300300300 epochs.

自举

BYOL 用目标网络的投影表征作为预测目标,目标网络权重是在线网络权重的指数滑动平均。这样,目标网络权重表示在线网络权重的延迟且更稳定版本。当目标衰减率为 111 时,目标网络永不更新,保持初始化的常数值。当目标衰减率为 000 时,目标网络每步瞬时更新为在线网络。更新目标过频与过慢之间存在权衡,如表 5(a) 所示。瞬时更新目标网络(τ=0\tau=0τ=0)会使训练不稳定、表现极差;永不更新目标(τ=1\tau=1τ=1)虽稳定,但阻止迭代改进,最终表征质量低。衰减率在 0.90.90.9 与 0.9990.9990.999 之间的所有取值,在 300300300 个 epoch 时 top-111 精度均高于 68.4%68.4\%68.4%。

Target τbase\tau_{\text{base}}τbase​ Top-111
Constant random network 111 18.8±0.718.8{\scriptstyle\pm 0.7}18.8±0.7
Moving average of online 0.9990.9990.999 69.869.869.8
Moving average of online 0.990.990.99 72.5\bf{72.5}72.5
Moving average of online 0.90.90.9 68.468.468.4
Stop gradient of online*†* 000 0.30.30.3
Method Predictor Target network β\betaβ Top-111
BYOL ✓ ✓ 0 72.5\bf{72.5}72.5
−-− ✓ ✓ 1 70.970.970.9
−-− ✓ 1 70.770.770.7
SimCLR 1 69.469.469.4
−-− ✓ 1 69.169.169.1
−-− ✓ 0 0.30.30.3
−-− ✓ 0 0.20.20.2
−-− 0 0.10.10.1

(a) Results for different target modes. †In the stop gradient of online, τ=τbase=0\tau=\tau_{\text{base}}=0τ=τbase​=0 is kept constant throughout training.

目标 τbase\tau_{\mathrm{base}}τbase​ Top-111
恒定随机网络 111 18.8±0.718.8{\scriptstyle\pm 0.7}18.8±0.7
在线网络的滑动平均 0.9990.9990.999 69.869.869.8
在线网络的滑动平均 0.990.990.99 72.5\mathbf{72.5}72.5
在线网络的滑动平均 0.90.90.9 68.468.468.4
在线网络的停止梯度 000 0.30.30.3
方法 预测器 目标网络 β\betaβ Top-111
BYOL ✓ ✓ 0 72.5\mathbf{72.5}72.5
−-− ✓ ✓ 1 70.970.970.9
−-− ✓ 1 70.770.770.7
SimCLR 1 69.469.469.4
−-− ✓ 1 69.169.169.1
−-− ✓ 0 0.30.30.3
−-− ✓ 0 0.20.20.2
−-− 0 0.10.10.1

(a) 不同目标模式的结果。在在线网络的停止梯度中,训练全程保持 τ=τbase=0\tau=\tau_{\mathrm{base}}=0τ=τbase​=0 恒定。

Ablation to contrastive methods

In this subsection, we recast SimCLR and BYOL using the same formalism to better understand where the improvement of BYOL over SimCLR comes from. Let us consider the following objective that extends the InfoNCE objective [10, 84] (see Section F.4),

相对对比方法的消融

本小节用同一形式体系重写 SimCLR 与 BYOL,以更好理解 BYOL 相对 SimCLR 的改进来自何处。考虑如下扩展 InfoNCE 目标 [10, 84] 的目标(见第 F.4 节),

\displaystyle\text{InfoNCE}^{\alpha,\beta}_{{\theta}}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\frac{2}{B}\sum_{i=1}^{B}S_{\theta}(v_{i},v^{\prime}_{i})\!-\beta\cdot\frac{2\alpha}{B}\sum_{i=1}^{B}\ln\mathopen{}\mathclose{{\left(\sum\limits_{j\neq i}\exp\frac{S_{\theta}(v_{i},v_{j})}{\alpha}+\sum\limits_{j}\exp\frac{S_{\theta}(v_{i},v^{\prime}_{j})}{\alpha}}}\right)\mathbin{\raisebox{2.15277pt}{,}} \tag{6}

where α>0\alpha>0α>0 is a fixed temperature, β∈[0,1]\beta\in[0,1]β∈[0,1] a weighting coefficient, BBB the batch size, vvv and v′v^{\prime}v′ are batches of augmented views where for any batch index iii, viv_{i}vi​ and vi′v^{\prime}_{i}vi′​ are augmented views from the same image; the real-valued function SθS_{\theta}Sθ​ quantifies pairwise similarity between augmented views. For any augmented view uuu we denote zθ(u)≜fθ(gθ(u))z_{\theta}(u)\triangleq f_{\theta}(g_{\theta}(u))zθ​(u)≜fθ​(gθ​(u)) and zξ(u)≜fξ(gξ(u))z_{\xi}(u)\triangleq f_{\xi}(g_{\xi}(u))zξ​(u)≜fξ​(gξ​(u)). For given ϕ\phiϕ and ψ\psiψ, we consider the normalized dot product

其中 α>0\alpha>0α>0 为固定温度,β∈[0,1]\beta\in[0,1]β∈[0,1] 为加权系数,BBB 为批次大小,vvv 与 v′v^{\prime}v′ 为增强视图批次,对任意批次索引 iii,viv_{i}vi​ 与 vi′v^{\prime}_{i}vi′​ 来自同一图像;实值函数 SθS_{\theta}Sθ​ 量化增强视图之间的成对相似度。对任意增强视图 uuu,记 zθ(u)≜fθ(gθ(u))z_{\theta}(u)\triangleq f_{\theta}(g_{\theta}(u))zθ​(u)≜fθ​(gθ​(u)),zξ(u)≜fξ(gξ(u))z_{\xi}(u)\triangleq f_{\xi}(g_{\xi}(u))zξ​(u)≜fξ​(gξ​(u))。对给定的 ϕ\phiϕ 与 ψ\psiψ,我们考虑归一化点积

Sθ(u1,u2)=Δ⟨ϕ(u1),ψ(u2)⟩∥ϕ(u1)∥2⋅∥ψ(u2)∥2⋅(7)S_{\theta}(u_{1},u_{2})\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\frac{\langle\phi(u_{1}),\psi(u_{2})\rangle}{\|\phi(u_{1})\|_{2}\cdot\|\psi(u_{2})\|_{2}}\cdot \tag{7}Sθ​(u1​,u2​)=Δ∥ϕ(u1​)∥2​⋅∥ψ(u2​)∥2​⟨ϕ(u1​),ψ(u2​)⟩​⋅(7)

Up to minor details (cf. Section F.5), we recover the SimCLR loss with ϕ(u1)=zθ(u1)\phi(u_{1})=z_{\theta}(u_{1})ϕ(u1​)=zθ​(u1​) (no predictor), ψ(u2)=zθ(u2)\psi(u_{2})=z_{\theta}(u_{2})ψ(u2​)=zθ​(u2​) (no target network) and β=1\beta=1β=1. We recover the BYOL loss when using a predictor and a target network, i.e., \phi(u_{1})=p_{\theta}\mathopen{}\mathclose{{\left(z_{\theta}(u_{1})}}\right) and ψ(u2)=zξ(u2)\psi(u_{2})=z_{\xi}(u_{2})ψ(u2​)=zξ​(u2​) with β=0\beta=0β=0. To evaluate the influence of the target network, the predictor and the coefficient β\betaβ, we perform an ablation over them. Results are presented in Table 5(b) and more details are given in Section F.4.

除去次要细节(参见第 F.5 节),取 ϕ(u1)=zθ(u1)\phi(u_{1})=z_{\theta}(u_{1})ϕ(u1​)=zθ​(u1​)(无预测器)、ψ(u2)=zθ(u2)\psi(u_{2})=z_{\theta}(u_{2})ψ(u2​)=zθ​(u2​)(无目标网络)且 β=1\beta=1β=1,即恢复 SimCLR 损失。使用预测器与目标网络时,即 ϕ(u1)=pθ(zθ(u1))\phi(u_{1})=p_{\theta}(z_{\theta}(u_{1}))ϕ(u1​)=pθ​(zθ​(u1​))、ψ(u2)=zξ(u2)\psi(u_{2})=z_{\xi}(u_{2})ψ(u2​)=zξ​(u2​) 且 β=0\beta=0β=0,即恢复 BYOL 损失。为评估目标网络、预测器与系数 β\betaβ 的影响,我们对其做消融。结果见表 5(b),更多细节见第 F.4 节。

The only variant that performs well without negative examples (i.e., with β=0\beta=0β=0) is BYOL, using both a bootstrap target network and a predictor. Adding the negative pairs to BYOL’s loss without re-tuning the temperature parameter hurts its performance. In Section F.4, we show that we can add back negative pairs and still match the performance of BYOL with proper tuning of the temperature.

在不使用负例(即 β=0\beta=0β=0)时唯一表现良好的变体是 BYOL,它同时使用自举目标网络与预测器。在不重调温度参数的情况下把负样本对加回 BYOL 损失会损害其表现。第 F.4 节表明,适当调节温度后,可以加回负样本对并仍匹配 BYOL 的表现。

Simply adding a target network to SimCLR already improves performance (+1.6+1.6+1.6 points). This sheds new light on the use of the target network in MoCo [9], where the target network is used to provide more negative examples. Here, we show that by mere stabilization effect, even when using the same number of negative examples, using a target network is beneficial. Finally, we observe that modifying the architecture of SθS_{\theta}Sθ​ to include a predictor only mildly affects the performance of SimCLR.

单纯给 SimCLR 加上目标网络已能改进表现(+1.61.61.6 点)。这为 MoCo [9] 中目标网络的用法提供了新视角:那里目标网络用于提供更多负例。这里我们表明,即便负例数量相同,仅凭稳定效果,使用目标网络也有益。最后,我们观察到:修改 SθS_{\theta}Sθ​ 的架构以包含预测器,对 SimCLR 表现影响不大。

Network hyperparameters

In Appendix F, we explore how other network parameters may impact BYOL’s performance. We iterate over multiple weight decays, learning rates, and projector/encoder architectures to observe that small hyperparameter changes do not drastically alter the final score. We note that removing the weight decay in either BYOL or SimCLR leads to network divergence, emphasizing the need for weight regularization in the self-supervised setting. Furthermore, we observe that changing the scaling factor in the network initialization [85] did not impact the performance (higher than 72%72\%72% top-111 accuracy).

网络超参数

附录 F 中,我们探索其他网络参数如何影响 BYOL 表现。我们遍历多种权重衰减、学习率以及投影器/编码器架构,观察到小的超参变化不会剧烈改变最终分数。我们注意到,在 BYOL 或 SimCLR 中去掉权重衰减都会导致网络发散,强调自监督设置中权重正则的必要。此外,改变网络初始化中的缩放因子 [85] 不影响表现(高于 72%72\%72% top-111 精度)。

Relationship with Mean Teacher

Another semi-supervised approach, Mean Teacher (MT) [20], complements a supervised loss on few labels with an additional consistency loss. In [20], this consistency loss is the ℓ2\ell_{2}ℓ2​ distance between the logits from a student network, and those of a temporally averaged version of the student network, called teacher. Removing the predictor in BYOL results in an unsupervised version of MT with no classification loss that uses image augmentations instead of the original architectural noise (e.g., dropout). This variant of BYOL collapses (Row 7 of Table 5) which suggests that the additional predictor is critical to prevent collapse in an unsupervised scenario.

与 Mean Teacher 的关系

另一种半监督方法 Mean Teacher(MT)[20] 用额外一致性损失补充少量标签上的监督损失。在 [20] 中,该一致性损失是学生网络 logits 与学生网络时间平均版本(称为教师)logits 之间的 ℓ2\ell_{2}ℓ2​ 距离。去掉 BYOL 中的预测器,会得到无分类损失的无监督版 MT,并用图像增强代替原先的结构噪声(例如 dropout)。该 BYOL 变体会崩塌(表 5 第 7 行),说明额外预测器对防止无监督场景下的崩塌至关重要。

Importance of a near-optimal predictor

Table 5(b) already shows the importance of combining a predictor and a target network: the representation does collapse when either is removed. We further found that we can remove the target network without collapse by making the predictor near-optimal, either by (i) using an optimal linear predictor (obtained by linear regression on the current batch) before back-propagating the error through the network (52.5%52.5\%52.5% top-1 accuracy), or (ii) increasing the learning rate of the predictor (66.5%66.5\%66.5% top-1). By contrast, increasing the learning rates of both projector and predictor (without target network) yields poor results (≈25%\approx 25\%≈25% top-1). See Appendix I for more details. This seems to indicate that keeping the predictor near-optimal at all times is important to preventing collapse, which may be one of the roles of BYOL’s target network.

接近最优的预测器的重要性

表 5(b) 已表明组合预测器与目标网络的重要性:去掉任一都会使表征崩塌。我们进一步发现,通过使预测器接近最优,可以在不崩塌的情况下去掉目标网络,做法包括:(i) 在把误差反传到网络之前,使用由当前批次线性回归得到的最优线性预测器(52.5%52.5\%52.5% top-111 精度);或 (ii) 提高预测器学习率(66.5%66.5\%66.5% top-111)。相比之下,同时提高投影器与预测器的学习率(无目标网络)效果很差(约 25%25\%25% top-111)。更多细节见附录 I。这似乎表明:始终保持预测器接近最优对防止崩塌很重要,而这可能正是 BYOL 目标网络的作用之一。

6 Conclusion

6 结论

We introduced BYOL, a new algorithm for self-supervised learning of image representations. BYOL learns its representation by predicting previous versions of its outputs, without using negative pairs. We show that BYOL achieves state-of-the-art results on various benchmarks. In particular, under the linear evaluation protocol on ImageNet with a ResNet-505050 (1×1\times1×), BYOL achieves a new state of the art and bridges most of the remaining gap between self-supervised methods and the supervised learning baseline of [8]. Using a ResNet-200200200 (2×)(2\times)(2×), BYOL reaches a top-111 accuracy of 79.6%79.6\%79.6% which improves over the previous state of the art (76.8%76.8\%76.8%) while using 30%30\%30% fewer parameters.

我们提出 BYOL,一种新的图像表征自监督学习算法。BYOL 通过预测自身输出的先前版本来学习表征,不使用负样本对。我们表明 BYOL 在多种基准上达到最优。特别地,在 ImageNet 线性评估协议下,使用 ResNet-505050(1×1\times1×),BYOL 达到新的最优,并弥合了自监督方法与 [8] 监督基线之间的大部分剩余差距。使用 ResNet-200200200(2×2\times2×),BYOL 达到 79.6%79.6\%79.6% top-111 精度,优于先前最优(76.8%76.8\%76.8%),同时参数少 30%30\%30%。

Nevertheless, BYOL remains dependent on existing sets of augmentations that are specific to vision applications. To generalize BYOL to other modalities (e.g., audio, video, text, …) it is necessary to obtain similarly suitable augmentations for each of them. Designing such augmentations may require significant effort and expertise. Therefore, automating the search for these augmentations would be an important next step to generalize BYOL to other modalities.

尽管如此,BYOL 仍依赖现有、专用于视觉应用的增强集合。要把 BYOL 推广到其他模态(例如音频、视频、文本等),需要为每种模态获得同样合适的增强。设计此类增强可能需要大量精力与专长。因此,自动化搜索这些增强,将是把 BYOL 推广到其他模态的重要下一步。

Broader impact

更广泛的影响

The presented research should be categorized as research in the field of unsupervised learning. This work may inspire new algorithms, theoretical, and experimental investigation. The algorithm presented here can be used for many different vision applications and a particular use may have both positive or negative impacts, which is known as the dual use problem. Besides, as vision datasets could be biased, the representation learned by BYOL could be susceptible to replicate these biases.

本项研究应归入无监督学习领域的研究。本工作可能启发新的算法、理论与实验探索。此处给出的算法可用于许多不同的视觉应用,特定用途可能同时带来正面或负面影响,即所谓两用问题。此外,由于视觉数据集可能有偏,BYOL 学到的表征也可能复制这些偏置。

Acknowledgements

致谢

The authors would like to thank the following people for their help throughout the process of writing this paper, in alphabetical order: Aaron van den Oord, Andrew Brock, Jason Ramapuram, Jeffrey De Fauw, Karen Simonyan, Katrina McKinney, Nathalie Beauguerlange, Olivier Henaff, Oriol Vinyals, Pauline Luc, Razvan Pascanu, Sander Dieleman, and the DeepMind team. We especially thank Jason Ramapuram and Jeffrey De Fauw, who provided the JAX SimCLR reproduction used throughout the paper.

作者按字母顺序列出并感谢以下人士在撰写本文过程中的帮助:Aaron van den Oord、Andrew Brock、Jason Ramapuram、Jeffrey De Fauw、Karen Simonyan、Katrina McKinney、Nathalie Beauguerlange、Olivier Henaff、Oriol Vinyals、Pauline Luc、Razvan Pascanu、Sander Dieleman,以及 DeepMind 团队。我们特别感谢 Jason Ramapuram 与 Jeffrey De Fauw,他们提供了本文通篇使用的 JAX SimCLR 复现。

References

参考文献

[1] Kunihiko Fukushima. Neocognitron: A self-organizing neural network model for a mechanism of pattern recognition unaffected by shift in position. Biological Cybernetics , 36(4):193–202, 1980.

[2] Laurenz Wiskott and Terrence J Sejnowski. Slow feature analysis: Unsupervised learning of invariances. Neural Computation , 14(4), 2002.

[3] Geoffrey E Hinton, Simon Osindero, and Yee-Whye Teh. A fast learning algorithm for deep belief nets. Neural Computation , 18(7):1527–1554, 2006.

[4] Maxime Oquab, Leon Bottou, Ivan Laptev, and Josef Sivic. Learning and transferring mid-level image representations using convolutional neural networks. In Computer Vision and Pattern Recognition , 2014.

[5] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 , 2014.

[6] Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In Computer Vision and Pattern Recognition , 2014.

[7] Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Computer Vision and Pattern Recognition , 2015.

[8] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709 , 2020.

[9] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross B. Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722 , 2019.

[10] Aäron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748 , 2018.

[11] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849v4 , 2019.

[12] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. arXiv preprint arXiv:2005.10243 , 2020.

[13] Nikunj Saunshi, Orestis Plevrakis, Sanjeev Arora, Mikhail Khodak, and Hrishikesh Khandeparkar. A theoretical analysis of contrastive unsupervised representation learning. In International Conference on Machine Learning , 2019.

[14] R. Manmatha, Chao-Yuan Wu, Alexander J. Smola, and Philipp Krähenbühl. Sampling matters in deep embedding learning. In International Conference on Computer Vision , 2017.

[15] Ben Harwood, Vijay B. G. Kumar, Gustavo Carneiro, Ian Reid, and Tom Drummond. Smart mining for deep metric learning. In International Conference on Computer Vision , 2017.

[16] Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In International Conference on Machine Learning , 2013.

[17] Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In European Conference on Computer Vision , 2018.

[18] Philip Bachman, Ouais Alsharif, and Doina Precup. Learning with pseudo-ensembles. In Advances in neural information processing systems , pages 3365–3373, 2014.

[19] Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242 , 2016.

[20] Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in neural information processing systems , pages 1195–1204, 2017.

[21] Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision , 115(3):211–252, 2015.

[22] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Computer Vision and Pattern Recognition , 2016.

[23] Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Computer Vision and Pattern Recognition , 2015.

[24] Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In International Conference on Machine Learning , 2008.

[25] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114 , 2013.

[26] Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic back-propagation and variational inference in deep latent gaussian models. arXiv preprint arXiv:1401.4082 , 2014.

[27] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Neural Information Processing Systems , 2014.

[28] Jeff Donahue, Philipp Krähenbühl, and Trevor Darrell. Adversarial feature learning. arXiv preprint arXiv:1605.09782 , 2016.

[29] Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martín Arjovsky, Olivier Mastropietro, and Aaron C. Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704 , 2017.

[30] Jeff Donahue and Karen Simonyan. Large scale adversarial representation learning. In Neural Information Processing Systems , 2019.

[31] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096 , 2018.

[32] Olivier J. Hénaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, S. M. Ali Eslami, and Aäron van den Oord. Data-efficient image recognition with contrastive predictive coding. In International Conference on Machine Learning , 2019.

[33] R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. arXiv preprint arXiv:1808.06670 , 2019.

[34] Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In Neural Information Processing Systems , 2019.

[35] Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. arXiv preprint arXiv:1912.01991 , 2019.

[36] Junnan Li, Pan Zhou, Caiming Xiong, Richard Socher, and Steven CH Hoi. Prototypical contrastive learning of unsupervised representations. arXiv preprint arXiv:2005.04966 , 2020.

[37] Rishabh Jain, Haoqi Fan, Ross B. Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297 , 2020.

[38] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big self-supervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029 , 2020.

[39] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In Computer Vision and Pattern Recognition , 2018.

[40] Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In International Conference on Computer Vision , 2017.

[41] Richard Zhang, Phillip Isola, and Alexei A. Efros. Colorful image colorization. In European Conference on Computer Vision , 2016.

[42] Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Learning representations for automatic colorization. In European Conference on Computer Vision , 2016.

[43] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A. Efros. Context encoders: Feature learning by inpainting. In Computer Vision and Pattern Recognition , 2016.

[44] Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision , 2016.

[45] Christian Ledig, Lucas Theis, Ferenc Huszár, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. In Computer Vision and Pattern Recognition , 2017.

[46] Alexey Dosovitskiy, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with convolutional neural networks. In Neural Information Processing Systems , 2014.

[47] Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728 , 2018.

[48] Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. In Computer Vision and Pattern Recognition , 2019.

[49] Daniel Guo, Bernardo Avila Pires, Bilal Piot, Jean-Bastien Grill, Florent Altché, Rémi Munos, and Mohammad Gheshlaghi Azar. Bootstrap latent-predictive representations for multitask reinforcement learning. In International Conference on Machine Learning , 2020.

[50] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin A. Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen. King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature , 518:529–533, 2015.

[51] Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning , 2016.

[52] Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Gheshlaghi Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In AAAI Conference on Artificial Intelligence , 2018.

[53] Hado Van Hasselt, Yotam Doron, Florian Strub, Matteo Hessel, Nicolas Sonnerat, and Joseph Modayil. Deep reinforcement learning and the deadly triad. Deep Reinforcement Learning Workshop NeurIPS , 2018.

[54] Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971 , 2015.

[55] Olivier Chapelle, Bernhard Scholkopf, and Alexander Zien. Semi-supervised learning. IEEE Transactions on Neural Networks , 20(3):542–542, 2009.

[56] Xiaojin Zhu and Andrew B Goldberg. Introduction to semi-supervised learning. Synthesis lectures on artificial intelligence and machine learning , 3(1):1–130, 2009.

[57] Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in neural information processing systems , 2014.

[58] Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semi-supervised learning with ladder networks. In Advances in neural information processing systems , 2015.

[59] David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A Raffel. Mixmatch: A holistic approach to semi-supervised learning. In Advances in Neural Information Processing Systems , 2019.

[60] Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence , 41(8):1979–1993, 2018.

[61] David Berthelot, N. Carlini, E. D. Cubuk, Alex Kurakin, Kihyuk Sohn, Han Zhang, and Colin Raffel. Remixmatch: Semi-supervised learning with distribution matching and augmentation anchoring. In ICLR , 2020.

[62] Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685 , 2020.

[63] Suzanna Becker and Geoffrey E. Hinton. Self-organizing neural network that discovers surfaces in random-dot stereograms. Nature , 355(6356):161–163, 1992.

[64] James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, and Skye Wanderman-Milne. JAX: composable transformations of Python+NumPy programs, 2018.

[65] Tom Hennigan, Trevor Cai, Tamara Norman, and Igor Babuschkin. Haiku: Sonnet for JAX, 2020.

[66] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems , pages 2672–2680, 2014.

[67] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146 , 2016.

[68] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning , 2015.

[69] Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. In International Conference on Machine Learning , 2010.

[70] Yang You, Igor Gitman, and Boris Ginsburg. Scaling SGD batch size to 32k for imagenet training. arXiv preprint arXiv:1708.03888 , 2017.

[71] Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with warm restarts. In International Conference on Learning Representations , 2017.

[72] Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677 , 2017.

[73] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. Transactions on Pattern Analysis and Machine Intelligence , 2017.

[74] Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better ImageNet models transfer better? In Computer Cision and Pattern Recognition , 2019.

[75] Chengyue Gong, Tongzheng Ren, Mao Ye, and Qiang Liu. Maxup: A simple way to improve generalization of neural network training. arXiv preprint arXiv:2002.09024 , 2020.

[76] Xiaohua Zhai, Joan Puigcerver, Alexander I Kolesnikov, Pierre Ruyssen, Carlos Riquelme, Mario Lucic, Josip Djolonga, André Susano Pinto, Maxim Neumann, Alexey Dosovitskiy, Lucas Beyer, Olivier Bachem, Michael Tschannen, Marcin Michalski, Olivier Bousquet, Sylvain Gelly, and Neil Houlsby. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv: Computer Vision and Pattern Recognition , 2019.

[77] Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. S4L: Self-supervised semi-supervised learning. In International Conference on Computer Vision , 2019.

[78] Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.

[79] Jianxiong Xiao, James Hays, Krista A. Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In Computer Vision and Pattern Recognition , 2010.

[80] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The Pascal visual object classes (VOC) challenge. International Journal of Computer Vision , 88(2):303–338, 2010.

[81] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In Computer Vision and Pattern Recognition , 2014.

[82] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. In Neural Information Processing Systems , 2015.

[83] I. Laina, C. Rupprecht, V. Belagiannis, F. Tombari, and N. Navab. Deeper depth prediction with fully convolutional residual networks. In International Conference on 3D Vision , 2016.

[84] Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A Alemi, and George Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922 , 2019.

[85] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision , 2015.

[86] Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In International Conference on Machine Learning , 2013.

[87] Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. arXiv preprint arXiv:1909.13719 , 2019.

[88] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Computer Vision and Pattern Recognition , pages 2818–2826, 2016.

[89] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101 – mining discriminative components with random forests. In European Conference on Computer Vision , 2014.

[90] Thomas Berg, Jiongxin Liu, Seung Woo Lee, Michelle L. Alexander, David W. Jacobs, and Peter N. Belhumeur. Birdsnap: Large-scale fine-grained visual categorization of birds. In Computer Vision and Pattern Recognition , 2014.

[91] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3D object representations for fine-grained categorization. In Workshop on 3D Representation and Recognition , Sydney, Australia, 2013.

[92] Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew B. Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151 , 2013.

[93] O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. V. Jawahar. Cats and dogs. In Computer Vision and Pattern Recognition , 2012.

[94] Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories. Computer Vision and Pattern Recognition Workshop , 2004.

[95] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics and Image Processing , 2008.

[96] Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In International Conference on Machine Learning , 2014.

[97] Art B Owen. A robust hybrid of lasso and ridge regression. Contemporary Mathematics , 443(7):59–72, 2007.

[98] Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In International Conference on Computer Vision , 2019.

[99] Deepak Pathak, Ross Girshick, Piotr Dollár, Trevor Darrell, and Bharath Hariharan. Learning features by watching objects move. In Conference on Computer Vision and Pattern Recognition , 2017.

[100] Yuxin Wu and Kaiming He. Group normalization. In European Conference on Computer Vision , 2018.

Appendix A Algorithm

附录 A 算法

D\mathcal{D}D, T,\mathcal{T},T, and T′\mathcal{T}^{\prime}T′ set of images and distributions of transformations
θ{\theta}θ, fθf_{\theta}fθ​, gθ,g_{\theta},gθ​, and qθq_{\theta}qθ​ initial online parameters, encoder, projector, and predictor
ξ\xiξ, fξf_{\xi}fξ​, gξg_{\xi}gξ​ initial target parameters, target encoder, and target projector
optimizer\mathrm{optimizer}optimizer optimizer, updates online parameters using the loss gradient
KKK and NNN total number of optimization steps and batch size
{τk}k=1K\{\tau_{k}\}_{k=1}^{K}{τk​}k=1K​ and {ηk}k=1K\{\eta_{k}\}_{k=1}^{K}{ηk​}k=1K​ target network update schedule and learning rate schedule

Inputs :
D\mathcal{D}D, T,\mathcal{T},T, and T′\mathcal{T}^{\prime}T′ set of images and distributions of transformations θ{\theta}θ, fθf_{\theta}fθ​, gθ,g_{\theta},gθ​, and qθq_{\theta}qθ​ initial online parameters, encoder, projector, and predictor ξ\xiξ, fξf_{\xi}fξ​, gξg_{\xi}gξ​ initial target parameters, target encoder, and target projector optimizer\mathrm{optimizer}optimizer optimizer, updates online parameters using the loss gradient KKK and NNN total number of optimization steps and batch size {τk}k=1K\{\tau_{k}\}_{k=1}^{K}{τk​}k=1K​ and {ηk}k=1K\{\eta_{k}\}_{k=1}^{K}{ηk​}k=1K​ target network update schedule and learning rate schedule
1 for k=1k=1k=1 to KKK do
2 B←{xi∼D}i=1N\mathcal{B}\leftarrow\{x_{i}\sim\mathcal{D}\}_{i=1}^{N}B←{xi​∼D}i=1N​ // sample a batch of NNN images
3 for xi∈Bx_{i}\in\mathcal{B}xi​∈B do
4 t∼T and t′∼T′t\sim\mathcal{T}{\rm\ and\ }t^{\prime}\sim\mathcal{T}^{\prime}t∼T and t′∼T′ // sample image transformations
5 z_{1}\leftarrow g_{\theta}\mathopen{}\mathclose{{\left(f_{\theta}(t(x_{i}))}}\right) and z_{2}\leftarrow g_{\theta}\mathopen{}\mathclose{{\left(f_{\theta}(t^{\prime}(x_{i}))}}\right) // compute projections
6 z^{\prime}_{1}\leftarrow g_{\xi}\mathopen{}\mathclose{{\left(f_{\xi}(t^{\prime}(x_{i}))}}\right) and z^{\prime}_{2}\leftarrow g_{\xi}\mathopen{}\mathclose{{\left(f_{\xi}(t(x_{i}))}}\right) // compute target projections
7 l_{i}\leftarrow-2\cdot\mathopen{}\mathclose{{\left(\frac{\langle q_{\theta}(z_{1}),z^{\prime}_{1}\rangle}{\mathopen{}\mathclose{{\left\|q_{\theta}(z_{1})}}\right\|_{2}\cdot\mathopen{}\mathclose{{\left\|z^{\prime}_{1}}}\right\|_{2}}+\frac{\langle q_{\theta}(z_{2}),z^{\prime}_{2}\rangle}{\mathopen{}\mathclose{{\left\|q_{\theta}(z_{2})}}\right\|_{2}\cdot\mathopen{}\mathclose{{\left\|z^{\prime}_{2}}}\right\|_{2}}}}\right) // compute the loss for xix_{i}xi​
8 end for
9 δθ←1N∑i=1N∂θli{\delta\hskip-1.00006pt\theta}\leftarrow\frac{1}{N}\sum\limits_{i=1}^{N}\partial_{\theta}l_{i}δθ←N1​i=1∑N​∂θ​li​ // compute the total loss gradient w.r.t. θ\thetaθ
10 θ←optimizer(θ,δθ,ηk){\theta}\leftarrow\mathrm{optimizer}({\theta},{\delta\hskip-1.00006pt\theta},\eta_{k})θ←optimizer(θ,δθ,ηk​) // update online parameters
11 ξ←τkξ+(1−τk)θ\xi\leftarrow\tau_{k}\xi+(1-\tau_{k}){\theta}ξ←τk​ξ+(1−τk​)θ // update target parameters
12 end for
Output : encoder fθf_{\theta}fθ​

Algorithm 1 BYOL: Bootstrap Your Own Latent

D\mathcal{D}D、T\mathcal{T}T 与 T′\mathcal{T}^{\prime}T′ 图像集合与变换分布
θ{\theta}θ、fθf_{\theta}fθ​、gθg_{\theta}gθ​ 与 qθq_{\theta}qθ​ 初始在线参数、编码器、投影器与预测器
ξ\xiξ、fξf_{\xi}fξ​、gξg_{\xi}gξ​ 初始目标参数、目标编码器与目标投影器
optimizer\mathrm{optimizer}optimizer 优化器,用损失梯度更新在线参数
KKK 与 NNN 总优化步数与批次大小
{τk}k=1K\{\tau_{k}\}_{k=1}^{K}{τk​}k=1K​ 与 {ηk}k=1K\{\eta_{k}\}_{k=1}^{K}{ηk​}k=1K​ 目标网络更新日程与学习率日程

输入:
D\mathcal{D}D、T\mathcal{T}T 与 T′\mathcal{T}^{\prime}T′:图像集合与变换分布;θ{\theta}θ、fθf_{\theta}fθ​、gθg_{\theta}gθ​ 与 qθq_{\theta}qθ​:初始在线参数、编码器、投影器与预测器;ξ\xiξ、fξf_{\xi}fξ​、gξg_{\xi}gξ​:初始目标参数、目标编码器与目标投影器;optimizer\mathrm{optimizer}optimizer:用损失梯度更新在线参数的优化器;KKK 与 NNN:总优化步数与批次大小;{τk}k=1K\{\tau_{k}\}_{k=1}^{K}{τk​}k=1K​ 与 {ηk}k=1K\{\eta_{k}\}_{k=1}^{K}{ηk​}k=1K​:目标网络更新日程与学习率日程。
1 for k=1k=1k=1 to KKK do
2 B←{xi∼D}i=1N\mathcal{B}\leftarrow\{x_{i}\sim\mathcal{D}\}_{i=1}^{N}B←{xi​∼D}i=1N​ // 采样 NNN 张图像的一个批次
3 for xi∈Bx_{i}\in\mathcal{B}xi​∈B do
4 t∼Tt\sim\mathcal{T}t∼T 且 t′∼T′t^{\prime}\sim\mathcal{T}^{\prime}t′∼T′ // 采样图像变换
5 z1←gθ(fθ(t(xi)))z_{1}\leftarrow g_{\theta}(f_{\theta}(t(x_{i})))z1​←gθ​(fθ​(t(xi​))) 且 z2←gθ(fθ(t′(xi)))z_{2}\leftarrow g_{\theta}(f_{\theta}(t^{\prime}(x_{i})))z2​←gθ​(fθ​(t′(xi​))) // 计算投影
6 z1′←gξ(fξ(t′(xi)))z^{\prime}_{1}\leftarrow g_{\xi}(f_{\xi}(t^{\prime}(x_{i})))z1′​←gξ​(fξ​(t′(xi​))) 且 z2′←gξ(fξ(t(xi)))z^{\prime}_{2}\leftarrow g_{\xi}(f_{\xi}(t(x_{i})))z2′​←gξ​(fξ​(t(xi​))) // 计算目标投影
7 li←−2⋅(⟨qθ(z1),z1′⟩∥qθ(z1)∥2⋅∥z1′∥2+⟨qθ(z2),z2′⟩∥qθ(z2)∥2⋅∥z2′∥2)l_{i}\leftarrow-2\cdot\left(\frac{\langle q_{\theta}(z_{1}),z^{\prime}_{1}\rangle}{\|q_{\theta}(z_{1})\|_{2}\cdot\|z^{\prime}_{1}\|_{2}}+\frac{\langle q_{\theta}(z_{2}),z^{\prime}_{2}\rangle}{\|q_{\theta}(z_{2})\|_{2}\cdot\|z^{\prime}_{2}\|_{2}}\right)li​←−2⋅(∥qθ​(z1​)∥2​⋅∥z1′​∥2​⟨qθ​(z1​),z1′​⟩​+∥qθ​(z2​)∥2​⋅∥z2′​∥2​⟨qθ​(z2​),z2′​⟩​) // 计算 xix_{i}xi​ 的损失
8 end for
9 δθ←1N∑i=1N∂θli{\delta\theta}\leftarrow\frac{1}{N}\sum_{i=1}^{N}\partial_{\theta}l_{i}δθ←N1​∑i=1N​∂θ​li​ // 计算总损失对 θ\thetaθ 的梯度
10 θ←optimizer(θ,δθ,ηk){\theta}\leftarrow\mathrm{optimizer}({\theta},{\delta\theta},\eta_{k})θ←optimizer(θ,δθ,ηk​) // 更新在线参数
11 ξ←τkξ+(1−τk)θ\xi\leftarrow\tau_{k}\xi+(1-\tau_{k}){\theta}ξ←τk​ξ+(1−τk​)θ // 更新目标参数
12 end for
输出: 编码器 fθf_{\theta}fθ​

算法 1 BYOL:Bootstrap Your Own Latent

Appendix B Image augmentations

附录 B 图像增强

During self-supervised training, BYOL uses the following image augmentations (which are a subset of the ones presented in [8]):

在自监督训练期间,BYOL 使用如下图像增强(它们是 [8] 中给出增强的子集):

  • • random cropping: a random patch of the image is selected, with an area uniformly sampled between 8% and 100% of that of the original image, and an aspect ratio logarithmically sampled between 3/43/43/4 and 4/34/34/3. This patch is then resized to the target size of 224×224224\times 224224×224 using bicubic interpolation;
  • • 随机裁剪:随机选取图像图块,面积在原图面积的 8% 到 100% 间均匀采样,宽高比在 3/43/43/4 与 4/34/34/3 间对数采样;随后用双三次插值将该图块缩放到目标尺寸 224×224224\times 224224×224;
  • • optional left-right flip;
  • • 可选的左右翻转;
  • • color jittering: the brightness, contrast, saturation and hue of the image are shifted by a uniformly random offset applied on all the pixels of the same image. The order in which these shifts are performed is randomly selected for each patch;
  • • 颜色抖动:对亮度、对比度、饱和度与色调施加均匀随机偏移,同一图像的所有像素使用同一偏移;这些偏移的施加顺序对每个图块随机选定;
  • • color dropping: an optional conversion to grayscale. When applied, output intensity for a pixel (r,g,b)(r,g,b)(r,g,b) corresponds to its luma component, computed as 0.2989r+0.5870g+0.1140b0.2989r+0.5870g+0.1140b0.2989r+0.5870g+0.1140b;
  • • 去色:可选的灰度转换。施加时,像素 (r,g,b)(r,g,b)(r,g,b) 的输出强度对应其亮度分量,按 0.2989r+0.5870g+0.1140b0.2989r+0.5870g+0.1140b0.2989r+0.5870g+0.1140b 计算;
  • • Gaussian blurring: for a 224×224224\times 224224×224 image, a square Gaussian kernel of size 23×2323\times 2323×23 is used, with a standard deviation uniformly sampled over [0.1,2.0][0.1,2.0][0.1,2.0];
  • • 高斯模糊:对 224×224224\times 224224×224 图像使用 23×2323\times 2323×23 的方形高斯核,标准差在 [0.1,2.0][0.1,2.0][0.1,2.0] 上均匀采样;
  • • solarization: an optional color transformation x↦x⋅1{x<0.5}+(1−x)⋅1{x≥0.5}x\mapsto x\cdot{\bf 1}_{\{x<0.5\}}+(1-x)\cdot{\bf 1}_{\{x\geq 0.5\}}x↦x⋅1{x<0.5}​+(1−x)⋅1{x≥0.5}​ for pixels with values in [0,1][0,1][0,1].
  • • 曝光过度(solarization):可选颜色变换 x↦x⋅1{x<0.5}+(1−x)⋅1{x≥0.5}x\mapsto x\cdot{\bf 1}_{\{x<0.5\}}+(1-x)\cdot{\bf 1}_{\{x\geq 0.5\}}x↦x⋅1{x<0.5}​+(1−x)⋅1{x≥0.5}​,像素值落在 [0,1][0,1][0,1]。

Augmentations from the sets T\mathcal{T}T and T′\mathcal{T}^{\prime}T′ (introduced in Section 3) are compositions of the above image augmentations in the listed order, each applied with a predetermined probability. The image augmentations parameters are listed in Table 6.

集合 T\mathcal{T}T 与 T′\mathcal{T}^{\prime}T′(第 3 节引入)中的增强,是按上述顺序组合各图像增强,并以预定概率分别施加。图像增强参数列于表 6。

During evaluation, we use a center crop similar to [8]: images are resized to 256256256 pixels along the shorter side using bicubic resampling, after which a 224×224224\times 224224×224 center crop is applied. In both training and evaluation, we normalize color channels by subtracting the average color and dividing by the standard deviation, computed on ImageNet, after applying the augmentations.

评估时,我们使用与 [8] 类似的中心裁剪:图像沿较短边用双三次重采样缩放到 256256256 像素,再取 224×224224\times 224224×224 中心裁剪。训练与评估中,在施加增强后,我们按 ImageNet 上计算的均值与标准差对颜色通道做归一化(减均值除标准差)。

Parameter T\mathcal{T}T T′\mathcal{T}^{\prime}T′
Random crop probability 1.01.01.0 1.01.01.0
Flip probability 0.50.50.5 0.50.50.5
Color jittering probability 0.80.80.8 0.80.80.8
Brightness adjustment max intensity 0.40.40.4 0.40.40.4
Contrast adjustment max intensity 0.40.40.4 0.40.40.4
Saturation adjustment max intensity 0.20.20.2 0.20.20.2
Hue adjustment max intensity 0.10.10.1 0.10.10.1
Color dropping probability 0.20.20.2 0.20.20.2
Gaussian blurring probability 1.01.01.0 0.10.10.1
Solarization probability 0.00.00.0 0.20.20.2

Table 6: Parameters used to generate image augmentations.

参数 T\mathcal{T}T T′\mathcal{T}^{\prime}T′
随机裁剪概率 1.01.01.0 1.01.01.0
翻转概率 0.50.50.5 0.50.50.5
颜色抖动概率 0.80.80.8 0.80.80.8
亮度调整最大强度 0.40.40.4 0.40.40.4
对比度调整最大强度 0.40.40.4 0.40.40.4
饱和度调整最大强度 0.20.20.2 0.20.20.2
色调调整最大强度 0.10.10.1 0.10.10.1
去色概率 0.20.20.2 0.20.20.2
高斯模糊概率 1.01.01.0 0.10.10.1
曝光过度概率 0.00.00.0 0.20.20.2

Appendix C Evaluation on ImageNet training

附录 C 在 ImageNet 训练上的评估

C.1 Self-supervised learning evaluation on ImageNet

C.1 ImageNet 上的自监督学习评估

Linear evaluation protocol on ImageNet

As in [48, 74, 8, 37], we use the standard linear evaluation protocol on ImageNet, which consists in training a linear classifier on top of the frozen representation, i.e., without updating the network parameters nor the batch statistics. At training time, we apply spatial augmentations, i.e., random crops with resize to 224×224224\times 224224×224 pixels, and random flips. At test time, images are resized to 256256256 pixels along the shorter side using bicubic resampling, after which a 224×224224\times 224224×224 center crop is applied. In both cases, we normalize the color channels by subtracting the average color and dividing by the standard deviation (computed on ImageNet), after applying the augmentations. We optimize the cross-entropy loss using SGD with Nesterov momentum over 808080 epochs, using a batch size of 102410241024 and a momentum of 0.90.90.9. We do not use any regularization methods such as weight decay, gradient clipping [86], tclip [34], or logits regularization. We finally sweep over 555 learning rates {0.4,0.3,0.2,0.1,0.05}\{0.4,0.3,0.2,0.1,0.05\}{0.4,0.3,0.2,0.1,0.05} on a local validation set (10009 images from ImageNet train set), and report the accuracy of the best validation hyperparameter on the test set (which is the public validation set of the original ILSVRC2012 ImageNet dataset).

ImageNet 上的线性评估协议

与 [48, 74, 8, 37] 一样,我们使用 ImageNet 上的标准线性评估协议:在冻结表征上训练线性分类器,即不更新网络参数也不更新批统计量。训练时施加空间增强,即随机裁剪并缩放到 224×224224\times 224224×224 像素,以及随机翻转。测试时,图像沿较短边用双三次重采样缩放到 256256256 像素,再取 224×224224\times 224224×224 中心裁剪。两种情形下,在施加增强后,我们按 ImageNet 上计算的均值与标准差对颜色通道做归一化。我们用带动量的 Nesterov SGD 优化交叉熵损失,808080 个 epoch,批次 102410241024,动量 0.90.90.9。不使用权重衰减、梯度裁剪 [86]、tclip [34] 或 logits 正则等任何正则方法。最后在本地验证集(来自 ImageNet 训练集的 10009 张图像)上扫描 555 个学习率 {0.4,0.3,0.2,0.1,0.05}\{0.4,0.3,0.2,0.1,0.05\}{0.4,0.3,0.2,0.1,0.05},并把验证最优超参在测试集(原始 ILSVRC2012 ImageNet 公开验证集)上的精度作为报告结果。

Variant on linear evaluation on ImageNet

In this paragraph only, we deviate from the protocol of [8, 37] and propose another way of performing linear evaluation on top of a frozen representation. This method achieves better performance both in top-1 and top-5 accuracy.

ImageNet 线性评估的变体

仅在本段中,我们偏离 [8, 37] 的协议,并提出另一种在冻结表征上做线性评估的方式。该方法在 top-1 与 top-5 精度上都能取得更好表现。

  • • We replace the spatial augmentations (random crops with resize to 224×224224\times 224224×224 pixels and random flips) with the pre-train augmentations of Appendix B. This method was already used in [32] with a different subset of pre-train augmentations.
  • • 我们用附录 B 的预训练增强,替换空间增强(随机裁剪并缩放到 224×224224\times 224224×224 像素,以及随机翻转)。该方法已在 [32] 中使用,但预训练增强子集不同。
  • • We regularize the linear classifier as in [34][^8] by clipping the logits using a hyperbolic tangent function tclip(x)≜α⋅tanh⁡(x/α),{\rm tclip}(x)\triangleq\alpha\cdot\tanh(x/\alpha),tclip(x)≜α⋅tanh(x/α), where α\alphaα is a positive scalar, and by adding a logit-regularization penalty term in the loss Loss(x,y)≜cross_entropy(tclip(x),y)+β⋅average(tclip(x)2),{\rm Loss}(x,y)\triangleq{\rm cross\_entropy}({\rm tclip}(x),y)+\beta\cdot{\rm average}({\rm tclip}(x)^{2}),Loss(x,y)≜cross_entropy(tclip(x),y)+β⋅average(tclip(x)2), where xxx are the logits, yyy are the target labels, and β\betaβ is the regularization parameter. We set α=20\alpha=20α=20 and β=1e−2\beta=1e{-2}β=1e−2.
  • • 我们按 [34] 的方式正则线性分类器:用双曲正切裁剪 logits tclip(x)≜α⋅tanh⁡(x/α),{\rm tclip}(x)\triangleq\alpha\cdot\tanh(x/\alpha),tclip(x)≜α⋅tanh(x/α), 其中 α\alphaα 为正标量,并在损失中加入 logit 正则惩罚项 Loss(x,y)≜cross_entropy(tclip(x),y)+β⋅average(tclip(x)2),{\rm Loss}(x,y)\triangleq{\rm cross\_entropy}({\rm tclip}(x),y)+\beta\cdot{\rm average}({\rm tclip}(x)^{2}),Loss(x,y)≜cross_entropy(tclip(x),y)+β⋅average(tclip(x)2), 其中 xxx 为 logits,yyy 为目标标签,β\betaβ 为正则参数。我们设 α=20\alpha=20α=20,β=1e−2\beta=1e{-2}β=1e−2。

We report in Table 7 the top-1 and top-5 accuracy on ImageNet using this modified protocol. These modifications in the evaluation protocol increase the BYOL’s top-111 accuracy from 74.3%74.3\%74.3% to 74.8%74.8\%74.8% with a ResNet-505050 (1×1\times1×).

我们在表 7 中报告用该修改协议在 ImageNet 上的 top-1 与 top-5 精度。这些评估协议修改把 BYOL 在 ResNet-505050(1×1\times1×)上的 top-111 精度从 74.3%74.3\%74.3% 提高到 74.8%74.8\%74.8%。

Architecture Pre-train augmentations Logits regularization Top-111 Top-555
ResNet-505050 (1×1\times1×) 74.374.374.3 91.691.691.6
✓ 74.474.474.4 91.891.891.8
✓ 74.774.774.7 91.891.891.8
✓ ✓ 74.8\bf{74.8}74.8 91.8\bf{91.8}91.8
ResNet-505050 (4×4\times4×) 78.678.678.6 94.294.294.2
✓ 78.678.678.6 94.394.394.3
✓ 78.978.978.9 94.394.394.3
✓ ✓ 79.0\bf{79.0}79.0 94.5\bf{94.5}94.5
ResNet-200200200 (2×2\times2×) 79.679.679.6 94.894.894.8
✓ 79.679.679.6 94.894.894.8
✓ 79.879.879.8 95.095.095.0
✓ ✓ 80.0\bf{80.0}80.0 95.0\bf{95.0}95.0

Table 7: Different linear evaluation protocols on ResNet architectures by either replacing the spatial augmentations with pre-train augmentations, or regularizing the linear classifier. No pre-train augmentations and no logits regularization correspond to the evaluation protocol of the main paper, which is the same as in [8, 37].

Semi-supervised learning on ImageNet

We follow the semi-supervised learning protocol of [8, 77]. We first initialize the network with the parameters of the pretrained representation, and fine-tune it with a subset of ImageNet labels. At training time, we apply spatial augmentations, i.e., random crops with resize to 224×224224\times 224224×224 pixels and random flips. At test time, images are resized to 256256256 pixels along the shorter side using bicubic resampling, after which a 224×224224\times 224224×224 center crop is applied. In both cases, we normalize the color channels by subtracting the average color and dividing by the standard deviation (computed on ImageNet), after applying the augmentations. We optimize the cross-entropy loss using SGD with Nesterov momentum. We used a batch size of 102410241024, a momentum of 0.90.90.9. We do not use any regularization methods such as weight decay, gradient clipping [86], tclip [34], or logits rescaling. We sweep over the learning rate {0.01,0.02,0.05,0.1,0.005}\{0.01,0.02,0.05,0.1,0.005\}{0.01,0.02,0.05,0.1,0.005} and the number of epochs {30,50}\{30,50\}{30,50} and select the hyperparameters achieving the best performance on our local validation set to report test performance.

ImageNet 上的半监督学习

我们遵循 [8, 77] 的半监督学习协议。先用预训练表征的参数初始化网络,再用一部分 ImageNet 标签微调。训练时施加空间增强,即随机裁剪并缩放到 224×224224\times 224224×224 像素以及随机翻转。测试时,图像沿较短边用双三次重采样缩放到 256256256 像素,再取 224×224224\times 224224×224 中心裁剪。两种情形下,在施加增强后按 ImageNet 均值与标准差归一化颜色通道。我们用带动量的 Nesterov SGD 优化交叉熵损失,批次 102410241024,动量 0.90.90.9。不使用权重衰减、梯度裁剪 [86]、tclip [34] 或 logits 缩放等正则。我们扫描学习率 {0.01,0.02,0.05,0.1,0.005}\{0.01,0.02,0.05,0.1,0.005\}{0.01,0.02,0.05,0.1,0.005} 与 epoch 数 {30,50}\{30,50\}{30,50},选取本地验证集上表现最好的超参,再报告测试表现。

(a) Top-1 accuracy

(a) Top-1 精度

Supervised: Semi-supervised (100%100\%100%):
Method Top-111 Top-555 Method Top-111 Top-555
Supervised[8] 76.576.576.5 −-− SimCLR [8] 76.076.076.0 93.193.193.1
AutoAugment [87] 77.677.677.6 93.893.893.8 SimCLR (repro) 76.576.576.5 93.593.593.5
MaxUp [75] 78.9\bf{78.9}78.9 94.2\bf{94.2}94.2 BYOL 77.7\bf{77.7}77.7 93.9\bf{93.9}93.9

Table 8: Semi-supervised training with the full ImageNet on a ResNet-505050 (×1\times 1×1). We also report other fully supervised methods for extensive comparisons.

In Table 2 presented in the main text, we fine-tune the representation over the 111% and 101010% ImageNet splits from [8] with various ResNet architectures.

在正文表 2 中,我们在来自 [8] 的 1%1\%1% 与 10%10\%10% ImageNet 划分上,对多种 ResNet 架构微调表征。

In Figure 4, we fine-tune the representation over 111%, 222%, 555%, 101010%, 202020%, 505050%, and 100100100% of the ImageNet dataset as in [32] with a ResNet-505050 (1×1\times1×) architecture, and compare them with a supervised baseline and a fine-tuned SimCLR representation. In this case and contrary to Table 2 we don’t reuse the splits from SimCLR but we create our own via a balanced selection. In this setting, we observed that tuning a BYOL representation always outperforms a supervised baseline trained from scratch. In Figure 5, we then fine-tune the representation over multiple ResNet architectures. We observe that the largest networks are prone to overfitting as they are outperformed by ResNets with identical depth but smaller scaling factor. This overfitting is further confirmed when looking at the training and evaluation loss: large networks have lower training losses, but higher validation losses than some of their slimmer counterparts. Regularization methods are thus recommended when tuning on large architectures.

在图 4 中,我们按 [32] 用 ResNet-505050(1×1\times1×)架构,在 ImageNet 数据集的 1%1\%1%、2%2\%2%、5%5\%5%、10%10\%10%、20%20\%20%、50%50\%50% 与 100%100\%100% 上微调表征,并与从零训练的监督基线以及微调的 SimCLR 表征比较。与表 2 不同,此处我们不复用 SimCLR 的划分,而是通过平衡选取自行创建。该设置下,我们观察到微调 BYOL 表征总是优于从零训练的监督基线。在图 5 中,我们再对多种 ResNet 架构微调表征。我们观察到最大的网络容易过拟合,因为它们被深度相同但缩放因子更小的 ResNet 超过。查看训练与评估损失可进一步确认该过拟合:大网络训练损失更低,但验证损失高于某些更瘦的对应网络。因此在大型架构上调优时建议使用正则方法。

Finally, we fine-tune the representation over the full ImageNet dataset. We report the results in Table 8 along with supervised baselines trained on ImageNet. We observe that fine-tuning the SimCLR checkpoint does not yield better results (in our reproduction, which matches the results reported in the original paper [8]) than using a random initialization (76.576.576.5 top-111). Instead, BYOL’s initialization checkpoint leads to a high final score (77.777.777.7 top-111), higher than the vanilla supervised baseline of [8], matching the strong supervised baseline of AutoAugment[87] but still 1.21.21.2 points below the stronger supervised baseline [75], which uses advanced supervised learning techniques.

最后,我们在完整 ImageNet 数据集上微调表征。结果见表 8,并与在 ImageNet 上训练的监督基线对照。我们观察到微调 SimCLR 检查点并不能带来更好结果(在我们的复现中,与原文 [8] 报告一致),相对随机初始化(76.576.576.5 top-111)并无提升。相反,BYOL 的初始化检查点带来更高最终分数(77.777.777.7 top-111),高于 [8] 的普通监督基线,与 AutoAugment [87] 的强监督基线持平,但仍比使用先进监督学习技术的更强监督基线 [75] 低 1.21.21.2 点。

Figure 5

Figure 5: Semi-supervised training with a fraction of ImageNet labels on multiple ResNets architecture pretrained with BYOL. Note that large networks are facing overfitting problems.

图 5:在多种用 BYOL 预训练的 ResNet 架构上,用一部分 ImageNet 标签做半监督训练。注意大型网络面临过拟合问题。

C.2 Linear evaluation on larger architectures and supervised baselines

C.2 更大架构上的线性评估与监督基线

BYOL Supervised (ours) Supervised [8]
Architecture Multiplier Weights Top-1 Top-5 Top-1 Top-5 Top-1
ResNet-50 1×1\times1× 24M 74.374.374.3 91.691.691.6 76.476.476.4 92.992.992.9 76.576.576.5
ResNet-101 1×1\times1× 43M 76.476.476.4 93.093.093.0 78.078.078.0 94.094.094.0 -
ResNet-152 1×1\times1× 58M 77.377.377.3 93.793.793.7 79.179.179.1 94.594.594.5 -
ResNet-200 1×1\times1× 63M 77.877.877.8 93.993.993.9 79.379.379.3 94.694.694.6 -
ResNet-50 2×2\times2× 94M 77.477.477.4 93.693.693.6 79.979.979.9 95.095.095.0 77.877.877.8
ResNet-101 2×2\times2× 170M 78.778.778.7 94.394.394.3 80.380.380.3 95.095.095.0 -
ResNet-50 3×3\times3× 211M 78.278.278.2 93.993.993.9 80.280.280.2 95.095.095.0 -
ResNet-152 2×2\times2× 232M 79.079.079.0 94.694.694.6 80.680.680.6 95.395.395.3 -
ResNet-200 2×2\times2× 250M 79.6\bf{79.6}79.6 94.9\bf{94.9}94.9 80.180.180.1 95.295.295.2 -
ResNet-50 4×4\times4× 375M 78.678.678.6 94.294.294.2 80.780.780.7 95.3\bf{95.3}95.3 78.978.978.9
ResNet-101 3×3\times3× 382M 78.478.478.4 94.294.294.2 80.780.780.7 95.3\bf{95.3}95.3 -
ResNet-152 3×3\times3× 522M 79.579.579.5 94.694.694.6 80.9\bf{80.9}80.9 95.295.295.2 -

Table 9: Linear evaluation of BYOL on ImageNet using larger encoders. Top-111 and top-555 accuracies are reported in %.

Here we investigate the performance of BYOL with deeper and wider ResNet architectures. We compare ourselves to the best supervised baselines from [8] when available (rightmost column in table 9), which are also presented in Figure 1. Importantly, we close in on those baselines using the ResNet-505050 (2×2\times2×) and the ResNet-505050 (4×4\times4×) architectures, where we are within 0.40.40.4 accuracy points of the supervised performance. To the best of our knowledge, this is the first time that the gap to supervised has been closed to such an extent using a self-supervised method under the linear evaluation protocol. Therefore, in order to ensure fair comparison, and suspecting that the supervised baselines’ performance in [8] could be even further improved with appropriate data augmentations, we also report on our own reproduction of strong supervised baselines. We use RandAugment [87] data augmentation for all large ResNet architectures (which are all version 111, as per [22]). We train our supervised baselines for up to 200200200 epochs, using SGD with a Nesterov momentum value of 0.90.90.9, a cosine-annealed learning rate after a 555 epochs linear warmup period, weight decay with a value of 1e−41e-41e−4, and a label smoothing [88] value of 0.10.10.1. Results are presented in Figure 6.

这里我们研究更深更宽 ResNet 架构下 BYOL 的表现。在可用时,我们与 [8] 中最好的监督基线比较(表 9 最右列),它们也呈现在图 1 中。重要的是,在 ResNet-505050(2×2\times2×)与 ResNet-505050(4×4\times4×)架构上,我们把与监督表现的差距收窄到 0.40.40.4 个精度点以内。据我们所知,这是首次有自监督方法在线性评估协议下把与监督的差距缩小到如此程度。因此,为确保公平比较,并怀疑 [8] 中监督基线的表现若配合合适数据增强还能进一步提高,我们也报告自己复现的强监督基线。对所有大型 ResNet 架构(均为 [22] 的版本 1),我们使用 RandAugment [87] 数据增强。监督基线最多训练 200200200 个 epoch,使用动量 0.90.90.9 的 Nesterov SGD,在 555 个 epoch 线性预热后余弦退火学习率,权重衰减 1e−41e-41e−4,标签平滑 [88] 值 0.10.10.1。结果见图 6。

Figure 6

Figure 6: Results for linear evaluation of BYOL compared to fully supervised baselines with various ResNet architectures. Our supervised baselines are ran with RandAugment [87] augmentations.

图 6:多种 ResNet 架构下,BYOL 线性评估相对完全监督基线的结果。我们的监督基线使用 RandAugment [87] 增强。

Appendix D Transfer to other datasets

附录 D 迁移到其他数据集

D.1 Datasets

D.1 数据集

Dataset Classes Original train examples Train examples Valid. examples Test examples Accuracy measure Test provided
ImageNet [21] 100010001000 128116712811671281167 127115812711581271158 100091000910009 500005000050000 Top-1 accuracy -
Food101 [89] 101101101 757507575075750 681756817568175 757575757575 252502525025250 Top-1 accuracy -
CIFAR-10 [78] 101010 500005000050000 450004500045000 500050005000 100001000010000 Top-1 accuracy -
CIFAR-100 [78] 100100100 500005000050000 449334493344933 506750675067 100001000010000 Top-1 accuracy -
Birdsnap [90] 500500500 473864738647386 424054240542405 498149814981 244324432443 Top-1 accuracy -
Sun397 (split 1) [79] 397397397 198501985019850 158801588015880 397039703970 198501985019850 Top-1 accuracy -
Cars [91] 196196196 814481448144 649464946494 165016501650 804180418041 Top-1 accuracy -
Aircraft [92] 100100100 333433343334 333433343334 333333333333 333333333333 Mean per-class accuracy Yes
PASCAL-VOC2007  [80] 202020 501150115011 250125012501 251025102510 495249524952 11-point mAP / AP50 -
PASCAL-VOC2012  [80] 212121 105821058210582 −-− 211921192119 144914491449 Mean IoU -
DTD (split 1)  [81] 474747 188018801880 188018801880 188018801880 188018801880 Top-1 accuracy Yes
Pets [93] 373737 368036803680 294029402940 740740740 366936693669 Mean per-class accuracy -
Caltech-101 [94] 101101101 306030603060 255025502550 510510510 608460846084 Mean per-class accuracy -
Places365 [73] 365365365 180346018034601803460 180346018034601803460 −-− 365003650036500 Top-1 accuracy -
Flowers [95] 102102102 102010201020 102010201020 102010201020 614961496149 Mean per-class accuracy Yes

Table 10: Characteristics of image datasets used in transfer learning. When an official test split with labels is not publicly available, we use the official validation split as test set, and create a held-out validation set from the training examples.

数据集 类别数 原始训练样本 训练样本 验证样本 测试样本 精度指标 是否提供测试集
ImageNet [21] 100010001000 128116712811671281167 127115812711581271158 100091000910009 500005000050000 Top-1 精度 -
Food101 [89] 101101101 757507575075750 681756817568175 757575757575 252502525025250 Top-1 精度 -
CIFAR-10 [78] 101010 500005000050000 450004500045000 500050005000 100001000010000 Top-1 精度 -
CIFAR-100 [78] 100100100 500005000050000 449334493344933 506750675067 100001000010000 Top-1 精度 -
Birdsnap [90] 500500500 473864738647386 424054240542405 498149814981 244324432443 Top-1 精度 -
Sun397 (split 1) [79] 397397397 198501985019850 158801588015880 397039703970 198501985019850 Top-1 精度 -
Cars [91] 196196196 814481448144 649464946494 165016501650 804180418041 Top-1 精度 -
Aircraft [92] 100100100 333433343334 333433343334 333333333333 333333333333 每类平均精度 Yes
PASCAL-VOC2007  [80] 202020 501150115011 250125012501 251025102510 495249524952 11-point mAP / AP50 -
PASCAL-VOC2012  [80] 212121 105821058210582 −-− 211921192119 144914491449 Mean IoU -
DTD (split 1)  [81] 474747 188018801880 188018801880 188018801880 188018801880 Top-1 精度 Yes
Pets [93] 373737 368036803680 294029402940 740740740 366936693669 每类平均精度 -
Caltech-101 [94] 101101101 306030603060 255025502550 510510510 608460846084 每类平均精度 -
Places365 [73] 365365365 180346018034601803460 180346018034601803460 −-− 365003650036500 Top-1 精度 -
Flowers [95] 102102102 102010201020 102010201020 102010201020 614961496149 每类平均精度 Yes

表 10:迁移学习所用图像数据集的特征。若官方带标签的测试划分未公开,我们用官方验证集作测试集,并从训练样本中划出一份留出验证集。

We perform transfer via linear classification and fine-tuning on the same set of datasets as in [8], namely Food-101101101 dataset [89], CIFAR-101010 [78] and CIFAR-100100100 [78], Birdsnap [90], the SUN397397397 scene dataset [79], Stanford Cars [91], FGVC Aircraft [92], the PASCAL VOC 200720072007 classification task [80], the Describable Textures Dataset (DTD) [81], Oxford-IIIT Pets [93], Caltech-101101101 [94], and Oxford 102102102 Flowers [95]. As in [8], we used the validation sets specified by the dataset creators to select hyperparameters for FGVC Aircraft, PASCAL VOC 2007, DTD, and Oxford 102 Flowers. On other datasets, we use the validation examples as test set, and hold out a subset of the training examples that we use as validation set. We use standard metrics for each datasets:

我们在与 [8] 相同的一组数据集上做线性分类与微调迁移,包括 Food-101101101 [89]、CIFAR-101010 [78] 与 CIFAR-100100100 [78]、Birdsnap [90]、SUN397397397 场景数据集 [79]、Stanford Cars [91]、FGVC Aircraft [92]、PASCAL VOC 200720072007 分类任务 [80]、Describable Textures Dataset(DTD) [81]、Oxford-IIIT Pets [93]、Caltech-101101101 [94] 以及 Oxford 102102102 Flowers [95]。与 [8] 一样,对 FGVC Aircraft、PASCAL VOC 2007、DTD 与 Oxford 102 Flowers,我们用数据集作者指定的验证集选超参。其余数据集上,把验证样本当作测试集,并从训练样本中留出子集作验证。各数据集采用标准指标:

  • • Top-111: We compute the proportion of correctly classified examples.
  • • Top-111:我们计算正确分类样本的比例。
  • • Mean per class: We compute the top-111 accuracy for each class separately and then compute the empirical mean over the classes.
  • • 类平均:我们分别计算每一类的 top-111 精度,再对各类取经验均值。
  • • Point 11-mAP: We compute the empirical mean average precision as defined in [80].
  • • Point 11-mAP:我们计算 [80] 所定义的经验平均精度均值。
  • • Mean IoU: We compute the empirical mean Intersection-Over-Union as defined in [80].
  • • *Mean IoU:*我们计算 [80] 所定义的经验交并比均值。
  • • AP50: We compute the Average Precision as defined in [80].
  • • *AP50:*我们计算 [80] 所定义的平均精度。

We detail the validation procedures for some specific datasets:

我们对若干特定数据集的验证流程说明如下:

  • • For Sun397 [79], the original dataset specifies 10 train/test splits, all of which contain 50 examples/images of 397 different classes. We use the first train/test split. The original dataset specifies no validation split and therefore, the training images have been further subdivided into 40 images per class for the train split and 10 images per class for the valid split.
  • • 对 Sun397 [79],原数据集指定 10 个训练/测试划分,每个划分含 397 类、每类 50 张样本/图像。我们使用第一个训练/测试划分。原数据集未指定验证划分,因此训练图像被进一步划分为:训练划分每类 40 张,验证划分每类 10 张。
  • • For Birdsnap [90], we use a random selection of valid images with the same number of images per category as the test split.
  • • 对 Birdsnap [90],我们随机选取与测试划分每类图像数相同的验证图像。
  • • For DTD [81], the original dataset specifies 10 train/validation/test splits, we only use the first split.
  • • 对 DTD [81],原数据集指定 10 个训练/验证/测试划分,我们只使用第一个划分。
  • • For Caltech-101 [94], the original does not dataset specifies any train/test splits. We have followed the approach used in [96]: This file defines datasets for 5 random splits of 25 training images per category, with 5 validation images per category and the remaining images used for testing.
  • • 对 Caltech-101 [94],原数据集未指定任何训练/测试划分。我们遵循 [96] 的做法:该文件定义了 5 个随机划分,每类 25 张训练图像、5 张验证图像,其余用于测试。
  • • For ImageNet, we took the last 100091000910009 last images of the official tensorflow ImageNet split.
  • • 对 ImageNet,我们取官方 tensorflow ImageNet 划分最后的 100091000910009 张图像。
  • • For Oxford-IIIT Pets, the valid set consists of 20 randomly selected images per class.
  • • 对 Oxford-IIIT Pets,验证集由每类随机选取的 20 张图像组成。

Information about the dataset are summarized in Table 10.

关于数据集的信息总结于表 10。

D.2 Transfer via linear classification

D.2 经线性分类的迁移

We follow the linear evaluation protocol of [48, 74, 8] that we detail next for completeness. We train a regularized multinomial logistic regression classifier on top of the frozen representation, i.e., with frozen pretrained parameters and without re-computing batch-normalization statistics. In training and testing, we do not perform any image augmentations; images are resized to 224224224 pixels along the shorter side using bicubic resampling and then normalized with ImageNet statistics. Finally, we minimize the cross-entropy objective using LBFGS with ℓ2\ell_{2}ℓ2​-regularization, where we select the regularization parameters from a range of 454545 logarithmically-spaced values between 10−610^{-6}10−6 and 10510^{5}105. After choosing the best-performing hyperparameters on the validation set, the model is retrained on combined training and validation images together, using the chosen parameters. The final accuracy is reported on the test set.

我们沿用 [48, 74, 8] 的线性评估协议,并在此完整写出以便对照。在冻结表征之上训练带正则的多项逻辑回归分类器,即保持预训练参数冻结,也不重新计算批归一化统计量。训练与测试均不做图像增强:图像沿较短边用双三次重采样缩到 224224224 像素,再用 ImageNet 统计量归一化。最后用带 ℓ2\ell_{2}ℓ2​ 正则的 LBFGS 最小化交叉熵,正则系数在 10−610^{-6}10−6 到 10510^{5}105 之间按对数均匀取 454545 个候选。在验证集上选出最优超参后,用选定参数在训练+验证合并集上重训,最终在测试集上报精度。

D.3 Transfer via fine-tuning

D.3 经微调的迁移

We follow the same fine-tuning protocol as in [32, 48, 76, 8] that we also detail for completeness. Specifically, we initialize the network with the parameters of the pretrained representation. At training time, we apply spatial transformation, i.e., random crops with resize to 224×224224\times 224224×224 pixels and random flips. At test time, images are resized to 256256256 pixels along the shorter side using bicubic resampling, after which a 224×224224\times 224224×224 center crop is extracted. In both cases, we normalize the color channels by subtracting the average color and dividing by the standard deviation (computed on ImageNet), after applying the augmentations. We optimize the loss using SGD with Nesterov momentum for 200002000020000 steps with a batch size of 256256256 and with a momentum of 0.90.90.9. We set the momentum parameter for the batch normalization statistics to max⁡(1−10/s,0.9)\max(1-10/s,0.9)max(1−10/s,0.9) where sss is the number of steps per epoch. The learning rate and weight decay are selected respectively with a grid of seven logarithmically spaced learning rates between 0.00010.00010.0001 and 0.10.10.1, and 777 logarithmically-spaced values of weight decay between 10−610^{-6}10−6 and 10−310^{-3}10−3, as well as no weight decay. These values of weight decay are divided by the learning rate. After choosing the best-performing hyperparameters on the validation set, the model is retrained on combined training and validation images together, using the chosen parameters. The final accuracy is reported on the test set.

我们沿用 [32, 48, 76, 8] 的微调协议并完整写出以便对照。具体地,用预训练表征参数初始化网络。训练时施加空间变换,即随机裁剪并缩放到 224×224224\times 224224×224 像素以及随机翻转。测试时,图像沿较短边用双三次重采样缩到 256256256 像素,再取 224×224224\times 224224×224 中心裁剪。两种情形下,都在增强之后按 ImageNet 均值减、标准差除做颜色通道归一化。损失用带动量 0.90.90.9 的 Nesterov SGD 优化,200002000020000 步、batch size 256256256。批归一化统计量的动量设为 max⁡(1−10/s,0.9)\max(1-10/s,0.9)max(1−10/s,0.9),其中 sss 为每 epoch 步数。学习率与权重衰减分别在 0.00010.00010.0001–0.10.10.1 的七个对数均匀学习率,以及 10−610^{-6}10−6–10−310^{-3}10−3 的七个对数均匀权重衰减(另加无权重衰减)网格上选取;这些权重衰减值再除以学习率。验证集选出最优超参后,用选定参数在训练+验证合并集上重训,最终在测试集上报精度。

D.4 Implementation details for semantic segmentation

D.4 语义分割实现细节

We use the same fully-convolutional network (FCN)-based [7] architecture as [9]. The backbone consists of the convolutional layers in ResNet-505050. The 3×33\times 33×3 convolutions in the conv555 blocks use dilation 222 and stride 111. This is followed by two extra 3×33\times 33×3 convolutions with 256256256 channels, each followed by batch normalization and ReLU activations, and a 1×11\times 11×1 convolution for per-pixel classification. The dilation is set to 666 in the two extra 3×33\times 33×3 convolutions. The total stride is 161616 (FCN-161616s [7]).

我们采用与 [9] 相同的基于全卷积网络(FCN) [7] 的架构。骨干为 ResNet-505050 中的卷积层。conv555 块里的 3×33\times 33×3 卷积使用膨胀率 222、步幅 111。其后接两个带 256256256 通道的额外 3×33\times 33×3 卷积,各自后接批归一化与 ReLU,再接一个用于逐像素分类的 1×11\times 11×1 卷积。这两个额外 3×33\times 33×3 卷积的膨胀率设为 666。总步幅为 161616(FCN-161616s [7])。

We train on the train_aug2012 set and report results on val2012. Hyperparameters are selected on a 211921192119 images held-out validation set. We use a standard per-pixel softmax cross-entropy loss to train the FCN. Training is done with random scaling (by a ratio in \mathopen{}\mathclose{{\left[0.5,2.0}}\right]), cropping, and horizontal flipping. The crop size is 513513513. Inference is performed on the \mathopen{}\mathclose{{\left[513,513}}\right] central crop. For training we use a batch size of 161616 and weight decay of 0.00010.00010.0001. We select the base learning rate by sweeping across 555 logarithmically spaced values between 10−310^{-3}10−3 and 10−110^{-1}10−1. The learning rate is multiplied by 0.10.10.1 at the 707070-th and 909090-th percentile of training. We train for 300003000030000 iterations, and average the results on 5 seeds.

我们在 train_aug2012 上训练,并在 val2012 上报结果。超参在 211921192119 张留出验证图像上选取。用标准逐像素 softmax 交叉熵训练 FCN。训练时施加随机缩放(比例在 \mathopen{}\mathclose{{\left[0.5,2.0}}\right])、裁剪与水平翻转,裁剪大小为 513513513。推理在 \mathopen{}\mathclose{{\left[513,513}}\right] 中心裁剪上进行。训练 batch size 为 161616,权重衰减 0.00010.00010.0001。基础学习率在 10−310^{-3}10−3 与 10−110^{-1}10−1 之间五个对数均匀值上扫描;在训练进度的第 707070 与第 909090 百分位处学习率乘以 0.10.10.1。共训练 300003000030000 次迭代,对 555 个随机种子取平均。

D.5 Implementation details for object detection

D.5 目标检测实现细节

For object detection, we follow prior work on Pascal detection transfer [40, 23] wherever possible. We use a Faster R-CNN [82] detector with a R505050-C444 backbone with a frozen representation. The R505050-C444 backbone ends with the conv444 stage of a ResNet-505050, and the box prediction head consists of the conv555 stage (including global pooling). We preprocess the images by applying multi-scale augmentation (rescaling the image so its longest edge is between 480480480 and 102410241024 pixels) but no other augmentation. We use an asynchronous SGD optimizer with 999 workers and train for 1.51.51.5M steps. We used an initial learning rate of 10−310^{-3}10−3, which is reduced to 10−410^{-4}10−4 at 1M steps and to 10−510^{-5}10−5 at 1.21.21.2M steps.

目标检测尽量沿用 Pascal 检测迁移的既有设定 [40, 23]。我们使用带冻结表征的 Faster R-CNN [82] 检测器,骨干为 R505050-C444。R505050-C444 骨干止于 ResNet-505050 的 conv444 阶段,框预测头由 conv555 阶段(含全局池化)组成。图像预处理只做多尺度增强(最长边缩放到 480480480–102410241024 像素之间),不做其他增强。用 999 个 worker 的异步 SGD,训练 1.51.51.5M 步。初始学习率 10−310^{-3}10−3,在 111M 步降到 10−410^{-4}10−4,在 1.21.21.2M 步降到 10−510^{-5}10−5。

D.6 Implementation details for depth estimation

D.6 深度估计实现细节

For depth estimation, we follow the same protocol as in [83], and report its core components for completeness. We use a standard ResNet-505050 backbone and feed the conv555 features into 444 fast up-projection blocks with respective filter sizes 512512512, 256256256, 128128128, and 646464. We use a reverse Huber loss function for training [83, 97].

对深度估计,我们遵循与 [83] 相同的协议,并为完整性报告其核心组件。我们使用标准 ResNet-505050 骨干,把 conv555 特征送入 4 个快速上投影块,滤波器大小分别为 512512512、256256256、128128128 与 646464。训练使用反向 Huber 损失函数 [83, 97]。

The original NYU Depth v222 frames of size \mathopen{}\mathclose{{\left[640,480}}\right] are down-sampled by a factor 0.50.50.5 and center-cropped to \mathopen{}\mathclose{{\left[304,228}}\right] pixels. Input images are randomly horizontally flipped and the following color transformations are applied:

原始 NYU Depth v222 帧尺寸为 [640,480][640,480][640,480],先按因子 0.50.50.5 下采样,再中心裁剪到 [304,228][304,228][304,228] 像素。输入图像随机水平翻转,并施加如下颜色变换:

  • • Grayscale with an application probability of 0.30.30.3.
  • • 灰度,施加概率 0.30.30.3。
  • • Brightness with a maximum brightness difference of 0.12550.12550.1255.
  • • 亮度,最大亮度差 0.12550.12550.1255。
  • • Saturation with a saturation factor randomly picked in the interval \mathopen{}\mathclose{{\left[0.5,1.5}}\right].
  • • 饱和度,饱和度因子在区间 [0.5,1.5][0.5,1.5][0.5,1.5] 内随机选取。
  • • Hue with a hue adjustment factor randomly picked in the interval \mathopen{}\mathclose{{\left[-0.2,0.2}}\right].
  • • 色调,色调调整因子在区间 [−0.2,0.2][-0.2,0.2][−0.2,0.2] 内随机选取。

We train for 750075007500 steps with batch size 256256256, weight decay 0.0005,0.0005,0.0005, and learning rate 0.160.160.16 (scaled linearly from the setup of [83] to account for the bigger batch size).

我们训练 750075007500 步,批次大小 256256256,权重衰减 0.00050.00050.0005,学习率 0.160.160.16(相对 [83] 的设置按更大批次线性缩放)。

D.7 Further comparisons on PASCAL and NYU v2 Depth

D.7 PASCAL 与 NYU v2 Depth 上的进一步比较

For completeness,  Table 11 and 12 extends Table 4 with other published baselines which use comparable networks. We see that in almost all settings, BYOL outperforms these baselines, even when those baselines use more data or deeper models. One notable exception is RMS error for NYU Depth prediction, which is a metric that’s sensitive to outliers. The reason for this is unclear, but one possibility is that the network is producing higher-variance predictions due to being more confident about a test-set scene’s similarities with those in the training set.

为完整起见,表 11 与表 12 在表 4 之外补充了使用可比网络的其他已发表基线。几乎在所有设定下 BYOL 都优于这些基线,即便对方用了更多数据或更深模型。一个明显例外是 NYU 深度预测的 RMS 误差——该指标对异常值敏感。原因尚不清楚,一种可能是网络对测试场景与训练集相似性更有把握,从而给出方差更高的预测。

Method AP50 mIoU
Supervised-IN [9] 74.474.474.4 74.474.474.4
RelPos [23], by [40]∗ 66.866.866.8 -
Multi-task [40]∗ 70.570.570.5 -
LocalAgg [98] 69.169.169.1 -
MoCo [9] 74.974.974.9 72.572.572.5
MoCo + IG-1B [9] 75.675.675.6 73.673.673.6
CPC[32]∗∗ 76.676.676.6 -
SimCLR (repro) 75.275.275.2 75.275.275.2
BYOL (ours) 77.5\bf{77.5}77.5 76.3\bf{76.3}76.3

Table 11: Transfer results in semantic segmentation and object detection.

方法 AP50 mIoU
Supervised-IN [9] 74.474.474.4 74.474.474.4
RelPos [23], by [40]∗ 66.866.866.8 -
Multi-task [40]∗ 70.570.570.5 -
LocalAgg [98] 69.169.169.1 -
MoCo [9] 74.974.974.9 72.572.572.5
MoCo + IG-1B [9] 75.675.675.6 73.673.673.6
CPC[32]∗∗ 76.676.676.6 -
SimCLR(复现) 75.275.275.2 75.275.275.2
BYOL(本文) 77.5\bf{77.5}77.5 76.3\bf{76.3}76.3

表 11:语义分割与目标检测上的迁移结果。

Higher better Lower better
Method pct.  ⁣< ⁣1.25\!<\!1.25<1.25 pct.  ⁣< ⁣1.252\!<\!1.25^{2}<1.252 pct.  ⁣< ⁣1.253\!<\!1.25^{3}<1.253 rms rel
Supervised-IN [83] 81.181.181.1 95.395.395.3 98.898.898.8 0.5730.5730.573 0.127\bf{0.127}0.127
RelPos [23], by [40]∗ 80.680.680.6 94.794.794.7 98.398.398.3 0.399\bf{0.399}0.399 0.1460.1460.146
Color [41], by [40]∗ 76.876.876.8 93.593.593.5 97.797.797.7 0.4440.4440.444 0.1640.1640.164
Exemplar [46, 40]∗ 71.371.371.3 90.690.690.6 96.596.596.5 0.5130.5130.513 0.1910.1910.191
Mot. Seg. [99], by [40]∗ 74.274.274.2 92.492.492.4 97.497.497.4 0.4730.4730.473 0.1770.1770.177
Multi-task [40]∗ 79.379.379.3 94.294.294.2 98.198.198.1 0.4220.4220.422 0.1520.1520.152
SimCLR (repro) 83.383.383.3 96.596.596.5 99.199.199.1 0.5570.5570.557 0.1340.1340.134
BYOL (ours) 84.6\bf{84.6}84.6 96.7\bf{96.7}96.7 99.1\bf{99.1}99.1 0.5410.5410.541 0.1290.1290.129

Table 12: Transfer results on NYU v2 depth estimation.

越高越好 越低越好
方法 pct.  ⁣< ⁣1.25\!<\!1.25<1.25 pct.  ⁣< ⁣1.252\!<\!1.25^{2}<1.252 pct.  ⁣< ⁣1.253\!<\!1.25^{3}<1.253 rms rel
Supervised-IN [83] 81.181.181.1 95.395.395.3 98.898.898.8 0.5730.5730.573 0.127\bf{0.127}0.127
RelPos [23], by [40]∗ 80.680.680.6 94.794.794.7 98.398.398.3 0.399\bf{0.399}0.399 0.1460.1460.146
Color [41], by [40]∗ 76.876.876.8 93.593.593.5 97.797.797.7 0.4440.4440.444 0.1640.1640.164
Exemplar [46, 40]∗ 71.371.371.3 90.690.690.6 96.596.596.5 0.5130.5130.513 0.1910.1910.191
Mot. Seg. [99], by [40]∗ 74.274.274.2 92.492.492.4 97.497.497.4 0.4730.4730.473 0.1770.1770.177
Multi-task [40]∗ 79.379.379.3 94.294.294.2 98.198.198.1 0.4220.4220.422 0.1520.1520.152
SimCLR(复现) 83.383.383.3 96.596.596.5 99.199.199.1 0.5570.5570.557 0.1340.1340.134
BYOL(本文) 84.6\bf{84.6}84.6 96.7\bf{96.7}96.7 99.1\bf{99.1}99.1 0.5410.5410.541 0.1290.1290.129

表 12:NYU v2 深度估计上的迁移结果。

Appendix E Pretraining on Places 365

附录 E 在 Places 365 上预训练

To ascertain that BYOL learns good representations on other datasets, we applied our representation learning protocol on the scene recognition dataset Places365365365-Standard [73] before performing linear evaluation. This dataset contains 1.801.801.80 million training images and 365003650036500 validation images with labels, making it roughly similar to ImageNet in scale. We reuse the exact same parameters as in Section 4 and train the representation for 100010001000 epochs, using BYOL and our SimCLR reproduction. Results for the linear evaluation setup (using the protocol of Section C.1 for ImageNet and Places365, and that of Appendix D on other datasets) are reported in Table 13.

为确认 BYOL 在其他数据集上也能学到好表征,我们把同一套表征学习流程用到场景识别数据集 Places365365365-Standard [73] 上,再做线性评估。该数据集有 1.801.801.80 百万训练图像与 365003650036500 张带标签验证图像,规模大致与 ImageNet 相当。我们复用第 4 节完全相同的超参,用 BYOL 与我们复现的 SimCLR 各训练 100010001000 个 epoch。线性评估结果(ImageNet 与 Places365 用附录 C.1 协议,其余数据集用附录 D 协议)见表 13。

Interestingly, the representation trained by using BYOL on Places365 (BYOL-PL) consistently outperforms that of SimCLR on the same dataset, but underperforms the BYOL representation trained on ImageNet (BYOL-IN) on all tasks except Places365 and SUN397 [79], another scene understanding dataset. Interestingly, all three unsupervised representation learning methods achieve a relatively high performance on the Places365 task; for comparison, reference [73] (in its linked repository) reports a top-1 accuracy of 55.2%55.2\%55.2% for a ResNet-505050v2 trained from scratch using labels on this dataset.

有趣的是,在 Places365 上用 BYOL 训得的表征(BYOL-PL)始终优于同数据集上的 SimCLR,但在除 Places365 与另一场景理解数据集 SUN397 [79] 之外的所有任务上,都不如在 ImageNet 上训得的 BYOL(BYOL-IN)。三种无监督表征学习方法在 Places365 任务上都取得相对较高的成绩;对照地,文献 [73](其关联仓库)报告在该数据集上用标签从头训练的 ResNet-505050v2 top-1 精度为 55.2%55.2\%55.2%。

Method Places365 ImageNet Food101 CIFAR10 CIFAR100 Birdsnap SUN397 Cars Aircraft DTD Pets Caltech-101 Flowers
BYOL-IN 51.051.051.0 74.374.374.3 75.375.375.3 91.391.391.3 78.478.478.4 57.357.357.3 62.662.662.6 67.267.267.2 60.660.660.6 76.576.576.5 90.490.490.4 94.394.394.3 96.196.196.1
BYOL-PL 53.2\bf{53.2}53.2 58.5\bf{58.5}58.5 64.7\bf{64.7}64.7 84.5\bf{84.5}84.5 66.1\bf{66.1}66.1 28.8\bf{28.8}28.8 64.2\bf{64.2}64.2 55.6\bf{55.6}55.6 55.9\bf{55.9}55.9 68.5\bf{68.5}68.5 66.1\bf{66.1}66.1 84.3\bf{84.3}84.3 90.0\bf{90.0}90.0
SimCLR-PL 53.053.053.0 56.556.556.5 61.761.761.7 80.880.880.8 61.161.161.1 21.221.221.2 62.562.562.5 40.140.140.1 44.344.344.3 64.364.364.3 59.459.459.4 77.177.177.1 85.985.985.9

Table 13: Transfer learning results (linear evaluation, ResNet-505050) from Places365 (PL). For comparison purposes, we also report the results from BYOL trained on ImageNet (BYOL-IN).

方法 Places365 ImageNet Food101 CIFAR10 CIFAR100 Birdsnap SUN397 Cars Aircraft DTD Pets Caltech-101 Flowers
BYOL-IN 51.051.051.0 74.374.374.3 75.375.375.3 91.391.391.3 78.478.478.4 57.357.357.3 62.662.662.6 67.267.267.2 60.660.660.6 76.576.576.5 90.490.490.4 94.394.394.3 96.196.196.1
BYOL-PL 53.2\bf{53.2}53.2 58.5\bf{58.5}58.5 64.7\bf{64.7}64.7 84.5\bf{84.5}84.5 66.1\bf{66.1}66.1 28.8\bf{28.8}28.8 64.2\bf{64.2}64.2 55.6\bf{55.6}55.6 55.9\bf{55.9}55.9 68.5\bf{68.5}68.5 66.1\bf{66.1}66.1 84.3\bf{84.3}84.3 90.0\bf{90.0}90.0
SimCLR-PL 53.053.053.0 56.556.556.5 61.761.761.7 80.880.880.8 61.161.161.1 21.221.221.2 62.562.562.5 40.140.140.1 44.344.344.3 64.364.364.3 59.459.459.4 77.177.177.1 85.985.985.9

表 13:从 Places365(PL)出发的迁移学习结果(线性评估,ResNet-505050)。为对照,同时给出在 ImageNet 上训练的 BYOL(BYOL-IN)结果。

Appendix F Additional ablation results

附录 F 额外消融结果

To extend on the above results, we provide additional ablations obtained using the same experimental setup as in Section 5, i.e., 300 epochs, averaged over 333 seeds with the initial learning rate set to 0.30.30.3, the batch size to 409640964096, the weight decay to 10−610^{-6}10−6 and the base target decay rate τbase\tau_{\text{base}}τbase​ to 0.990.990.99 unless specified otherwise. Confidence intervals correspond to the half-difference between the maximum and minimum score of these seeds; we omit them for half-differences lower than 0.250.250.25 accuracy points.

为扩展上述结果,我们给出与第 5 节相同实验设定下的额外消融,即 300300300 个 epoch,对 333 个种子取平均;除非另有说明,初始学习率设为 0.30.30.3,batch size 为 409640964096,权重衰减为 10−610^{-6}10−6,基础目标衰减率 τbase\tau_{\text{base}}τbase​ 为 0.990.990.99。置信区间取这些种子最高分与最低分之差的一半;半差低于 0.250.250.25 个精度点时省略。

F.1 Architecture settings

F.1 架构设置

Table 14 shows the influence of projector and predictor architecture on BYOL. We examine the effect of different depths for both the projector and predictor, as well as the effect of the projection size. We do not apply a ReLU activation nor a batch normalization on the final linear layer of our MLPs such that a depth of 111 corresponds to a linear layer. Using the default projector and predictor of depth 222 yields the best performance.

表 14 展示投影器与预测器架构对 BYOL 的影响。我们考察二者不同深度以及投影维度的效果。MLP 最后一层线性层不加 ReLU,也不加批归一化,因此深度为 111 即对应单层线性层。默认投影器与预测器深度均为 222 时效果最好。

Proj. gθg_{\theta}gθ​ depth Pred. qθq_{\theta}qθ​ depth Top-111 Top-555
111 111 61.961.961.9 86.086.086.0
222 65.065.065.0 86.886.886.8
333 65.765.765.7 86.886.886.8
222 111 71.571.571.5 90.790.790.7
222 72.5\bf{72.5}72.5 90.8\bf{90.8}90.8
333 71.471.471.4 90.490.490.4
333 111 71.471.471.4 90.490.490.4
222 72.172.172.1 90.590.590.5
333 72.172.172.1 90.590.590.5

(a) Projector and predictor depth (i.e. the number of Linear layers).

投影器 gθg_{\theta}gθ​ 深度 预测器 qθq_{\theta}qθ​ 深度 Top-111 Top-555
111 111 61.961.961.9 86.086.086.0
222 65.065.065.0 86.886.886.8
333 65.765.765.7 86.886.886.8
222 111 71.571.571.5 90.790.790.7
222 72.5\bf{72.5}72.5 90.8\bf{90.8}90.8
333 71.471.471.4 90.490.490.4
333 111 71.471.471.4 90.490.490.4
222 72.172.172.1 90.590.590.5
333 72.172.172.1 90.590.590.5

(a) 投影器与预测器深度(即 Linear 层数)。

Table 15(a) shows the influence of the initial learning rate on BYOL. Note that the optimal value depends on the number of training epochs. Table 15(b) displays the influence of the weight decay on BYOL.

表 15(a) 显示初始学习率对 BYOL 的影响。注意最优值依赖训练 epoch 数。表 15(b) 显示权重衰减对 BYOL 的影响。

Learning
rate Top-111 Top-555
0.010.010.01 34.8±3.034.8{\scriptstyle\pm 3.0}34.8±3.0 60.8±3.260.8{\scriptstyle\pm 3.2}60.8±3.2
0.10.10.1 65.065.065.0 87.087.087.0
0.20.20.2 71.771.771.7 90.690.690.6
0.30.30.3 72.5\bf{72.5}72.5 90.8\bf{90.8}90.8
0.40.40.4 72.372.372.3 90.690.690.6
0.50.50.5 71.571.571.5 90.190.190.1
111 69.469.469.4 89.289.289.2
Weight decay coefficient Top-111 Top-555
1⋅10−71\cdot 10^{-7}1⋅10−7 72.172.172.1 90.490.490.4
5⋅10−75\cdot 10^{-7}5⋅10−7 72.6\bf{72.6}72.6 91.0\bf{91.0}91.0
1⋅10−61\cdot 10^{-6}1⋅10−6 72.572.572.5 90.890.890.8
5⋅10−65\cdot 10^{-6}5⋅10−6 71.0±0.371.0{\scriptstyle\pm 0.3}71.0±0.3 90.090.090.0
1⋅10−51\cdot 10^{-5}1⋅10−5 69.6±0.469.6{\scriptstyle\pm 0.4}69.6±0.4 89.389.389.3

(a) Base learning rate.

学习
率 Top-111 Top-555
0.010.010.01 34.8±3.034.8{\scriptstyle\pm 3.0}34.8±3.0 60.8±3.260.8{\scriptstyle\pm 3.2}60.8±3.2
0.10.10.1 65.065.065.0 87.087.087.0
0.20.20.2 71.771.771.7 90.690.690.6
0.30.30.3 72.5\bf{72.5}72.5 90.8\bf{90.8}90.8
0.40.40.4 72.372.372.3 90.690.690.6
0.50.50.5 71.571.571.5 90.190.190.1
111 69.469.469.4 89.289.289.2
权重衰减系数 Top-111 Top-555
1⋅10−71\cdot 10^{-7}1⋅10−7 72.172.172.1 90.490.490.4
5⋅10−75\cdot 10^{-7}5⋅10−7 72.6\bf{72.6}72.6 91.0\bf{91.0}91.0
1⋅10−61\cdot 10^{-6}1⋅10−6 72.572.572.5 90.890.890.8
5⋅10−65\cdot 10^{-6}5⋅10−6 71.0±0.371.0{\scriptstyle\pm 0.3}71.0±0.3 90.090.090.0
1⋅10−51\cdot 10^{-5}1⋅10−5 69.6±0.469.6{\scriptstyle\pm 0.4}69.6±0.4 89.389.389.3

(a) 基础学习率。

F.2 Batch size

F.2 批次大小

We run a sweep over the batch size for both BYOL and our reproduction of SimCLR. As explained in Section 5, when reducing the batch size by a factor NNN, we average gradients over NNN consecutive steps and update the target network once every NNN steps. We report in Table 16, the performance of both our reproduction of SimCLR and BYOL for batch sizes between 409640964096 (BYOL and SimCLR default) down to 646464. We observe that the performance of SimCLR deteriorates faster than the one of BYOL which stays mostly constant for batch sizes larger than 256256256. We believe that the performance at batch size 256256256 could match the performance of the large 409640964096 batch size with proper parameter tuning when accumulating the gradient. We think that the drop in performance at batch size 646464 in table 16 is mainly related to the ill behaviour of batch normalization at low batch sizes [100].

我们对 BYOL 与复现的 SimCLR 扫了一遍 batch size。如第 5 节所述,当 batch size 缩小 NNN 倍时,我们在连续 NNN 步上平均梯度,并每 NNN 步更新一次目标网络。表 16 给出 batch size 从 409640964096(BYOL 与 SimCLR 默认)降到 646464 时二者的表现。可见 SimCLR 掉点更快,而 BYOL 在 batch size 大于 256256256 时大体保持平稳。我们相信,若在梯度累积时仔细调参,batch size 256256256 有望追上大 batch 409640964096 的成绩。表 16 中 batch size 646464 的掉点,我们主要归因于小 batch 下批归一化行为不良 [100]。

Batch Top-111 Top-555
size BYOL (ours) SimCLR (repro) BYOL (ours) SimCLR (repro)
409640964096 72.5\bf{72.5}72.5 67.967.967.9 90.8\bf{90.8}90.8 88.588.588.5
204820482048 72.472.472.4 67.867.867.8 90.790.790.7 88.588.588.5
102410241024 72.272.272.2 67.467.467.4 90.790.790.7 88.188.188.1
512512512 72.272.272.2 66.566.566.5 90.890.890.8 87.687.687.6
256256256 71.871.871.8 64.3±2.164.3{\scriptstyle\pm 2.1}64.3±2.1 90.790.790.7 86.3±1.086.3{\scriptstyle\pm 1.0}86.3±1.0
128128128 69.6±0.569.6{\scriptstyle\pm 0.5}69.6±0.5 63.663.663.6 89.689.689.6 85.985.985.9
646464 59.7±1.559.7{\scriptstyle\pm 1.5}59.7±1.5 59.2±2.959.2{\scriptstyle\pm 2.9}59.2±2.9 83.2±1.283.2{\scriptstyle\pm 1.2}83.2±1.2 83.0±1.983.0{\scriptstyle\pm 1.9}83.0±1.9

Table 16: Influence of the batch size.

Batch Top-111 Top-555
size BYOL(本文) SimCLR(复现) BYOL(本文) SimCLR(复现)
409640964096 72.5\bf{72.5}72.5 67.967.967.9 90.8\bf{90.8}90.8 88.588.588.5
204820482048 72.472.472.4 67.867.867.8 90.790.790.7 88.588.588.5
102410241024 72.272.272.2 67.467.467.4 90.790.790.7 88.188.188.1
512512512 72.272.272.2 66.566.566.5 90.890.890.8 87.687.687.6
256256256 71.871.871.8 64.3±2.164.3{\scriptstyle\pm 2.1}64.3±2.1 90.790.790.7 86.3±1.086.3{\scriptstyle\pm 1.0}86.3±1.0
128128128 69.6±0.569.6{\scriptstyle\pm 0.5}69.6±0.5 63.663.663.6 89.689.689.6 85.985.985.9
646464 59.7±1.559.7{\scriptstyle\pm 1.5}59.7±1.5 59.2±2.959.2{\scriptstyle\pm 2.9}59.2±2.9 83.2±1.283.2{\scriptstyle\pm 1.2}83.2±1.2 83.0±1.983.0{\scriptstyle\pm 1.9}83.0±1.9

表 16:batch size 的影响。

F.3 Image augmentations

F.3 图像增强

Table 17 compares the impact of individual image transformations on BYOL and SimCLR. BYOL is more resilient to changes of image augmentations across the board. For completeness, we also include an ablation with symmetric parameters across both views; for this ablation, we use a Gaussian blurring w.p. of 0.50.50.5 and a solarization w.p. of 0.20.20.2 for both T\mathcal{T}T and T′\mathcal{T}^{\prime}T′, and recover very similar results compared to our baseline choice of parameters.

表 17 比较单项图像变换对 BYOL 与 SimCLR 的影响。总体而言 BYOL 对增强变化更稳健。为完整起见,我们也给出两视图对称参数的消融:对 T\mathcal{T}T 与 T′\mathcal{T}^{\prime}T′ 均以 0.50.50.5 概率做高斯模糊、以 0.20.20.2 概率做日晒化,结果与基线参数选择非常接近。

Top-111 Top-555
Image augmentation BYOL (ours) SimCLR (repro) BYOL (ours) SimCLR (repro)
Baseline 72.5\bf{72.5}72.5 67.967.967.9 90.8\bf{90.8}90.8 88.588.588.5
Remove flip 71.971.971.9 67.367.367.3 90.690.690.6 88.288.288.2
Remove blur 71.271.271.2 65.265.265.2 90.390.390.3 86.686.686.6
Remove color (jittering and grayscale) 63.4±0.763.4{\scriptstyle\pm 0.7}63.4±0.7 45.745.745.7 85.3±0.585.3{\scriptstyle\pm 0.5}85.3±0.5 70.670.670.6
Remove color jittering 71.871.871.8 63.763.763.7 90.790.790.7 85.985.985.9
Remove grayscale 70.370.370.3 61.961.961.9 89.889.889.8 84.184.184.1
Remove blur in T′\mathcal{T}^{\prime}T′ 72.472.472.4 67.567.567.5 90.890.890.8 88.488.488.4
Remove solarize in T′\mathcal{T}^{\prime}T′ 72.372.372.3 67.767.767.7 90.890.890.8 88.288.288.2
Remove blur and solarize in T′\mathcal{T}^{\prime}T′ 72.272.272.2 67.467.467.4 90.890.890.8 88.188.188.1
Symmetric blurring/solarization 72.572.572.5 68.168.168.1 90.890.890.8 88.488.488.4
Crop only 59.4±0.359.4{\scriptstyle\pm 0.3}59.4±0.3 40.3±0.340.3{\scriptstyle\pm 0.3}40.3±0.3 82.482.482.4 64.8±0.464.8{\scriptstyle\pm 0.4}64.8±0.4
Crop and flip only 60.1±0.360.1{\scriptstyle\pm 0.3}60.1±0.3 40.240.240.2 83.0±0.383.0{\scriptstyle\pm 0.3}83.0±0.3 64.864.864.8
Crop and color only 70.770.770.7 64.264.264.2 90.090.090.0 86.286.286.2
Crop and blur only 61.1±0.361.1{\scriptstyle\pm 0.3}61.1±0.3 41.741.741.7 83.983.983.9 66.466.466.4

Table 17: Ablation on image transformations.

Top-111 Top-555
图像增强 BYOL(本文) SimCLR(复现) BYOL(本文) SimCLR(复现)
基线 72.5\bf{72.5}72.5 67.967.967.9 90.8\bf{90.8}90.8 88.588.588.5
去掉翻转 71.971.971.9 67.367.367.3 90.690.690.6 88.288.288.2
去掉模糊 71.271.271.2 65.265.265.2 90.390.390.3 86.686.686.6
去掉颜色(抖动与灰度) 63.4±0.763.4{\scriptstyle\pm 0.7}63.4±0.7 45.745.745.7 85.3±0.585.3{\scriptstyle\pm 0.5}85.3±0.5 70.670.670.6
去掉颜色抖动 71.871.871.8 63.763.763.7 90.790.790.7 85.985.985.9
去掉灰度 70.370.370.3 61.961.961.9 89.889.889.8 84.184.184.1
在 T′\mathcal{T}^{\prime}T′ 中去掉模糊 72.472.472.4 67.567.567.5 90.890.890.8 88.488.488.4
在 T′\mathcal{T}^{\prime}T′ 中去掉日晒化 72.372.372.3 67.767.767.7 90.890.890.8 88.288.288.2
在 T′\mathcal{T}^{\prime}T′ 中去掉模糊与日晒化 72.272.272.2 67.467.467.4 90.890.890.8 88.188.188.1
对称模糊/日晒化 72.572.572.5 68.168.168.1 90.890.890.8 88.488.488.4
仅裁剪 59.4±0.359.4{\scriptstyle\pm 0.3}59.4±0.3 40.3±0.340.3{\scriptstyle\pm 0.3}40.3±0.3 82.482.482.4 64.8±0.464.8{\scriptstyle\pm 0.4}64.8±0.4
仅裁剪与翻转 60.1±0.360.1{\scriptstyle\pm 0.3}60.1±0.3 40.240.240.2 83.0±0.383.0{\scriptstyle\pm 0.3}83.0±0.3 64.864.864.8
仅裁剪与颜色 70.770.770.7 64.264.264.2 90.090.090.0 86.286.286.2
仅裁剪与模糊 61.1±0.361.1{\scriptstyle\pm 0.3}61.1±0.3 41.741.741.7 83.983.983.9 66.466.466.4

表 17:图像变换消融。

Loss weight β\betaβ Temperature α\alphaα Top-111 Top-555
000 0.10.10.1 72.572.572.5 90.890.890.8
0.10.10.1 0.010.010.01 72.272.272.2 90.790.790.7
0.10.10.1 72.472.472.4 90.990.990.9
0.30.30.3 72.7\bf{72.7}72.7 91.091.091.0
111 72.672.672.6 90.990.990.9
333 72.572.572.5 90.990.990.9
101010 72.572.572.5 90.990.990.9
0.50.50.5 0.010.010.01 70.970.970.9 90.290.290.2
0.10.10.1 72.072.072.0 90.890.890.8
0.30.30.3 72.7\bf{72.7}72.7 91.2\bf{91.2}91.2
111 72.772.772.7 91.191.191.1
333 72.672.672.6 91.191.191.1
101010 72.572.572.5 91.091.091.0
111 0.010.010.01 53.9±0.553.9{\scriptstyle\pm 0.5}53.9±0.5 77.5±0.577.5{\scriptstyle\pm 0.5}77.5±0.5
0.10.10.1 70.970.970.9 90.390.390.3
0.30.30.3 72.7\bf{72.7}72.7 91.191.191.1
111 72.7\bf{72.7}72.7 91.191.191.1
333 72.672.672.6 91.091.091.0
101010 72.672.672.6 91.191.191.1

Table 18: Top-1 accuracy in % under linear evaluation protocol at 300 epochs of sweep over the temperature α\alphaα and the dispersion term weight β\betaβ when using a predictor and a target network.

损失权重 β\betaβ 温度 α\alphaα Top-111 Top-555
000 0.10.10.1 72.572.572.5 90.890.890.8
0.10.10.1 0.010.010.01 72.272.272.2 90.790.790.7
0.10.10.1 72.472.472.4 90.990.990.9
0.30.30.3 72.7\bf{72.7}72.7 91.091.091.0
111 72.672.672.6 90.990.990.9
333 72.572.572.5 90.990.990.9
101010 72.572.572.5 90.990.990.9
0.50.50.5 0.010.010.01 70.970.970.9 90.290.290.2
0.10.10.1 72.072.072.0 90.890.890.8
0.30.30.3 72.7\bf{72.7}72.7 91.2\bf{91.2}91.2
111 72.772.772.7 91.191.191.1
333 72.672.672.6 91.191.191.1
101010 72.572.572.5 91.091.091.0
111 0.010.010.01 53.9±0.553.9{\scriptstyle\pm 0.5}53.9±0.5 77.5±0.577.5{\scriptstyle\pm 0.5}77.5±0.5
0.10.10.1 70.970.970.9 90.390.390.3
0.30.30.3 72.7\bf{72.7}72.7 91.191.191.1
111 72.7\bf{72.7}72.7 91.191.191.1
333 72.672.672.6 91.091.091.0
101010 72.672.672.6 91.191.191.1

表 18:在使用预测器与目标网络时,对温度 α\alphaα 与分散项权重 β\betaβ 做扫描,300300300 个 epoch 线性评估下的 Top-1 精度(%)。

F.4 Details on the relation to contrastive methods

F.4 与对比方法关系的细节

As mentioned in Section 5, the BYOL loss Equation 2 can be derived from the InfoNCE loss

如第 5 节所述,BYOL 损失(方程 2)可由 InfoNCE 损失导出

\text{InfoNCE}^{\alpha,\beta}_{{\theta}}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\frac{2}{B}\sum_{i=1}^{B}S_{\theta}(v_{i},v^{\prime}_{i})\!-\!\frac{2\alpha\cdot\beta}{B}\sum_{i=1}^{B}\ln\mathopen{}\mathclose{{\left(\sum\limits_{j\neq i}\exp\frac{S_{\theta}(v_{i},v_{j})}{\alpha}+\sum\limits_{j}\exp\frac{S_{\theta}(v_{i},v^{\prime}_{j})}{\alpha}}}\right)\mathbin{\raisebox{2.15277pt}{,}} \tag{8}

with

其中

Sθ(u1,u2)=Δ⟨ϕ(u1),ψ(u2)⟩∥ϕ(u1)∥2⋅∥ψ(u2)∥2⋅(9)S_{\theta}(u_{1},u_{2})\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\frac{\langle\phi(u_{1}),\psi(u_{2})\rangle}{\|\phi(u_{1})\|_{2}\cdot\|\psi(u_{2})\|_{2}}\cdot \tag{9}Sθ​(u1​,u2​)=Δ∥ϕ(u1​)∥2​⋅∥ψ(u2​)∥2​⟨ϕ(u1​),ψ(u2​)⟩​⋅(9)

The InfoNCE loss, introduced in [10], can be found in factored form in [84] as

InfoNCE 损失由 [10] 引入,可在 [84] 中找到因式形式

InfoNCEθ=Δ1B∑i=1Bln⁡f(vi,vi′)1B∑jexp⁡f(vi,vj′) ⋅(10)\text{InfoNCE}_{{\theta}}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\frac{1}{B}\sum_{i=1}^{B}\ln\cfrac{f(v_{i},v^{\prime}_{i})}{\frac{1}{B}\sum\limits_{j}\exp f(v_{i},v^{\prime}_{j})}\,\cdot \tag{10}InfoNCEθ​=ΔB1​i=1∑B​lnB1​j∑​expf(vi​,vj′​)f(vi​,vi′​)​⋅(10)

As in SimCLR [8] we also use negative examples given by (vi,vj)j≠i(v_{i},v_{j})_{j\neq i}(vi​,vj​)j=i​ to get

与 SimCLR [8] 一样,我们也使用由 (vi,vj)j≠i(v_{i},v_{j})_{j\neq i}(vi​,vj​)j=i​ 给出的负例,从而得到

\displaystyle\frac{1}{B}\sum_{i=1}^{B}\ln\cfrac{\exp f(v_{i},v^{\prime}_{i})}{\frac{1}{B}\sum\limits_{j\neq i}\exp f(v_{i},v_{j})+\frac{1}{B}\sum\limits_{j}\exp f(v_{i},v^{\prime}_{j})} \\ \displaystyle\qquad=\ln B+\frac{1}{B}\sum_{i=1}^{B}f(v_{i},v^{\prime}_{i})-\frac{1}{B}\sum_{i=1}^{B}\ln\mathopen{}\mathclose{{\left(\sum\limits_{j\neq i}\exp f(v_{i},v_{j})+\sum\limits_{j}\exp f(v_{i},v^{\prime}_{j})}}\right). \tag{11}

To obtain Equation 8 from Equation 12, we subtract ln⁡B\ln BlnB (which is independent of θ{\theta}θ), multiply by 2α2\alpha2α, take f(x,y)=Sθ(x,y)/αf(x,y)=S_{\theta}(x,y)/\alphaf(x,y)=Sθ​(x,y)/α and finally multiply the second (negative examples) term by β\betaβ. Using β=1\beta=1β=1 and dividing by 2α2\alpha2α gets us back to the usual InfoNCE loss as used by SimCLR.

为从方程 12 得到方程 8,我们减去 ln⁡B\ln BlnB(与 θ{\theta}θ 无关),乘以 2α2\alpha2α,取 f(x,y)=Sθ(x,y)/αf(x,y)=S_{\theta}(x,y)/\alphaf(x,y)=Sθ​(x,y)/α,最后把第二项(负例项)乘以 β\betaβ。取 β=1\beta=1β=1 并除以 2α2\alpha2α,即回到 SimCLR 所用的常规 InfoNCE 损失。

In our ablation in Table 5(b), we set the temperature α\alphaα to its best value in the SimCLR setting (i.e., α=0.1\alpha=0.1α=0.1). With this value, setting β\betaβ to 1 (which adds negative examples), in the BYOL setting (i.e., with both a predictor and a target network) hurts the performances. In Table 18, we report results of a sweep over both the temperature α\alphaα and the weight parameter β\betaβ with a predictor and a target network where BYOL corresponds to β=0\beta=0β=0. No run significantly outperforms BYOL and some values of α\alphaα and β\betaβ hurt the performance. While the best temperature for SimCLR (without the target network and a predictor) is 0.10.10.1, after adding a predictor and a target network the best temperature α\alphaα is higher than 0.30.30.3.

在表 5(b) 的消融中,我们把温度 α\alphaα 设为 SimCLR 设定下的最优值(即 α=0.1\alpha=0.1α=0.1)。在该取值下,把 β\betaβ 设为 111(即加入负样本),在 BYOL 设定(同时有预测器与目标网络)中会伤害性能。表 18 报告在同时使用预测器与目标网络时对温度 α\alphaα 与权重参数 β\betaβ 的扫描结果,其中 BYOL 对应 β=0\beta=0β=0。没有任何一组显著超过 BYOL,部分 α\alphaα 与 β\betaβ 还会掉点。SimCLR(无目标网络、无预测器)的最佳温度是 0.10.10.1,加入预测器与目标网络后,最佳温度 α\alphaα 高于 0.30.30.3。

Using a target network in the loss has two effects: stopping the gradient through the prediction targets and stabilizing the targets with averaging. Stopping the gradient through the target change the objective while averaging makes the target stable and stale. In Table 5(b) we only shows results of the ablation when either using the online network as the prediction target (and flowing the gradient through it) or with a target network (both stopping the gradient into the prediction targets and computing the prediction targets with a moving average of the online network). We shown in Table 5(b) that using a target network is beneficial but it has two distinct effects we would like to understand from which effect the improvement comes from. We report in Table 19 the results already in Table 5(b) but also when the prediction target is computed with a stop gradient of the online network (the gradient does not flow into the prediction targets). This shows that making the prediction targets stable and stale is the main cause of the improvement rather than the change in the objective due to the stop gradient.

在损失里使用目标网络有两重效果:截断经预测目标的梯度,以及用平均使目标稳定。截断梯度会改变目标函数,平均则让目标稳定且“陈旧”。表 5(b) 只给出两类消融:要么用在线网络作预测目标(梯度穿过去),要么用目标网络(既截断进入预测目标的梯度,又用在线网络的滑动平均算预测目标)。表 5(b) 表明使用目标网络有益,但这两种效果混在一起,我们想弄清增益主要来自哪一种。表 19 在表 5(b) 已有结果之外,补充了用在线网络的停梯度作为预测目标(梯度不流入预测目标)的情形。结果表明:让预测目标稳定且陈旧,才是主要增益来源,而不是停梯度带来的目标函数变化。

Method Predictor Target parameters β\betaβ Top-1
BYOL ✓ ξ\xiξ 0 72.5\bf{72.5}72.5
✓ ξ\xiξ 1 70.970.970.9
ξ\xiξ 1 70.770.770.7
✓ sg(θ)\mathrm{sg}({\theta})sg(θ) 1 70.270.270.2
SimCLR θ{\theta}θ 1 69.469.469.4
✓ sg(θ)\mathrm{sg}({\theta})sg(θ) 1 70.170.170.1
sg(θ)\mathrm{sg}({\theta})sg(θ) 1 69.269.269.2
✓ θ{\theta}θ 1 69.069.069.0
✓ sg(θ)\mathrm{sg}({\theta})sg(θ) 0 5.55.55.5
✓ θ{\theta}θ 0 0.30.30.3
ξ\xiξ 0 0.20.20.2
sg(θ)\mathrm{sg}({\theta})sg(θ) 0 0.10.10.1
θ{\theta}θ 0 0.10.10.1

Table 19: Top-1 accuracy in %, under linear evaluation protocol at 300 epochs, of intermediate variants between BYOL and SimCLR (with caveats discussed in Section F.5). sg\mathrm{sg}sg means stop gradient.

方法 预测器 目标参数 β\betaβ Top-1
BYOL ✓ ξ\xiξ 0 72.5\bf{72.5}72.5
✓ ξ\xiξ 1 70.970.970.9
ξ\xiξ 1 70.770.770.7
✓ sg(θ)\mathrm{sg}({\theta})sg(θ) 1 70.270.270.2
SimCLR θ{\theta}θ 1 69.469.469.4
✓ sg(θ)\mathrm{sg}({\theta})sg(θ) 1 70.170.170.1
sg(θ)\mathrm{sg}({\theta})sg(θ) 1 69.269.269.2
✓ θ{\theta}θ 1 69.069.069.0
✓ sg(θ)\mathrm{sg}({\theta})sg(θ) 0 5.55.55.5
✓ θ{\theta}θ 0 0.30.30.3
ξ\xiξ 0 0.20.20.2
sg(θ)\mathrm{sg}({\theta})sg(θ) 0 0.10.10.1
θ{\theta}θ 0 0.10.10.1

表 19:在 BYOL 与 SimCLR 之间的中间变体在 300300300 个 epoch 线性评估下的 Top-1 精度(%)(附带第 F.5 节讨论的注意点)。sg\mathrm{sg}sg 表示停梯度。

F.5 SimCLR baseline of Section 5

F.5 第 5 节的 SimCLR 基线

The SimCLR baseline in Section 5 (β=1\beta=1β=1, without predictor nor target network) is slightly different from the original one in [8]. First we multiply the original loss by 2α2\alpha2α. For comparaison here is the original SimCLR loss,

第 5 节中的 SimCLR 基线(β=1\beta=1β=1,无预测器也无目标网络)与 [8] 中的原始版本略有不同。首先我们把原始损失乘以 2α2\alpha2α。为便于比较,这里给出原始 SimCLR 损失,

\displaystyle\text{InfoNCE}_{{\theta}}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\frac{1}{B}\sum_{i=1}^{B}\frac{S_{\theta}(v_{i},v^{\prime}_{i})}{\alpha}\!-\!\frac{1}{B}\sum_{i=1}^{B}\ln\mathopen{}\mathclose{{\left(\sum\limits_{j\neq i}\exp\frac{S_{\theta}(v_{i},v_{j})}{\alpha}+\sum\limits_{j}\exp\frac{S_{\theta}(v_{i},v^{\prime}_{j})}{\alpha}}}\right)\cdot \tag{13}

Note that this multiplication by 2α2\alpha2α matters as the LARS optimizer is not completely invariant with respect to the scale of the loss. Indeed, LARS applies a preconditioning to gradient updates on all weights, except for biases and batch normalization parameters. Updates on preconditioned weights are invariant by multiplicative scaling of the loss. However, the bias and batch normalization parameter updates remain sensitive to multiplicative scaling of the loss.

注意:乘以 2α2\alpha2α 是有意义的,因为 LARS 优化器对损失尺度并非完全不变。LARS 会对除偏置与批归一化参数以外的所有权重做预条件更新;经预条件的权重更新对损失的乘性缩放不变。但偏置与批归一化参数的更新仍对损失的乘性缩放敏感。

We also increase the original SimCLR hidden and output size of the projector to respectively 4096 and 256. In our reproduction of SimCLR, these three combined changes improves the top-1 accuracy at 300 epochs from 67.9%67.9\%67.9% (without the changes) to 69.2%69.2\%69.2% (with the changes).

我们还将原始 SimCLR 投影器的隐层与输出尺寸分别增大到 4096 与 256。在我们复现的 SimCLR 中,这三项改动合起来把 300 个 epoch 时的 top-1 精度从 67.9%67.9\%67.9%(无改动)提升到 69.2%69.2\%69.2%(有改动)。

F.6 Ablation on the normalization in the loss function

F.6 损失函数中归一化的消融

(a) Representation ℓ2\ell_{2}ℓ2​-norm

(a) 表征 ℓ2\ell_{2}ℓ2​-范数

Normalization Top-1 Top-5
ℓ2\ell_{2}ℓ2​-norm 72.5\bf{72.5}72.5 90.8\bf{90.8}90.8
LayerNorm 72.5±0.472.5{\scriptstyle\pm 0.4}72.5±0.4 90.190.190.1
No normalization 67.467.467.4 87.187.187.1
BatchNorm 65.365.365.3 85.385.385.3

Table 20: Top-1 accuracy in % under linear evaluation protocol at 300 epochs for different normalizations in the loss.

归一化 Top-1 Top-5
ℓ2\ell_{2}ℓ2​-范数 72.5\mathbf{72.5}72.5 90.8\mathbf{90.8}90.8
LayerNorm 72.5±0.472.5{\scriptstyle\pm 0.4}72.5±0.4 90.190.190.1
无归一化 67.467.467.4 87.187.187.1
BatchNorm 65.365.365.3 85.385.385.3

表 20:损失中不同归一化下,300 个 epoch 线性评估协议的 Top-1 精度(%)。

BYOL minimizes a squared error between the ℓ2\ell_{2}ℓ2​-normalized prediction and target. We report results of BYOL at 300 epochs using different normalization function and no normalization at all. More precisely, given batch of prediction and targets in Rd\mathbb{R}^{d}Rd, (pi,ti)i≤B(p_{i},t_{i})_{i\leq B}(pi​,ti​)i≤B​ with BBB the batch size, BYOL uses the loss function 1B∑i=1B∥nℓ2(pi)−nℓ2(zi)∥22\frac{1}{B}\sum_{i=1}^{B}\|n_{\ell_{2}}(p_{i})-n_{\ell_{2}}(z_{i})\|_{2}^{2}B1​∑i=1B​∥nℓ2​​(pi​)−nℓ2​​(zi​)∥22​ with nℓ2:x→x/∥x∥2n_{\ell_{2}}:x\rightarrow x/\|x\|_{2}nℓ2​​:x→x/∥x∥2​. We run BYOL with other normalization functions: non-trainable batch-normalization and layer-normalization and no normalization. We divide the batch normalization and layer normalization by d\sqrt{d}d​ to have a consistent scale with the ℓ2\ell_{2}ℓ2​-normalization. We report results in Table 20 where ℓ2\ell_{2}ℓ2​, LayerNorm, no normalization and BatchNorm respectively denote using nℓ2n_{\ell_{2}}nℓ2​​, nBN n_{\text{{B\hskip-0.70004ptN} }}nBN ​, nLN n_{\text{{L\hskip-0.70004ptN} }}nLN ​ and nId n_{\text{{I\hskip-0.70004ptd} }}nId ​ with

BYOL 最小化 ℓ2\ell_{2}ℓ2​ 归一化后的预测与目标之间的平方误差。我们报告 300300300 个 epoch 下改用其他归一化函数、乃至完全不做归一化的结果。更精确地,给定批次内的预测与目标 (pi,ti)i≤B∈Rd(p_{i},t_{i})_{i\leq B}\in\mathbb{R}^{d}(pi​,ti​)i≤B​∈Rd(BBB 为 batch size),BYOL 使用损失 1B∑i=1B∥nℓ2(pi)−nℓ2(zi)∥22\frac{1}{B}\sum_{i=1}^{B}\|n_{\ell_{2}}(p_{i})-n_{\ell_{2}}(z_{i})\|_{2}^{2}B1​∑i=1B​∥nℓ2​​(pi​)−nℓ2​​(zi​)∥22​,其中 nℓ2:x→x/∥x∥2n_{\ell_{2}}:x\rightarrow x/\|x\|_{2}nℓ2​​:x→x/∥x∥2​。我们还试验了不可训练的批归一化、层归一化以及无归一化。批归一化与层归一化再除以 d\sqrt{d}d​,以与 ℓ2\ell_{2}ℓ2​ 归一化尺度一致。结果见表 20,其中 ℓ2\ell_{2}ℓ2​、LayerNorm、无归一化与 BatchNorm 分别对应 nℓ2n_{\ell_{2}}nℓ2​​、nBN n_{\text{{B\hskip-0.70004ptN} }}nBN ​、nLN n_{\text{{L\hskip-0.70004ptN} }}nLN ​ 与 nId n_{\text{{I\hskip-0.70004ptd} }}nId ​,且

\displaystyle{n_{\text{{B\hskip-0.70004ptN} }}^{j}}_{i} \\ \displaystyle:x\rightarrow\frac{x_{i}^{j}-\mu_{\text{{B\hskip-0.70004ptN} }}^{j}(x)}{\sigma_{\text{BN}}^{j}(x)\cdot\sqrt{d}}\mathbin{\raisebox{2.15277pt}{,}}\quad{n_{\text{{L\hskip-0.70004ptN} }}^{j}}_{i}:x\rightarrow\frac{x_{i}^{j}-{\mu_{\text{{L\hskip-0.70004ptN} }}}_{i}(x)}{{\sigma_{\text{LN}}}_{i}(x)\cdot\sqrt{d}}\mathbin{\raisebox{2.15277pt}{,}}\quad n_{\text{{I\hskip-0.70004ptd} }}:x\rightarrow x, \\ \displaystyle\mu_{\text{{B\hskip-0.70004ptN} }}^{j} \\ \displaystyle:x\rightarrow\frac{1}{B}\sum_{i=1}^{B}x_{i}^{j},\quad\sigma_{\text{{B\hskip-0.70004ptN} }}^{j}:x\rightarrow\sqrt{\frac{1}{B}\sum_{i=1}^{B}\mathopen{}\mathclose{{\left({x_{i}^{j}}}}\right)^{2}-\mu_{\text{{B\hskip-0.70004ptN} }}^{j}(x)^{2}},\quad \\ \displaystyle{\mu_{\text{{L\hskip-0.70004ptN} }}}_{i} \\ \displaystyle:x\rightarrow\frac{1}{d}\sum_{j=1}^{d}x_{i}^{j},\quad{\sigma_{\text{{L\hskip-0.70004ptN} }}}_{i}:x\rightarrow\frac{\|x_{i}-{\mu_{\textsc{L\hskip-0.70004ptN}}}_{i}(x)\|_{2}}{\sqrt{d}}

When using no normalization at all, the projection ℓ2\ell_{2}ℓ2​ norm rapidly increases during the first 100 epochs and stabilizes at around 3⋅1063\cdot 10^{6}3⋅106 as shown in Figure 7. Despite this behaviour, using no normalization still performs reasonably well (67.4%)(67.4\%)(67.4%). The ℓ2\ell_{2}ℓ2​ normalization performs the best.

完全不使用归一化时,投影的 ℓ2\ell_{2}ℓ2​ 范数在前 100 个 epoch 迅速增大,并稳定在约 3⋅1063\cdot 10^{6}3⋅106,如图 7 所示。尽管如此,无归一化仍有合理表现(67.4%67.4\%67.4%)。ℓ2\ell_{2}ℓ2​ 归一化表现最好。

Appendix G Training with smaller batch sizes

附录 G 用更小批次训练

The results described in Section 4 were obtained using a batch size of 409640964096 split over 512512512 TPU cores. Due to its increased robustness, BYOL can also be trained using smaller batch sizes without significantly decreasing performance. Using the same linear evaluation setup, BYOL achieves 73.7%73.7\%73.7% top-1 accuracy when trained over 100010001000 epochs with a batch size of 512512512 split over 646464 TPU cores (approximately 444 days of training). For this setup, we reuse the same setting as in Section 3, but use a base learning rate of 0.40.40.4 (appropriately scaled by the batch size) and τbase=0.9995\tau_{\text{base}}=0.9995τbase​=0.9995 with the same weight decay coefficient of 1.5⋅10−61.5\cdot 10^{-6}1.5⋅10−6.

第 4 节结果使用 batch size 409640964096,分在 512512512 个 TPU 核上。由于鲁棒性更强,BYOL 也能用更小 batch 训练而不显著掉点。同一线性评估设定下,用 batch size 512512512 分在 646464 个 TPU 核上训练 100010001000 个 epoch(约 444 天),BYOL 取得 73.7%73.7\%73.7% top-1 精度。该设定复用第 3 节其余配置,但基础学习率取 0.40.40.4(按 batch size 适当缩放),τbase=0.9995\tau_{\text{base}}=0.9995τbase​=0.9995,权重衰减系数仍为 1.5⋅10−61.5\cdot 10^{-6}1.5⋅10−6。

Appendix H Details on Equation 5 in Section 3.2

附录 H 第 3.2 节方程 5 的细节

In this section we clarify why BYOL’s update is related to Equation 5 from Section 3.2,

本节澄清为何 BYOL 的更新与第 3.2 节方程 5 相关,

\displaystyle\nabla_{\theta}\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|q^{\star}(z_{\theta})-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right]=\nabla_{\theta}\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|\mathbb{E}\mathopen{}\mathclose{{\left[z^{\prime}_{\xi}|z_{\theta}}}\right]-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right]=\nabla_{\theta}\mathbb{E}\mathopen{}\mathclose{{\left[\sum_{i}\var(z^{\prime}_{\xi,i}|z_{\theta})}}\right]. \tag{5}

Recall that q⋆q^{\star}q⋆ is defined as

回顾 q⋆q^{\star}q⋆ 定义为

\displaystyle q^{\star}\mathrel{\hbox{\hskip 3.8889pt\hskip-3.8889pt\hbox{$=$}\hskip-3.8889pt\hskip-2.7431pt\raisebox{4.66875pt}{\hbox{$\scriptscriptstyle\Delta$}}\hskip-2.7431pt\hskip 3.8889pt}}\argmin_{q}\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|q(z_{\theta})-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right],\quad\text{where}\quad q^{\star}(z_{\theta})=\mathbb{E}\mathopen{}\mathclose{{\left[z^{\prime}_{\xi}|z_{\theta}}}\right], \tag{4}

and implicitly depends on θ{\theta}θ and ξ\xiξ; therefore, it should be denoted as q⋆(θ,ξ)q^{\star}({\theta},\xi)q⋆(θ,ξ) instead of just q⋆q^{\star}q⋆. For simplicity we write q⋆(θ,ξ)(zθ)q^{\star}({\theta},\xi)(z_{\theta})q⋆(θ,ξ)(zθ​) as q⋆(θ,ξ,zθ)q^{\star}({\theta},\xi,z_{\theta})q⋆(θ,ξ,zθ​) the output of the optimal predictor for any parameters θ{\theta}θ and ξ\xiξ and input zθz_{\theta}zθ​.

并且它隐式依赖 θ{\theta}θ 与 ξ\xiξ;因此应记为 q⋆(θ,ξ)q^{\star}({\theta},\xi)q⋆(θ,ξ) 而非仅 q⋆q^{\star}q⋆。为简洁起见,对任意参数 θ{\theta}θ、ξ\xiξ 与输入 zθz_{\theta}zθ​,我们把最优预测器的输出 q⋆(θ,ξ)(zθ)q^{\star}({\theta},\xi)(z_{\theta})q⋆(θ,ξ)(zθ​) 写作 q⋆(θ,ξ,zθ)q^{\star}({\theta},\xi,z_{\theta})q⋆(θ,ξ,zθ​)。

BYOL updates its online parameters following the gradient of Equation 5, but considering only the gradients of qqq with respect to its third argument zzz when applying the chain rule. If we rewrite

BYOL 按方程 5 的梯度更新在线参数,但在应用链式法则时,只考虑 qqq 相对其第三个自变量 zzz 的梯度。若我们重写

\displaystyle\mathbb{E}\mathopen{}\mathclose{{\left[\mathopen{}\mathclose{{\left\|q^{\star}({\theta},\xi,z_{\theta})-z^{\prime}_{\xi}}}\right\|_{2}^{2}}}\right]=\mathbb{E}\mathopen{}\mathclose{{\left[L(q^{\star}({\theta},\xi,z_{\theta}),z^{\prime}_{\xi})}}\right], \tag{14}

the gradient of this quantity w.r.t. θ{\theta}θ is

该量相对 θ{\theta}θ 的梯度为

\displaystyle\frac{\partial}{\partial{\theta}}\mathbb{E}\mathopen{}\mathclose{{\left[L(q^{\star}({\theta},\xi,z_{\theta}),z^{\prime}_{\xi})}}\right]=\mathbb{E}\mathopen{}\mathclose{{\left[\frac{\partial L}{\partial q}\cdot\frac{\partial q^{\star}}{\partial{\theta}}+\frac{\partial L}{\partial q}\cdot\frac{\partial q^{\star}}{\partial z}\cdot\frac{\partial z_{\theta}}{\partial{\theta}}}}\right], \tag{15}

where ∂q⋆∂θ\frac{\partial q^{\star}}{\partial{\theta}}∂θ∂q⋆​ and ∂q⋆∂z\frac{\partial q^{\star}}{\partial z}∂z∂q⋆​ are the gradients of q⋆q^{\star}q⋆ with respect to its first and last argument. Using the envelope theorem, and thanks to the optimality condition of the predictor, the term \mathbb{E}\mathopen{}\mathclose{{\left[\frac{\partial L}{\partial q}\cdot\frac{\partial q^{\star}}{\partial{\theta}}}}\right]=0. Therefore, the remaining term \mathbb{E}\mathopen{}\mathclose{{\left[\frac{\partial L}{\partial q}\cdot\frac{\partial q^{\star}}{\partial z}\cdot\frac{\partial z_{\theta}}{\partial{\theta}}}}\right] where gradients are only back-propagated through the predictor’s input is exactly the direction followed by BYOL.

其中 ∂q⋆∂θ\frac{\partial q^{\star}}{\partial{\theta}}∂θ∂q⋆​ 与 ∂q⋆∂z\frac{\partial q^{\star}}{\partial z}∂z∂q⋆​ 是 q⋆q^{\star}q⋆ 对其第一与最后一个参数的梯度。由包络定理,并借助预测器的最优性条件,项 \mathbb{E}\mathopen{}\mathclose{{\left[\frac{\partial L}{\partial q}\cdot\frac{\partial q^{\star}}{\partial{\theta}}}}\right]=0。因此,剩余项 \mathbb{E}\mathopen{}\mathclose{{\left[\frac{\partial L}{\partial q}\cdot\frac{\partial q^{\star}}{\partial z}\cdot\frac{\partial z_{\theta}}{\partial{\theta}}}}\right]——梯度只经预测器输入回传——正是 BYOL 所沿的方向。

Appendix I Importance of a near-optimal predictor

附录 I 接近最优的预测器的重要性

In this part we build upon the intuitions of Section 3.2 on the importance of keeping the predictor near-optimal. Specifically, we show that it is possible to remove the exponential moving average in BYOL’s target network (i.e., simply copy weights of the online network into the target) without causing the representation to collapse, provided the predictor remains sufficiently good.

本部分建立在第 3.2 节关于保持预测器接近最优之重要性的直觉之上。具体地,我们表明:只要预测器保持足够好,就有可能去掉 BYOL 目标网络中的指数滑动平均(即简单地把在线网络权重复制到目标网络),而不导致表征崩塌。

I.1 Predictor learning rate

I.1 预测器学习率

In this setup, we remove the exponential moving average (i.e., set τ=0\tau=0τ=0 over the full training in Equation 1), and multiply the learning rate of the predictor by a constant λ\lambdaλ compared to the learning rate used for the rest of the network; all other hyperparameters are unchanged. As shown in Table 21, using sufficiently large values of λ\lambdaλ provides a reasonably good level of performance and the performance sharply decreases with λ\lambdaλ to 0.01%0.01\%0.01% top-1 accuracy (no better than random) for λ=0\lambda=0λ=0.

该设定下去掉指数滑动平均(即在式 1 的全程训练中令 τ=0\tau=0τ=0),并把预测器学习率相对网络其余部分乘以常数 λ\lambdaλ;其余超参不变。如表 21 所示,λ\lambdaλ 足够大时仍能达到尚可的水平,而随 λ\lambdaλ 降到 000,性能急剧掉到 0.01%0.01\%0.01% top-1(不优于随机)。

To show that this effect is directly related to a change of behavior in the predictor, and not only to a change of learning rate in any subpart of the network, we perform a similar experiment by using a multiplier λ\lambdaλ on the predictor’s learning rate, and a different multiplier μ\muμ for the projector. In Table 22, we show that the representation typically collapses or performs poorly when the predictor learning rate is lower or equal to that of the projector. As mentioned in Section 3.2, we further hypothesize that one of the contributions of the target network is to maintain a near optimal predictor at all times.

为说明这一效应直接来自预测器行为变化,而不只是网络某一子模块学习率变了,我们做类似实验:对预测器学习率乘 λ\lambdaλ,对投影器另乘 μ\muμ。表 22 表明,当预测器学习率低于或等于投影器时,表征通常崩塌或表现很差。如第 3.2 节所述,我们进一步猜想:目标网络的贡献之一,正是始终维持接近最优的预测器。

I.2 Optimal linear predictor in closed form

I.2 闭式最优线性预测器

Similarly, we can get rid of the slowly moving target network if we use a closed form optimal predictor on the batch, instead of a learned, non-optimal one. In this case we restrict ourselves to a linear predictor,

类似地,若在批次上使用闭式最优预测器,而不是学到的、非最优预测器,我们也可以去掉慢速滑动的目标网络。此时我们把自身限制为线性预测器,

\displaystyle q^{\star}=\argmin_{Q}\mathopen{}\mathclose{{\left\|Z_{\theta}Q-Z^{\prime}_{\xi}}}\right\|_{2}^{2}=\mathopen{}\mathclose{{\left(Z_{\theta}^{\mathsf{\scriptscriptstyle T}}Z_{\theta}}}\right)^{-1}Z_{\theta}^{\mathsf{\scriptscriptstyle T}}Z^{\prime}_{\xi}

with \mathopen{}\mathclose{{\left\|\cdot}}\right\|_{2} being the Frobenius norm, ZθZ_{\theta}Zθ​ and Zξ′Z^{\prime}_{\xi}Zξ′​ of shape (B,F)(B,F)(B,F) respectively the online and target projections, where BBB is the batch size and FFF the number of features; and q⋆q^{\star}q⋆ of shape (F,F)(F,F)(F,F), the optimal linear predictor for the batch.

其中 ∥⋅∥2\|\cdot\|_{2}∥⋅∥2​ 为 Frobenius 范数,ZθZ_{\theta}Zθ​ 与 Zξ′Z^{\prime}_{\xi}Zξ′​ 形状为 (B,F)(B,F)(B,F),分别是在线与目标投影,BBB 为批次大小,FFF 为特征数;q⋆q^{\star}q⋆ 形状为 (F,F)(F,F)(F,F),是该批次的最优线性预测器。

At 300300300 epochs, when using the closed form optimal predictor, and directly hard copying the weights of the online network into the target, we obtain a top-111 accuracy of fillfillfill.

在 300300300 个 epoch 时,使用闭式最优预测器并把在线网络权重直接硬拷贝到目标网络,我们获得的 top-111 精度为 fill。

λ\lambdaλ Top-111
000 0.010.010.01
111 5.55.55.5
222 62.8±1.562.8{\scriptstyle\pm 1.5}62.8±1.5
101010 66.666.666.6
202020 66.3±0.366.3{\scriptstyle\pm 0.3}66.3±0.3
Baseline 72.572.572.5

Table 21: Top-111 accuracy at 300 epochs when removing the slowly moving target network, directly hard copying the weights of the online network into the target network, and applying a multiplier to the predictor learning rate.

λ\lambdaλ Top-111
000 0.010.010.01
111 5.55.55.5
222 62.8±1.562.8{\scriptstyle\pm 1.5}62.8±1.5
101010 66.666.666.6
202020 66.3±0.366.3{\scriptstyle\pm 0.3}66.3±0.3
基线 72.572.572.5

表 21:去掉慢速滑动目标网络、把在线网络权重硬拷贝到目标网络,并对预测器学习率施加乘数时,300300300 个 epoch 的 Top-111 精度。

λpred\lambda_{pred}λpred​
111 1.51.51.5 222 555 101010
μproj\mu_{proj}μproj​ 111 3.2±2.93.2{\scriptstyle\pm 2.9}3.2±2.9 25.7±6.625.7{\scriptstyle\pm 6.6}25.7±6.6 60.8±2.960.8{\scriptstyle\pm 2.9}60.8±2.9 66.7±0.466.7{\scriptstyle\pm 0.4}66.7±0.4 66.966.966.9
1.51.51.5 1.4±2.01.4{\scriptstyle\pm 2.0}1.4±2.0 9.2±7.09.2{\scriptstyle\pm 7.0}9.2±7.0 55.2±5.855.2{\scriptstyle\pm 5.8}55.2±5.8 61.5±0.661.5{\scriptstyle\pm 0.6}61.5±0.6 66.0±0.366.0{\scriptstyle\pm 0.3}66.0±0.3
222 2.0±2.82.0{\scriptstyle\pm 2.8}2.0±2.8 5.3±1.95.3{\scriptstyle\pm 1.9}5.3±1.9 15.8±13.415.8{\scriptstyle\pm 13.4}15.8±13.4 60.9±0.860.9{\scriptstyle\pm 0.8}60.9±0.8 66.366.366.3
555 1.5±0.91.5{\scriptstyle\pm 0.9}1.5±0.9 2.5±1.52.5{\scriptstyle\pm 1.5}2.5±1.5 2.5±1.42.5{\scriptstyle\pm 1.4}2.5±1.4 20.5±2.020.5{\scriptstyle\pm 2.0}20.5±2.0 60.5±0.660.5{\scriptstyle\pm 0.6}60.5±0.6
101010 0.10.10.1 2.1±0.32.1{\scriptstyle\pm 0.3}2.1±0.3 1.9±0.81.9{\scriptstyle\pm 0.8}1.9±0.8 2.8±0.42.8{\scriptstyle\pm 0.4}2.8±0.4 8.3±6.88.3{\scriptstyle\pm 6.8}8.3±6.8

Table 22: Top-111 accuracy at 300 epochs when removing the slowly moving target network, directly hard copying the weights of the online network in the target network, and applying a multiplier μ\muμ to the projector and λ\lambdaλ to the predictor learning rate. The predictor learning rate needs to be higher than the projector learning rate in order to successfully remove the target network. This further suggests that the learning dynamic of predictor is central to BYOL’s stability.

λpred\lambda_{pred}λpred​
111 1.51.51.5 222 555 101010
μproj\mu_{proj}μproj​ 111 3.2±2.93.2{\scriptstyle\pm 2.9}3.2±2.9 25.7±6.625.7{\scriptstyle\pm 6.6}25.7±6.6 60.8±2.960.8{\scriptstyle\pm 2.9}60.8±2.9 66.7±0.466.7{\scriptstyle\pm 0.4}66.7±0.4 66.966.966.9
1.51.51.5 1.4±2.01.4{\scriptstyle\pm 2.0}1.4±2.0 9.2±7.09.2{\scriptstyle\pm 7.0}9.2±7.0 55.2±5.855.2{\scriptstyle\pm 5.8}55.2±5.8 61.5±0.661.5{\scriptstyle\pm 0.6}61.5±0.6 66.0±0.366.0{\scriptstyle\pm 0.3}66.0±0.3
222 2.0±2.82.0{\scriptstyle\pm 2.8}2.0±2.8 5.3±1.95.3{\scriptstyle\pm 1.9}5.3±1.9 15.8±13.415.8{\scriptstyle\pm 13.4}15.8±13.4 60.9±0.860.9{\scriptstyle\pm 0.8}60.9±0.8 66.366.366.3
555 1.5±0.91.5{\scriptstyle\pm 0.9}1.5±0.9 2.5±1.52.5{\scriptstyle\pm 1.5}2.5±1.5 2.5±1.42.5{\scriptstyle\pm 1.4}2.5±1.4 20.5±2.020.5{\scriptstyle\pm 2.0}20.5±2.0 60.5±0.660.5{\scriptstyle\pm 0.6}60.5±0.6
101010 0.10.10.1 2.1±0.32.1{\scriptstyle\pm 0.3}2.1±0.3 1.9±0.81.9{\scriptstyle\pm 0.8}1.9±0.8 2.8±0.42.8{\scriptstyle\pm 0.4}2.8±0.4 8.3±6.88.3{\scriptstyle\pm 6.8}8.3±6.8

表 22:去掉慢速滑动目标网络、把在线网络权重硬拷贝到目标网络,并对投影器施加乘数 μ\muμ、对预测器施加乘数 λ\lambdaλ 时,300300300 个 epoch 的 Top-111 精度。要成功去掉目标网络,预测器学习率需高于投影器学习率。这进一步表明预测器的学习动态对 BYOL 的稳定性至关重要。

Figure 8

Figure 8: BYOL sketch summarizing the method by emphasizing the neural architecture.

图 8:通过强调神经网络架构来概括方法的 BYOL 示意图。

See pages 1-3 of lalala.pdf

见 lalala.pdf 第 1–3 页。