The existing contrastive learning methods widely adopt one-hot instance discrimination as pretext task for self-supervised learning, which inevitably neglects rich inter-instance similarities among natural images, then leading to potential representation degeneration. In this paper, we propose a novel image mix method, PatchMix, for contrastive learning in Vision Transformer (ViT), to model inter-instance similarities among images. Following the nature of ViT, we randomly mix multiple images from mini-batch in patch level to construct mixed image patch sequences for ViT. Compared to the existing sample mix methods, our PatchMix can flexibly and efficiently mix more than two images and simulate more complicated similarity relations among natural images. In this manner, our contrastive framework can significantly reduce the gap between contrastive objective and ground truth in reality. Experimental results demonstrate that our proposed method significantly outperforms the previous state-of-the-art on both ImageNet-1K and CIFAR datasets, e.g., 3.0% linear accuracy improvement on ImageNet-1K and 8.7% kNN accuracy improvement on CIFAR100. Moreover, our method achieves the leading transfer performance on downstream tasks, object detection and instance segmentation on COCO dataset. The code is available at https://github.com/visresearch/patchmix
翻译:现有对比学习方法广泛采用独热码实例判别作为自监督学习的预文本任务,这不可避免地忽略了自然图像中丰富的实例间相似性,进而导致表示退化。本文针对视觉Transformer(ViT)中的对比学习,提出了一种新颖的图像混合方法——PatchMix,用于建模图像间的实例间相似性。遵循ViT的特性,我们从微型批次中随机混合多幅图像的块级内容,构建混合图像块序列。与现有样本混合方法相比,PatchMix能灵活高效地混合两幅以上图像,并模拟自然图像间更复杂的相似关系。通过这种方式,我们的对比框架能显著缩小对比目标与真实标签之间的差距。实验结果表明,我们提出的方法在ImageNet-1K和CIFAR数据集上均显著超越了现有最优方法,例如在ImageNet-1K上线性准确率提升3.0%,在CIFAR100上kNN准确率提升8.7%。此外,我们的方法在下游任务(COCO数据集上的目标检测和实例分割)中取得了领先的迁移性能。代码已开源至https://github.com/visresearch/patchmix。