Method for pre-training vision-language transformer, and artificial intelligence system comprising vision-language transformer pre-trained through same method
The MCD pre-training method addresses data processing and misalignment issues in vision-language transformer training by using knowledge distillation and contrastive learning to align feature vectors, resulting in enhanced performance for vision tasks.
Patent Information
- Application Number
- PCT/KR2024/003118
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-09
- Filing Date
- 2024-03-11
- Publication Date
- 2024-09-12
AI Technical Summary
Conventional vision-language transformer pre-training methods face challenges with excessive data processing overhead and misalignment issues during image augmentation, leading to deteriorated performance due to the need for large datasets and external modules to detect misalignment.
The proposed method, MCD pre-training, uses knowledge distillation to leverage misalignment in image-text pairs by randomly augmenting images, converting misalignment into useful information through a contrastive learning approach, and aligning feature vector representations using a teacher and student encoder framework.
This approach efficiently secures large pre-training data, improves vision-language transformer performance, and enables effective execution of vision tasks like image classification, segmentation, and captioning with improved accuracy.
Smart Images

Figure KR2024003118_12092024_PF_FP_ABST
Abstract
Description
A method for pre-training a vision-language transformer and an artificial intelligence system including a pre-trained vision-language transformer.
[0001] The present invention relates to a method for pre-training a transformer using vision and language data, and to an artificial intelligence system including a vision transformer pre-trained thereby.
[0002] With the recent emergence of pre-trained vision-language pretraining (VLP) models on large-scale general domain data, AI-based computer vision processing technology is rapidly developing.
[0003] In particular, Vision Transformers trained on large-scale image-text datasets using techniques such as global self-attention and contrastive language-image pretraining, as in prior literature 1, have shown innovative progress in downstream tasks such as diverse and challenging vision tasks.
[0004] However, to fully train global self-attention, which is mainly driven by vision transformers, a large dataset is required and there is a problem of excessive data processing overhead.
[0005] To obtain such large-scale data sets, many methods are used to obtain diverse data by augmenting language data or / and vision data, for example, by randomly applying rotation, flipping, resizing, cropping, color adjustment, enlargement, cropping, and adding Gaussian noise to existing images.
[0006] During the process of augmenting the image above, if you randomly perform actions such as enlarging or reducing a specific area or cropping it, a misalignment problem occurs where the text matches the image that was the original augmentation target.
[0007] In addition, when a vision-language transformer is pre-trained in the conventional manner based on pairs of texts matched to the misaligned augmented images before augmentation, a problem occurs in which the final performance of the pre-trained vision-language transformer deteriorates.
[0008] To overcome these issues, prior literature 2 proposed a technique that introduces an additional external module to detect misalignment through an object detector and, if detected, correct the text through a summary extractor. Prior literature 3 proposed a technique to align alignment during pre-training using station embedding. However, the use of such external modules increases data processing volume, placing a significant burden on pre-training.
[0009] (Patent Document 1) Prior Document 1: Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever. Learning Transferable Visual Models From Natural Language Supervision, on 26 Feb 2021
[0010] (Patent Document 2) Prior Document 2: Yuting Gao, Jinfeng Liu, Zihan Xu, Jun Zhang, Ke Li, and Chunhua Shen. Pyramidclip: Hierarchical feature alignment for vision-language model pretraining. arXiv preprint arXiv:2204.14095, 2022. 1, 2, 3
[0011] (Patent Document 3) Prior Document 3: Janghyeon Lee, Jongsuk Kim, Hyounguk Shon, Bumsoo Kim, Seung Hwan Kim, Honglak Lee, and Junmo Kim. Uniclip: Unified framework for contrastive language-image pretraining. In Advances in Neural Information Processing Systems, 2022. 1, 2, 3, 5, 6, 7
[0012] The vision-language transformer pre-training method according to the present invention aims to secure pre-training data of a plurality of image-text pairs by randomly enlarging or masking a plurality of image data required for pre-training.
[0013] In addition, the vision-language transformer pre-training method of the present invention aims to train the vision-language transformer by utilizing misalignment of image-text pairs that occurs during random image enlargement or masking as useful information.
[0014] And the present invention aims to develop an artificial intelligence system capable of effectively performing various vision tasks using a vision-language transformer pre-trained in this manner.
[0015] A method for pre-training a vision-language transformer according to an embodiment of the present invention proposes a method for pre-training a vision-language transformer by randomly augmenting an image, intentionally inducing a misalignment between the augmented image and text, and using the misalignment as useful information.
[0016] In detail, the present invention proposes a vision-language transformer pre-training method according to an embodiment, a contrast image-text pre-training method using knowledge distillation (Misalign, Contrast then Distill: MCD, hereinafter, “MCD pre-training method”) that can pre-train by utilizing misalignment of augmented image-text pairs as useful information.
[0017] Specifically, a method for pre-training a vision-language transformer according to an embodiment of the present invention is a method for pre-training a vision-language transformer with a dataset of a plurality of original image-text pairs, wherein a computing system including a memory and a processor comprises the steps of: randomly augmenting the original images to generate a plurality of augmented images; inputting texts matched to the original images into a text encoder to output text feature vector representations; inputting the original images and the plurality of augmented images into a teacher image encoder to output first image feature vector representations; inputting the original images and the plurality of augmented images into a student image encoder to output second image feature vector representations; generating a first alignment metric for the text feature vector representations and the first image feature vector representations; learning the first alignment metric so that the text feature vector representations and the first image feature vector representations are aligned to have similarity according to a positive and negative mapping relationship of the image-text pairs; A step of performing knowledge distillation on a student image encoder by aligning the second alignment matrix to predict the output of the learned first alignment matrix is included.
[0018] At this time, the step of inputting the teacher image encoder and outputting the first image feature vector representations may include the step of outputting the first image feature vector representations through the original images and the plurality of augmented images through the plurality of self-attention layers and the feed forward network layer.
[0019] In addition, the step of inputting the second image feature vector representations into the student image encoder may include a step of inputting the original images and a plurality of augmented images into a token sparsification layer based on output values from a plurality of self-attention layers to perform token sparsification.
[0020] In addition, the step of learning the first alignment metric so that the text feature vector representations and the first image feature vector representations are aligned may include the step of determining a positive feature vector representation pair and a negative feature vector representation pair of the text feature vector representations and the first image feature vector representations according to a mapping relationship between the original image-text pair and the augmented image-text pair, and the step of learning a teacher image encoder according to a loss function that makes the distance between the positive feature vector representation pairs close and makes the distance between the negative feature vector representation pairs far for similarity alignment.
[0021] In addition, the step of learning encoders according to the loss function may include a step of applying a momentum stopping gradient to the teacher image encoder to block backpropagation when learning for similarity sorting according to the loss function.
[0022] Additionally, the step of performing knowledge distillation on the student image encoder may include a step of knowledge distilling such that the output value of the first alignment metric according to the similarity alignment is predicted by the second alignment metric.
[0023] Additionally, the step of performing knowledge distillation on the second alignment matrix may include a step of blocking backpropagation to the text encoder during the knowledge distillation.
[0024] Additionally, the step of performing knowledge distillation on the second sorting matrix may include a step of performing knowledge distillation so that parameters of the second sorting matrix follow parameters of the first sorting matrix.
[0025] Additionally, the step of knowledge distilling so that the parameters of the second sorting matrix follow the parameters of the first sorting matrix may include the step of updating the parameters of the second sorting matrix with an exponential moving average (EMA) of the parameters of the first sorting matrix.
[0026] In addition, the step of performing knowledge distillation on the second alignment matrix may include a step of performing knowledge distillation by defining a loss function that reflects misalignment information between the augmented image and the text through the distance between the first image feature vector representation and the text feature vector representation and the distance between the second image feature vector representation and the text feature vector representation.
[0027] In addition, the step of distilling knowledge by defining a loss function based on the distance may include the step of calculating a first Euclidean distance between the original image feature vector representation and the text feature vector representation output by the student image encoder, and a second Euclidean distance between the augmented image feature vector representation and the text feature vector representation output by the student image encoder, and calculating a first log ratio that is calculated as a ratio of the first Euclidean distance and the second Euclidean distance in a log scale.
[0028] In addition, the step of defining a loss function based on the distance and distilling knowledge may include the step of calculating a third Euclidean distance between the original image feature vector representation and the text feature vector representation output by the teacher image encoder, and a fourth Euclidean distance between the augmented image feature vector representation and the text feature vector representation output by the teacher image encoder, and calculating a second log ratio that calculates the ratio of the third Euclidean distance and the fourth Euclidean distance in a log scale.
[0029] In addition, the step of performing knowledge distillation by defining a loss function based on the distance may further include a step of performing knowledge distillation by defining the difference between the first log ratio and the second log ratio as a loss function for aligning the second alignment metric so that it approximates the first alignment metric.
[0030] At this time, the loss function for aligning the first sorting matrix and the second sorting matrix is can be defined as
[0031] Additionally, the step of performing an update through a stationary gradient may be further included to prevent backpropagation between the teacher image encoder and the text encoder.
[0032] In addition, a vision-language transformer pre-trained by a computing system including a memory and a processor according to an embodiment of the present invention comprises: a text encoder that receives texts as input and outputs text feature vector representations; a teacher image encoder that receives original images and a plurality of augmented images augmented from the original images as input and outputs first image feature vector representations; a student image encoder that receives the original images and a plurality of augmented images augmented from the original images as input and outputs second image feature vector representations; and the teacher image encoder and the text encoder similarity-align the text feature vector representations and the first image feature vector representations so that a first alignment metric is learned, and the student image encoder knowledge-distills a second alignment metric for the text feature vector representations and the second image feature vector representations so that the output value is predicted based on the first alignment metric.
[0033] In addition, the present invention aims to provide an artificial intelligence system including a vision-language transformer capable of performing a vision task with improved performance by securing a large amount of data required for pre-training through the image augmentation method and efficiently pre-training the vision-language transformer with a large amount of secured misaligned image-text pairs.
[0034] The present invention provides a vision-language transformer pre-training method according to an embodiment, which randomly augments images to expand a plurality of misaligned image-text pairs into pre-training data, thereby easily securing a large number of pre-training data that contain various and useful information in various aspects.
[0035] In addition, the vision-language transformer pre-training method according to the embodiment of the present invention can provide a vision-language transformer with improved performance through an MCD pre-training method that can learn misalignment of augmented image-text pairs as useful information.
[0036] And, according to an embodiment of the present invention, an artificial intelligence system including a pre-trained vision-language transformer can effectively perform vision tasks such as image classification, object detection, image segmentation, image captioning, image analysis, and optical character recognition by using a vision-language transformer learned with pre-training data containing various useful information in various aspects.
[0037] FIG. 1 illustrates an example block diagram of a computing system executing an MCD pre-training method according to an embodiment of the present invention.
[0038] FIG. 2 illustrates an example of a block diagram of a computing device that pre-trains a vision-language transformer and executes the pre-trained vision-language transformer according to an MCD pre-training method according to an embodiment of the present invention.
[0039] FIG. 3 illustrates an example block diagram from another aspect for a computing device that performs an MCD pre-training method according to an embodiment of the present invention and executes a pre-trained vision-language transformer.
[0040] Figure 4 conceptually illustrates the framework of an MCD pre-training method according to an embodiment of the present invention.
[0041] FIG. 5 illustrates the meta-architecture of the framework of the MCD pre-training method according to an embodiment of the present invention.
[0042] The present invention is capable of various modifications and embodiments. Therefore, specific embodiments are illustrated in the drawings and described in detail in the detailed description. The effects and features of the present invention, as well as the methods for achieving them, will become clear with reference to the embodiments described in detail below together with the drawings. However, the present invention is not limited to the embodiments disclosed below and can be implemented in various forms. In the following embodiments, terms such as first, second, etc. are not used in a limiting sense but are used for the purpose of distinguishing one component from another. Furthermore, the singular expression includes plural expressions unless the context clearly indicates otherwise. Furthermore, terms such as "include" or "have" indicate the presence of a feature or component described in the specification, and do not preemptively exclude the possibility that one or more other features or components may be added. Furthermore, in the drawings, the sizes of components may be exaggerated or reduced for convenience of explanation. For example, the size and thickness of each component shown in the drawings are arbitrarily shown for convenience of explanation, and thus the present invention is not necessarily limited to what is shown.
[0043]
[0044] FIG. 1 illustrates an example block diagram of a computing system executing an MCD pre-training method according to an embodiment of the present invention.
[0045] Referring to FIG. 1, a computing system (1000) according to one embodiment of the present invention includes a user computing device (110), a training computing system (150), and a server computing system (130), and each device and system are communicatively connected via a network (170).
[0046] According to various embodiments of the present invention, 1) a user computing device (110) can pre-train a vision-language transformer (120) locally and execute an application including the trained vision-language transformer (120), 2) a server computing system (130) communicating with the user computing device (110) can pre-train a vision-language transformer (120 or 140) and provide an application including the vision-language transformer (120 or 140) or the vision-language transformer (120 or 140) directly to the user computing device (110) or in the form of a web service, and 3) the user computing device (110) and the server computing system (130) can be linked to each other to pre-train a vision-language transformer (120 or 140) or execute a pre-trained vision-language transformer (120 or 140) to provide various application services.
[0047] Additionally, according to various embodiments of the present invention, a user computing device (110) and / or a server computing system (130) may train a model (120) through interaction with a training computing system (150) communicatively connected via a network (170). In this case, the training computing system (150) may be separate from the server computing system (130) or may be a part of the server computing system (130).
[0048] That is, the vision-language transformer pre-training method according to the embodiment is such that 1) a user computing device (110) can pre-train a vision-language transformer (120) directly locally, 2) a server computing system (130) and a user computing device (110) can interact with each other through a network and pre-train, and 3) a separate training computing system (150) can pre-train a vision-language transformer using various training techniques and learning techniques.
[0049] And the training computing system (150) may be implemented in a manner that transmits the pre-trained vision-language transformer (120 or / and 140) to the user computing device (110) or / and the server computing system (130) through a network to provide or / and update the same.
[0050] In some embodiments, the training computing system (150) may be part of a server computing system (130) or part of a user computing device (110).
[0051] In addition, the present invention provides a method and system for pre-training a vision-language transformer, which can be included in applications that perform various downstream tasks by performing additional tasks such as fine-tuning a pre-trained vision-language transformer.
[0052]
[0053] The user computing device (110) may include any type of computing device, such as a smart phone, a mobile phone, a digital broadcasting device, a personal digital assistant (PDA), a portable multimedia player (PMP), a desktop, a wearable device, an embedded computing device, and / or a tablet PC.
[0054] Such a user computing device (110) includes at least one processor (111) and memory (112). Here, the processor (111) may be composed of at least one or a plurality of electrically connected processors among a central processing unit (CPU), a graphics processing unit (GPU), application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, and / or other electrical units for performing functions.
[0055] The memory (112) may include one or more non-transitory / transitory computer-readable storage media, such as RAM, ROM, EEPROM, EPROM, flash memory devices, magnetic disks, and combinations thereof, and may include web storage of a server that performs a memory storage function on the Internet. The memory (112) may store data (113) and commands (114) necessary for the at least one processor (111) to perform operations such as pre-training a vision-language transformer (120) or executing an application including a pre-trained vision-language transformer (120).
[0056] In one embodiment, the user computing device (110) may store at least one machine learning model (e.g., a vision-language transformer (120)).
[0057] In detail, the vision-language transformer (120) of one embodiment may be various machine learning models, such as multiple neural networks (e.g., deep neural networks) or other types of machine learning models including non-linear models and / or linear models, and may be composed of combinations thereof.
[0058] And the neural network may include at least one of feed-forward neural networks, recurrent neural networks (e.g., long short-term memory recurrent neural networks), convolutional neural networks, or / and other forms of neural networks.
[0059] In one embodiment, a user computing device (110) receives at least one vision-language transformer (120) from a server computing system (130) via a network (170), stores it in a memory, and then executes the stored vision-language transformer (120) by a processor (111) to operate an application having various vision-based tasks.
[0060] In another embodiment, the server computing system (130) may include at least one machine learning model (e.g., a vision-language transformer (140)) to perform operations through the vision-language transformer (140), and may provide the user with an artificial intelligence system that performs various tasks using the vision-language transformer (140) by communicating data related thereto with the user computing device (110). For example, the user computing device (110) may perform vision tasks including the vision-language transformer (140) in a manner that the server computing system (130) provides output for the user's input using the vision-language transformer (140) through the web. Additionally, the vision-to-language transformers (120 or / and 140) may also be implemented in such a way that at least some of the vision-to-language transformers (120 or / and 140) run on a user computing device (110) and the rest run on a server computing system (130).
[0061] Additionally, the user computing device (110) may include at least one input component that detects a user's input. For example, the user input component may include a touch sensor (e.g., a touch screen or / and a touch pad, etc.) that detects a touch of a user's input medium (e.g., a finger or a stylus), an image sensor that detects a user's motion input, a microphone, a button, a mouse, and / or a keyboard that detects a user's voice input, etc. In addition, the user input component may include an interface and an external controller when receiving input to an external controller (e.g., a mouse, a keyboard, etc.) through an interface.
[0062] A server computing system (130) includes at least one processor (131) and memory (132). Here, the processor (131) may be composed of at least one or a plurality of electrically connected processors, such as a central processing unit (CPU), a graphics processing unit (GPU), application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, and / or other electrical units for performing functions.
[0063] And the memory (132) may include one or more non-transitory / transitory computer-readable storage media such as RAM, ROM, EEPROM, EPROM, flash memory device, magnetic disk, etc., and combinations thereof. This memory (132) may store data (133) and commands (134) required for the processor (131) to pre-train the vision-language transformer (140) or perform various vision tasks (e.g., image detection, classification, segmentation, etc.) using the vision-language transformer (140).
[0064] In one embodiment, the server computing system (130) may be implemented to include at least one computing device. For example, the server computing system (130) may be implemented to operate multiple computing devices according to a sequential computing architecture, a parallel computing architecture, or a combination thereof. Additionally, the server computing system (130) may include multiple computing devices connected via a network.
[0065] Additionally, the server computing system (130) may store at least one vision-to-language transformer (140). For example, the server computing system (130) may include a neural network or / and other multi-layer nonlinear models as the vision-to-language transformer (140). Exemplary neural networks may include feedforward neural networks, deep neural networks, recurrent neural networks, and convolutional neural networks.
[0066] The training computing system (150) includes at least one processor (151) and memory (152). Here, the processor (151) may be composed of at least one or a plurality of processors electrically connected among a central processing unit (CPU), a graphics processing unit (GPU), application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors, and / or other electrical units for performing functions.
[0067] And the memory (152) may include one or more non-transitory / transitory computer-readable storage media such as RAM, ROM, EEPROM, EPROM, flash memory device, magnetic disk, etc. and combinations thereof. This memory (152) may store data (153) and instructions (154) necessary for the processor (151) to perform training of the vision-language transformer.
[0068] For example, the training computing system (150) may include a model trainer (160) that pre-trains a vision-to-language transformer (120 or 140) stored on the user computing device (110) or / and the server computing system (130) using various training or learning techniques, such as backpropagation of errors (according to the framework illustrated in FIG. 5).
[0069] For example, the model trainer (160) can perform a backpropagation method to update one or more parameters of the vision-language transformer (120 or / and 140) based on a defined loss function.
[0070] In some implementations, performing backward propagation of errors may include performing truncated backpropagation through time. The model trainer (160) may perform a number of generalization techniques (e.g., weight reduction, dropout, knowledge distillation, etc.) to improve the generalization ability of the vision-to-language transformer (120 or / and 140) being trained.
[0071] In particular, the model trainer (160) can train the vision-to-language transformer (120 or / and 140) based on a set of training data. The training data can include multi-modal data, such as, for example, images, audio samples, text, etc. Examples of image types that can be used can include typical RGB images, video frames, LiDAR point clouds, X-ray images, computed tomography scans, hyperspectral images, and / or various other forms of images.
[0072] Such trainer data and input data for downstream tasks may be provided by a user computing device (110) and / or a server computing system (130). When the training computing device trains the vision-language transformer (120) on specific data of the user computing device (110), the vision-language transformer (120) may be characterized as a personalized model.
[0073] The model trainer (160) comprises computer logic utilized to provide the desired functionality. The model trainer (160) may be implemented as hardware, firmware, and / or software that controls a general-purpose processor. For example, in one embodiment, the model trainer (160) comprises a program file stored on a storage device, which may be loaded into memory and executed by one or more processors. In another implementation, the model trainer (160) comprises one or more sets of computer-executable instructions stored on a tangible computer-readable storage medium, such as a RAM hard disk or an optical or magnetic medium.
[0074] The network (170) includes, but is not limited to, a 3rd Generation Partnership Project (3GPP) network, a Long Term Evolution (LTE) network, a World Interoperability for Microwave Access (WIMAX) network, the Internet, a Local Area Network (LAN), a Wireless Local Area Network (Wireless LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), a Bluetooth network, a satellite broadcasting network, an analog broadcasting network, and / or a Digital Multimedia Broadcasting (DMB) network.
[0075] In general, communication over a network (170) may be performed using any type of wired and / or wireless connection, using various communication protocols (e.g., TCP / IP, HTTP, SMTP, FTP), encodings or formats (e.g., HTML, XML), and / or protection schemes (e.g., VPN, Secure HTTP, SSL).
[0076]
[0077] FIG. 2 illustrates an example block diagram of a computing device that pre-trains a vision-language transformer and executes the pre-trained vision-language transformer according to a knowledge distillation framework according to an embodiment of the present invention.
[0078] As shown in FIG. 2, the computing device (100) included in the user computing device (110), the server computing system (130), and the training computing system (150) includes a plurality of applications (e.g., application 1 to application N). Each application may include a machine learning library and one or more vision-language transformers. For example, the applications may include vision tasks (e.g., detection, classification, segmentation, etc.) applications and text messaging applications, email applications, dictation applications, virtual keyboard applications, browser applications, chat-bot applications, etc. that include such vision tasks.
[0079] In an embodiment, the computing device (100) may include a model trainer (160) for pre-training a vision-language transformer, and may store and operate the pre-trained vision-language transformer to perform various vision tasks using the vision-language transformer on input data.
[0080] Each application of the computing device (100) may communicate with a number of other components of the computing device (100), such as, for example, one or more sensors, a context manager, a device state component, and / or additional components. In one embodiment, each application may communicate with each device component using an API (e.g., a public API). In one embodiment, the API used by each application may be specific to that application.
[0081] FIG. 3 illustrates an example block diagram from another aspect for a computing device (200) that pre-trains a vision-to-language transformer and executes the pre-trained vision-to-language transformer through a knowledge distillation framework according to an embodiment of the present invention.
[0082] Referring to FIG. 3, a computing device (200) includes a plurality of applications (e.g., Application 1 to Application N). Each application may communicate with a central intelligence layer. For example, the applications may include an image processing application, a text messaging application, an email application, a dictation application, a virtual keyboard application, a browser application, etc. In one embodiment, each application may communicate with the central intelligence layer (and the models stored therein) using an API (e.g., a common API across all applications).
[0083] The central intelligence layer may include multiple vision-to-language transformers. For example, as illustrated in FIG. 3, at least some of the vision-to-language transformers may be provided for each application and managed by the central intelligence layer. In other implementations, two or more applications may share a single vision-to-language transformer. For example, in some implementations, the central intelligence layer may provide a single model for all applications. In some implementations, the central intelligence layer may be included within the operating system of the computing device (200) or implemented differently.
[0084] The central intelligence layer may communicate with a central device data layer. The central device data layer may be a centralized data repository for the computing device (200). As illustrated in FIG. 3, the central device data layer may communicate with a number of other components of the computing device (200), such as, for example, one or more sensors, a context manager, a device state component, and / or additional components. In some implementations, the central device data layer may communicate with each device component using an API (e.g., a private API).
[0085] The techniques described herein may refer to servers, databases, software applications, and other computer-based systems, as well as actions taken and information transmitted to or from such systems. It will be appreciated that the inherent flexibility of computer-based systems allows for a wide range of possible configurations, combinations, and division of labor and functionality between and among components. For example, the processes described herein may be implemented using a single device or component, or multiple devices or components operating in combination. Databases and applications may be implemented on a single system or in a distributed system across multiple systems. Distributed components may operate sequentially or in parallel.
[0086]
[0087] Hereinafter, the process of pre-training a vision-language transformer according to the knowledge distillation framework using a dataset augmented through random image enlargement by the computing system (1000) is described in detail with reference to FIGS. 4 to 6.
[0088] The vision-language transformer described in the present invention refers to a vision-language-based artificial intelligence model (VLP) pre-trained on a large-scale dataset to jointly represent two heterogeneous data formats of vision-language (image-text) pairs.
[0089] A vision-to-language transformer according to this embodiment may include a single-stream model that transforms input data combining images and text, and a dual (multi-)stream model that processes image-text through separate image encoders and text encoders.
[0090] In the following examples, a vision-language transformer having a dual-stream architecture that is pre-trained on a dataset with image-text matching as a contrastive objective for convenience of operation is described.
[0091] A vision-language transformer pre-training method according to an embodiment can facilitate pre-training of a dataset of contrastive image-text pairs using a knowledge-distilled encoder based on a plurality of augmented image-text pairs obtained through image random augmentation.
[0092] Referring to FIGS. 4 and 5, the vision-language transformer pre-training architecture according to the embodiment includes a text encoder (10), a teacher image encoder (20), and a student image encoder (30). The student image encoder (30) and the teacher image encoder (20) may include a multi-head self-attention layer and a feed-forward network. The student image encoder (30) may further include a token sparsification layer.
[0093] Here, the image-text dataset for pre-training is an uncurated dataset, meaning data on which no labeling or captioning task has been performed, for example.
[0094] In the embodiment, in order to clearly verify the efficiency of the vision-language transformer pre-training method according to the present embodiment, at least one dataset among the large-scale open source datasets CC (Conceptual Captions) 3M, YFCC (Yahoo Flickr Creative Commons) 15M, and YFCC15M, 88M may be included as a dataset for pre-training.
[0095] Additionally, according to the present embodiment, the downstream dataset for verifying the performance of the pre-trained vision-language transformer may include zero-shot image-text from Flickr30K or / and MS-COCO.
[0096] In particular, a computing system (1000) according to an embodiment of the present invention can prepare a plurality of image-text pairs, each of which is a pair of image data (hereinafter, “image”) and text data (hereinafter, “text”) that is a label for the image, as a pre-training dataset.
[0097] And the computing system (1000) can generate an augmented image by randomly augmenting the original image to increase the diversity of the dataset and improve the generalization ability of the vision-language transformer.
[0098] The computing system (1000) according to the embodiment may generate multiple augmented images by applying, among other things, random image enlargement (e.g., random crop, random rotation, random flip, color jittering, or / and random grayscale) during image augmentation to intentionally cause misalignment between the augmented images and text.
[0099] Additionally, the computing system (1000) can additionally generate multiple augmented images by applying a method of masking a random portion of an image.
[0100] Additional augmented images generated through random image augmentation in this way can cause serious artifacts in text pairs in the original image. A brief theoretical justification for this is presented below.
[0101] First, the text feature vector T, the original image feature vector I, and the augmented image feature vector I' are formulated as a Markov Chain T → I → I', which means that I' depends only on the original image I.
[0102] According to the data processing inequality theory, which states that data processing cannot increase the amount of information, a formula like Hai can be derived.
[0103] [Mathematical Formula 1]
[0104]
[0105] Here, represents mutual information, and the two pieces of information are identical if and only if the image (I) and the augmented image (I') are captured identically and contain the same information about the text (T).
[0106] A computing system (1000) according to an embodiment proposes a new method of utilizing information imbalance between an original image-text pair and an augmented image-text pair as learning information.
[0107] Figure 4 conceptually illustrates the framework of an MCD pre-training method according to an embodiment of the present invention.
[0108] Referring to FIG. 4, the computing system (1000) according to the embodiment can perform pre-training of the image encoders (20, 30) and the text encoder (10) by 1) generating a plurality of augmented images by augmenting an original image as described above to generate an original image-text pair and an augmented image-text pair, 2) inputting the original image-text pair and the plurality of augmented image-text pairs into a teacher image encoder (20), a student image encoder (30), and a text encoder (10), respectively, to output feature vector representations for the image-text pairs, 3) projecting the output image feature representation vectors and text feature representation vectors according to contrastive objectives to obtain a distance between the feature representation vectors, and 4) distilling the knowledge of the teacher image encoder (20) into the student image encoder (30) based on the obtained distance.
[0109] Below we will explain the MCD pre-training process in more detail.
[0110] First, the computing system (1000) can generate multiple augmented images by randomly enlarging or / and masking the original image.
[0111] Next, the framework of the MCD pre-training method includes a momentum teacher image encoder (20), a student image encoder (30), and a text encoder (10), as shown in FIG. 4, and the knowledge of the teacher image encoder (20) can be distilled into the student image encoder (30) based on the stationary gradient.
[0112] Here, the momentum teacher image encoder (20) is a teacher image encoder (20) in which the model's parameters are updated more slowly over time, and can stably train the student image encoder (30).
[0113] And the student image encoder (30) may be a relatively simple (e.g., with fewer parameters) machine learning model compared to the teacher image encoder (20) that is trained to imitate the operation of the teacher image encoder (20).
[0114] These teacher and student image encoders (30) are trained to convert the features of the original image and the augmented image into feature representations, and can output an image feature vector representation of the input image.
[0115] Here, the feature vector representation refers to a vector that represents the features of an image object in n dimensions, and can be called an embedding as a feature vector that is converted into a structured form by combining multiple features of a transformed object in a format that a machine learning model can process.
[0116] Finally, the text encoder (10) is an encoder that outputs a text feature vector representation (T) when text is input. In detail, the text encoder (10) is trained to convert text features into feature representations, and can output a text feature vector representation (T) for the input text.
[0117] The computing system (1000) can obtain a first image feature vector representation including an original image feature vector representation (bar I) and an augmented image feature vector representation (bar I') using a teacher image encoder (20) for each of the original image and the augmented image.
[0118] In addition, the computing system (1000) can input the original image and the augmented image into the student image encoder (30) to obtain a second image feature vector representation including the original image feature vector representation (I) and the augmented image feature vector representation (I').
[0119] And the computing system (1000) can obtain a text feature vector representation (T) by inputting text matching the original image into a text encoder (10).
[0120] Next, the computing system (1000) can generate a first alignment matrix (bar A) by mapping the text feature vector representations (T) and the first image feature vector representations output from the teacher image encoder (20) according to the matched positive pairs and the unmatched negative pairs.
[0121] And the computing system (1000) can train the teacher image encoder (20) and the text encoder (10) in a manner of aligning the first alignment metric (bar A) based on the positive / negative criteria to which the output text feature vector representations (T) and the first image feature vector representations are mapped (for example, in a manner of training to maximize the similarity of positive pairs and minimize the similarity of negative pairs) in a similarity contrast manner.
[0122] At this time, the computing system (1000) may be a momentum teacher with stop gradient model (Momentum Teacher with Stop Gradient) in the process of training the first alignment matrix (bar A) composed of the first image feature vector representations for similarity alignment, and thus, backpropagation (sg) to the teacher image encoder (20) may be blocked during similarity alignment learning.
[0123] Thereafter, the computing system (1000) can be trained according to a loss function so that the spatial distance between positive feature vector representations becomes closer for similarity alignment and the spatial distance between negative feature vector representations becomes farther.
[0124] in other words, Contrastive learning can be achieved by defining a loss function to achieve this.
[0125] For example, as described above, the computing system (1000) can train the teacher image encoder (20) by performing contrastive learning on the first alignment metric (bar A) so that the loss function InfoNCE Loss is applied to the similarity metric.
[0126] And the computing system (1000) can input the original image and the augmented image into the student image encoder (30) to output second image feature vector representations.
[0127] At this time, the student image encoder (30) can also accelerate pre-training by reconstructing patch tokens by including a token sparsification layer. However, the token sparsification layer may be omitted.
[0128] In detail, the student image encoder (30) can calculate the attention value between images (self-attention) and discard tokens below a predetermined standard according to the calculated attention value between each image.
[0129] For example, the student image encoder (30) can discard careless tokens at a fixed rate (1-κ) based on the attention value between each patch of the 4th, 7th, and 10th transformer layers among the self-potential layers, where κ is the token retention rate.
[0130] And the computing system (1000) can generate a second alignment matrix (A) by mapping the text feature vector representations (T) and the second image feature vector representations according to the matched positive pairs and the unmatched negative pairs.
[0131] Next, the computing system (1000) can perform knowledge distillation so that the second sorting matrix (A) predicts the output value of the first sorting matrix (bar A) sorted according to the similarity mapping, unlike the existing knowledge distillation method.
[0132] That is, the computing system (1000) can perform knowledge distillation by training the student image encoder (30) to align the second alignment matrix (A) by soft-aligning the first alignment matrix (bar A).
[0133] At this time, the text encoder (10) and the teacher image encoder (20) may be a momentum model with a stop gradient that blocks backpropagation (sg) to the text encoder (10) during knowledge distillation.
[0134] In detail, the computing system (1000) can learn the parameters of the student image encoder (30) to perform knowledge distillation so that the second alignment matrix (A) is aligned according to the first alignment matrix (bar A).
[0135] And the computing system (1000) can update the parameters of the teacher image encoder (20) with an exponential moving average (EMA) based on the parameters of the student image encoder (30).
[0136] At this time, the computing system (1000) can perform knowledge distillation by defining a loss function based on the distance between the image feature vector representation and the text feature vector representation (T) to reflect misalignment information between the augmented image and the text as described above.
[0137] In detail, the computing system (1000) can calculate a first Euclidean distance between the original image feature vector representation (I) and the text feature vector representation (T) output by the student image encoder (30), and a second Euclidean distance between the augmented image feature vector representation (I') and the text feature vector representation (T) output by the student image encoder (30), and calculate a first ratio of the first Euclidean distance and the second Euclidean distance, and at this time, a log scale can be applied. That is, the first ratio can be calculated in a log scale to calculate the first log ratio.
[0138] In addition, the computing system (1000) can calculate a third Euclidean distance between the original image feature vector representation (bar I) and the text feature vector representation (T) output by the teacher image encoder (20), and a fourth Euclidean distance between the augmented image feature vector representation (bar I') and the text feature vector representation (T) output by the teacher image encoder (20), and calculate a second ratio of the third Euclidean distance and the fourth Euclidean distance, and at this time, a log scale can be applied. That is, the second log ratio can be calculated by calculating the second ratio in a log scale.
[0139] And the computing system (1000) can train the encoder by defining the difference between the first log ratio and the second log ratio as a loss function for aligning the second alignment metric to approximate the first alignment metric (bar A).
[0140] Below, the calculation process for the above pre-training is explained in detail through specific mathematical formulas.
[0141] Specifically, a function representing a momentum teacher image encoder (20) with a stationary slope and a function representing a first alignment metric (A') for a momentum text encoder (10) with a stationary slope And, a function representing the second sorting matrix (A) can be defined as in the following mathematical formula 2.
[0142] [Equation 2]
[0143]
[0144] Here, sg is the stationary slope, and are image feature representations for the j-th image using the teacher image encoder (20) and the student image encoder (30), respectively. is the text feature representation (T) for the i-th text, is an alignment metric for image feature representation and text feature representation, N is the patch size of the image-text pair, and sim represents a function for cosine similarity.
[0145] And as mentioned above, the loss can be obtained for the first alignment matrix (bar A) using the InfoNCE loss.
[0146] And as described above, a loss function can be defined based on the distance between the original image feature vector representation (I, bar I), the augmented image feature vector representation (I', bar I'), and the text feature vector representation (T) to perform pre-training, and this process is explained through mathematical expressions 3 to 6.
[0147] And the computing system (1000) can define a loss function for aligning the first alignment matrix (bar A) and the second alignment matrix (A) based on the InfoNCE loss.
[0148] [Equation 3]
[0149]
[0150] Here, stands for align loss, and D(V1, V2) stands for the Euclidean distance between the V1 vector and the V2 vector, which can be calculated through cosine similarity.
[0151] thus, is the first Euclidean distance, is the second Euclidean distance, is the third Euclidean distance, is the fourth Euclidean distance.
[0152] Specifically, in the embodiment, the original image feature vector Wow, text feature vector is an L2 normalized vector, and the Euclidean distance is a cosine similarity function. can be produced through.
[0153] Next, the computing system (1000) can gradually distill the knowledge of the teacher image encoder (20) into a student image encoder (30) based on the above loss function.
[0154] In detail, the computing system (1000) performs knowledge distillation to predict that the second sorting matrix and the first sorting matrix are identical.
[0155] In detail, the distillation loss is defined as the KL divergence for each row and column between the first sorted matrix (bar A) and the second sorted matrix (A). In detail, the overall distillation loss is defined as the KL divergence for each row and column between the first sorted matrix (bar A) and the second sorted matrix (A), and if σ is a softmax function, then the KL divergence between the first sorted matrix (bar A) and the second sorted matrix (A) is By expressing it as in the following mathematical formula 4, the distillation loss can be calculated according to the mathematical formula 4.
[0156] [Equation 4]
[0157]
[0158] Here, the overall distillation loss, Ldistill, is the average of the KL losses for the row vectors and column vectors of the first sorting matrix parameters and the second sorting matrix parameters, respectively, and can be defined as in the following mathematical expression 5.
[0159] [Equation 5]
[0160]
[0161] And in order to accelerate the training of the student image encoder (30), and to strike a balance between the knowledge distillation training and the teacher image encoder (20) training, the final loss Lstudent of the student image encoder (30) can be calculated using Equation 6 based on Ldistill and the InfoNCE loss Lclip(A).
[0162] [Equation 6]
[0163]
[0164] Here, is a parameter that balances the KL divergence loss and the InfoNCE loss, and is set based on an exponential moving average (ema) in the embodiment.
[0165] Therefore, the final loss L of MCD pre-training can be calculated as in Equation 7.
[0166] [Equation 7]
[0167]
[0168] And as described above, in order to prevent backpropagation in the teacher image encoder (20) and the text encoder (10), updates to the parameters of the encoder (10, 20) can be performed through a stationary gradient.
[0169] In detail, and denote the parameters of the student encoder and the momentum teacher image encoder (20), respectively, and at the t-th step The update can be performed according to the following mathematical formula 8.
[0170] [Equation 8]
[0171]
[0172] Experimental results showed that the most efficient training could be performed when m was 0.994.
[0173] Below, a description is provided to compare the effectiveness of a vision-language transformer learned through MCD pre-training according to an embodiment of the present invention with existing technologies.
[0174] An artificial intelligence system including a vision-language transformer of the present invention can perform vision tasks such as image classification, segmentation, object detection, image generation, automatic caption generation, image search, and image description with relatively high accuracy compared to existing transformers.
[0175] Table 1 below compares the zero-shot image classification performance of a vision-language transformer model pre-trained using the MCD pre-training method on the YFCC15M dataset, which includes 11 downstream datasets, with a vision-language transformer model trained on the YFCC15M dataset using existing techniques. In this case, whether additional supervision other than contrast loss for image-text pairs was performed is abbreviated as S: augmented-to-SSL, E: text augmentation, N: nearest neighbor, L: masked language modeling, and I: augmented information encoded with an additional embedding layer X.
[0176] [Table 1]
[0177]
[0178] As can be seen in the table above, the MCD model that only performs augmented SSL outperforms the existing model in 9 out of 11 downstream datasets, and the average value is also significantly improved.
[0179] Accordingly, the computing system (1000) can perform various artificial intelligence tasks by executing various applications including a vision-language transformer that has excellent performance for such vision tasks.
[0180] And the framework that utilizes token sparsification and knowledge distillation for this contrastive language-image pre-training can be extended and applied to pre-training for additional modalities, such as audio, at the level of ordinary technicians.
[0181]
[0182] The embodiments of the present invention described above may be implemented in the form of program commands that can be executed by various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program commands, data files, data structures, etc., either singly or in combination. The program commands recorded on the computer-readable recording medium may be specially designed and configured for the present invention or may be known and available to those skilled in the art of computer software. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and hardware devices specifically configured to store and execute program commands, such as ROMs, RAMs, and flash memories. Examples of program commands include not only machine language codes generated by a compiler, but also high-level language codes that can be executed by a computer using an interpreter, etc. Hardware devices may be changed into one or more software modules to perform processing according to the present invention, and vice versa.
[0183] The present invention is a method for pre-training a vision transformer through a computing system and is a basic invention for performing tasks such as vision tasks using a pre-trained vision transformer, and therefore has industrial applicability.
Claims
1. A method for pre-training a vision-language transformer using a dataset of multiple original image-text pairs by a computing system including a memory and a processor, A step of randomly augmenting the original image to generate multiple augmented images; A step of inputting text matching the original image into a text encoder and outputting text feature vector representations; A step of inputting the original image and a plurality of augmented images into a teacher image encoder and outputting first image feature vector representations; A step of inputting the original image and multiple augmented images into a student image encoder and outputting second image feature vector representations; A step of generating a first alignment matrix for the above text feature vector representations and the above first image feature vector representations; A step of learning the first alignment metric so that the text feature vector representations and the first image feature vector representations are aligned to have similarity according to the positive and negative mapping relationship of the image-text pair; A step of performing knowledge distillation on a student image encoder by aligning the second alignment matrix to predict the output of the learned first alignment matrix. A pre-training method for vision-language transformers.
2. In paragraph 1, The step of inputting the first image feature vector representations into the above teacher image encoder is as follows: A step of outputting first image feature vector representations through a plurality of self-attention layers and a feed-forward network layer of the original images and a plurality of augmented images. A pre-training method for vision-language transformers.
3. In paragraph 2, The step of inputting the above student image encoder and outputting the second image feature vector representations is: A step of performing token sparsification by inputting the above original images and a plurality of augmented images into a token sparsification layer based on output values from a plurality of self-attention layers. A pre-training method for vision-language transformers.
4. In paragraph 1, The step of learning the first alignment metric so that the text feature vector representations and the first image feature vector representations are aligned is: A step of determining a positive feature vector representation pair and a negative feature vector representation pair of the text feature vector representations and the first image feature vector representations according to the mapping relationship between the original image-text pair and the augmented image-text pair, A step of training a teacher image encoder according to a loss function that makes the distance between the positive feature vector representation pairs closer and the distance between the negative feature vector representation pairs farther for similarity alignment. A pre-training method for vision-language transformers.
5. In paragraph 4, The step of learning encoders according to the above loss function is: When learning for similarity sorting according to the above loss function, a step of applying a momentum stop gradient to the teacher image encoder to block backpropagation is included. A pre-training method for vision-language transformers.
6. In paragraph 5, The step of performing knowledge distillation on the above student image encoder is: A step of knowledge distillation is included so that the second alignment metric predicts the output value of the first alignment metric according to the similarity alignment. A pre-training method for vision-language transformers.
7. In paragraph 6, The step of performing knowledge distillation on the above second sorting matrix is: A step of blocking backpropagation to the text encoder during the above knowledge distillation. A pre-training method for vision-language transformers.
8. In paragraph 7, The step of performing knowledge distillation on the above second sorting matrix is: A step of knowledge distillation is included so that the parameters of the second sorting matrix follow the parameters of the first sorting matrix. A pre-training method for vision-language transformers.
9. In paragraph 8, The step of distilling knowledge so that the parameters of the second sorting matrix follow the parameters of the first sorting matrix is: A step of updating the parameters of the second sorting matrix to the parameters of the first sorting matrix using an exponential moving average (EMA). A pre-training method for vision-language transformers.
10. In paragraph 1, The step of performing knowledge distillation on the above second sorting matrix is: A step of knowledge distillation is included by defining a loss function that reflects misalignment information between the augmented image and the text through the distance between the first image feature vector representation and the text feature vector representation and the distance between the second image feature vector representation and the text feature vector representation. A pre-training method for vision-language transformers.
11. In paragraph 10, The step of knowledge distillation by defining a loss function based on the above distance is: A step of calculating a first Euclidean distance between the original image feature vector representation and the text feature vector representation output by the student image encoder, a second Euclidean distance between the augmented image feature vector representation and the text feature vector representation output by the student image encoder, and calculating a first log ratio that calculates the ratio of the first Euclidean distance and the second Euclidean distance in a log scale. A pre-training method for vision-language transformers.
12. In paragraph 11, The step of knowledge distillation by defining a loss function based on the above distance is: A step of calculating a third Euclidean distance between the original image feature vector representation and the text feature vector representation output by the teacher image encoder, a fourth Euclidean distance between the augmented image feature vector representation and the text feature vector representation output by the teacher image encoder, and calculating a second log ratio by calculating the ratio of the third Euclidean distance and the fourth Euclidean distance in a log scale. A pre-training method for vision-language transformers.
13. In paragraph 12, The step of knowledge distillation by defining a loss function based on the above distance is: The step of performing knowledge distillation by defining the difference between the first log ratio and the second log ratio as a loss function for aligning the second alignment metric to be close to the first alignment metric is further included. A pre-training method for vision-language transformers.
14. In paragraph 13, The loss function for aligning the first and second sorting matrices is: Defined as A pre-training method for vision-language transformers.
15. In paragraph 10, Further comprising a step of performing an update through a stationary gradient to prevent backpropagation between the teacher image encoder and the text encoder. A pre-training method for vision-language transformers.
16. An artificial intelligence system that performs a vision task, including a vision-language transformer pre-trained according to paragraph 1.
17. A pre-trained vision-language transformer comprising a computing system including memory and processor, A text encoder that inputs texts and outputs text feature vector representations; A teacher image encoder that receives original images and a plurality of augmented images augmented from the original images and outputs first image feature vector representations; A student image encoder that receives the original images and a plurality of augmented images augmented from the original images and outputs second image feature vector representations; and The teacher image encoder and the text encoder learn a first alignment metric by similarity-aligning the text feature vector representations and the first image feature vector representations, The above student image encoder is a knowledge distillation that predicts the output value of the first alignment matrix based on the second alignment matrix for the text feature vector representations and the second image feature vector representations. Pre-trained vision-language transformer.
Citation Information
Patent Citations
Multi-modal pre-training model training method and device, equipment and storage medium
CN114005012A
Fine-grained image classification method based on visual feature constraint
CN115410031A
A method for recognizing an object in an image using features vectors of an encoding neural network
EP3754548A1
Training method and training apparatus for image recognition model based on semantic enhancement
JP2023017759A
Cited By
Vehicle fault diagnosis model, training and using method and device thereof and medium
CN119151014A
Visual language large model hybrid quantification method and device and electronic equipment
CN119441513A
Chest image artificial intelligence model training method, electronic equipment and storage medium
CN120014386A
Image-text matching and gray scale sensitive detection method, device and equipment
CN120472196A
Visual language alignment enhancement method and device, equipment and medium
CN120656172A
