CLIP解读

    https://blog.csdn.net/weixin_44031582/article/details/120469669

    Vision-Language Pre-training (VLP) models have shown remarkable performance on various downstream tasks. Their success heavily relies on the scale of pre-trained cross-modal datasets. However, the lack of large-scale datasets and benchmarks in Chinese hinders the development of Chinese VLP models and broader multilingual applications. In this work, we release a large-scale Chinese cross-modal dataset named Wukong, containing 100 million Chinese image-text pairs from the web. Wukong aims to benchmark different multi-modal pre-training methods to facilitate the VLP research and community development. Furthermore, we release a group of models pre-trained with various image encoders (ViT-B/ViT-L/SwinT) and also apply advanced pre-training techniques into VLP such as locked-image text tuning, token-wise similarity in contrastive learning, and reduced-token interaction. Extensive experiments and a deep benchmarking of different downstream tasks are also provided. Experiments show that Wukong can serve as a promising Chinese pre-training dataset and benchmark for different cross-modal learning methods. For the zero-shot image classification task on 10 datasets, Wukong\textsubscript{ViT-L} achieves an average accuracy of 73.03\%. For the image-text retrieval task, Wukong\textsubscript{ViT-L} achieves a mean recall of 71.6\% on AIC-ICC which is 12.9\% higher than the result of WenLan~2.0. More information can refer to \url{https://wukong-dataset.github.io/wukong-dataset/}.

    视觉语言预训练(VLP)模型在各种下游任务上表现出了显著的性能。他们的成功很大程度上依赖于预先训练的跨模式数据集的规模。然而,中文大规模数据集和基准的缺乏阻碍了中文VLP模型的发展和更广泛的多语言应用。在本工作中,我们发布了一个大规模的中文跨模态数据集“悟空”,该数据集包含了来自互联网的1亿个中文图像-文本对。悟空旨在为不同的多模式预培训方法提供基准,以促进VLP研究和社区发展。此外,我们发布了一组用各种图像编码器预训练的模型(vi - b / vi - l /SwinT),并将先进的预训练技术应用到VLP中,如锁定图像文本调优、对比学习中基于标记的相似性和减少标记的交互。还提供了广泛的实验和不同下游任务的深度基准测试。实验表明,悟空可以作为不同跨模态学习方法的训练前数据集和学习标杆。对于10个数据集上的零拍图像分类任务,Wukong\ text下标{vi - l}的平均准确率为73.03\%。在图像-文本检索任务中,悟空文本下标{vi - l}在AIC-ICC上的平均召回率为71.6\%,比文兰~2.0提高了12.9\%。更多信息可以参考\url{https://wukong-dataset.github.io/wukong-dataset/}。

    \section{Introduction}
    Pre-training large-scale models on big data, and fine-tuning on downstream tasks, have become an emerging paradigm of artificial intelligence systems. Models such as BERT~\citep{devlin2018bert} and GPT~\citep{brown2020language} grow in popularity in the natural language processing community as they possess high transferability to a wide range of downstream tasks or even zero-shot tasks, yielding state-of-the-art performance. Recent works such as CLIP~\citep{radford2021learning}, ALIGN~\citep{jia2021scaling} and FILIP~\citep{yao2021filip} further extend this diagram to the joint Vision Language Pre-training (VLP) domain and show superior results over state-of-the-art methods on various downstream tasks. This promising direction draws significant attention from both industry and researchers to consider it as the path to the next-generation AI models. There are two reasons that lead to the success of VLP models.
    {介绍}\部分
    对大数据进行预训练的大规模模型,以及对下游任务进行微调,已经成为人工智能系统的一种新兴范式。BERT~\citep{devlin2018bert}和GPT~\citep{brown2020language}等模型在自然语言处理社区中越来越受欢迎,因为它们具有对广泛的下游任务甚至零机会任务的高可转移性,从而产生最先进的性能。最近的研究成果如CLIP~\citep{radford2021learning}、ALIGN~\citep{jia2021scaling}和FILIP~\citep{yao2021filip}进一步将这一图扩展到联合视觉语言预训练(VLP)领域,并在各种下游任务上显示了优于最先进的方法的结果。这一前景广阔的方向吸引了业界和研究人员的极大关注,他们认为这是通往下一代人工智能模型的道路。VLP模型的成功有两个原因。

    On the one hand, more advanced model architectures such as ViT~\citep{dosovitskiy2020image}/BERT~\citep{devlin2018bert} and training objectives like contrastive learning~\citep{he2020momentum}, are usually able to lift the powerful generalization and robustness capabilities of learned representations. On the other hand, thanks to the concurrent advancement in hardware~\citep{stuart2011multi,kindratenko2009gpu} and distributed training frameworks~\citep{narayanan2021efficient,rajbhandari2020zero,rasley2020deepspeed}, more and more data can be fed into a large-scale model to improve the generalization, transferability and zero-shot capability. In either vision or language tasks, pre-training on larger-scale data such as JFT-300M~\citep{sun2017jft300m} in image classification \citep{riquelme2021scaling}, C4 dataset in T5~\citep{raffel2020exploring}, has been proven useful and critical for improving downstream task performance via transfer or prompt learning. In addition, recent work~\citep{jia2021scaling} has already shown the potential of scaling up the VLP model by more than 100 million noisy image-text pairs from the web.
    一方面,更先进的模型体系结构,如ViT~ citep{dosovitskiy2020image}/BERT~ citep{devlin2018bert}和训练目标,如对比学习~ citep{he2020momentum},通常能够提高学习后表示的强大的泛化和鲁棒性能力。另一方面,由于硬件的并行发展~ \ citep {stuart2011multi, kindratenko2009gpu}和分布式训练框架~ \ citep {narayanan2021efficient、rajbhandari2020zero rasley2020deepspeed},越来越多的数据可以输入一个大规模的模型来提高泛化,可转让性和zero-shot能力。在视觉或语言任务中,对更大规模的数据(如JFT-300M~ citep{sun2017jft300m}在图像分类中citep{riquelme2021scaling}, T5~ citep{raffel2020exploring}中C4数据集)进行预训练,已经被证明对通过迁移或快速学习提高下游任务性能是有用的和关键的。此外,最近的工作已经显示了将VLP模型扩展到超过1亿个来自网络的噪声图像-文本对的潜力。

    image.png

    Therefore, the success of VLP models pre-trained on large-scale data urges people to continuously crawl and collect larger image-text dataset. Table~\ref{tab:public-datasets} shows an overview of many popular datasets in the VLP domain. Publicly-available vision-language English datasets such as Flickr30k~\citep{plummer2015flickr30k}, SBU Captions~\citep{ordonez2011im2text} and CC12M~\citep{sharma2018conceptual} are relatively small at a scale of around 10 million samples, and a larger-scale one is LAION-400M \citep{schuhmann2021laion400m}. However, directly using English datasets to train a model will lead to a great performance drop in translated Chinese downstream tasks. There are a lot of certain Chinese idioms and slang that translated English cannot cover, where machine translation often brings errors that harm the task performance. The current community lacks a large-scale publicly available dataset in Chinese, resulting in (a) the development of the community is stunted; (b) each work uses a secret large dataset to achieve surprisingly good performance that other works cannot fairly compare.
    因此,对大规模数据进行预训练的VLP模型的成功促使人们不断地抓取和收集更大的图像-文本数据集。表~\ref{标签:public-datasets}显示了VLP领域中许多流行数据集的概述。视觉语言普及英语等数据集Flickr30k ~ \ citep {plummer2015flickr30k},死伤字幕~ \ citep {ordonez2011im2text}和CC12M ~ \ citep {sharma2018conceptual}相对较小的规模约1000万样品,和大规模laion - 400 m \ citep {schuhmann2021laion400m}。然而,直接使用英文数据集来训练模型,会导致中文翻译下游任务的性能下降。汉语中有很多特定的习语和俚语翻译成英语后是无法覆盖的,机器翻译往往会带来错误,影响任务的执行。当前社区缺乏大规模的中文公开可用数据集,导致:(1)社区发展受阻;(b)每个作品都使用一个秘密的大数据集,以达到其他作品无法公平比较的令人惊讶的好性能。

    To bridge this gap, we release a large-scale Chinese cross-modal dataset named Wukong, containing 100 million image-text pairs from the web. To guarantee diversity and generalization, our Wukong dataset is collected according to a high-frequency Chinese word list of 200K queries. We also adopt image-based and text-based filtering strategies to further refine it. The resulting dataset is currently the largest Chinese vision-language dataset so far. We perform an analysis of this dataset and show that it covers a wide range of visual and textual concepts. Training a large-scale VLP model is super expensive. For example, The largest CLIP~\citep{radford2021learning} model takes 18 days to train on 592 V100 GPUs, and M6-10T~\citep{lin2021m6} is trained on 512 NVIDIA-V100 GPUs for around 10 days. Thus, it is almost impossible for everyone to pre-train a large-scale model due to substantial financial costs and hardware requirements. It is in great demand for researchers to download and reuse various kinds of pre-trained large-scale VLP models.
    为了弥补这一差距,我们发布了一个名为“悟空”的大型中国跨模态数据集,包含了1亿个来自网络的图像-文本对。为了保证数据的多样性和泛化性,我们的悟空数据集是根据一个高频的200K个查询的中文单词列表来收集的。我们还采用了基于图像和文本的过滤策略来进一步细化它。生成的数据集是目前最大的中文视觉语言数据集。我们对这个数据集进行分析,并表明它涵盖了广泛的视觉和文本概念。训练一个大规模的VLP模型是非常昂贵的。例如,最大的CLIP~ citep{radford2021learning}模型在592 V100 gpu上需要18天的训练,而M6-10T~ citep{lin2021m6}在512 NVIDIA-V100 gpu上需要大约10天的训练。因此,由于大量的财务成本和硬件需求,几乎不可能让每个人都预先训练一个大规模的模型。研究人员需要下载和重用各种预训练的大规模VLP模型。

    However, the choices of publicly-available large VLP models are also very limited, which hinders the development on downstream tasks of the large-scale model. In order to contribute to our community, we further release a group of large-scale models pre-trained using different architectures (ResNet~\citep{he2016deep}/ViT~\citep{dosovitskiy2020image}/SwinT~\citep{liu2021swin}) and different methods (CLIP~\citep{radford2021learning}, FILIP~\citep{yao2021filip}, and LiT~\citep{zhai2021lit}). As shown in Figure \ref{fig:model-arch}, we follow the popular dual-encoder architecture for vision-language representation learning, with the contrastive learning objective. We also provide an extensive benchmarking of the released models on various downstream tasks, such as zero-shot image classification and Img2Text/Text2Img retrieval. Interesting observations can be found from the results:
    然而,公开的大型VLP模型的选择也非常有限,这阻碍了大型模型下游任务的开发。为了促成我们的社区,我们进一步释放一批大型模型pre-trained使用不同的架构(ResNet ~ \ citep {he2016deep} /维特~ \ citep {dosovitskiy2020image} / SwinT ~ \ citep {liu2021swin})和不同的方法(夹~ \ citep {radford2021learning},菲利普~ \ citep {yao2021filip},和点燃~ \ citep {zhai2021lit})。如图\ref{fig:model-arch}所示,我们遵循流行的双编码器架构进行视觉语言表示学习,目标是对比学习。我们还在各种下游任务,如零拍图像分类和Img2Text/Text2Img检索上,为发布的模型提供了广泛的基准测试。从结果中可以发现有趣的观察结果:

    Firstly, by transferring the image encoder trained on English dataset, we find that it can still work well with Chinese texts for cross-modal pre-training and achieve a good performance on Chinese downstream tasks. Secondly, we find that cross-modal token-wise similarity from FILIP complements various patch-based visual encoders like SwinT and can contribute to better visual and textual representations. More findings can be found in Section~\ref{sec:expt}.
    首先,通过传输在英文数据集上训练的图像编码器,我们发现它仍然可以很好地与中文文本进行跨模态前训练,并在中文下游任务上取得了良好的性能。其次,我们发现来自FILIP的跨模态标记方面的相似性补充了各种基于补丁的视觉编码器(如SwinT),并有助于更好的视觉和文本表示。更多的发现可以在章节~\ref{sec:expt}中找到。
    此处的token不是离散值,暂时没法接HyperHill

    下面的token-wise similarity的思想和deepemd有关
    应该可以转化为一个OT或者匹配问题

    全局相似性使用sep似乎就和因果attention有关,有空还是要回去看代码,看下下三角mask如何影响了计算
    token-wise已经考虑了局部相似性,如何与其抗衡???
    image.png
    The base model consists of an image encoder and a text encoder with visual tokens and textual tokens as inputs. The input tokens from the two modalities are then concatenated and are added with position embeddings indicating token positions. For the image encoder, weights from an external model trained on datasets of other language are preloaded and locked. We compute the global similarity and token-wise similarity in the contrastive pre-training loss.
    基本模型由一个图像编码器和一个文本编码器组成,其中可视标记和文本标记作为输入。然后将来自两个模式的输入令牌连接起来,并使用指示令牌位置的位置嵌入添加这些令牌。对于图像编码器,预先加载并锁定了基于其他语言数据集训练的外部模型的权值。我们在对比训练前损失中计算全局相似度和令牌相似度。

    Experiments show that Wukong can serve as a promising Chinese pre-training dataset for different cross-modal learning methods. The pre-trained models show prominent performance on various downstream tasks such as zero-shot image classification and image-text retrieval. Specifically, for zero-shot image classification, our model reaches up to 61.5\% average top-1 accuracy on 17 datasets. For the retrieval task, our best model significantly outperforms WenLan~2.0 on AIC-ICC by 10\% of top-1 recall for image-to-text retrieval, and 11.6\% of top-1 recall for text-to-image retrieval respectively. Visualization on word-patch alignment also shows that our model learns meaningful finer-grained features via the token-wise similarity.
    实验表明,悟空可以作为不同跨模态学习方法的中文前训练数据集。训练前的模型在各种下游任务,如零拍图像分类和图像文本检索上表现出突出的性能。其中,在17个数据集上,零拍图像分类的平均精度达到61.5% \%。在检索任务上,最优模型的图像-文本检索top-1查全率比文兰~2.0在AIC-ICC上分别提高了10 %和11.6 %。单词-patch对齐的可视化也表明,我们的模型通过标记方向的相似性学习有意义的更细粒度的特征。

    In summary, our main contributions are: \begin{enumerate}[label=(\alph),leftmargin=,topsep=1pt] \item A public larger-scale Chinese vision and language pre-training dataset with 100 million image-text pairs is released, covering a more comprehensive range of concepts. \item We release a group of large-scale VLP models pre-trained with various popular architectures and methods. An extensive benchmarking of the released models is also provided. \item Our pre-trained model shows state-of-the-art performance on Chinese benchmarks such as zero-shot image classification tasks consisting of seventeen datasets and image-text retrieval tasks consisting of five datasets. \end{enumerate}
    我们发布了一个拥有1亿幅图像-文本对的大规模中文视觉和语言训练前数据集,涵盖了更广泛的概念范围。我们发布了一组使用各种流行的架构和方法进行预训练的大型VLP模型。还提供了对已发布模型的广泛基准测试。我们的预训练模型显示了最先进的中国基准,如由17个数据集组成的零拍图像分类任务和由5个数据集组成的图像-文本检索任务。结束{列举}

    \section{Related Work}

    \paragraph{Vision-Language Pre-training (VLP) Models.} There are two typical architectures of VLP models according to the modality interaction methods, i.e., single-stream and dual-stream. Single-stream models~\citep{kim2021vilt,li2019visualbert} directly concatenate the visual and textual embeddings together and feed them to a single transformer-based model. This kind of model can be easily fit into text/image generation tasks to perform image captioning or text-to-image generation, which are usually hard to evaluate and benchmark. Dual-stream models such as ViLBERT~\citep{lu2019vilbert}, CLIP~\citep{radford2021learning} and ALIGN~\citep{jia2021scaling} have separate models for each modality. This paradigm is more flexible and efficient when modeling each modality, e.g., CNN for images, Transformers for texts. Moreover, dual-stream models have the merit of efficient inference for downstream tasks such as image-text retrieval, since they can decouple and offline store pre-computed image/text features from encoders. In CLIP~\citep{radford2021learning}, the authors also evaluate the image encoder as a self-supervised pre-trained model and show promising results. This paper mainly follows and benchmarks the dual-stream approaches.
    \段落{视觉语言前训练(VLP)模型。根据模态交互方法的不同,VLP模型有两种典型的体系结构,即单流和双流。单流模型直接将视觉和文本嵌入连接在一起,并将它们馈送到单个基于变压器的模型。这种模型可以很容易地适用于文本/图像生成任务,以执行图像标题或文本到图像的生成,这些通常很难评估和基准。双流模型,如ViLBERT~ citep{lu2019vilbert}, CLIP~ citep{radford2021learning}和ALIGN~ citep{jia2021scaling}为每个模态有单独的模型。当建模每个模态时,这种范式更加灵活和高效,例如,CNN用于图像,transformer用于文本。此外,双流模型具有对下游任务(如图像-文本检索)进行有效推理的优点,因为它们可以从编码器中解耦和离线存储预先计算的图像/文本特征。在CLIP~\citep{radford2021learning}中,作者还评价了图像编码器作为一个自我监督的预训练模型,并显示了有希望的结果。本文主要遵循和基准双流方法。

    \paragraph{Vision-Language Datasets.} The current success of VLP models greatly lies in the scale of pre-trained datasets. The publicly-available pre-training datasets used by recent VLP models are mainly image caption data or image-text pair data. Many small-sized datasets (e.g., a few hundred thousand) such as COCO-Captions~\citep{lin2014microsoft}, Flickr30k~\citep{plummer2015flickr30k}, Visual Genome~\citep{krishna2016visual}, and VQA2~\citep{goyal2017making} are hand-annotated data that have very limited domain and diversity. On the other hand, pre-training models on online collected data (such as alt-texts from the HTML pages) have shown promising results. CC3M~\citep{sharma2018conceptual}, CC12M~\citep{changpinyo2021cc12m} and YFCC100M~\citep{thomee2016yfcc100m} have millions of image-text pairs in English generated by an online data collection pipeline including image and text filters, as well as text transformations. VLP models on these datasets have shown to be effective in multiple downstream tasks. Moreover, larger-scale datasets with more than 100M samples (e.g., CLIP~\citep{radford2021learning}: 400M and ALIGN~\citep{jia2021scaling}): 1.8B) have even armed the recent VLP models with surprisingly good zero-shot recognition ability, but they are not publicly available. Thus, the current community lacks a large-scale Vision-Language dataset in Chinese. We aim to contribute a benchmark Chinese dataset to test various VLP methods on different downstream tasks.
    {\段视觉语言的数据集。目前VLP模型的成功很大程度上取决于预训练数据集的规模。近年来VLP模型所使用的公开的训练前数据集主要是图像标题数据或图像-文本对数据。许多小型数据集(例如,数十万个),如coco - caption ~ citep{lin2014microsoft}、Flickr30k~ citep{plummer2015flickr30k}、Visual Genome~ citep{krishna2016visual}和VQA2~ citep{goyal2017making}都是手工标注的数据,它们的领域和多样性非常有限。另一方面,基于在线收集的数据(例如HTML页面中的替代文本)的预训练模型已经显示出了令人满意的结果。CC3M~ citep{sharma2018概念性}、CC12M~ citep{changpinyo2021cc12m}和YFCC100M~ citep{thomee2016yfcc100m}拥有由包括图像和文本过滤器以及文本转换在内的在线数据收集管道生成的数以百万计的英文图像-文本对。在这些数据集上的VLP模型已被证明在多个下游任务中是有效的。此外,拥有超过100M样本的大型数据集(例如CLIP~ citep{radford2021learning}: 400M和ALIGN~ citep{jia2021scaling}): 1.8B)甚至使最近的VLP模型具有令人惊讶的良好的零拍识别能力,但它们还没有公开可用。因此,目前的社区缺乏大规模的中文视觉语言数据集。我们的目标是提供一个基准的中国数据集来测试不同下游任务的各种VLP方法。

    \section{Dataset Collection}

    image.png

    In this work, we construct a new dataset called Wukong of 100 million image-text pairs collected from the Internet. To cover diverse visual concepts, Wukong dataset is collected according to a list of 200K queries. This base query list is taken from~\citep{song2018directional} and then filtered according to the frequency of Chinese words and phrases. After the query list is constructed, we send each query to Baidu Image Search Engine, to get a list of image URLs and corresponding caption information. To keep a balance between different queries, we search for at most 1000 samples per query. Images are then downloaded with previously-obtained image URLs. In this way, we collect a total of 166 million raw \textlangle{}image, text\textrangle{} pairs. Then following common practices~\citep{sharma2018conceptual,changpinyo2021cc12m,jia2021scaling}, we apply a series of filtering strategies described in the below section to construct the final Wukong dataset. Figure~\ref{fig:dataset_samples} shows some samples within our dataset. In addition, we also build a test set named Wukong50K with 50K samples, which serves as a benchmarking dataset for future models.
    在本工作中,我们构建了一个新的名为“悟空”的数据集,它包含了从互联网上收集的1亿个图像-文本对。为了涵盖不同的视觉概念,根据一个200K查询列表收集了悟空数据集。该基础查询列表从~\citep{song2018directional}中提取,然后根据汉语单词和短语的出现频率进行过滤。在构建完查询列表后,我们将每个查询发送到百度图像搜索引擎,以获得一个图像url列表和相应的标题信息。为了保持不同查询之间的平衡,我们在每个查询中最多搜索1000个样本。然后使用之前获得的图像url下载图像。这样,我们总共收集了1.66亿个原始的\textlangle{}图像、text\ textangle{}对。然后,按照常见的实践~\citep{sharma2018概念性,changpinyo2021cc12m,jia2021scaling},我们应用了一系列的过滤策略,在下面一节中描述了构建最终的悟空数据集。图~\ref{fig:dataset_samples}显示了我们数据集中的一些示例。此外,我们还用50K样本构建了测试集“悟空50K”,作为未来模型的标杆数据集。

    \subsection{Image-based Filtering}

    We first filter the data according to the size and aspect ratio of the image. Only images with both dimensions greater than 200 pixels, and the ratio of large-to-small dimensions is no more than 3 are kept. In this way, we filter out images that are too small, or are very tall or wide, which can be of low-resolution after image augmentations like upsampling and square cropping used during pre-training~\citep{yao2021filip}.
    我们首先根据图像的大小和宽高比对数据进行过滤。只保留两个尺寸都大于200像素且大小比不大于3的图像。通过这种方式,我们过滤掉了太小、太高或太宽的图像,这些图像在训练前使用上采样和平方裁剪等图像增强后可能是低分辨率的。

    \subsection{Text-based Filtering}

    image.png

    Secondly, to select samples with high-quality Chinese descriptions of the corresponding image, we filter the data according to the language, length and frequency of the text accompanying an image. Specifically, we first check the language and length. We keep sentences that contain at least one but fewer than 32 Chinese words. We also discard meaningless image descriptions like 000.jpg'' from the text. Afterward, texts paired with too many images are usually irrelevant to the content of the images, like\texttt{查看源网页}’’ (\textit{View source page}), \texttt{展开全文}'' (\textit{Expand text}),\texttt{摄影部落}’’ (\textit{Photography community}). In practice, we set this threshold as 10, i.e., we discard the image-text pairs whose text appears more than 10 times in the whole corpus collected. To protect the privacy of the individuals appearing in the text, we substitute person names with a special token ``\textlangle{}人 名\textrangle{}’’ (\textlangle{}\textit{Person name}\textrangle{}). Besides, we also construct a list of Chinese sensitive words, and image-text pairs containing sensitive words are also discarded.
    其次,根据图像所附文本的语言、长度和频率,选择具有高质量中文描述的图像样本。具体来说,我们首先检查语言和长度。我们保留包含至少一个但不超过32个中文单词的句子。我们还抛弃了文本中毫无意义的图像描述,比如“00.jpg”。之后,文本搭配太多的图像通常是无关紧要的内容图片,像‘\ texttt{查看源网页}”(\ textit{查看源代码页面}),“\ texttt{展开全文}”(\ textit{扩大文本}),“\ texttt{摄影部落}”(\ textit{摄影社区})。在实际操作中,我们将该阈值设为10,即丢弃文本在所收集的整个语料库中出现次数超过10次的图像-文本对。保护个人的隐私出现在文本中,我们代替人的名字有特殊令牌“\ textlangle{}人名\ textrangle{}”(\ textlangle {} \ textit{人名称}\ textrangle{})。此外,我们还构建了一个中文敏感词列表,并丢弃了包含敏感词的图像-文本对。这样是破坏了实体级的识别能力的

    After applying the above filtering strategies, we finally get a dataset of about 100 million \textlangle{}image, text\textrangle{} pairs. Table~\ref{tab:wukong_dataset_statistics} shows statistics of our dataset. There are \num{20442} unique tokens within the texts of our dataset, and the average number of tokens in each caption is 22. Additionally, in Figure~\ref{fig:word-cloud}, we visualize the distribution of words (consisting of one or more tokens) in our dataset. We use the Chinese text segmentation module \textnormal{jieba}\footnote{\url{https://github.com/fxsjy/jieba}} to generate words and build this word cloud of our dataset.
    应用上述过滤策略后,我们最终得到了一个大约1亿张\textlangle{}图像、texttextangle{}对的数据集。表~\ref{tab:wukong_dataset_statistics}显示了我们的数据集的统计信息。在我们的数据集的文本中有num{20442}唯一的标记,每个标题中的标记的平均数量是22。此外,在图~\ref{fig:word-cloud}中,我们将单词(由一个或多个标记组成)在数据集中的分布可视化。我们使用中文文本分割模块textnormal{jieba}\脚注{\url{https://github.com/fxsjy/jieba}}来生成单词,并构建我们的数据集的这个单词云。

    image.png

    \section{Methodology}

    \subsection{Text-Image Joint Alignment}

    Following the recent well-proven methods~\citep{radford2021learning,yao2021filip}, we adopt the contrastive pre-training architecture as shown in Figure~\ref{fig:model-arch}. We use a dual-stream model with Transformer-based text and image encoders. These two encoders convert textual and visual input tokens to embeddings of the same dimension. In this learned joint embedding space, we use a contrastive loss to encourage the paired image and text to have similar embeddings, while non-paired ones to have distinct embeddings. In~\citep{radford2021learning} and~\citep{jia2021scaling}, this cross-modal similarity is computed via dot product between the global features of the entire image and that of the text sequence. On the other hand, in~\citep{yao2021filip}, the similarity is computed based on a finer-grained interaction between the image patches and textual tokens, which also brings surprisingly good word-patch alignment and learns meaningful fine-grained features with promising localization ability.
    根据最近被证明行之有效的方法~ citep{radford2021learning,yao2021filip},我们采用了如图~ ref{fig:model-arch}所示的对比训练前架构。我们使用基于变压器的文本和图像编码器的双流模型。这两个编码器将文本和视觉输入标记转换为相同维度的嵌入。在这个学习过的联合嵌入空间中,我们使用对比损失来鼓励成对的图像和文本具有相似的嵌入,而非成对的图像和文本具有不同的嵌入。在~\citep{radford2021learning}和~\citep{jia2021scaling}中,这种交叉模态相似性是通过整个图像的全局特征与文本序列的全局特征之间的点积来计算的。另一方面,在~\citep{yao2021filip}中,相似度是基于图像块和文本标记之间的细粒度交互来计算的,这也带来了令人惊讶的良好的字-块对齐和学习有意义的细粒度特征和有前景的定位能力。

    \subsection{Model Architectures}

    \paragraph{Visual Encoder.} Two types of visual encoders, \textit{i.e.,} Vision Transformer~\citep{dosovitskiy2020image} (ViT) and Swin Transformer~\citep{liu2021swin} (SwinT), are used as backbones for training different model variants. For ViT, the input image is first rescaled into a standard size and then split into fixed-size patches. Each of the patches is linearly embedded via a trainable linear projection. The resulting sequence of patch vectors is fed to a standard transformer encoder. Different from ViT, SwinT uses a hierarchical transformer that computes representation with shifted windows, which limits the original self-attention computation to non-overlapping local windows while also allowing for cross-window connection.
    段{视觉编码器。两种类型的视觉编码器,\textit{即。,} Vision Transformer~ citep{dosovitskiy2020image} (ViT)和Swin Transformer~ citep{liu2021swin} (SwinT),被用作训练不同模型变体的主干。对于ViT,输入图像首先被重新缩放为一个标准大小,然后被分割为固定大小的补丁。每个patch是通过一个可训练的线性投影线性嵌入。得到的patch向量序列被馈送到一个标准的变压器编码器。与ViT不同的是,SwinT使用了一个分层的转换器,它用移位的窗口来计算表示,这将原来的自我关注计算限制在非重叠的本地窗口上,同时也允许跨窗口连接。

    \paragraph{Textual Encoder.} The textual encoder is a standard decoder-only transformer as in~\citep{radford2021learning}. We use WordPiece~\citep{wu2016wordpiece} with a vocabulary size of \num{21128} for Chinese text tokenization. Similar to~\citep{pires2019multilingual}, we add spaces around Chinese characters before applying WordPiece so that Chinese is effectively character-tokenized. We add two special tokens (i.e., \texttt{[CLS]} and \texttt{[SEP]}) at the beginning and ending of each text sequence. The text encoder has \num{12} layers, each of which has \num{12} attention heads and a hidden state dimension of \num{768}.
    {\段落文本编码器。文本编码器是一个标准的仅解码器转换器,如~\citep{radford2021learning}。我们使用词汇量为\num{21128}的WordPiece~ citep{wu2016wordpiece}进行中文文本标记。与~\citep{pires2019multilingual}类似,我们在应用WordPiece之前在中文字符周围添加空格,这样中文就可以有效地进行字符标记化。我们在每个文本序列的开头和结尾添加两个特殊标记(即\texttt{[CLS]}和\texttt{[SEP]})。文本编码器有\num的{12}层,每个层有\num的{12}注意头和一个隐藏状态维度为\num{768}。

    ~\citep{radford2021learning}即CLIP论文 解读 https://blog.csdn.net/weixin_44031582/article/details/120469669

    \paragraph{Linear Projection of the Encoders.} On the top of the visual and textual encoders, the global representations of visual token sequence (e.g., \texttt{[CLS]} token for ViT; average pooled representation of all patch tokens for Swin Transformer) and textual token sequence (e.g., textual \texttt{[SEP]} token) are linearly projected to the common multi-modalities space, followed by L2-normalization separately.
    \段落{编码器的线性投影。在可视化和文本编码器的顶部,可视化标记序列的全局表示(例如,ViT的\texttt{[CLS]}标记;Swin Transformer所有补丁令牌的平均池表示)和文本令牌序列(例如,文本\texttt{[SEP]}令牌)线性映射到公共多模态空间,然后分别进行l2 -归一化。

    \paragraph{Token Reduction Layer.} Instead of only computing the cross-modal similarity between global representations of sequences, we experiment with a late interaction method as introduced in FILIP~\citep{yao2021filip}. We aim to take into account the fine-grained token-wise interaction between image patches and text tokens. It could potentially mine more detailed semantic word-patch alignment between two modalities. Meanwhile, as a large amount of computation is introduced by this token-wise interaction, we propose a token reduction layer inspired by \citep{ryoo2021tokenlearner}. It aims to learn a small set of tokens (e.g., 12 or 24) from the whole output tokens of visual encoder (e.g., 16$\times$16 in ViT-L/14), and use them for the reduced-token interaction as described in Section~\ref{tklearner}. The token reduction layer can largely reduce the computation cost for the late interaction method.
    {牌还原层段。我们不只是计算序列的全局表示之间的交叉模态相似性,而是使用FILIP~ citep{ya2021filip}中引入的一种后期交互方法进行实验。我们的目标是考虑图像补丁和文本标记之间的细粒度标记智能交互。它有可能挖掘出两种模态之间更详细的语义词块对齐。同时,由于这种智能令牌交互引入了大量的计算,我们提出了一个令牌约简层,其灵感来自\citep{ryoo2021tokenlearner}。它旨在从视觉编码器的整个输出标记中学习一组标记(例如,12或24)(例如,vi - l /14中的16$\times$16),并将它们用于节~\ref{tklearner}中所述的减少标记交互。令牌缩减层可以大大降低后期交互方法的计算成本。此处其实可以试试hilbert一维求解,调topk的参数,计算量很小,就是一个O(n)复杂度

    结合CLIP论文的一些分析
    image.png
    线性投影层使得原有嵌入得以保持,使用一个子空间进行交互
    数值尺度的一致性不确定对欧式距离的计算是否有影响
    参数t用于调和余弦先死度值域和label(可能是one-hot)

    交叉熵说明
    https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html?highlight=crossentropyloss#torch.nn.CrossEntropyLoss
    image.png

    image.png
    image.png
    0.5并不影响优化目标
    image.png
    实际执行时并不是区分对角线元素与非对角线元素
    而是一次优化一行一列,每个位置理论上计算了两次,计算量也确实是两倍
    但是拿对数计算可以展开是等价的

    此处对相似度进行了展开讲解,token-wise那部分应该是trainable的
    image.png

    image.png
    hilbert应该能优化这个计算过程,相比玩维度对齐,这个idea更安全,cls表达力有限也确实可以理解

    \subsection{Reduced-token Interaction}
    \label{tklearner}

    Obviously, using the token-wise similarity introduces a larger amount of computation. The computation cost of it is about $2 \times n_1 \times n_2$ times than that of global similarity as shown in Equation~\ref{eq:global_sim} and Equation~\ref{eq:token_sim}. The number of visual tokens $n_1$ is normally predefined while the number of textual tokens $n_2$ depends on the text input. To reduce the computation cost of full token-wise similarity, an efficient way is to decrease the number of tokens involved in similarity calculation and we call this reduced-token interaction. For this purpose, we propose a learnable token reduction layer on top of visual features output by the image encoder. The workflow of this layer is described in the right part of Figure~\ref{fig:model-arch}.
    显然,使用基于标记的相似性会引入大量的计算。与全局相似的计算成本相比,其计算成本约为$2 n_1 n_2$,如式~\ref{eq:global_sim}和式~\ref{eq:token_sim}所示。视觉标记的数量$n_1$通常是预定义的,而文本标记的数量$n_2$则取决于文本输入。为了降低全令牌相似度的计算成本,一种有效的方法是减少相似度计算中涉及的令牌数量,我们称之为减少令牌交互。为此,我们在图像编码器输出的视觉特征之上提出了一个可学习的令牌缩减层。这一层的工作流程在Figure~\ref{fig:model-arch}的右侧描述。

    image.png

    \subsection{Locked-image Text Tuning}

    Inspired by ``Locked-image Text tuning’’ (LiT-tuning)~\citep{zhai2021lit} which shows that a locked pre-trained image encoder with unlocked text encoder works well, we take advantage of pre-trained image encoders for contrastive learning. In particular, this setting aims to teach a Chinese text encoder to read out suitable representations from an existing image encoder pre-trained on English datasets. techniques for learning image descriptors and vision-language alignment~\citep{zhai2021lit}. And the image descriptors are beforehand well pre-trained using relatively clean or (semi-) manually labeled images. In this work, we extend this idea to multilingual data sources, and try to align a locked image encoder pre-trained on English data sources and a trainable Chinese text encoder. Moreover, the LiT-tuning method significantly speeds up the training process and reduces memory requirements since no gradients need to be computed for the visual encoder. Empirical results in Section~\ref{sec:expt} confirm the effectiveness of our method.

    受“锁定图像文本调优”(litt -tuning)的启发,我们利用预先训练的图像编码器进行对比学习,证明了锁定图像编码器与未锁定文本编码器的良好结合。特别地,本设置的目的是教中文文本编码器从现有的在英语数据集上预先训练的图像编码器读出适当的表示。学习图像描述符和视觉语言对齐的技术。而图像描述符是使用相对干净或(半)手动标记的图像预先很好地训练的。在本工作中,我们将这个想法扩展到多语言数据源,并尝试对齐一个锁定的图像编码器预先训练的英文数据源和一个可训练的中文文本编码器。此外,由于视觉编码器不需要计算梯度,litt -tuning方法显著加快了训练过程,并减少了内存需求。章节~\ref{sec:expt}中的实证结果证实了我们方法的有效性。

    \section{Experiments}
    \label{sec:expt}

    \subsection{Experimental Setup}

    image.png

    \paragraph{Model Architectures.} Following the existing VLP models, \textit{e.g.,} CLIP~\citep{radford2021learning}, ALIGN~\citep{jia2021scaling}, we employ a dual-encoder architecture as illustrated in Figure~\ref{fig:model-arch}. As only text-encoder tuning shows good performance~\citep{zhai2021lit}, our visual encoder is initialized and locked with pre-trained models, \textit{e.g.,} ViT-B, ViT-L from CLIP~\footnote{\url{https://github.com/openai/CLIP/}}, Swin-L from Swin Transformer~\footnote{\url{https://github.com/microsoft/Swin-Transformer}}, and only the text encoder is trained. According to the different types of visual encoders, we train three model variants, \textit{i.e.,} Wukong\textsubscript{ViT-B}, Wukong\textsubscript{ViT-L} and Wukong\textsubscript{Swin}, using the token-wise similarity with our proposed reduced-token interaction. Detailed settings are described in Table~\ref{tab:model-arch}.

    {\段模型架构。}遵循现有的VLP模型,\textit{例如。,} CLIP~\citep{radford2021learning}, ALIGN~\citep{jia2021scaling},我们采用如图~ ref{fig:model-arch}所示的双编码器架构。由于只有文本编码器的调优显示出良好的性能~\citep{zhai2021lit},我们的视觉编码器被初始化并锁定在预先训练的模型,\textit{例如。,} vi - b, vi - l from CLIP~\脚注{\url{https://github.com/openai/CLIP/}}, Swin Transformer~\脚注{\url{https://github.com/microsoft/Swin-Transformer}},并且只训练文本编码器。根据视觉编码器的不同类型,我们训练了三种模型变体,即\textit{, Wukong\textsubscript{vi - b}, Wukong\textsubscript{vi - l}和Wukong\textsubscript{Swin},使用令牌方面的相似性与我们提出的减少令牌交互。详细设置见表~\ref{tab:model-arch}。

    image.png

    \paragraph{Model Training Settings.} For better generalization and data-efficiency, we employ Autoaugment~\citep{cubuk2019autoaugment} for image data augmentation that aims to build more image-text pairs. All of our models are trained using Nvidia V100 GPUs and Ascend cards. Specifically, Wukong\textsubscript{ViT-B} is trained using 32 GPUs for 3 days, Wukong\textsubscript{ViT-L} is trained using 32 GPUs for 10 days and Wukong\textsubscript{Swin} is trained using 40 GPUs for 5 days. In the training, we use the LAMB optimizer~\citep{2019Large} and the cosine learning rate schedule with a linear warmup~\citep{2016SGDR}. Weight decay regularization is applied to all parameters except for bias, layer normalization, token embedding, positional embedding and temperature in the contrastive loss. The detailed hyperparameters are shown in Table~\ref{tab:hyperparameters}. In order to pick the optimal checkpoint out, ImageNet dataset~\citep{deng2009imagenet} with translated label names is used for zero-shot validation.
    {\段模型训练设置。为了提高泛化效果和数据效率,我们采用Autoaugment方法对图像数据进行增强,以构建更多的图像-文本对。我们所有的型号都是使用Nvidia V100 gpu和Ascend卡进行培训的。其中Wukong\ text下标{vi - b}用32个gpu训练3天,Wukong\ text下标{vi - l}用32个gpu训练10天,Wukong\ text下标{Swin}用40个gpu训练5天。在训练中,我们使用了LAMB优化器~ citep{2019Large}和带线性预热的余弦学习速率计划~ citep{2016SGDR}。对对比损耗中除偏置、层归一化、令牌嵌入、位置嵌入和温度外的所有参数进行权值衰减正则化。详细的超参数如表~\ref{tab:hyperparameters}所示。为了挑选出最佳的检查点,使用带有翻译过的标签名的ImageNet数据集~\citep{deng2009imagenet}进行零拍验证。不引入外部数据进行zeroshot验证也是一个亮点

    \subsection{Zero-shot Image Classification} We evaluate our pre-trained models for zero-shot classification task on 10 datasets whose class labels are translated from English. To make the evaluation results more reliable, the translation process is done with an online machine translation service followed by a manual refinement. We publish the annotated Chinese versions of these datasets for future evaluation in the research community in \url{https://wukong-dataset.github.io/wukong-dataset/}.
    我们评估了我们的预训练模型在10个数据集上的零镜头分类任务,这些数据集的类别标签是从英语翻译过来的。为了使评价结果更加可靠,翻译过程是通过在线机器翻译服务完成的,然后再进行手工细化。我们在\url{https://wukong-dataset.github.io/wukong-dataset/}中发布了这些数据集的中文注释版本,以供未来的研究社区评估。

    \paragraph{Prompt Ensemble.} Text prompts are often used as a class label augmentation to get a better performance in zero-shot image classification task~\citep{radford2021learning,yao2021filip}. For simplicity, instead of designing prompts manually, we use fixed 80 text prompts which are used on ImageNet dataset by CLIP. Since the original prompts are in English, they are manually translated into Chinese. It is possible that adding extra descriptions as a part of text prompts specific to each dataset may further improve the results. Since our paper aims to provide a benchmark dataset with pre-trained models, we stick to the general-purpose prompt templates, and leave the design of better prompt templates for each task as a future work. Note that when using the global similarity, we follow CLIP to ensemble different prompt templates by using their mean textual representation, i.e., we sum different templates for the same class label to form a mean textual representation. While for the token-wise similarity, since there is no global representation, we simply ensemble prompt templates by their mean token-wise similarity to images.
    {\段落提示合奏。在零拍图像分类任务中,文本提示符经常被用作类标签的扩展,以获得更好的性能~ citep{radford2021learning,yao2021filip}。为了简单起见,我们使用固定的80个文本提示符,而不是手工设计提示符。这些文本提示符是CLIP在ImageNet数据集上使用的。因为原来的提示是英文的,所以需要手工翻译成中文。在特定于每个数据集的文本提示中添加额外的描述可能会进一步改善结果。由于本文的目标是提供一个带有预训练模型的基准数据集,所以我们坚持使用通用的提示模板,并将为每个任务设计更好的提示模板作为未来的工作。注意,在使用全局相似度时,我们遵循CLIP,通过使用它们的平均文本表示来集成不同的提示模板,也就是说,我们对同一个类标签求和不同的模板来形成平均文本表示。而对于标记方面的相似性,由于没有全局表示,我们只是根据提示模板与图像的平均标记方面的相似性来进行集成。

    image.png

    The evaluation of zero-shot image classification on different datasets is illustrated in Table~\ref{tab:zero-shot}. For our proposed models, i.e., Wukong\textsubscript{ViT-B}, Wukong\textsubscript{ViT-L} and Wukong\textsubscript{Swin}, we also evaluate multiple model variants with global similarity (marked with G'') or **full token-wise interaction (marked withF’’). Among all the model variants, Wukong\textsubscript{ViT-L} obtains the best result of 73.03\%. We find that using token-wise similarity together with reduced-token interaction brings significant improvement especially for ViT-based models. Take Wukong\textsubscript{ViT-B} as an example, using the token reduction layer achieves the highest accuracy 65.65\% among all. However, the token reduction layer in SwinT is less effective. The reason might be that patch merging in SwinT has already served a similar purpose on selecting and merging the important visual patch tokens.
    表~\ref{tab:zero-shot}给出了不同数据集上的零拍图像分类评价。对于我们提出的模型,即Wukong\ text下标{vi - b}、Wukong\ text下标{vi - l}和Wukong\ text下标{Swin},我们也评估了具有全局相似度(标记为’’ G’)或完全标记为令牌交互(标记为’’ F’)的多个模型变体。
    在所有模型变量中,Wukong\textsubscript{vi - l}的结果最好,为73.03\%。我们发现,使用令牌方向的相似性以及减少令牌交互带来了显著的改进,特别是对于基于虚拟现实的模型。**以Wukong\textsubscript{vi - b}为例,使用令牌约简层的准确率最高,达到65.65% \%。然而,SwinT中的令牌缩减层效果较差。原因可能是,在选择和合并重要的可视补丁标记方面,SwinT中的补丁合并已经起到了类似的作用。

    In summary, the zero-shot classification performances on various tasks show the effectiveness of our dataset and models. Although these visual encoders are all pre-trained on English datasets, e.g., ImageNet-22K and YFCC100M~\citep{thomee2016yfcc100m}, we find that the image feature computed by them is still reliable and expressive for efficiently pairing Chinese texts and images in our dataset.
    综上所述,零拍分类在各种任务上的性能表明了我们的数据集和模型的有效性。虽然这些视觉编码器都是在英文数据集(如ImageNet-22K和YFCC100M~\citep{thomee2016yfcc100m})上进行了预训练,但我们发现,在我们的数据集中,通过它们计算的图像特征仍然是可靠的和有表现力的,可以有效地对中文文本和图像进行匹配。

    \subsection{Image-Text Retrieval} In this section, we evaluate our models on two sub-tasks, including image-to-text retrieval and text-to-image retrieval. In the image-to-text retrieval, the model retrieves a target text from a set of candidates given an image as query, or vice versa for the text-to-image retrieval. We benchmark our models on 6 different datasets, including Flickr8K-CN~\citep{flickr8k-cn}, Flickr30K-CN~\citep{flickr30k-cn}, COCO-CN~\citep{coco-cn}, AIC-ICC~\citep{aicicc}, MUGE~\footnote{\url{https://tianchi.aliyun.com/muge}} and Wukong50K.
    在本节中,我们在两个子任务上评估我们的模型,包括图像到文本的检索和文本到图像的检索。在图像到文本检索中,模型从给定图像的一组候选者中检索目标文本作为查询,反之亦然,用于文本到图像检索。我们在6个不同的数据集上对模型进行了基准测试,包括Flickr8K-CN~ citep{Flickr8K-CN}、Flickr30K-CN~ citep{Flickr30K-CN}、AIC-ICC~ citep{aicicc}、MUGE~\脚注{\url{https://tianchi.aliyun.com/muge}}和悟空50k。

    image.png
    基本没跟别的工作比,确实只是baseline,或者说中文多模态还不够繁荣
    image.png
    For each dataset, our pre-trained models are evaluated in both zero-shot and fine-tuned settings. Following common practices, we report Recall@K (recall of top K candidates) with $K = 1,5,10$ for both image-to-text and text-to-image retrieval on all datasets except for MUGE, which only has the text-to-image retrieval setting. The average of Recall@K, i.e., Mean Recall (MR), is used for the final comparison. We report results on the test sets, except for MUGE and AIC-ICC where test sets are not released. For MUGE, we report results on the validation set, and for AIC-ICC, following the setting of WenLan~2.0~\citep{fei2021wenlan}, we take the first 10K images along with their corresponding 50K pieces of texts from the validation set for testing.
    对于每个数据集,我们的预训练模型都在零镜头和微调设置下进行评估。按照常见的做法,我们报告了Recall@K(前K个候选对象的召回率),对于除MUGE之外的所有数据集上的图像到文本和文本到图像检索,$K = 1,5,10美元,MUGE只有文本到图像检索设置。Recall@K的平均值,即Mean Recall (MR),作为最终的比较。我们报告测试集的结果,MUGE和AIC-ICC不发布测试集。对于MUGE,我们报告验证集中的结果,对于AIC-ICC,在WenLan~2.0~ citep设置之后,我们从验证集中取前10K幅图像及其对应的50K段文本进行测试。

    Table~\ref{tab:retrieval-zero-shot} and Table~\ref{tab:retrieval-finetuned} show the results of zero-shot and fine-tuned image-text retrieval respectively.
    Our Wukong\textsubscript{ViT-L} achieves the best results among different model variations and datasets, in either zero-shot or fine-tuned setting.
    Compared with baseline methods, on AIC-ICC, Wukong significantly outperforms WenLan~2.0 by around 12.9\%, which was pre-trained on a larger dataset consisting of 650 million image-text pairs. For the COCO-CN dataset, our Wukong models also achieve comparable performance to state-of-the-art methods. Overall, experimental results demonstrate the capabilities of our pre-trained models.
    表~\ref{tab: retrieve -zero-shot}和表~\ref{tab: retrieve -finetune}分别显示了zero-shot和微调图像-文本检索的结果。
    我们的Wukong\ text下标{vi - l}在不同的模型变量和数据集中,无论是零镜头还是微调设置,都获得了最好的结果。
    与基线方法相比,在ai - icc上,在6.5亿对图像-文本对的数据集上,悟空的训练效果明显优于文兰~2.0,约12.9% \%。对于COCO-CN数据集,我们的悟空模型也实现了与最先进的方法相媲美的性能。总的来说,实验结果证明了我们的预训练模型的能力。

    \subsection{Visualization of word-patch alignment}

    Since we follow the fine-grained interaction in FILIP~\citep{yao2021filip}, our models Wukong\rlap{\textsuperscript{F}}\textsubscript{ViT-L} and Wukong\rlap{\textsuperscript{F}}\textsubscript{Swin} likewise own the capability of capturing the correspondence between images and Chinese texts. Note that they are trained using the token-wise similarity. We exclude ones with the global similarity since they lack of word-patch alignment capability, which has also been evidenced in previous work~\citep{yao2021filip}.
    由于我们遵循了FILIP~ citep{yao2021filip}中的细粒度交互,我们的模型Wukong\rlap{text上标{F}}\ text下标{vi - l}和Wukong\rlap{text上标{F}}\ text下标{Swin}同样具有捕捉图像与中文文本之间对应关系的能力。请注意,它们是使用标记方面的相似性进行训练的。我们将具有全局相似性的算法排除在外,因为它们缺乏文字-补丁对齐能力,这在之前的工作中也得到了证明。
    可视化能力可以作为case study写到文章中
    image.png
    Visualization of word-patch alignment. We randomly choose six classes in the Chinese ImageNet dataset. Each Chinese label name is used as a prompt, whose English text is described in the parentheses. Behind which, the tail numbers indicate the location indices of this class label in the tokenized textual input. Take (a) as an example, the number 0 always represents \texttt{[CLS]}, the number 1 is the tokenized \texttt{豆}'' and the number 2 is\texttt{娘}’’. Indices of the tokenized label name are highlighted in red.
    字贴片对齐的可视化。我们在中国ImageNet数据集中随机选择6个类。每个中文标签名称作为提示符,其英文文本在括号中描述。在其后面,尾部编号表示该类标签在标记化文本输入中的位置索引。以()为例,0总是代表\ texttt {(CLS)}, 1号是标记化的“\ texttt{豆}”和2号是‘\ texttt{娘}”。标记化标签名称的索引用红色突出显示。

    As shown in Figure~\ref{fig:vis}, we visualize images from six labels in the Chinese ImageNet. We apply the same visualization method from FILIP~\citep{yao2021filip}, to align textual tokens and image patch tokens. In particular, we calculate the token-wise similarity between each image patch token and all tokenized textual tokens from the text label, i.e., \texttt{[CLS]}{class label tokens}\texttt{[SEP]}, as illustrated in the Section~\ref{method:objective}. For each image patch, the position index of textual tokens with the maximum similarity is considered as its predicted text token. Note that the Chinese class label is often tokenized to more than one token. We highlight all the predicted position indices that correspond to the class label, and place them at the center of the corresponding patches.
    如图~\ref{fig:vis}所示,我们将中文ImageNet中的六个标签中的图像可视化。我们应用FILIP~\citep{yao2021filip}中相同的可视化方法来对齐文本标记和图像补丁标记。特别地,我们计算每个图像补丁标记与文本标签中所有经标记的文本标记之间的标记级相似度,即\texttt{[CLS]}{类标记标记}\texttt{[SEP]},如章节~\ref{method:objective}所示。对于每个图像patch,将相似度最大的文本标记的位置索引作为其预测文本标记。请注意,中文类标签经常被标记为多个标记。我们突出显示所有与类标签对应的预测位置索引,并将它们放置在相应patch的中心。

    From Figure~\ref{fig:vis}, we surprisingly find that both models are able to predict image patches of the target object. For Wukong\rlap{\textsuperscript{F}}\textsubscript{ViT-L} with each image patchified to 16$\times$16, such word-patch alignment is more fine-grained than Wukong\rlap{\textsuperscript{F}}\textsubscript{Swin} with the output resolution as 7$\times$7. Take Figure~\ref{fig:vis}~(e) as an example, Wukong\rlap{\textsuperscript{F}}\textsubscript{ViT-L} is even able to align Chinese tokens \texttt{教}'' and\texttt{堂}’’, which means church as one word, to the smaller church in the bottom-right corner. Wukong\rlap{\textsuperscript{F}}\textsubscript{ViT-L} also well outlines the hummingbird in the example of Figure~\ref{fig:vis}~(c), while Wukong\rlap{\textsuperscript{F}}\textsubscript{Swin} often aligns to the main body of the target object.
    从图~\ref{fig:vis}中,我们惊奇地发现,这两种模型都能够预测目标物体的图像patch。对于Wukong\rlap{\ text上标{F}}\ text下标{vi - l},每个图像的patch值为16$\乘以$16,这样的字-patch对齐比Wukong\rlap{\ text上标{F} \ text下标{Swin}输出分辨率为7$\乘以$7的字-patch对齐粒度更细。把图~ \ ref{无花果:vis} ~ (e)作为一个例子,悟空\ rlap {\ textsuperscript {F}} \ textsubscript {ViT-L}甚至能够使中国令牌“\ texttt{教}”和“\ texttt{堂}”,这意味着教会作为一个词,右下角的小教堂。Wukong\rlap{\ text上标{F}}\ text下标{vi - l}也很好地在Figure~ ref{fig:vis}~(c)的例子中勾画出了蜂鸟的轮廓,而Wukong\rlap{F}}\ text下标{Swin}经常对准目标对象的主体。

    Another interesting observation is that these Chinese pre-trained models are able to align image patches to English tokens as shown in Figure~\ref{fig:vis}~(d). The main reason lies in that the vocabulary used from BERT~\citep{devlin2018bert} also includes multilingual words such as ``\texttt{iPod}’’.
    另一个有趣的观察结果是,这些中国预先训练的模型能够将图像块与英文标记对齐,如图~\ref{fig:vis}~(d)所示。主要原因在于BERT~\citep{devlin2018bert}中使用的词汇还包括’’ \texttt{iPod} “等多语种词汇。

    This visualization of word-patch alignment evidences the effectiveness of cross-modal token-wise similarity even in the LiT-tuning setting. Though the visual encoder (i.e., ViT-L/14 or Swin-L) is locked in the pre-training phase, the learnable linear projection layer on top of it, is still able to align patches and words in a fine-grained manner. We also find that this token-wise similarity in loss function works across various patch-based visual encoders, not only the traditional ViT architecture but also SwinT that uses the sophisticated shifted windowing attention and patch merging. Given this promising capability of aligning words and patches, our experiment offers a potential solution towards image object localization.
    这种文字-贴片对齐的可视化证明了跨模态标记相似度的有效性,甚至在litt调优设置中也是如此。尽管视觉编码器(如vi - l /14或Swin-L)在训练前阶段被锁定,但其之上的可学习线性投影层仍然能够以细粒度的方式对patch和words进行对齐。我们还发现,丢失函数中这种令牌方面的相似性适用于各种基于补丁的视觉编码器,不仅适用于传统的ViT架构,还适用于使用复杂的转移窗口注意和补丁合并的SwinT。考虑到对齐单词和贴片的能力,我们的实验为图像对象定位提供了一个潜在的解决方案。

    \section{Conclusion} In this work, we build a large-scale Chinese vision-language dataset called Wukong. To the best of our knowledge, it is the first hundred-million level dataset specific for Chinese language and it paves the way for future research on Chinese cross-modal pre-training. Meanwhile, using this dataset, we propose three Chinese VLP models, i.e., Wukong\textsubscript{ViT-B}, Wukong\textsubscript{ViT-L} and Wukong\textsubscript{Swin}. Experiments evidence that it is possible to apply the frozen visual encoders pre-trained on English dataset to Chinese multi-modal pre-training. It also shows that Wukong can serve as a promising Chinese pre-training dataset and benchmark for different cross-modal learning methods. Our pre-trained Wukong\textsubscript{ViT-L} achieves state-of-the-art performance on Chinese benchmarks such as zero-shot image classification and image-text retrieval tasks. In the future, we plan to explore more solutions to train multilingual cross-modal models with the Wukong dataset.
    在本工作中,我们构建了一个大规模的中文视觉语言数据集“悟空”。据我们所知,这是第一个专门针对汉语的亿级数据集,为今后汉语跨模态预训练的研究奠定了基础。同时,利用该数据集,我们提出了三种中文VLP模型:Wukong\ text下标{vi - b}、Wukong\ text下标{vi - l}和Wukong\ text下标{Swin}。实验证明,将英语数据集上预训练的静态视觉编码器应用于汉语多模态预训练是可行的。研究结果表明,悟空可以作为不同跨模态学习方法的训练前数据集和学习标杆。我们预先训练的Wukong\ text下标{vi - l}在中国的基准测试中,如零拍图像分类和图像-文本检索任务,都达到了最先进的性能。在未来,我们计划探索更多的解决方案,以训练多语种的跨模态模型与悟空数据集。

    \section{Appendix}

    \subsection{Prompt Template}
    \label{appendix_prompt}

    As previously observed in GPT-3~\citep{brown2020language}, the zero-shot performance can be significantly improved by customizing the prompt templates to each task. CLIP~\citep{radford2021learning} also shows that specifying the category for each dataset contributes to the performance. However, since we only aim to provide a Chinese dataset with a general benchmarking of our released models, we leave the prompt engineering'' to the future work. We simply use the reported 80 general English prompts in CLIP and translate them to Chinese manually, as follows. Note that{}‘’ is replaced by the exact Chinese label name.
    正如前面在GPT-3~\citep{brown2020language}中所观察到的,可以通过为每个任务定制提示模板来显著提高零镜头性能。CLIP~\citep{radford2021learning}还表明,为每个数据集指定类别有助于性能。然而,由于我们的目标只是为我们发布的模型提供一个中国数据集,我们把“即时工程”留给了未来的工作。我们只是使用CLIP中报告的80个一般英语提示,并将其手动翻译成中文,如下所示。注意,’’ {}“被准确的中文标签名称所取代。

    \paragraph{Chinese Prompts:} \{\}的照片。'',许多{}的照片。’’,
    一张包含\{\}的照片。'',质量差的{}的照片。’’, \{\}的雕塑。'',<br />难以看到{}的照片。’’, \{\}的低分辨率照片。'',{}的渲染。’’,
    涂鸦\{\}。'',{}的糟糕照片。’’, \{\}的裁剪照片。'',{}的纹
    身。’’, \{\}的刺绣照片。'',很难看到{}的照片。’’, \{\}的明亮照<br />片。'',一张干净的{}的照片。’’, \{\}的深色照片。'',{}的手绘
    画。’’, 我的\{\}的照片。'',不自然的{}的照片。’’, 一张酷<br />的\{\}的照片。'',{}的特写照片。’’, \{\}的黑白照片。'',<br />一幅{}的画。’’, 一幅\{\}的绘画。'',一张{}的像素照片。’’,
    \{\}的雕像。'',一张{}的明亮照片。’’, \{\}的裁剪照片。'',人
    造的{}的照片。’’, 一张关于\{\}的照片。'',损坏的{}的jpeg照
    片。’’, \{\}的模糊照片。'',{}的相片。’’, 一张\{\}的好照片。'',<br />{}的渲染照。’’, 视频游戏中的\{\}。'',一张{}的照片。’’,
    \{\}的涂鸦。'',{}的近距离照片。’’, \{\}的折纸。'',{}在视
    频游戏中。’’, \{\}的草图。'',{}的涂鸦照。’’, \{\}的折纸形<br />状。'',低分辨率的{}的照片。’’, 玩具\{\}。'',{}的副本。’’,
    \{\}的干净的照片。'',一张大{}的照片。’’, \{\}的重现。'',一
    张漂亮的{}的照片。’’, 一张奇怪的\{\}的照片。'',模糊的{}的照
    片。’’, 卡通\{\}。'',{}的艺术作品。’’, \{\}的素描。'',<br />刺绣{}。’’, \{\}的像素照。'',{}的拍照。’’, \{\}的损坏的照<br />片。'',高质量的{}的照片。’’, 毛绒玩具\{\}。'',漂亮的{}的照
    片。’’, 小\{\}的照片。'',照片是奇怪的{}。’’, 漫画\{\}。'',<br />{}的艺术照。’’, \{\}的图形。'',大{}的照片。’’, 黑白<br />的\{\}的照片。'',{}毛绒玩具。’’, 一张\{\}的深色照片。'',<br />{}的摄影图。’’, \{\}的涂鸦照。'',玩具形状的{}。’’,
    拍了\{\}的照片。'',酷酷的{}的照片。’’, 照片里的小\{\}。'',<br />{}的刺青。’’

    \subsection{Image-text retrieval dataset.}
    \label{appendix_dataset}

    The data scale of datasets for image-text retrieval is described in Table~\ref{tab:retrieval-dataset}. The texts in Flickr8K-CN, COCO-CN, AIC-ICC are human-annotated, the texts in Flickr30K-CN train/val set are machine-translated while the texts in Flickr30K-CN test set are human-translated from their original English counterparts. In Flickr8K-CN, Flickr30K-CN and AIC-ICC, each image is paired with 5 texts. In COCO-CN, each image is paired with 1 to 2 texts. In MUGE, each text is paired with 1 to 2 images in the train set, and with about 6 images in the val/test sets.
    用于图像-文本检索的数据集的数据规模见表~\ref{tab: retrieve -dataset}。Flickr8K-CN、COCO-CN、AIC-ICC中的文本是人工标注的,Flickr30K-CN train/val set中的文本是机器翻译的,而Flickr30K-CN测试集中的文本是人工翻译的。在Flickr8K-CN、Flickr30K-CN和AIC-ICC中,每个图像都与5个文本配对。在COCO-CN中,每个图像都与1到2个文本配对。在MUGE中,每个文本与列集中的1到2个图像配对,在val/测试集中与大约6个图像配对。
    可以抄这个表
    image.png