WO2023040306A1 - 多模态预训练方法和装置 - Google Patents

多模态预训练方法和装置 Download PDF

Info

Publication number
WO2023040306A1
WO2023040306A1 PCT/CN2022/092680 CN2022092680W WO2023040306A1 WO 2023040306 A1 WO2023040306 A1 WO 2023040306A1 CN 2022092680 W CN2022092680 W CN 2022092680W WO 2023040306 A1 WO2023040306 A1 WO 2023040306A1
Authority
WO
WIPO (PCT)
Prior art keywords
feature
video
word segmentation
loss value
objective
Prior art date
Application number
PCT/CN2022/092680
Other languages
English (en)
French (fr)
Inventor
李业豪
潘滢炜
姚霆
梅涛
Original Assignee
北京京东尚科信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京京东尚科信息技术有限公司 filed Critical 北京京东尚科信息技术有限公司
Publication of WO2023040306A1 publication Critical patent/WO2023040306A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/40Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
    • G06F16/48Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/483Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using metadata automatically derived from the content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking

Definitions

  • the present disclosure relates to the field of information processing, and in particular to a multimodal pre-training method and device.
  • Visual language multimodal pre-training technology is one of the emerging topics in the recent multi-modal field. Its purpose is to enable the model to pre-train large-scale weakly labeled visual (such as images, videos) and text data to obtain a Better multimodal feature representation, thus boosting the performance of models for various multimodal tasks.
  • the related technologies of visual language multimodal pre-training are basically based on the method of pre-training model of BERT (Bidirectional Encoder Representations From Transformer, bidirectional encoder representation based on transformer) in the field of natural language processing.
  • BERT Bidirectional Encoder Representations From Transformer, bidirectional encoder representation based on transformer
  • a multimodal pre-training method including: sampling the video in the video-text pair to obtain a first video frame sequence; Perform word segmentation processing on the text to obtain a first word segmentation sequence; perform mask processing on the first video frame sequence to obtain a second video frame sequence; perform mask processing on the first word segmentation sequence to obtain a second word segmentation sequence; encode the first video frame sequence to obtain the first video feature, encode the first word segmentation sequence to obtain the first word segmentation feature; encode the second video frame sequence to obtain The second video feature, encoding the second word segmentation sequence to obtain a second word segmentation feature; using the first video feature, the first word segmentation feature, the second video feature, and the second word segmentation feature Determine a pre-trained objective function; use the pre-trained objective function to perform multimodal pre-training.
  • determining the pre-trained objective function includes: using the first word segmentation feature, the second video feature and the preset first negative sample feature to determine a first comparison loss value; using the first video feature, the second word segmentation feature, and the preset second negative sample feature determine a second comparison loss value; determine a first target according to the first comparison loss value and the second comparison loss value; use the first The video feature, the second video feature and the second negative sample feature determine a third comparison loss value; utilize the first word segmentation feature, the second word segmentation feature and the first negative sample feature to determine a fourth comparison a loss value; determining a second target according to the third comparative loss value and the fourth comparative loss value; determining the objective function according to the first target and the second target.
  • determining the first comparison loss value includes: converting the first word segmentation feature into a global first positive sample feature; converting the second video feature into a global video query feature; using the video The query feature, the first positive sample feature, and the first negative sample feature determine a first comparative loss value.
  • determining the second contrast loss value includes: converting the first video feature into a global second positive sample feature; converting the second word segmentation feature into a global text query feature; using the text The query features, the second positive sample features, and the second negative sample features determine a second contrastive loss value.
  • determining a third contrast loss value includes: determining a third contrast loss value by using the video query feature, the second positive sample feature, and the second negative sample feature.
  • determining a fourth contrast loss value includes: determining a fourth contrast loss value by using the text query feature, the first positive sample feature, and the first negative sample feature.
  • the first target is the sum of the first contrast loss value and the second contrast loss value; the second target is the third contrast loss value and the fourth contrast loss sum of values.
  • the objective function is the sum of the first objective and the second objective.
  • performing fusion processing on the second video feature and the second word segmentation feature to obtain a fusion feature includes: according to the first target, the The second objective, the third objective and the fourth objective determine the objective function.
  • the objective function is the sum of the first objective, the second objective, the third objective and the fourth objective.
  • a multimodal pre-training device including: a first processing module configured to sample a video in a video-text pair to obtain a first video frame sequence, and It is configured to perform word segmentation processing on the text in the video-text pair to obtain a first word segmentation sequence; the second processing module is configured to perform mask processing on the first video frame sequence to obtain a second video The frame sequence is further configured to perform mask processing on the first word segmentation sequence to obtain a second word segmentation sequence; the third processing module is configured to encode the first video frame sequence to obtain a first video The feature is further configured to encode the first word segmentation sequence to obtain the first word segmentation feature; the fourth processing module is configured to encode the second video frame sequence to obtain the second video feature, and It is configured to encode the second word segmentation sequence to obtain a second word segmentation feature; a fifth processing module is configured to use the first video feature, the first word segmentation feature, the second video feature, The second word segmentation feature determines a pre-t
  • a multimodal pre-training device including: a memory configured to store instructions; a processor coupled to the memory, and the processor is configured to execute based on instructions stored in the memory to implement the following: The method described in any one of the above embodiments.
  • a computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, the method involved in any of the above-mentioned embodiments is implemented.
  • FIG. 1 is a schematic flow diagram of a multimodal pre-training method according to an embodiment of the present disclosure
  • FIG. 2 is a schematic flow diagram of a multimodal pre-training method according to another embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of a multimodal pre-training device according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of a multimodal pre-training device according to another embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of a multimodal pre-training model according to an embodiment of the present disclosure.
  • the video text multimodal pre-training technology only uses the input video text with a mask (Mask) for global feature representation during pre-training in order to mine the connection between two modalities
  • this learning method makes the overall video-text relationship between input video frames and word sequences underexplored, resulting in the degradation of multimodal feature quality.
  • the present disclosure provides a multi-modal pre-training solution, which can enhance the correlation between cross-modal data, and effectively improve the ability of the multi-modal pre-trained model to understand multi-modal data content.
  • FIG. 1 is a schematic flowchart of a multimodal pre-training method according to an embodiment of the present disclosure.
  • the following multimodal pre-training method is performed by a multimodal pre-training device.
  • step 101 the video in the video-text pair is sampled to obtain a first sequence of video frames, and the text in the video-text pair is segmented to obtain a first sequence of word segments.
  • the video is sampled in an equidistant sampling manner to obtain the first video frame sequence.
  • marks [CLS] and [SEP] are respectively set at the beginning and the end of the first word segmentation sequence to facilitate subsequent processing.
  • step 102 mask processing is performed on the first video frame sequence to obtain a second video frame sequence, and mask processing is performed on the first word segmentation sequence to obtain a second word segmentation sequence.
  • the video frames in the first sequence of video frames are replaced with a mask at random probability to obtain the second sequence of video frames.
  • a mask is used to replace the tokens in the first token sequence with random probability to obtain the second token sequence.
  • step 103 the first video frame sequence is encoded to obtain a first video feature, and the first word segmentation sequence is encoded to obtain a first word segmentation feature.
  • a video key-value encoder (Video Key Encoder) is used to encode the first video frame sequence to obtain the first video features
  • a text key-value encoder (Sentence Key Encoder) is used to encode the first word segmentation sequence Encode to get the first participle feature.
  • the first video feature output by the video key-value encoder reflects the contextual characteristics of the unmasked video frame.
  • the first word segmentation feature of text key-value output reflects the contextual characteristics of the unmasked word segmentation sequence.
  • step 104 the second video frame sequence is encoded to obtain a second video feature, and the second word segmentation sequence is encoded to obtain a second word segmentation feature.
  • a video query encoder (Video Query Encoder) is used to encode the second video frame sequence to obtain the second video feature
  • a text query encoder (Sentence Query Encoder) is used to encode the second word segmentation sequence, To get the second participle feature.
  • the second video feature output by the video query encoder reflects the correlation between frames in the video mode
  • the second word segmentation feature output by the text query encoder reflects the correlation between words in the text mode
  • a pre-trained objective function is determined by using the first video feature, the first word segmentation feature, the second video feature, and the second word segmentation feature.
  • the pre-training objective function is determined as shown in FIG. 2 .
  • a first comparison loss value is determined by using the first word segmentation feature, the second video feature and the preset first negative sample feature.
  • MLP Multi-layer Perceptron, multi-layer perceptron
  • K represents the size of the negative sample queue included in the first negative sample feature, Indicates the ith negative sample in the negative sample queue.
  • the first comparative loss value is calculated using formula (2)
  • a second comparison loss value is determined by using the first video feature, the second word segmentation feature and the preset second negative sample feature.
  • the MLP model is used to convert the first video feature into a global second positive sample feature
  • Use Text Query Features The second positive sample features and the second negative sample feature A second contrastive loss value is determined.
  • K represents the size of the negative sample queue included in the second negative sample feature, Indicates the ith negative sample in the negative sample queue.
  • the second contrastive loss value is calculated using formula (4)
  • step 203 a first target is determined according to the first comparative loss value and the second comparative loss value.
  • the first target is the sum of the first contrast loss value and the second contrast loss value.
  • the first target is calculated using formula (5).
  • the first objective is used to represent a combination of video-to-text and text-to-video video matching losses.
  • a third contrastive loss value is determined by using the first video feature, the second video feature and the second negative sample feature.
  • using video query features The second positive sample features and the second negative sample features A third contrast loss value is determined.
  • the third comparative loss value is calculated using formula (6)
  • a fourth comparison loss value is determined by using the first word segmentation feature, the second word segmentation feature and the first negative sample feature.
  • the fourth comparative loss value is calculated using formula (7)
  • a second target is determined according to the third contrast loss value and the fourth contrast loss value.
  • the second target is the sum of the third contrast loss value and the fourth contrast loss value.
  • the second target is calculated using formula (8).
  • the second objective is used to represent the denoising loss in the video modality and in the text modality.
  • step 207 an objective function is determined according to the first objective and the second objective.
  • the objective function is the sum of the first objective and the second objective.
  • the objective function L is calculated using formula (9).
  • step 106 multimodal pre-training is performed using the pre-trained objective function.
  • the pre-trained objective function is determined based on the cross-modal matching loss and intra-modal denoising loss, which can enhance the correlation between cross-modal data, effectively Improve the multimodal pre-training model's ability to understand multimodal data content.
  • fusion processing is performed on the second video features and the second word segmentation features to obtain fusion features.
  • MLM Mask Language Modeling, text modeling with mask
  • MSG Mask Language Generation, text generation with mask
  • a cross-modal decoder (Cross-Modal Decoder) is used to perform fusion processing on the second video features and the second word segmentation features to obtain fusion features.
  • the cross-modal decoder is used to output the fusion features of video and text multi-modal information, and provide feature input for subsequent tasks.
  • the objective function L is determined according to the first objective L Co-IM , the second objective L Co-ID , the third objective L MLM and the fourth objective L MSG .
  • the objective function L is the sum of the first objective L Co-IM , the second objective L Co-ID , the third objective L MLM and the fourth objective L MSG .
  • the objective function L is calculated using the following formula (10).
  • FIG. 3 is a schematic structural diagram of a multimodal pre-training device according to an embodiment of the present disclosure.
  • the multimodal pre-training device includes a first processing module 31 , a second processing module 32 , a third processing module 33 , a fourth processing module 34 , a fifth processing module 35 and a sixth processing module 36 .
  • the first processing module 31 is configured to sample the video in the video-text pair to obtain a first video frame sequence, and is also configured to perform word segmentation processing on the text in the video-text pair to obtain a first word segmentation sequence.
  • the video is sampled in an equidistant sampling manner to obtain the first video frame sequence.
  • marks [CLS] and [SEP] are respectively set at the beginning and the end of the first word segmentation sequence to facilitate subsequent processing.
  • the second processing module 32 is configured to perform mask processing on the first video frame sequence to obtain a second video frame sequence, and is also configured to perform mask processing on the first word segmentation sequence to obtain a second word segmentation sequence.
  • the video frames in the first sequence of video frames are replaced with a mask at random probability to obtain the second sequence of video frames.
  • a mask is used to replace the tokens in the first token sequence with random probability to obtain the second token sequence.
  • the third processing module 33 is configured to encode the first video frame sequence to obtain the first video feature, and is also configured to encode the first word segmentation sequence to obtain the first word segmentation feature.
  • a video key-value encoder is used to encode the first video frame sequence to obtain the first video features
  • a text key-value encoder is used to encode the first word segmentation sequence to obtain the first word segmentation features.
  • the first video feature output by the video key-value encoder reflects the contextual characteristics of the unmasked video frame.
  • the first word segmentation feature of text key-value output reflects the contextual characteristics of the unmasked word segmentation sequence.
  • the fourth processing module 34 is configured to encode the second video frame sequence to obtain the second video feature, and is also configured to encode the second word segmentation sequence to obtain the second word segmentation feature.
  • a video query encoder is used to encode the second video frame sequence to obtain the second video features
  • a text query encoder is used to encode the second word segmentation sequence to obtain the second word segmentation features
  • the second video feature output by the video query encoder reflects the correlation between frames in the video mode
  • the second word segmentation feature output by the text query encoder reflects the correlation between words in the text mode
  • the fifth processing module 35 is configured to determine a pre-trained objective function by using the first video feature, the first word segmentation feature, the second video feature, and the second word segmentation feature. In some embodiments, the fifth processing module 35 uses the first word segmentation feature, the second video feature and the preset first negative sample feature to determine the first comparison loss value.
  • the first negative sample features As shown in the above formula (1).
  • the first comparative loss value is calculated using the above formula (2)
  • the fifth processing module 35 uses the first video feature, the second word segmentation feature and the preset second negative sample feature to determine the second comparison loss value. For example, using the MLP model to convert the first video feature into a global second positive sample feature Use the MLP model to convert the second word segmentation feature into a global text query feature Use Text Query Features The second positive sample features and the second negative sample features A second contrastive loss value is determined.
  • the second negative sample feature As shown in the above formula (3).
  • the second contrastive loss value is calculated using the above formula (4)
  • the fifth processing module 35 determines the first target according to the first comparison loss value and the second comparison loss value.
  • the first target is the sum of the first contrast loss value and the second contrast loss value.
  • the first target is calculated using the above formula (5).
  • the first objective is used to represent a combination of video-to-text and text-to-video video matching losses.
  • the fifth processing module 35 determines a third contrast loss value by using the first video feature, the second video feature and the second negative sample feature. In some embodiments, using video query features The second positive sample features and the second negative sample feature A third contrast loss value is determined. For example, using the above formula (6) to calculate the third comparative loss value
  • the fifth processing module 35 uses the first word segmentation feature, the second word segmentation feature and the first negative sample feature to determine a fourth comparison loss value. In some embodiments, using the text query feature Features of the first positive sample and the first negative sample features A fourth contrast loss value is determined.
  • the fourth comparative loss value is calculated using the above formula (7)
  • the fifth processing module 35 determines the second target according to the third comparison loss value and the fourth comparison loss value.
  • the second target is the sum of the third contrast loss value and the fourth contrast loss value.
  • the second target is calculated using the above formula (8).
  • the second objective is used to represent the denoising loss in the video modality and in the text modality.
  • the fifth processing module 35 determines an objective function according to the first objective and the second objective.
  • the objective function is the sum of the first objective and the second objective.
  • the objective function L is calculated using the above formula (9).
  • the fifth processing module 35 performs fusion processing on the second video features and the second word segmentation features to obtain fusion features. Input the fusion feature into the MLM model to obtain the third target L MLM , and input the fusion feature into the MSG model to obtain the fourth target L MSG .
  • a cross-modal decoder is used to perform fusion processing on the second video features and the second word segmentation features to obtain fusion features.
  • the cross-modal decoder is used to output the fusion features of video and text multi-modal information, and provide feature input for subsequent tasks.
  • the objective function L is determined according to the first objective L Co-IM , the second objective L Co-ID , the third objective L MLM and the fourth objective L MSG .
  • the objective function L is the sum of the first objective L Co-IM , the second objective L Co-ID , the third objective L MLM and the fourth objective L MSG .
  • the objective function L is calculated using the above formula (10).
  • the sixth processing module 36 is configured to perform multimodal pre-training using the pre-trained objective function.
  • Fig. 4 is a schematic structural diagram of a multimodal pre-training device according to another embodiment of the present disclosure. As shown in FIG. 4 , the multimodal pre-training device includes a memory 41 and a processor 42 .
  • the memory 41 is used to store instructions
  • the processor 42 is coupled to the memory 41 , and the processor 42 is configured to execute and implement the method involved in any embodiment as shown in FIG. 1 or FIG. 2 based on the instructions stored in the memory.
  • the multimodal pre-training device also includes a communication interface 43 for information exchange with other devices. Meanwhile, the multimodal pre-training device further includes a bus 44 , and the processor 42 , the communication interface 43 , and the memory 41 communicate with each other through the bus 44 .
  • the memory 41 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. Memory 41 may also be a memory array.
  • the storage 41 may also be divided into blocks, and the blocks can be combined into virtual volumes according to certain rules.
  • processor 42 may be a central processing unit CPU, or may be an application specific integrated circuit ASIC, or one or more integrated circuits configured to implement embodiments of the present disclosure.
  • the present disclosure also relates to a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the instructions are executed by a processor, the method involved in any one of the embodiments shown in FIG. 1 or FIG. 2 is implemented.
  • FIG. 5 is a schematic diagram of a multimodal pre-training model according to an embodiment of the present disclosure.
  • the first video frame sequence is obtained by sampling the video in the video-text pair, and word segmentation processing is performed on the text in the video-text pair to obtain the first word segmentation sequence.
  • the video frames in the first sequence of video frames are replaced by a mask with random probability to obtain a second sequence of video frames.
  • the tokens in the first token sequence are replaced by a mask with random probability to obtain the second token sequence.
  • a video key-value encoder is used to encode the first video frame sequence to obtain first video features
  • a text key-value encoder is used to encode the first word segmentation sequence to obtain first word segmentation features
  • a video query encoder is used to encode the second video frame sequence to obtain second video features
  • a text query encoder is used to encode the second word segmentation sequence to obtain second word segmentation features.
  • the MLP model to convert the first word segmentation feature into the global first positive sample feature
  • the MLP model to convert the first video feature into a global second positive sample feature
  • the MLP model to convert the second video feature into a global video query feature
  • the MLP model to convert the second word segmentation feature into a global text query feature
  • the video query feature is used.
  • the first negative sample feature As shown in the above formula (1).
  • the second negative sample feature As shown in the above formula (3).
  • the first target L Co-IM is calculated using the above formula (5).
  • the video query feature is used.
  • the second positive sample features and the second negative sample features Determine the third contrast loss value
  • the second target L Co-ID is determined according to the third comparison loss value and the fourth comparison loss value.
  • a cross-modal decoder is used to perform fusion processing on the second video features and the second word segmentation features to obtain fusion features. Input the fusion feature into the MLM model to obtain the third target L MLM , and input the fusion feature into the MSG model to obtain the fourth target L MSG .
  • the above formula (10) is used to take the sum of the first target L Co-IM , the second target L Co-ID , the third target L MLM and the fourth target L MSG as the target function L.
  • the functional unit modules described above can be implemented as a general-purpose processor, a programmable logic controller (Programmable Logic Controller, referred to as: PLC), a digital signal processor ( Digital Signal Processor (DSP for short), Application Specific Integrated Circuit (ASIC for short), Field-Programmable Gate Array (FPGA for short), or other programmable logic devices, discrete gates or transistors Logic devices, discrete hardware components, or any suitable combination thereof.
  • PLC programmable logic controller
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the program can be stored in a computer-readable storage medium.
  • the above-mentioned The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Library & Information Science (AREA)
  • Databases & Information Systems (AREA)
  • Multimedia (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Image Analysis (AREA)

Abstract

一种多模态预训练方法和装置。多模态预训练方法包括:对视频-文本对中的视频采样得到第一视频帧序列,对视频-文本对中的文本进行分词处理得到第一分词序列(101);对第一视频帧序列进行掩码处理得到第二视频帧序列,对第一分词序列进行掩码处理得到第二分词序列(102);对第一视频帧序列进行编码得到第一视频特征,对第一分词序列进行编码得到第一分词特征(103);对第二视频帧序列进行编码得到第二视频特征,对第二分词序列进行编码得到第二分词特征(104);利用第一视频特征、第一分词特征、第二视频特征、第二分词特征确定预训练的目标函数(105);利用目标函数进行多模态预训练(106)。

Description

多模态预训练方法和装置
相关申请的交叉引用
本公开是以CN申请号为202111078728.2,申请日为2021年9月15日的申请为基础,并主张其优先权,该CN申请的公开内容在此作为整体引入本公开中。
技术领域
本公开涉及信息处理领域,特别涉及一种多模态预训练方法和装置。
背景技术
视觉语言多模态预训练技术是近期多模态领域的新兴课题之一,它的目的是让模型能对进行大规模弱标注的视觉(如图像、视频)和文本数据进行预训练以得到一个更好的多模态特征表示,从而提升各种多模态任务模型的性能。
视觉语言多模态预训练的相关技术基本都是借鉴自然语言处理领域的BERT(Bidirectional Encoder Representations From Transformer,基于变换器的双向编码器表征)预训练模型的方法。
发明内容
根据本公开实施例的第一方面,提供一种多模态预训练方法,包括:对视频-文本对中的视频进行采样,以得到第一视频帧序列;对所述视频-文本对中的文本进行分词处理,以得到第一分词序列;对所述第一视频帧序列进行掩码处理,以得到第二视频帧序列;对所述第一分词序列进行掩码处理,以得到第二分词序列;对所述第一视频帧序列进行编码,以得到第一视频特征,对所述第一分词序列进行编码,以得到第一分词特征;对所述第二视频帧序列进行编码,以得到第二视频特征,对所述第二分词序列进行编码,以得到第二分词特征;利用所述第一视频特征、所述第一分词特征、所述第二视频特征、所述第二分词特征确定预训练的目标函数;利用所述预训练的目标函数进行多模态预训练。
在一些实施例中,确定预训练的目标函数包括:利用所述第一分词特征、所述第二视频特征和预设的第一负样本特征确定第一对比损失值;利用所述第一视频特征、所述第二分词特征和预设的第二负样本特征确定第二对比损失值;根据所述第一对比 损失值和所述第二对比损失值确定第一目标;利用所述第一视频特征、所述第二视频特征和所述第二负样本特征确定第三对比损失值;利用所述第一分词特征、所述第二分词特征和所述第一负样本特征确定第四对比损失值;根据所述第三对比损失值和所述第四对比损失值确定第二目标;根据所述第一目标和所述第二目标确定所述目标函数。
在一些实施例中,确定第一对比损失值包括:将所述第一分词特征转换为全局的第一正样本特征;将所述第二视频特征转换为全局的视频查询特征;利用所述视频查询特征、所述第一正样本特征和所述第一负样本特征确定第一对比损失值。
在一些实施例中,确定第二对比损失值包括:将所述第一视频特征转换为全局的第二正样本特征;将所述第二分词特征转换为全局的文本查询特征;利用所述文本查询特征、所述第二正样本特征和所述第二负样本特征确定第二对比损失值。
在一些实施例中,确定第三对比损失值包括:利用所述视频查询特征、所述第二正样本特征和所述第二负样本特征确定第三对比损失值。
在一些实施例中,确定第四对比损失值包括:利用所述文本查询特征、所述第一正样本特征和所述第一负样本特征确定第四对比损失值。
在一些实施例中,所述第一目标为所述第一对比损失值和所述第二对比损失值之和;所述第二目标为所述第三对比损失值和所述第四对比损失值之和。
在一些实施例中,所述目标函数为所述第一目标和所述第二目标之和。
在一些实施例中,对所述第二视频特征和所述第二分词特征进行融合处理,以得到融合特征;将所述融合特征输入带掩码的文本建模MLM模型以得到第三目标,将所述融合特征输入带掩码的文本生成MSG模型以得到第四目标;所述根据所述第一目标和所述第二目标确定所述目标函数包括:根据所述第一目标、所述第二目标、所述第三目标和所述第四目标确定所述目标函数。
在一些实施例中,所述目标函数为所述第一目标、所述第二目标、所述第三目标和所述第四目标之和。
根据本公开实施例的第二方面,提供一种多模态预训练装置,包括:第一处理模块,被配置为对视频-文本对中的视频进行采样,以得到第一视频帧序列,还被配置为对所述视频-文本对中的文本进行分词处理,以得到第一分词序列;第二处理模块,被配置为对所述第一视频帧序列进行掩码处理,以得到第二视频帧序列,还被配置为对所述第一分词序列进行掩码处理,以得到第二分词序列;第三处理模块,被配置为对 所述第一视频帧序列进行编码,以得到第一视频特征,还被配置为对所述第一分词序列进行编码,以得到第一分词特征;第四处理模块,被配置为对所述第二视频帧序列进行编码,以得到第二视频特征,还被配置为对所述第二分词序列进行编码,以得到第二分词特征;第五处理模块,被配置为利用所述第一视频特征、所述第一分词特征、所述第二视频特征、所述第二分词特征确定预训练的目标函数;第六处理模块,被配置为利用所述预训练的目标函数进行多模态预训练。
根据本公开实施例的第三方面,提供一种多模态预训练装置,包括:存储器,被配置为存储指令;处理器,耦合到存储器,处理器被配置为基于存储器存储的指令执行实现如上述任一实施例所述的方法。
根据本公开实施例的第四方面,提供一种计算机可读存储介质,其中,计算机可读存储介质存储有计算机指令,指令被处理器执行时实现如上述任一实施例涉及的方法。
通过以下参照附图对本公开的示例性实施例的详细描述,本公开的其它特征及其优点将会变得清楚。
附图说明
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本公开一个实施例的多模态预训练方法的流程示意图;
图2为本公开另一个实施例的多模态预训练方法的流程示意图;
图3为本公开一个实施例的多模态预训练装置的结构示意图;
图4为本公开另一个实施例的多模态预训练装置的结构示意图;
图5为本公开一个实施例的多模态预训练模型示意图。
具体实施方式
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。以下对至少一个示例性实施例的描述实际上仅仅是说明性的,决不作为对本公开及其 应用或使用的任何限制。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本公开的范围。
同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。
对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为授权说明书的一部分。
在这里示出和讨论的所有示例中,任何具体值应被解释为仅仅是示例性的,而不是作为限制。因此,示例性实施例的其它示例可以具有不同的值。
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。
发明人注意到,在相关技术中,视频文本多模态预训练技术为了挖掘两个模态之间的联系,仅利用带有掩码(Mask)的输入视频文本在预训练期间进行全局特征表示关联性的学习,这种学习方式使得输入视频帧和单词序列之间的整体视频-文本关系没有得到充分探索,从而导致多模态特征质量的下降。
据此,本公开提供一种多模态预训练方案,能够增强跨模态数据之间的关联性,有效提升多模态预训练模型对多模态数据内容的理解能力。
图1为本公开一个实施例的多模态预训练方法的流程示意图。在一些实施例中,下列的多模态预训练方法由多模态预训练装置执行。
在步骤101,对视频-文本对中的视频进行采样,以得到第一视频帧序列,对视频-文本对中的文本进行分词处理,以得到第一分词序列。
在一些实施例中,将视频按等间距采样的方式进行采样,以得到第一视频帧序列。
在一些实施例中,在第一分词序列的开头和结尾处分别设有标记[CLS]和[SEP],以便后续处理方便。
在步骤102,对第一视频帧序列进行掩码处理,以得到第二视频帧序列,对第一分词序列进行掩码处理,以得到第二分词序列。
在一些实施例中,用掩码以随机概率替换第一视频帧序列中的视频帧,以得到第二视频帧序列。
在一些实施例中,用掩码以随机概率替换第一分词序列中的分词,以得到第二分 词序列。
在步骤103,对第一视频帧序列进行编码,以得到第一视频特征,对第一分词序列进行编码,以得到第一分词特征。
在一些实施例中,使用视频键值编码器(Video Key Encoder)对第一视频帧序列进行编码,以得到第一视频特征,使用文本键值编码器(Sentence Key Encoder)对第一分词序列进行编码,以得到第一分词特征。
视频键值编码器输出的第一视频特征反映了无掩码的视频帧的上下文特性。文本键值输出的第一分词特征反映了无掩码的分词序列的上下文特性。
由于视频键值和文本键值并不是本公开的发明点所在,因此这里不展开描述。
在步骤104,对第二视频帧序列进行编码,以得到第二视频特征,对第二分词序列进行编码,以得到第二分词特征。
在一些实施例中,使用视频查询编码器(Video Query Encoder)对第二视频帧序列进行编码,以得到第二视频特征,使用文本查询编码器(Sentence Query Encoder)对第二分词序列进行编码,以得到第二分词特征。
视频查询编码器输出的第二视频特征反映了视频模态下帧与帧之间的关联性,文本查询编码器输出的第二分词特征反映了文本模态下词与词之间的关联性。
由于视频查询编码器和文本查询编码器并不是本公开的发明点所在,因此这里不展开描述。
在步骤105,利用第一视频特征、第一分词特征、第二视频特征、第二分词特征确定预训练的目标函数。
在一些实施例中,确定预训练的目标函数如图2所示。
在步骤201,利用第一分词特征、第二视频特征和预设的第一负样本特征确定第一对比损失值。
在一些实施例中,利用MLP(Multi-layer Perceptron,多层感知机)模型将第一分词特征转换为全局的第一正样本特征
Figure PCTCN2022092680-appb-000001
利用MLP模型将第二视频特征转换为全局的视频查询特征
Figure PCTCN2022092680-appb-000002
利用视频查询特征
Figure PCTCN2022092680-appb-000003
第一正样本特征
Figure PCTCN2022092680-appb-000004
和第一负样本特征
Figure PCTCN2022092680-appb-000005
确定第一对比损失值。
需要说明的是,第一负样本特征
Figure PCTCN2022092680-appb-000006
为:
Figure PCTCN2022092680-appb-000007
其中K表示第一负样本特征所包括的负样本队列的大小,
Figure PCTCN2022092680-appb-000008
表示负样本队列中 的第i个负样本。
在一些实施例中,利用公式(2)计算第一对比损失值
Figure PCTCN2022092680-appb-000009
Figure PCTCN2022092680-appb-000010
其中,t为用于控制缩放的超参数。运算符<A,B>表示向量A和B的余弦相似度。
在步骤202,利用第一视频特征、第二分词特征和预设的第二负样本特征确定第二对比损失值。
在一些实施例中,利用MLP模型将第一视频特征转换为全局的第二正样本特征
Figure PCTCN2022092680-appb-000011
利用MLP模型将第二分词特征转换为全局的文本查询特征
Figure PCTCN2022092680-appb-000012
利用文本查询特征
Figure PCTCN2022092680-appb-000013
第二正样本特征
Figure PCTCN2022092680-appb-000014
和第二负样本特征
Figure PCTCN2022092680-appb-000015
确定第二对比损失值。
需要说明的是,第二负样本特征
Figure PCTCN2022092680-appb-000016
为:
Figure PCTCN2022092680-appb-000017
其中K表示第二负样本特征所包括的负样本队列的大小,
Figure PCTCN2022092680-appb-000018
表示负样本队列中的第i个负样本。
在一些实施例中,利用公式(4)计算第二对比损失值
Figure PCTCN2022092680-appb-000019
Figure PCTCN2022092680-appb-000020
其中,t为用于控制缩放的超参数。运算符<A,B>表示向量A和B的余弦相似度。
在步骤203,根据第一对比损失值和第二对比损失值确定第一目标。
在一些实施例中,第一目标为第一对比损失值和第二对比损失值之和。例如,利用公式(5)计算第一目标。第一目标用于表示视频到文本和文本到视频的视频匹配损失的组合。
Figure PCTCN2022092680-appb-000021
在步骤204,利用第一视频特征、第二视频特征和第二负样本特征确定第三对比损失值。
在一些实施例中,利用视频查询特征
Figure PCTCN2022092680-appb-000022
第二正样本特征
Figure PCTCN2022092680-appb-000023
和第二负样本特征
Figure PCTCN2022092680-appb-000024
确定第三对比损失值。
在一些实施例中,利用公式(6)计算第三对比损失值
Figure PCTCN2022092680-appb-000025
Figure PCTCN2022092680-appb-000026
其中,t为用于控制缩放的超参数。运算符<A,B>表示向量A和B的余弦相似度。
在步骤205,利用第一分词特征、第二分词特征和第一负样本特征确定第四对比损失值。
在一些实施例中,利用文本查询特征
Figure PCTCN2022092680-appb-000027
第一正样本特征
Figure PCTCN2022092680-appb-000028
和第一负样本特征
Figure PCTCN2022092680-appb-000029
确定第四对比损失值。
在一些实施例中,利用公式(7)计算第四对比损失值
Figure PCTCN2022092680-appb-000030
Figure PCTCN2022092680-appb-000031
其中,t为用于控制缩放的超参数。运算符<A,B>表示向量A和B的余弦相似度。
在步骤206,根据第三对比损失值和第四对比损失值确定第二目标。
在一些实施例中,第二目标为第三对比损失值和第四对比损失值之和。例如,利用公式(8)计算第二目标。第二目标用于表示视频模态内和文本模态内的去噪损失。
Figure PCTCN2022092680-appb-000032
在步骤207,根据第一目标和第二目标确定目标函数。
在一些实施例中,目标函数为第一目标和第二目标之和。例如,利用公式(9)计算目标函数L。
L=L Co-IM+L Co-ID        (9)
返回图1。在步骤106,利用预训练的目标函数进行多模态预训练。
在本公开上述实施例提供的多模态预训练方法中,基于跨模态匹配损失和模态内去噪损失来确定预训练的目标函数,能够增强跨模态数据之间的关联性,有效提升多模态预训练模型对多模态数据内容的理解能力。
在一些实施例中,对第二视频特征和第二分词特征进行融合处理,以得到融合特征。将融合特征输入MLM(Masked Language Modelling,带掩码的文本建模)模型以得到第三目标L MLM,将融合特征输入MSG(Masked Language Generation,带掩码的文本生成)模型以得到第四目标L MSG
在一些实施例中,使用跨模态解码器(Cross-Modal Decoder)对第二视频特征和第二分词特征进行融合处理,以得到融合特征。跨模态解码器用于输出视频和文本多模态信息的融合特征,为后续任务提供特征输入。
由于跨模态解码器并不是本公开的发明点所在,因此这里不展开描述。
在一些实施例中,根据第一目标L Co-IM、第二目标L Co-ID、第三目标L MLM和第四 目标L MSG确定目标函数L。
在一些实施例中,目标函数L为第一目标L Co-IM、第二目标L Co-ID、第三目标L MLM和第四目标L MSG之和。
例如,利用下列公式(10)计算目标函数L。
L=L Co-IM+L Co-ID+L MLM+L MSG       (10)
图3为本公开一个实施例的多模态预训练装置的结构示意图。如图3所示,多模态预训练装置包括第一处理模块31、第二处理模块32、第三处理模块33、第四处理模块34、第五处理模块35和第六处理模块36。
第一处理模块31被配置为对视频-文本对中的视频进行采样,以得到第一视频帧序列,还被配置为对视频-文本对中的文本进行分词处理,以得到第一分词序列。
在一些实施例中,将视频按等间距采样的方式进行采样,以得到第一视频帧序列。
在一些实施例中,在第一分词序列的开头和结尾处分别设有标记[CLS]和[SEP],以便后续处理方便。
第二处理模块32被配置为对第一视频帧序列进行掩码处理,以得到第二视频帧序列,还被配置为对第一分词序列进行掩码处理,以得到第二分词序列。
在一些实施例中,用掩码以随机概率替换第一视频帧序列中的视频帧,以得到第二视频帧序列。
在一些实施例中,用掩码以随机概率替换第一分词序列中的分词,以得到第二分词序列。
第三处理模块33被配置为对第一视频帧序列进行编码,以得到第一视频特征,还被配置为对第一分词序列进行编码,以得到第一分词特征。
在一些实施例中,使用视频键值编码器对第一视频帧序列进行编码,以得到第一视频特征,使用文本键值编码器对第一分词序列进行编码,以得到第一分词特征。
视频键值编码器输出的第一视频特征反映了无掩码的视频帧的上下文特性。文本键值输出的第一分词特征反映了无掩码的分词序列的上下文特性。
第四处理模块34被配置为对第二视频帧序列进行编码,以得到第二视频特征,还被配置为对第二分词序列进行编码,以得到第二分词特征。
在一些实施例中,使用视频查询编码器对第二视频帧序列进行编码,以得到第二视频特征,使用文本查询编码器对第二分词序列进行编码,以得到第二分词特征。
视频查询编码器输出的第二视频特征反映了视频模态下帧与帧之间的关联性,文 本查询编码器输出的第二分词特征反映了文本模态下词与词之间的关联性。
第五处理模块35被配置为利用第一视频特征、第一分词特征、第二视频特征、第二分词特征确定预训练的目标函数。在一些实施例中,第五处理模块35利用第一分词特征、第二视频特征和预设的第一负样本特征确定第一对比损失值。
例如,利用MLP模型将第一分词特征转换为全局的第一正样本特征
Figure PCTCN2022092680-appb-000033
利用MLP模型将第二视频特征转换为全局的视频查询特征
Figure PCTCN2022092680-appb-000034
利用视频查询特征
Figure PCTCN2022092680-appb-000035
第一正样本特征
Figure PCTCN2022092680-appb-000036
和第一负样本特征
Figure PCTCN2022092680-appb-000037
确定第一对比损失值。
在一些实施例中,第一负样本特征
Figure PCTCN2022092680-appb-000038
如上述公式(1)所示。
在一些实施例中,利用上述公式(2)计算第一对比损失值
Figure PCTCN2022092680-appb-000039
第五处理模块35利用第一视频特征、第二分词特征和预设的第二负样本特征确定第二对比损失值。例如,利用MLP模型将第一视频特征转换为全局的第二正样本特征
Figure PCTCN2022092680-appb-000040
利用MLP模型将第二分词特征转换为全局的文本查询特征
Figure PCTCN2022092680-appb-000041
利用文本查询特征
Figure PCTCN2022092680-appb-000042
第二正样本特征
Figure PCTCN2022092680-appb-000043
和第二负样本特征
Figure PCTCN2022092680-appb-000044
确定第二对比损失值。
在一些实施例中,第二负样本特征
Figure PCTCN2022092680-appb-000045
如上述公式(3)所示。
在一些实施例中,利用上述公式(4)计算第二对比损失值
Figure PCTCN2022092680-appb-000046
第五处理模块35根据第一对比损失值和第二对比损失值确定第一目标。在一些实施例中,第一目标为第一对比损失值和第二对比损失值之和。例如,利用上述公式(5)计算第一目标。第一目标用于表示视频到文本和文本到视频的视频匹配损失的组合。
第五处理模块35利用第一视频特征、第二视频特征和第二负样本特征确定第三对比损失值。在一些实施例中,利用视频查询特征
Figure PCTCN2022092680-appb-000047
第二正样本特征
Figure PCTCN2022092680-appb-000048
和第二负样本特征
Figure PCTCN2022092680-appb-000049
确定第三对比损失值。例如,利用上述公式(6)计算第三对比损失值
Figure PCTCN2022092680-appb-000050
第五处理模块35利用第一分词特征、第二分词特征和第一负样本特征确定第四对比损失值。在一些实施例中,利用文本查询特征
Figure PCTCN2022092680-appb-000051
第一正样本特征
Figure PCTCN2022092680-appb-000052
和第一负样本特征
Figure PCTCN2022092680-appb-000053
确定第四对比损失值。
在一些实施例中,利用上述公式(7)计算第四对比损失值
Figure PCTCN2022092680-appb-000054
第五处理模块35根据第三对比损失值和第四对比损失值确定第二目标。在一些实施例中,第二目标为第三对比损失值和第四对比损失值之和。例如,利用上述公式(8)计算第二目标。第二目标用于表示视频模态内和文本模态内的去噪损失。
第五处理模块35根据第一目标和第二目标确定目标函数。在一些实施例中,目标函数为第一目标和第二目标之和。例如,利用上述公式(9)计算目标函数L。
在一些实施例中,第五处理模块35对第二视频特征和第二分词特征进行融合处理,以得到融合特征。将融合特征输入MLM模型以得到第三目标L MLM,将融合特征输入MSG模型以得到第四目标L MSG
在一些实施例中,使用跨模态解码器对第二视频特征和第二分词特征进行融合处理,以得到融合特征。跨模态解码器用于输出视频和文本多模态信息的融合特征,为后续任务提供特征输入。
在一些实施例中,根据第一目标L Co-IM、第二目标L Co-ID、第三目标L MLM和第四目标L MSG确定目标函数L。在一些实施例中,目标函数L为第一目标L Co-IM、第二目标L Co-ID、第三目标L MLM和第四目标L MSG之和。例如,利用上述公式(10)计算目标函数L。
第六处理模块36被配置为利用预训练的目标函数进行多模态预训练。
图4为本公开另一个实施例的多模态预训练装置的结构示意图。如图4所示,多模态预训练装置包括存储器41和处理器42。
存储器41用于存储指令,处理器42耦合到存储器41,处理器42被配置为基于存储器存储的指令执行实现如图1或图2中任一实施例涉及的方法。
如图4所示,该多模态预训练装置还包括通信接口43,用于与其它设备进行信息交互。同时,该多模态预训练装置还包括总线44,处理器42、通信接口43、以及存储器41通过总线44完成相互间的通信。
存储器41可以包含高速RAM存储器,也可还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。存储器41也可以是存储器阵列。存储器41还可能被分块,并且块可按一定的规则组合成虚拟卷。
此外,处理器42可以是一个中央处理器CPU,或者可以是专用集成电路ASIC,或是被配置成实施本公开实施例的一个或多个集成电路。
本公开同时还涉及一种计算机可读存储介质,其中计算机可读存储介质存储有计算机指令,指令被处理器执行时实现如图1或图2中任一实施例涉及的方法。
图5为本公开一个实施例的多模态预训练模型示意图。
如图5所示,通过对视频-文本对中的视频进行采样,以得到第一视频帧序列,对视频-文本对中的文本进行分词处理,以得到第一分词序列。用掩码以随机概率替换第 一视频帧序列中的视频帧,以得到第二视频帧序列。用掩码以随机概率替换第一分词序列中的分词,以得到第二分词序列。
使用视频键值编码器对第一视频帧序列进行编码,以得到第一视频特征,使用文本键值编码器对第一分词序列进行编码,以得到第一分词特征。
使用视频查询编码器对第二视频帧序列进行编码,以得到第二视频特征,使用文本查询编码器对第二分词序列进行编码,以得到第二分词特征。
利用MLP模型将第一分词特征转换为全局的第一正样本特征
Figure PCTCN2022092680-appb-000055
利用MLP模型将第一视频特征转换为全局的第二正样本特征
Figure PCTCN2022092680-appb-000056
利用MLP模型将第二视频特征转换为全局的视频查询特征
Figure PCTCN2022092680-appb-000057
利用MLP模型将第二分词特征转换为全局的文本查询特征
Figure PCTCN2022092680-appb-000058
在Co-IM(Contrastive Inter-modal Matching,对比模态间匹配)模块中,根据上述公式(2),利用视频查询特征
Figure PCTCN2022092680-appb-000059
第一正样本特征
Figure PCTCN2022092680-appb-000060
和第一负样本特征
Figure PCTCN2022092680-appb-000061
确定第一对比损失值
Figure PCTCN2022092680-appb-000062
在一些实施例中,第一负样本特征
Figure PCTCN2022092680-appb-000063
如上述公式(1)所示。
根据上述公式(4),利用文本查询特征
Figure PCTCN2022092680-appb-000064
第二正样本特征
Figure PCTCN2022092680-appb-000065
和第二负样本特征
Figure PCTCN2022092680-appb-000066
确定第二对比损失值
Figure PCTCN2022092680-appb-000067
在一些实施例中,第二负样本特征
Figure PCTCN2022092680-appb-000068
如上述公式(3)所示。
接下来,利用上述公式(5)计算第一目标L Co-IM
在Co-ID(Contrastive Intra-modal Denoising,对比模态内去噪)模块中,根据上述公式(6),利用视频查询特征
Figure PCTCN2022092680-appb-000069
第二正样本特征
Figure PCTCN2022092680-appb-000070
和第二负样本特征
Figure PCTCN2022092680-appb-000071
确定第三对比损失值
Figure PCTCN2022092680-appb-000072
根据上述公式(7),利用文本查询特征
Figure PCTCN2022092680-appb-000073
第一正样本特征
Figure PCTCN2022092680-appb-000074
和第一负样本特征
Figure PCTCN2022092680-appb-000075
确定第四对比损失值
Figure PCTCN2022092680-appb-000076
接下来,根据上述公式(8),根据第三对比损失值和第四对比损失值确定第二目标L Co-ID
此外,使用跨模态解码器对第二视频特征和第二分词特征进行融合处理,以得到融合特征。将融合特征输入MLM模型以得到第三目标L MLM,将融合特征输入MSG模型以得到第四目标L MSG
接下来,利用上述公式(10),通过将第一目标L Co-IM、第二目标L Co-ID、第三目标L MLM和第四目标L MSG之和作为目标函数L。
在一些实施例中,在上面所描述的功能单元模块可以实现为用于执行本公开所描 述功能的通用处理器、可编程逻辑控制器(Programmable Logic Controller,简称:PLC)、数字信号处理器(Digital Signal Processor,简称:DSP)、专用集成电路(Application Specific Integrated Circuit,简称:ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称:FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件或者其任意适当组合。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
本公开的描述是为了示例和描述起见而给出的,而并不是无遗漏的或者将本公开限于所公开的形式。很多修改和变化对于本领域的普通技术人员而言是显然的。选择和描述实施例是为了更好说明本公开的原理和实际应用,并且使本领域的普通技术人员能够理解本公开从而设计适于特定用途的带有各种修改的各种实施例。

Claims (13)

  1. 一种多模态预训练方法,包括:
    对视频-文本对中的视频进行采样,以得到第一视频帧序列;
    对所述视频-文本对中的文本进行分词处理,以得到第一分词序列;
    对所述第一视频帧序列进行掩码处理,以得到第二视频帧序列;
    对所述第一分词序列进行掩码处理,以得到第二分词序列;
    对所述第一视频帧序列进行编码,以得到第一视频特征,对所述第一分词序列进行编码,以得到第一分词特征;
    对所述第二视频帧序列进行编码,以得到第二视频特征,对所述第二分词序列进行编码,以得到第二分词特征;
    利用所述第一视频特征、所述第一分词特征、所述第二视频特征、所述第二分词特征确定预训练的目标函数;
    利用所述预训练的目标函数进行多模态预训练。
  2. 根据权利要求1所述的方法,其中,确定预训练的目标函数包括:
    利用所述第一分词特征、所述第二视频特征和预设的第一负样本特征确定第一对比损失值;
    利用所述第一视频特征、所述第二分词特征和预设的第二负样本特征确定第二对比损失值;
    根据所述第一对比损失值和所述第二对比损失值确定第一目标;
    利用所述第一视频特征、所述第二视频特征和所述第二负样本特征确定第三对比损失值;
    利用所述第一分词特征、所述第二分词特征和所述第一负样本特征确定第四对比损失值;
    根据所述第三对比损失值和所述第四对比损失值确定第二目标;
    根据所述第一目标和所述第二目标确定所述目标函数。
  3. 根据权利要求2所述的方法,其中,确定第一对比损失值包括:
    将所述第一分词特征转换为全局的第一正样本特征;
    将所述第二视频特征转换为全局的视频查询特征;
    利用所述视频查询特征、所述第一正样本特征和所述第一负样本特征确定第一对比损失值。
  4. 根据权利要求3所述的方法,其中,确定第二对比损失值包括:
    将所述第一视频特征转换为全局的第二正样本特征;
    将所述第二分词特征转换为全局的文本查询特征;
    利用所述文本查询特征、所述第二正样本特征和所述第二负样本特征确定第二对比损失值。
  5. 根据权利要求4所述的方法,其中,确定第三对比损失值包括:
    利用所述视频查询特征、所述第二正样本特征和所述第二负样本特征确定第三对比损失值。
  6. 根据权利要求5所述的方法,其中,确定第四对比损失值包括:
    利用所述文本查询特征、所述第一正样本特征和所述第一负样本特征确定第四对比损失值。
  7. 根据权利要求2所述的方法,其中,
    所述第一目标为所述第一对比损失值和所述第二对比损失值之和;
    所述第二目标为所述第三对比损失值和所述第四对比损失值之和。
  8. 根据权利要求2-7中任一项所述的方法,其中,
    所述目标函数为所述第一目标和所述第二目标之和。
  9. 根据权利要求2-7中任一项所述的方法,还包括:
    对所述第二视频特征和所述第二分词特征进行融合处理,以得到融合特征;
    将所述融合特征输入带掩码的文本建模MLM模型以得到第三目标,将所述融合特征输入带掩码的文本生成MSG模型以得到第四目标;
    所述根据所述第一目标和所述第二目标确定所述目标函数包括:
    根据所述第一目标、所述第二目标、所述第三目标和所述第四目标确定所述目标函数。
  10. 根据权利要求9所述的方法,其中,
    所述目标函数为所述第一目标、所述第二目标、所述第三目标和所述第四目标之和。
  11. 一种多模态预训练装置,包括:
    第一处理模块,被配置为对视频-文本对中的视频进行采样,以得到第一视频帧序列,还被配置为对所述视频-文本对中的文本进行分词处理,以得到第一分词序列;
    第二处理模块,被配置为对所述第一视频帧序列进行掩码处理,以得到第二视频帧序列,还被配置为对所述第一分词序列进行掩码处理,以得到第二分词序列;
    第三处理模块,被配置为对所述第一视频帧序列进行编码,以得到第一视频特征,还被配置为对所述第一分词序列进行编码,以得到第一分词特征;
    第四处理模块,被配置为对所述第二视频帧序列进行编码,以得到第二视频特征,还被配置为对所述第二分词序列进行编码,以得到第二分词特征;
    第五处理模块,被配置为利用所述第一视频特征、所述第一分词特征、所述第二视频特征、所述第二分词特征确定预训练的目标函数;
    第六处理模块,被配置为利用所述预训练的目标函数进行多模态预训练。
  12. 一种多模态预训练装置,包括:
    存储器,被配置为存储指令;
    处理器,耦合到存储器,处理器被配置为基于存储器存储的指令执行实现如权利要求1-10中任一项所述的方法。
  13. 一种非瞬态计算机可读存储介质,其中,计算机可读存储介质存储有计算机指令,指令被处理器执行时实现如权利要求1-10中任一项所述的方法。
PCT/CN2022/092680 2021-09-15 2022-05-13 多模态预训练方法和装置 WO2023040306A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111078728.2A CN113780194A (zh) 2021-09-15 2021-09-15 多模态预训练方法和装置
CN202111078728.2 2021-09-15

Publications (1)

Publication Number Publication Date
WO2023040306A1 true WO2023040306A1 (zh) 2023-03-23

Family

ID=78843921

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/092680 WO2023040306A1 (zh) 2021-09-15 2022-05-13 多模态预训练方法和装置

Country Status (2)

Country Link
CN (1) CN113780194A (zh)
WO (1) WO2023040306A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113780194A (zh) * 2021-09-15 2021-12-10 北京京东尚科信息技术有限公司 多模态预训练方法和装置
CN115131638B (zh) * 2022-05-31 2024-03-15 腾讯科技(深圳)有限公司 视觉文本预训练模型的训练方法、装置、介质和设备
CN115952317A (zh) * 2022-07-12 2023-04-11 北京字跳网络技术有限公司 视频处理方法、装置、设备、介质及程序产品
CN115829058B (zh) * 2022-12-23 2024-04-23 北京百度网讯科技有限公司 训练样本处理方法、跨模态匹配方法、装置、设备和介质
CN117036355B (zh) * 2023-10-10 2023-12-15 湖南大学 编码器和模型的训练方法、故障检测方法及相关设备

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112001180A (zh) * 2020-07-14 2020-11-27 北京百度网讯科技有限公司 多模态预训练模型获取方法、装置、电子设备及存储介质
US20210174162A1 (en) * 2019-12-09 2021-06-10 Salesforce.Com, Inc. Spatial-Temporal Reasoning Through Pretrained Language Models for Video-Grounded Dialogues
CN112990297A (zh) * 2021-03-10 2021-06-18 北京智源人工智能研究院 多模态预训练模型的训练方法、应用方法及装置
CN113239153A (zh) * 2021-05-26 2021-08-10 清华大学深圳国际研究生院 一种基于实例遮掩的文本与图像互检索方法
CN113257238A (zh) * 2021-07-13 2021-08-13 北京世纪好未来教育科技有限公司 预训练模型的训练方法、编码特征获取方法及相关装置
CN113283551A (zh) * 2021-07-22 2021-08-20 智者四海(北京)技术有限公司 多模态预训练模型的训练方法、训练装置及电子设备
CN113780194A (zh) * 2021-09-15 2021-12-10 北京京东尚科信息技术有限公司 多模态预训练方法和装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210174162A1 (en) * 2019-12-09 2021-06-10 Salesforce.Com, Inc. Spatial-Temporal Reasoning Through Pretrained Language Models for Video-Grounded Dialogues
CN112001180A (zh) * 2020-07-14 2020-11-27 北京百度网讯科技有限公司 多模态预训练模型获取方法、装置、电子设备及存储介质
CN112990297A (zh) * 2021-03-10 2021-06-18 北京智源人工智能研究院 多模态预训练模型的训练方法、应用方法及装置
CN113239153A (zh) * 2021-05-26 2021-08-10 清华大学深圳国际研究生院 一种基于实例遮掩的文本与图像互检索方法
CN113257238A (zh) * 2021-07-13 2021-08-13 北京世纪好未来教育科技有限公司 预训练模型的训练方法、编码特征获取方法及相关装置
CN113283551A (zh) * 2021-07-22 2021-08-20 智者四海(北京)技术有限公司 多模态预训练模型的训练方法、训练装置及电子设备
CN113780194A (zh) * 2021-09-15 2021-12-10 北京京东尚科信息技术有限公司 多模态预训练方法和装置

Also Published As

Publication number Publication date
CN113780194A (zh) 2021-12-10

Similar Documents

Publication Publication Date Title
WO2023040306A1 (zh) 多模态预训练方法和装置
CN111783462B (zh) 基于双神经网络融合的中文命名实体识别模型及方法
Chen et al. Recurrent neural network-based sentence encoder with gated attention for natural language inference
CN112487182A (zh) 文本处理模型的训练方法、文本处理方法及装置
CN110263325B (zh) 中文分词系统
CN112528637B (zh) 文本处理模型训练方法、装置、计算机设备和存储介质
WO2020143320A1 (zh) 文本词向量获取方法、装置、计算机设备及存储介质
CN111859912A (zh) 基于pcnn模型的带有实体感知的远程监督关系抽取方法
CN111859987A (zh) 文本处理方法、目标任务模型的训练方法和装置
JP2023022845A (ja) ビデオ処理方法、ビデオサーチ方法及びモデルトレーニング方法、装置、電子機器、記憶媒体及びコンピュータプログラム
CN114926835A (zh) 文本生成、模型训练方法和装置
CN112183111A (zh) 长文本语义相似度匹配方法、装置、电子设备及存储介质
EP4302234A1 (en) Cross-modal processing for vision and language
CN110298038A (zh) 一种文本打分方法及装置
CN116884391A (zh) 基于扩散模型的多模态融合音频生成方法及装置
CN114281982B (zh) 一种多模态融合技术的图书宣传摘要生成方法和系统
CN110347853B (zh) 一种基于循环神经网络的图像哈希码生成方法
CN111737467B (zh) 一种基于分段卷积神经网络的对象级情感分类方法
Zha et al. ASFNet: Adaptive multiscale segmentation fusion network for real‐time semantic segmentation
CN113747168A (zh) 多媒体数据描述模型的训练方法和描述信息的生成方法
CN115357710B (zh) 表格描述文本生成模型的训练方法、装置及电子设备
CN114266258B (zh) 一种语义关系提取方法、装置、电子设备及存储介质
CN112559727B (zh) 用于输出信息的方法、装置、设备、存储介质和程序
WO2021233389A1 (zh) 增强深度学习模型鲁棒性的方法及装置
CN114792388A (zh) 图像描述文字生成方法、装置及计算机可读存储介质

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE